You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.
Frank Kleine edited this page Apr 7, 2012
·
1 revision
The stubConsoleCommand interface
For creating command line scripts one should create classes implementing the net::stubbles::console::stubConsoleCommand interface. This interface has only one method: run() in which all the action takes place.
Why creating a class and implementing a special interface?
While it does not seem reasonable to create a whole class just for the script and even implement a special interface there are some good reasons to do so:
With a class one can implement a __bindings() method and use the Dependency Injection feature for command line scripts.
Following the dependency injection way you should get a testable class - this allows you to write unit tests for your command line script.
Every implementation of the interface can be run via stubcli command line script - no need to create your own script file for this with the tedious recurring bootstrap code.