zfcampus / zf-console

Create console applications in PHP
BSD 3-Clause "New" or "Revised" License
64 stars 25 forks source link

Adding a HandlerInterface definition. #48

Open visto9259 opened 5 years ago

visto9259 commented 5 years ago

This is simply to add an interface definition to faciliate the creation of route handlers.

I have been using this for a while now and works fine in editor like phpStorm and Zend Studio. The editors will add the __invoke( Route $route, AdapterInterface $console) automatically.

It also helps enforce the proper function definition.

Usage:

use Zend\Console\Adapter\AdapterInterface;
use ZF\Console\HandlerInterface;
use ZF\Console\Route;

class MyHandler implements HandlerInterface
{

/**
 * Invokable for Zf/Console Route handler
 *
 * @param Route $route
 * @param AdapterInterface $console
 */
public function __invoke(Route $route, AdapterInterface $console)
{
    ...
}

}

weierophinney commented 5 years ago

Please run composer cs-fix, and then commit the results - that's the only failing issue currently.

Also, please add some information to the README.md file regarding the interface, so users know about it.

Thanks!

visto9259 commented 5 years ago

First time submitting a pull request on a public package and obviously first time for zfcampus packages. I thought it had gone through travis without issues. Let me fix it.