/**
  * Builds code which injects an object which was specified by its object name
  *
  * @param Configuration $objectConfiguration Configuration of the object to inject into
  * @param $propertyName
  * @param $propertyObjectName
  * @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, $propertyName, $propertyObjectName)
 {
     $className = $objectConfiguration->getClassName();
     $injectAnnotation = $this->reflectionService->getPropertyAnnotation($className, $propertyName, 'TYPO3\\Flow\\Annotations\\Inject');
     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 ($injectAnnotation !== NULL && $injectAnnotation->setting !== NULL) {
         if ($injectAnnotation->package === NULL) {
             $settingPath = $objectConfiguration->getPackageKey();
         } else {
             $settingPath = $injectAnnotation->package;
         }
         $settingPath .= '.' . $injectAnnotation->setting;
         return array('$this->' . $propertyName . ' = \\TYPO3\\Flow\\Core\\Bootstrap::$staticObjectManager->get(\'TYPO3\\Flow\\Configuration\\ConfigurationManager\')->getConfiguration(\\TYPO3\\Flow\\Configuration\\ConfigurationManager::CONFIGURATION_TYPE_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) {
         $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 ($injectAnnotation->lazy === TRUE && $this->objectConfigurations[$propertyObjectName]->getScope() !== Configuration::SCOPE_PROTOTYPE) {
         return $this->buildLazyPropertyInjectionCode($propertyObjectName, $propertyClassName, $propertyName, $preparedSetterArgument);
     } else {
         return array('$this->' . $propertyName . ' = ' . $preparedSetterArgument . ';');
     }
 }