| Total Complexity | 9 |
| Total Lines | 103 |
| Duplicated Lines | 0 % |
| Coverage | 81.25% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class CollectionKernelBuilder |
||
| 10 | { |
||
| 11 | protected array $items = []; |
||
| 12 | |||
| 13 | protected Closure $generator; |
||
| 14 | |||
| 15 | protected array $accessors = []; |
||
| 16 | |||
| 17 | protected ?string $identifier = null; |
||
| 18 | |||
| 19 | protected bool $isMap = false; |
||
| 20 | |||
| 21 | protected ?JsonSerializerInterface $jsonSerializer = null; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @return $this |
||
| 25 | */ |
||
| 26 | 98 | public function withItems(array $items): CollectionKernelBuilder |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @return $this |
||
| 35 | */ |
||
| 36 | 98 | public function withGenerator(Closure $generator): CollectionKernelBuilder |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return $this |
||
| 45 | */ |
||
| 46 | public function withAccessors(array $accessors): CollectionKernelBuilder |
||
| 47 | { |
||
| 48 | $this->accessors = $accessors; |
||
| 49 | |||
| 50 | return $this; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return $this |
||
| 55 | */ |
||
| 56 | 90 | public function withIdentifier(?string $identifier): CollectionKernelBuilder |
|
| 57 | { |
||
| 58 | 90 | $this->identifier = $identifier; |
|
| 59 | |||
| 60 | 90 | return $this; |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return $this |
||
| 65 | */ |
||
| 66 | 18 | public function thatIsMapped(): CollectionKernelBuilder |
|
| 67 | { |
||
| 68 | 18 | $this->isMap = true; |
|
| 69 | |||
| 70 | 18 | return $this; |
|
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @return $this |
||
| 75 | */ |
||
| 76 | 80 | public function thatIsNotMapped(): CollectionKernelBuilder |
|
| 77 | { |
||
| 78 | 80 | $this->isMap = false; |
|
| 79 | |||
| 80 | 80 | return $this; |
|
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @return $this |
||
| 85 | */ |
||
| 86 | 52 | public function withMapped(bool $isMap): CollectionKernelBuilder |
|
| 91 | } |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @return $this |
||
| 95 | */ |
||
| 96 | public function withJsonSerializer(JsonSerializerInterface $jsonSerializer): CollectionKernelBuilder |
||
| 101 | } |
||
| 102 | |||
| 103 | 98 | public function build(): CollectionKernel |
|
| 112 | 98 | ); |
|
| 113 | } |
||
| 114 | } |
||
| 115 |