/** * {@inheritdoc} */ public function traverse(TraitGenerator $generator) { $class = ltrim($generator->getFullyQualifiedName(), '\\'); if (true === $this->collection->has($class)) { foreach ($this->collection->get($class) as $enhancer) { $enhancer->visitTraitGenerator($generator); } } }
/** * Executes the command * * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { $traits = $this->collection->keys(); $output->write('Enhancers: <info>' . $this->collection->count() . '</info>', true); foreach ($traits as $traitName) { $reflectionClass = new ReflectionClass($traitName); $output->write('Extending <info>' . $traitName . '</info> finished', true); $code = $this->generateTrait($reflectionClass); $this->filesystem->dumpFile($reflectionClass->getFileName(), $code); } $this->executeMetadataCacheClear($output); $this->executeSchemaUpdate($output); }