for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the SexyField package.
*
* (c) Dion Snoeijen <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare (strict_types = 1);
namespace Tardigrades\SectionField\ValueObject;
use Assert\Assertion;
use Tardigrades\Helper\ArrayConverter;
final class GeneratorConfig implements ConfigInterface
{
/** @var array */
private $sectionGeneratorConfig;
private function __construct(array $sectionGeneratorConfig)
Assertion::keyExists($sectionGeneratorConfig, 'generator', 'Config is not a section config');
$this->sectionGeneratorConfig = $sectionGeneratorConfig['generator'];
}
public function toArray(): array
return $this->sectionGeneratorConfig;
public function __toString(): string
return ArrayConverter::recursive($this->sectionGeneratorConfig);
public static function fromArray(array $sectionGeneratorConfig): self
return new self($sectionGeneratorConfig);