Skip to content

Instantly share code, notes, and snippets.

@heiglandreas
Created July 9, 2016 20:57
Show Gist options
  • Save heiglandreas/c16fd1301bec0636ce5a7b1e9fc12cd7 to your computer and use it in GitHub Desktop.
Save heiglandreas/c16fd1301bec0636ce5a7b1e9fc12cd7 to your computer and use it in GitHub Desktop.
First ideas for interfaces for console-commands
<?php
interface CommandInterface
{
public function execute(InputInterface $input, OutputInterface $output);
}
<?php
interface InputInterface
{
public function getArgument($argName) : mixed;
public function getArguments() : array;
public function getOption($argName) : mixed;
public function getOptions() : array;
public function hasArgument($argName) : boolean;
public function hasOption($argName) : boolean;
}
<?php
interface OutputInterface
{
public function getVerbosity() : int;
/**
* @param string|array $message
*/
public function write($message, bool $newline = false, int $options = 0) : void;
/**
* @param string|array $message
*/
public function writeln($message, int $options = 0) : void;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment