/** * Determines which of the given classes are potentially proxyable * and returns their names in an array. * * @param array $classNames Names of the classes to check * @return array Names of classes which can be proxied * @author Robert Lemke <*****@*****.**> */ protected function getProxyableClasses(array $classNames) { $proxyableClasses = array(); foreach ($classNames as $className) { if (!in_array(substr($className, 0, 12), $this->blacklistedSubPackages)) { if (!$this->reflectionService->isClassReflected($className)) { throw new \F3\FLOW3\AOP\Exception\UnknownClass('The class "' . $className . '" does not exist.', 1187348208); } if (!$this->reflectionService->isClassTaggedWith($className, 'aspect') && !$this->reflectionService->isClassAbstract($className) && !$this->reflectionService->isClassFinal($className) && !$this->reflectionService->isClassImplementationOf($className, 'F3\\FLOW3\\AOP\\ProxyInterface')) { $proxyableClasses[] = $className; } } } return $proxyableClasses; }
/** * Traverses through all active packages and registers their classes as * objects at the object manager. Finally the object configuration * defined by the package is loaded and applied to the registered objects. * * @param array $packages The packages whose classes should be registered * @return void * @author Robert Lemke <*****@*****.**> */ protected function registerAndConfigureAllPackageObjects(array $packages) { $objectTypes = array(); $availableClassNames = array(); foreach ($packages as $packageKey => $package) { foreach (array_keys($package->getClassFiles()) as $className) { if (!$this->classNameIsBlacklisted($className)) { $availableClassNames[] = $className; } } } foreach ($availableClassNames as $className) { if (substr($className, -9, 9) === 'Interface') { $objectTypes[] = $className; if (!isset($this->registeredObjects[$className])) { $this->registerObjectType($className); } } else { if (!isset($this->registeredObjects[$className])) { if (!$this->reflectionService->isClassAbstract($className)) { $this->registerObject($className, $className); } } } } foreach (array_keys($packages) as $packageKey) { $rawObjectConfigurations = $this->configurationManager->getConfiguration(\F3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_OBJECTS, $packageKey); foreach ($rawObjectConfigurations as $objectName => $rawObjectConfiguration) { $objectName = str_replace('_', '\\', $objectName); if (!isset($this->registeredObjects[$objectName])) { throw new \F3\FLOW3\Object\Exception\InvalidObjectConfigurationException('Tried to configure unknown object "' . $objectName . '" in package "' . $packageKey . '".', 1184926175); } if (is_array($rawObjectConfiguration)) { $existingObjectConfiguration = isset($this->objectConfigurations[$objectName]) ? $this->objectConfigurations[$objectName] : NULL; $this->objectConfigurations[$objectName] = \F3\FLOW3\Object\Configuration\ConfigurationBuilder::buildFromConfigurationArray($objectName, $rawObjectConfiguration, 'Package ' . $packageKey, $existingObjectConfiguration); } } } }