Remove validation from extension class
This commit is contained in:
@@ -20,32 +20,7 @@ final class IconExtension extends AbstractExtension
|
||||
'classes' => [],
|
||||
];
|
||||
|
||||
public function __construct(private array $directories, private array $colours)
|
||||
{
|
||||
if (empty($this->colours)) {
|
||||
throw new \InvalidArgumentException('Colours array must contain at least one colour!');
|
||||
}
|
||||
|
||||
$coloursContainsNonArray = array_reduce($this->colours,
|
||||
fn($notArray, $path) => $notArray || !is_array($path));
|
||||
|
||||
if ($coloursContainsNonArray) {
|
||||
throw new \TypeError('Colours array must only contain arrays!');
|
||||
}
|
||||
|
||||
foreach ($this->colours as $colour) {
|
||||
if (!(
|
||||
array_key_exists('stroke', $colour) &&
|
||||
array_key_exists('fill', $colour) &&
|
||||
array_key_exists('fill-hover', $colour) &&
|
||||
array_key_exists('stroke-hover', $colour) &&
|
||||
array_key_exists('fill-group-hover', $colour) &&
|
||||
array_key_exists('stroke-group-hover', $colour))
|
||||
) {
|
||||
throw new \Exception('Colours must contain a "stroke" and "fill" key!');
|
||||
}
|
||||
}
|
||||
}
|
||||
public function __construct(private array $directories, private array $colours) {}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
|
||||
Reference in New Issue
Block a user