Shell   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 40
ccs 0
cts 17
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A beforeScript() 0 6 1
A afterScript() 0 4 1
A compile() 0 3 1
1
<?php
2
/**
3
 * For licensing information, please see the LICENSE file accompanied with this file.
4
 *
5
 * @author Gerard van Helden <[email protected]>
6
 * @copyright 2012 Gerard van Helden <http://melp.nl>
7
 */
8
9
namespace Zicht\Tool\Script\Node\Script;
10
11
use Zicht\Tool\Script\Buffer;
12
use Zicht\Tool\Script\Node\Branch;
13
use Zicht\Tool\Script\Node\Node;
14
15
/**
16
 * Wraps the task line in a different shell
17
 */
18
class Shell extends Branch implements Annotation
19
{
20
    /**
21
     * Construct the decorator with the specified expression as the SHELL to use.
22
     *
23
     * @param \Zicht\Tool\Script\Node\Node $expr
24
     */
25
    public function __construct($expr)
26
    {
27
        parent::__construct(array($expr));
28
    }
29
30
    /**
31
     * @{inheritDoc}
32
     */
33
    public function beforeScript(Buffer $buffer)
34
    {
35
        $buffer->writeln('$z->push("SHELL", ')->indent(1);
36
        $this->nodes[0]->compile($buffer);
37
        $buffer->indent(-1)->writeln(');');
38
    }
39
40
    /**
41
     * @{inheritDoc}
42
     */
43
    public function afterScript(Buffer $buffer)
44
    {
45
        $buffer->writeln('$z->pop("SHELL");');
46
    }
47
48
    /**
49
     * Compiles the node into the buffer.
50
     *
51
     * @param \Zicht\Tool\Script\Buffer $buffer
52
     * @return void
53
     */
54
    public function compile(Buffer $buffer)
55
    {
56
    }
57
}
58