コード例 #1
0
ファイル: Compiled.php プロジェクト: pradeep-wagento/magento2
 /**
  * Create instance with call time arguments
  *
  * @param string $requestedType
  * @param array $arguments
  * @return object
  * @throws \Exception
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function create($requestedType, array $arguments = [])
 {
     $args = $this->config->getArguments($requestedType);
     $type = $this->config->getInstanceType($requestedType);
     if (!$args) {
         return new $type();
     }
     foreach ($args as $key => &$argument) {
         if (isset($arguments[$key])) {
             $argument = $arguments[$key];
         } elseif (isset($argument['_i_'])) {
             $argument = $this->get($argument['_i_']);
         } elseif (isset($argument['_ins_'])) {
             $argument = $this->create($argument['_ins_']);
         } elseif (isset($argument['_v_'])) {
             $argument = $argument['_v_'];
         } elseif (isset($argument['_vac_'])) {
             $argument = $argument['_vac_'];
             $this->parseArray($argument);
         } elseif (isset($argument['_vn_'])) {
             $argument = null;
         } elseif (isset($argument['_a_'])) {
             if (isset($this->globalArguments[$argument['_a_']])) {
                 $argument = $this->globalArguments[$argument['_a_']];
             } else {
                 $argument = $argument['_d_'];
             }
         }
     }
     $args = array_values($args);
     return $this->createObject($type, $args);
 }
コード例 #2
0
 /**
  * Return configured arguments
  *
  * @param string $instanceType
  * @return array
  */
 private function getConfiguredArguments($instanceType)
 {
     $configuredArguments = $this->diContainerConfig->getArguments($instanceType);
     return array_map(function ($type) {
         if (isset($type['instance'])) {
             $type['instance'] = ltrim($type['instance'], '\\');
         }
         return $type;
     }, $configuredArguments);
 }
コード例 #3
0
 /**
  * @return CartItemProcessorInterface[]
  * @deprecated
  */
 public function getCartItemProcessors()
 {
     if (!empty($this->cartItemProcessors)) {
         return $this->cartItemProcessors;
     }
     $arguments = $this->objectManagerConfig->getArguments(\Magento\Quote\Model\Quote\Item\Repository::class);
     if (isset($arguments['cartItemProcessors'])) {
         // Workaround for compiled mode.
         $processors = isset($arguments['cartItemProcessors']['_vac_']) ? $arguments['cartItemProcessors']['_vac_'] : $arguments['cartItemProcessors'];
         foreach ($processors as $name => $processor) {
             $className = isset($processor['instance']) ? $processor['instance'] : $processor['_i_'];
             $this->cartItemProcessors[$name] = ObjectManager::getInstance()->get($className);
         }
     }
     return $this->cartItemProcessors;
 }