for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WebTheory\Collection\Kernel;
use WebTheory\Collection\Contracts\JsonSerializerInterface;
use WebTheory\Collection\Resolution\PropertyResolver;
class CollectionKernelBuilder
{
protected array $items = [];
/**
* @var callable
*/
protected $factory;
protected ?string $identifier = null;
protected bool $map = false;
protected JsonSerializerInterface $jsonSerializer;
protected PropertyResolver $propertyResolver;
protected array $accessors = [];
public function withItems(array $items): self
$this->items = $items;
return $this;
}
public function withFactory(callable $factory): self
$this->factory = $factory;
public function withAccessors(array $accessors): self
$this->accessors = $accessors;
public function withIdentifier(string $identifier): self
$this->identifier = $identifier;
public function withMapped(bool $map): self
$this->map = $map;
public function withJsonSerializer(JsonSerializerInterface $jsonSerializer): self
$this->jsonSerializer = $jsonSerializer;
public function withPropertyResolver(PropertyResolver $propertyResolver): self
$this->propertyResolver = $propertyResolver;
public function build(): CollectionKernel
return new CollectionKernel(
$this->items,
$this->factory,
$this->identifier,
$this->accessors,
$this->map,
$this->jsonSerializer,
);