/** * Build a list of files (from the fileset elements) * and call the phpDocumentor parser * * @return string */ private function parseFiles() { $parser = new \phpDocumentor\Parser\Parser(); $parser->setTitle($this->title); $paths = array(); // filesets foreach ($this->filesets as $fs) { $ds = $fs->getDirectoryScanner($this->project); $dir = $fs->getDir($this->project); $srcFiles = $ds->getIncludedFiles(); foreach ($srcFiles as $file) { $paths[] = $dir . FileSystem::getFileSystem()->getSeparator() . $file; } } $this->project->log("Will parse " . count($paths) . " file(s)", Project::MSG_VERBOSE); $files = new phpDocumentor\Fileset\Collection(); $files->addFiles($paths); $parser->setPath($files->getProjectRoot()); return $parser->parseFiles($files); }
/** * Build a list of files (from the fileset elements) * and call the phpDocumentor parser * * @return string */ private function parseFiles() { $parser = $this->app['parser']; $builder = $this->app['descriptor.builder']; $builder->createProjectDescriptor(); $projectDescriptor = $builder->getProjectDescriptor(); $projectDescriptor->setName($this->title); $paths = array(); // filesets foreach ($this->filesets as $fs) { $ds = $fs->getDirectoryScanner($this->project); $dir = $fs->getDir($this->project); $srcFiles = $ds->getIncludedFiles(); foreach ($srcFiles as $file) { $paths[] = $dir . FileSystem::getFileSystem()->getSeparator() . $file; } } $this->project->log("Will parse " . count($paths) . " file(s)", Project::MSG_VERBOSE); $files = new \phpDocumentor\Fileset\Collection(); $files->addFiles($paths); $mapper = new \phpDocumentor\Descriptor\Cache\ProjectDescriptorMapper($this->app['descriptor.cache']); $mapper->garbageCollect($files); $mapper->populate($projectDescriptor); $parser->setPath($files->getProjectRoot()); $parser->setDefaultPackageName($this->defaultPackageName); $parser->parse($builder, $files); $mapper->save($projectDescriptor); return $mapper; }
/** * Returns the collection of files based on the input and configuration. * * @param InputInterface $input * * @return \phpDocumentor\File\Collection */ protected function getFileCollection($input) { $files = new \phpDocumentor\Fileset\Collection(); $files->setAllowedExtensions($this->getOption($input, 'extensions', 'parser/extensions/extension', array('php', 'php3', 'phtml'), true)); $files->setIgnorePatterns($this->getOption($input, 'ignore', 'files/ignore', array(), true)); $files->setIgnoreHidden($this->getOption($input, 'hidden', 'files/ignore-hidden', 'off') == 'on'); $files->setFollowSymlinks($this->getOption($input, 'ignore-symlinks', 'files/ignore-symlinks', 'off') == 'on'); $added_files = $this->getOption($input, 'filename', 'files/file', array(), true); foreach ($added_files as &$file) { $file = realpath($file); } $files->addFiles($added_files); $added_directories = $this->getOption($input, 'directory', 'files/directory', array(), true); foreach ($added_directories as &$dir) { $dir = realpath($dir); } $files->addDirectories($added_directories); return $files; }
/** * Returns the collection of files based on the input and configuration. * * @param InputInterface $input * * @return \phpDocumentor\File\Collection */ protected function getFileCollection($input) { $files = new \phpDocumentor\Fileset\Collection(); $files->setAllowedExtensions($this->getOption($input, 'extensions', 'parser/extensions/extension', array('php', 'php3', 'phtml'), true)); $files->setIgnorePatterns($this->getOption($input, 'ignore', 'files/ignore', array(), true)); $files->setIgnoreHidden($this->getOption($input, 'hidden', 'files/ignore-hidden', 'off') == 'on'); $files->setFollowSymlinks($this->getOption($input, 'ignore-symlinks', 'files/ignore-symlinks', 'off') == 'on'); $file_options = $this->getOption($input, 'filename', 'files/file', array(), true); $added_files = array(); foreach ($file_options as $glob) { if (!is_string($glob)) { continue; } $matches = glob($glob); if (is_array($matches)) { foreach ($matches as $file) { if (!empty($file)) { $file = realpath($file); if (!empty($file)) { $added_files[] = $file; } } } } } $files->addFiles($added_files); $directory_options = $this->getOption($input, 'directory', 'files/directory', array(), true); $added_directories = array(); foreach ($directory_options as $glob) { if (!is_string($glob)) { continue; } $matches = glob($glob, GLOB_ONLYDIR); if (is_array($matches)) { foreach ($matches as $dir) { if (!empty($dir)) { $dir = realpath($dir); if (!empty($dir)) { $added_directories[] = $dir; } } } } } $files->addDirectories($added_directories); return $files; }
/** * Returns the collection of files based on the input and configuration. * * @param InputInterface $input * * @return \phpDocumentor\File\Collection */ protected function getFileCollection($input) { $files = new \phpDocumentor\Fileset\Collection(); $files->setAllowedExtensions((array) $this->getOption($input, 'extensions', 'parser/extensions/extension', array('php', 'php3', 'phtml'))); $files->setIgnorePatterns((array) $this->getOption($input, 'ignore', 'files/ignore', array())); $files->setIgnoreHidden($this->getOption($input, 'hidden', 'files/ignore-hidden', 'off') == 'on'); $files->setFollowSymlinks($this->getOption($input, 'ignore-symlinks', 'files/ignore-symlinks', 'off') == 'on'); $files->addFiles((array) $this->getOption($input, 'filename', 'files/file', array())); $files->addDirectories((array) $this->getOption($input, 'directory', 'files/directory', array())); return $files; }