Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| TypescriptExpressionHashmap | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| offsetGet | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| createRandom | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\TypescriptCodeBuilder\Lists; |
| 3 | |
| 4 | use Apie\Core\Attributes\FakeMethod; |
| 5 | use Apie\Core\Lists\ItemHashmap; |
| 6 | use Apie\TypescriptCodeBuilder\Dto\Expressions\StringLiteralExpression; |
| 7 | use Apie\TypescriptCodeBuilder\TypescriptFileExpressionInterface; |
| 8 | use Faker\Generator; |
| 9 | |
| 10 | #[FakeMethod('createRandom')] |
| 11 | class TypescriptExpressionHashmap extends ItemHashmap |
| 12 | { |
| 13 | public function offsetGet(mixed $offset): TypescriptFileExpressionInterface |
| 14 | { |
| 15 | return parent::offsetGet($offset); |
| 16 | } |
| 17 | |
| 18 | public static function createRandom(Generator $faker): self |
| 19 | { |
| 20 | $elm = $faker->randomNumber(1, 4); |
| 21 | $list = []; |
| 22 | for ($i = 0; $i < $elm; $i++) { |
| 23 | $list[$faker->word()] = new StringLiteralExpression($faker->word()); |
| 24 | } |
| 25 | return new self($list); |
| 26 | } |
| 27 | } |