public function getNamespaces($requestedNamespace, $inputFolder, $exclude) { $broker = new Broker($backend = new Broker\Backend\Memory()); $broker->processDirectory($inputFolder); $namespaces = $backend->getNamespaces(); ksort($namespaces); $excludedNamespaces = $this->getExcludedNamespaces($exclude); $filteredNamespaces = $this->getFilteredNamespaces($requestedNamespace, $namespaces, $excludedNamespaces); return $filteredNamespaces; }
/** * {@inheritDoc} */ public function addFile(StreamBase $tokenStream, ReflectionFile $file) { if (self::$level <= 1) { // Clean the old cache only for main classes, allow to bypass cleaning for hierarchy $this->clearTokenCache(); } return parent::addFile($tokenStream, $file); }
/** * Returns all functions from all namespaces. * * @return array */ public function getFunctions() { $generator = $this->generator; return array_map(function (IReflectionFunction $function) use($generator) { return new Reflection\ReflectionFunction($function, $generator); }, parent::getFunctions()); }
/** * @return ReflectionFunction[] */ public function getFunctions() { return array_map(function (IReflectionFunction $function) { return $this->reflectionFactory->createFromReflection($function); }, parent::getFunctions()); }
/** * @see Symfony\Component\Console\Command.Command::execute() */ protected function execute(InputInterface $input, OutputInterface $output) { $namespace = $input->getArgument('namespace'); $path = $input->getArgument('path'); $out = realpath($input->getOption('output')); $output->writeln(sprintf('<comment>Processing code from namespace %s</comment>', $namespace)); $output->writeln(sprintf('<comment>Processing files from %s</comment>', $path)); $output->writeln(sprintf('<comment>Outputting to %s</comment>', $out)); $output_files = array(); $filters = array(); if ($filtersArgument = trim($input->getOption('filters'))) { $filters = explode(';', $filtersArgument); foreach ($filters as $filter) { $output->writeln(sprintf('<comment>Applying filter %s</comment>', $filter)); } } $broker = new Broker($backend = new Memory()); $broker->processDirectory($path, $filters); $namespaces = $backend->getNamespaces(); ksort($namespaces); $excludes = array(); if ($exclude = trim($input->getOption('exclude'))) { $excludes = explode(';', $exclude); foreach ($excludes as $exclude) { $output->writeln(sprintf('<comment>Excluding code from %s</comment>', $exclude)); } } $filtered = array(); foreach ($namespaces as $n => $reflection) { if (substr($n, 0, strlen($namespace)) != $namespace) { continue; } foreach ($excludes as $exclude) { if (strncmp($n, $exclude, strlen($exclude)) == 0) { continue 2; } } $filtered[$n] = $reflection; } unset($namespaces); $elements = array(); foreach ($filtered as $n => $reflection) { $output->writeln(sprintf('<info>Processing %s</info>', $n)); $element = new NamespaceElement($reflection); $element->buildClasses($out, $output); $elements[$n] = $element; } unset($filtered); foreach ($elements as $n => $element) { $output->writeln(sprintf('<info>Building index for %s</info>', $n)); $options = array(); if ($n == $namespace && $input->getOption('title')) { $options = array('title' => $input->getOption('title')); } $element->buildIndex($out, $output, $options); } }