Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
83.33% |
5 / 6 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| CodeList | |
83.33% |
5 / 6 |
|
50.00% |
1 / 2 |
3.04 | |
0.00% |
0 / 1 |
| offsetGet | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 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\ItemList; |
| 6 | use Apie\TypescriptCodeBuilder\Dto\TypescriptDeclaration; |
| 7 | use Apie\TypescriptCodeBuilder\TypescriptFileExpressionInterface; |
| 8 | use Faker\Generator; |
| 9 | |
| 10 | #[FakeMethod('createRandom')] |
| 11 | class CodeList extends ItemList |
| 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 | $items = []; |
| 21 | $count = $faker->numberBetween(0, 6); |
| 22 | for ($i = 0; $i < $count; $i++) { |
| 23 | $items[] = $faker->fakeClass($faker->randomElement([TypescriptDeclaration::class])); |
| 24 | } |
| 25 | return new self($items); |
| 26 | } |
| 27 | } |