a command line application ➔ Example: `phpdoc template:list` ➔ May have options ➔ Example: --help ➔ May have one or more arguments ➔ Example: `scrybe manual:to-html file1.rst file2.rst` ➔ Can be interactive ➔ Question-based instead of option-based
Console\Application($name, $version); protected function addCommandsForProjectNamespace() { $this->command( new \phpDocumentor\Command\Project\ParseCommand() ); $this->command( new \phpDocumentor\Command\Project\RunCommand() ); $this->command( new \phpDocumentor\Command\Project\TransformCommand() ); } Convenience method provided by Cilex $console->add(new GreetCommand()); $console->run(); without Cilex
files and folders ➔ Returns them as SplFileInfo objects ➔ Provides a DSL to retrieve a specific set of files ➔ Highly configurable and filterable ➔ Can use streams to find files in ➔ Example: `\Zend_Service_Amazon_S3`
\Symfony\Component\Finder\Finder(); $finder ->files() ->in($path) ->name( '/\.('.implode('|', $this->allowed_extensions).')$/' ) ->ignoreDotFiles($this->getIgnoreHidden()) ->filter( function(\SplFileInfo $file) use ($patterns) { if (!$patterns) { return true; } // apply ignore list on path instead of file, finder // can't do that by default return !preg_match($patterns, $file->getPathname()); } );
a non-linear approach ➔ For example: hooks for a plugin ➔ Similar to: concepts from Aspect Oriented Programming ➔ Provide third-parties with controlled interaction ➔ Observer variant: Event Dispatcher pattern