BasicRouter   A
last analyzed

↳ Parent: Project

Coupling/Cohesion

Components 1
Dependencies 6

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 6
dl 0
loc 35
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pathPrefix() 0 4 1
A execute() 0 16 3
1
<?php
2
3
namespace League\CLImate\TerminalObject\Router;
4
5
use League\CLImate\Util\Helper;
6
use League\CLImate\Util\OutputImporter;
7
8
class BasicRouter extends BaseRouter
9
{
10
    use OutputImporter;
11
12
    /**
13
     * @return string
14
     */
15 548
    public function pathPrefix()
16
    {
17 548
        return 'Basic';
18
    }
19
20
    /**
21
     * Execute a basic terminal object
22
     *
23
     * @param \League\CLImate\TerminalObject\Basic\BasicTerminalObject $obj
24
     * @return void
25
     */
26 364
    public function execute($obj)
27
    {
28 364
        $results = Helper::toArray($obj->result());
29
30 364
        $this->output->persist();
31
32 364
        foreach ($results as $result) {
33 364
            if ($obj->sameLine()) {
34 32
                $this->output->sameLine();
35 32
            }
36
37 364
            $this->output->write($obj->getParser()->apply($result));
38 364
        }
39
40 364
        $this->output->persist(false);
41 364
    }
42
}
43