injectableFactory = $injectableFactory; $this->fileManager = $fileManager; } public function run(array $options, array $flagList) { $fileList = $this->fileManager->getFileList('application/Espo/Classes/AppInfo'); $typeList = array_map(function ($item) { return lcfirst(substr($item, 0, -4)); }, $fileList); foreach ($typeList as $type) { if (in_array($type, $flagList)) { $this->processType($type, $options, $flagList); return; } } if (empty($flagList)) { echo "No parameters specified.\n"; return; } echo "Bad parameters specified.\n"; } protected function processType(string $type, array $options, array $flagList) { $className = 'Espo\\Classes\\AppInfo\\' . ucfirst($type); $obj = $this->injectableFactory->create($className); $result = $obj->process($options, $flagList); if ($result) { echo $result; } } }