public getAllImplementationClassNamesForInterface ( string $interfaceName ) : array | ||
$interfaceName | string | Name of the interface |
return | array | An array of class names of the default implementation for the object type |
public function getAllImplementationClassNamesForInterface($interfaceName)
{
if (!$this->initialized) {
$this->initialize();
}
$interfaceName = $this->cleanClassName($interfaceName);
if (interface_exists($interfaceName) === false) {
throw new \InvalidArgumentException('"' . $interfaceName . '" does not exist or is not the name of an interface.', 1238769560);
}
$this->loadOrReflectClassIfNecessary($interfaceName);
return isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) ? array_keys($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) : [];
}
/** * Adds all validators that extend the AssetValidatorInterface. * * @return void */ protected function initializeObject() { $assetValidatorImplementationClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(AssetValidatorInterface::class); foreach ($assetValidatorImplementationClassNames as $assetValidatorImplementationClassName) { $this->addValidator($this->objectManager->get($assetValidatorImplementationClassName)); } }