public function configure(array $configuration = null)
{
if (null === $configuration) {
$this->configuration = self::$defaultConfiguration;
return;
}
$this->configuration = array();
foreach ($configuration as $item) {
if (!is_string($item)) {
throw new InvalidFixerConfigurationException($this->getName(), sprintf('Expected string got "%s".', is_object($item) ? get_class($item) : gettype($item)));
}
if (!in_array($item, $this->options, true)) {
throw new InvalidFixerConfigurationException($this->getName(), sprintf('Unknown configuration item "%s", expected any of "%s".', $item, implode('", "', $this->options)));
}
if ('const' === $item && PHP_VERSION_ID < 70100) {
throw new InvalidFixerConfigurationException($this->getName(), sprintf('Invalid configuration item "%s" for PHP "%s".', $item, phpversion()));
}
$this->configuration[] = $item;
}
}