[ 'prefix' => 'u', 'longPrefix' => 'uri', 'required' => true, 'description' => 'Resource uri' ], ]; } protected function provideDescription() { return 'The script generates a full url for a resource.'; } protected function run() { try { $resource = new \core_kernel_classes_Resource($this->getOption('uri')); if ($resource->isClass()) { $resource = new \core_kernel_classes_Class($resource); } if (!$resource->exists()) { throw new \RuntimeException('Resource "' . $this->getOption('uri') . '" not found'); } /** @var ResourceUrlBuilder $urlBuilder */ $urlBuilder = $this->getServiceLocator()->get(ResourceUrlBuilder::SERVICE_ID); $report = Report::createSuccess('URL: ' . $urlBuilder->buildUrl($resource)); } catch (\Exception $e) { $report = Report::createFailure($e->getMessage()); } return $report; } protected function provideUsage() { return [ 'prefix' => 'h', 'longPrefix' => 'help', ]; } }