Skip to content

Commit

Permalink
Command now implements an ICommand interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cully Larson committed Sep 8, 2015
1 parent ecd14d4 commit 1beef5b
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
53 changes: 53 additions & 0 deletions src/Cully/ICommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace Cully;

interface ICommand {
/**
* @return bool
*/
public function hasRun();
/**
* Whether the last command succeeded. Will return FALSE if no
* command has been executed (we haven't succeeded because we
* haven't tried).
*
* A successful command is one that has an exit code of 0.
*
* @return bool
*/
public function success();
/**
* Whether the last command failed. This will return FALSE if no
* command has been executed (we haven't failed because we haven't
* tried).
*
* @return bool
*/
public function failure();
/**
* The last command executed.
*
* @return string
*/
public function getCommand();
/**
* Will be null if a command hasn't been executed, or if the
* last executed command didn't return an exit code.
*
* @return int|null
*/
public function getExitStatus();
/**
* Standard output from command.
*
* @return string
*/
public function getOutput();
/**
* Standard error from the command.
*
* @return string
*/
public function getError();
}
4 changes: 3 additions & 1 deletion src/Cully/Local/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Cully\Local;

class Command {
use Cully\ICommand;

class Command implements ICommand {
/**
* @var string
*/
Expand Down

0 comments on commit 1beef5b

Please sign in to comment.