Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
[BUGFIX] Check for invalid class name in data pre-processor handler
Browse files Browse the repository at this point in the history
  • Loading branch information
romm committed Aug 24, 2017
1 parent 3fd01de commit bd6e1ff
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Classes/Service/Items/DataPreProcessor/DataPreProcessorService.php
Expand Up @@ -13,6 +13,7 @@

namespace Romm\ConfigurationObject\Service\Items\DataPreProcessor;

use Romm\ConfigurationObject\Core\Core;
use Romm\ConfigurationObject\Service\AbstractService;

/**
Expand Down Expand Up @@ -55,17 +56,19 @@ public function initialize()
*/
public function getDataPreProcessor($data, $className)
{
$interfaces = class_implements($className);
$processor = $this->defaultProcessor;
$processor->setData($data);

if (true === isset($interfaces[DataPreProcessorInterface::class])) {
$processor = new DataPreProcessor();
$processor->setData($data);
if (Core::get()->classExists($className)) {
$interfaces = class_implements($className);

/** @var DataPreProcessorInterface $className */
$className::dataPreProcessor($processor);
} else {
$processor = $this->defaultProcessor;
$processor->setData($data);
if (true === isset($interfaces[DataPreProcessorInterface::class])) {
$processor = new DataPreProcessor();
$processor->setData($data);

/** @var DataPreProcessorInterface $className */
$className::dataPreProcessor($processor);
}
}

return $processor;
Expand Down

0 comments on commit bd6e1ff

Please sign in to comment.