/**
  * Builds code which injects an object which was specified by its object name
  *
  * @param Configuration $objectConfiguration Configuration of the object to inject into
  * @param ConfigurationProperty $propertyConfiguration
  * @param string $propertyName Name of the property to inject
  * @param string $propertyObjectName Object name of the object to inject
  * @return array PHP code
  * @throws \TYPO3\Flow\Object\Exception\UnknownObjectException
  */
 public function buildPropertyInjectionCodeByString(Configuration $objectConfiguration, ConfigurationProperty $propertyConfiguration, $propertyName, $propertyObjectName)
 {
     $className = $objectConfiguration->getClassName();
     if (strpos($propertyObjectName, '.') !== false) {
         $settingPath = explode('.', $propertyObjectName);
         $settings = Arrays::getValueByPath($this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS), array_shift($settingPath));
         $propertyObjectName = Arrays::getValueByPath($settings, $settingPath);
     }
     if (!isset($this->objectConfigurations[$propertyObjectName])) {
         $configurationSource = $objectConfiguration->getConfigurationSourceHint();
         if (!isset($propertyObjectName[0])) {
             throw new \TYPO3\Flow\Object\Exception\UnknownObjectException('Malformed DocComent block for a property in class "' . $className . '".', 1360171313);
         }
         if ($propertyObjectName[0] === '\\') {
             throw new \TYPO3\Flow\Object\Exception\UnknownObjectException('The object name "' . $propertyObjectName . '" which was specified as a property in the object configuration of object "' . $objectConfiguration->getObjectName() . '" (' . $configurationSource . ') starts with a leading backslash.', 1277827579);
         } else {
             throw new \TYPO3\Flow\Object\Exception\UnknownObjectException('The object "' . $propertyObjectName . '" which was specified as a property in the object configuration of object "' . $objectConfiguration->getObjectName() . '" (' . $configurationSource . ') does not exist. Check for spelling mistakes and if that dependency is correctly configured.', 1265213849);
         }
     }
     $propertyClassName = $this->objectConfigurations[$propertyObjectName]->getClassName();
     if ($this->objectConfigurations[$propertyObjectName]->getScope() === Configuration::SCOPE_PROTOTYPE && !$this->objectConfigurations[$propertyObjectName]->isCreatedByFactory()) {
         $preparedSetterArgument = 'new \\' . $propertyClassName . '(' . $this->buildMethodParametersCode($this->objectConfigurations[$propertyObjectName]->getArguments()) . ')';
     } else {
         $preparedSetterArgument = '\\TYPO3\\Flow\\Core\\Bootstrap::$staticObjectManager->get(\'' . $propertyObjectName . '\')';
     }
     $result = $this->buildSetterInjectionCode($className, $propertyName, $preparedSetterArgument);
     if ($result !== null) {
         return $result;
     }
     if ($propertyConfiguration->isLazyLoading() && $this->objectConfigurations[$propertyObjectName]->getScope() !== Configuration::SCOPE_PROTOTYPE) {
         return $this->buildLazyPropertyInjectionCode($propertyObjectName, $propertyClassName, $propertyName, $preparedSetterArgument);
     } else {
         return array('$this->' . $propertyName . ' = ' . $preparedSetterArgument . ';');
     }
 }
 /**
  * Parses the configuration for properties of type OBJECT
  *
  * @param string $propertyName Name of the property
  * @param mixed $objectNameOrConfiguration Value of the "object" section of the property configuration - either a string or an array
  * @param Configuration $parentObjectConfiguration The Configuration object this property belongs to
  * @return ConfigurationProperty A configuration property of type object
  * @throws InvalidObjectConfigurationException
  */
 protected function parsePropertyOfTypeObject($propertyName, $objectNameOrConfiguration, Configuration $parentObjectConfiguration)
 {
     if (is_array($objectNameOrConfiguration)) {
         if (isset($objectNameOrConfiguration['name'])) {
             $objectName = $objectNameOrConfiguration['name'];
             unset($objectNameOrConfiguration['name']);
         } else {
             if (isset($objectNameOrConfiguration['factoryObjectName'])) {
                 $objectName = NULL;
             } else {
                 $annotations = $this->reflectionService->getPropertyTagValues($parentObjectConfiguration->getClassName(), $propertyName, 'var');
                 if (count($annotations) !== 1) {
                     throw new InvalidObjectConfigurationException(sprintf('Object %s, for property "%s", contains neither object name, nor factory object name, and nor is the property properly @var - annotated.', $parentObjectConfiguration->getConfigurationSourceHint(), $propertyName, $parentObjectConfiguration->getClassName()), 1297097815);
                 }
                 $objectName = $annotations[0];
             }
         }
         $objectConfiguration = $this->parseConfigurationArray($objectName, $objectNameOrConfiguration, $parentObjectConfiguration->getConfigurationSourceHint() . ', property "' . $propertyName . '"');
         $property = new ConfigurationProperty($propertyName, $objectConfiguration, ConfigurationProperty::PROPERTY_TYPES_OBJECT);
     } else {
         $property = new ConfigurationProperty($propertyName, $objectNameOrConfiguration, ConfigurationProperty::PROPERTY_TYPES_OBJECT);
     }
     return $property;
 }