/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { try { /** @var \Magento\Framework\Component\ComponentRegistrar $componentRegistrar */ $componentRegistrar = $this->objectManager->get('Magento\\Framework\\Component\\ComponentRegistrar'); /** @var \Magento\Framework\Component\DirSearch $dirSearch */ $dirSearch = $this->objectManager->get('Magento\\Framework\\Component\\DirSearch'); /** @var \Magento\Framework\View\Design\Theme\ThemePackageList $themePackageList */ $themePackageList = $this->objectManager->get('Magento\\Framework\\View\\Design\\Theme\\ThemePackageList'); Files::setInstance(new Files($componentRegistrar, $dirSearch, $themePackageList)); $this->buildReport($input->getOption(self::INPUT_KEY_OUTPUT)); $output->writeln('<info>Report successfully processed.</info>'); } catch (\Exception $e) { $output->writeln('<error>Please check the path you provided. Dependencies report generator failed with error: ' . $e->getMessage() . '</error>'); } }
/** * @param Object $object * @param string $methodName */ public function methodInjection($object, $methodName, ObjectManager $objectManager) { $parameters = $this->getMethod($object, $methodName); $argumentsToInject = []; foreach ($parameters as $parameter) { $argumentsToInject[] = $objectManager->get($parameter[1]); } call_user_func_array([$object, $methodName], $argumentsToInject); }
/** * @param string $param * @return mixed */ public function wrap($param) { $beforeFunc = __FUNCTION__ . 'Before'; if (isset($this->_pluginList[$beforeFunc])) { foreach ($this->_pluginList[$beforeFunc] as $plugin) { $param = $this->_objectManager->get($plugin)->{$beforeFunc}($param); } } $insteadFunc = __FUNCTION__; if (isset($this->_pluginList[$insteadFunc])) { $first = reset($this->_pluginList[$insteadFunc]); $returnValue = $this->_objectManager->get($first)->{$insteadFunc}(); } else { $returnValue = $this->_getSubject()->wrap($param); } $afterFunc = __FUNCTION__ . 'After'; if (isset($this->_pluginList[$afterFunc])) { foreach (array_reverse($this->_pluginList[$afterFunc]) as $plugin) { $returnValue = $this->_objectManager->get($plugin)->{$afterFunc}($returnValue); } } return $returnValue; }
public function testGetIgnoresFirstSlash() { $this->assertSame($this->_object->get('Magento\\Test\\Di\\Child'), $this->_object->get('Magento\\Test\\Di\\Child')); }