Пример #1
0
 /**
  * Print the current definitions.
  */
 protected function printDefinitions()
 {
     $this->title('Definitions');
     $rows = [];
     foreach ($this->configuration->getDefinitionProviders() as $definition) {
         if ($definition instanceof ImmutableContainerAwareInterface) {
             $definition->setContainer(new Container());
         }
         $parameters = [];
         $reflection = new ReflectionClass($definition);
         if ($reflection->getProperties()) {
             foreach ($reflection->getProperties() as $parameter) {
                 if ($parameter->getName() === 'container') {
                     continue;
                 }
                 // Extract parameter type
                 $doc = $parameter->getDocComment();
                 preg_match('/.*@(type|var) (.+)\\n.*/', $doc, $type);
                 $type = $type[2];
                 $parameters[] = '<info>' . $parameter->getName() . '</info>: ' . $type;
             }
         }
         $definitions = array_keys($definition->getDefinitions());
         foreach ($definitions as $key => $binding) {
             $definitions[$key] = is_string($binding) ? $key + 1 . '. <comment>' . $binding . '</comment>' : null;
         }
         $rows[] = ['definition' => '<comment>' . get_class($definition) . '</comment>', 'options' => implode(PHP_EOL, $parameters), 'bindings' => implode(PHP_EOL, $definitions)];
         $rows[] = new TableSeparator();
     }
     $this->output->table(['Definition', 'Options', 'Bindings'], array_slice($rows, 0, -1));
 }