Skip to content

Commit 1beef5b

Browse files
author
Cully Larson
committed
Command now implements an ICommand interface.
1 parent ecd14d4 commit 1beef5b

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

src/Cully/ICommand.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
namespace Cully;
4+
5+
interface ICommand {
6+
/**
7+
* @return bool
8+
*/
9+
public function hasRun();
10+
/**
11+
* Whether the last command succeeded. Will return FALSE if no
12+
* command has been executed (we haven't succeeded because we
13+
* haven't tried).
14+
*
15+
* A successful command is one that has an exit code of 0.
16+
*
17+
* @return bool
18+
*/
19+
public function success();
20+
/**
21+
* Whether the last command failed. This will return FALSE if no
22+
* command has been executed (we haven't failed because we haven't
23+
* tried).
24+
*
25+
* @return bool
26+
*/
27+
public function failure();
28+
/**
29+
* The last command executed.
30+
*
31+
* @return string
32+
*/
33+
public function getCommand();
34+
/**
35+
* Will be null if a command hasn't been executed, or if the
36+
* last executed command didn't return an exit code.
37+
*
38+
* @return int|null
39+
*/
40+
public function getExitStatus();
41+
/**
42+
* Standard output from command.
43+
*
44+
* @return string
45+
*/
46+
public function getOutput();
47+
/**
48+
* Standard error from the command.
49+
*
50+
* @return string
51+
*/
52+
public function getError();
53+
}

src/Cully/Local/Command.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace Cully\Local;
44

5-
class Command {
5+
use Cully\ICommand;
6+
7+
class Command implements ICommand {
68
/**
79
* @var string
810
*/

0 commit comments

Comments
 (0)