Exec   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 81.82%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 39
ccs 9
cts 11
cp 0.8182
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCommand() 0 4 1
A setCommand() 0 4 1
A execute() 0 8 1
1
<?php
2
3
4
namespace Genesis\Commands;
5
6
7
use Genesis\Cli;
8
9
/**
10
 * @author Adam Bisek <[email protected]>
11
 */
12
class Exec extends Command
13
{
14
15
	private $command;
16
17
18
	/**
19
	 * Returns setted shell command
20
	 * @return mixed
21
	 */
22
	public function getCommand()
23
	{
24
		return $this->command;
25
	}
26
27
28
	/**
29
	 * Sets shell command (to be executed later)
30
	 * @param mixed $command
31
	 */
32 10
	public function setCommand($command)
33
	{
34 10
		$this->command = $command;
35 10
	}
36
37
38
	/**
39
	 * @return ExecResult
40
	 */
41 10
	public function execute()
42
	{
43 10
		echo Cli::getColoredString($this->command . PHP_EOL, 'light_blue');
44 10
		exec($this->command, $output, $return);
45 10
		$result = new ExecResult($return, $output);
46 10
		echo Cli::getColoredString(implode(PHP_EOL, $output), 'dark_gray') . "\n\n";
47 10
		return $result;
48
	}
49
50
}