Completed
Push — master ( d32259...77ced4 )
by Gordon
08:40 queued 06:34
created

TerminalHelper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 1
b 0
f 0
dl 0
loc 27
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A taskReport() 0 7 2
A tick() 0 3 1
A cross() 0 3 1
1
<?php declare(strict_types = 1);
2
3
namespace Suilven\PHPTravisEnhancer\Terminal;
4
5
trait TerminalHelper
6
{
7
    /**
8
     * Render a green tick in the terminal
9
     */
10
    private function tick(): void
11
    {
12
        $this->climate->bold()->green('✓');
13
    }
14
15
16
    /**
17
     * Render a red cross in the terminial
18
     */
19
    private function cross(): void
20
    {
21
        $this->climate->bold()->red('✘');
22
    }
23
24
25
    private function taskReport(string $message, int $retVal = 0): void
26
    {
27
        $this->climate->inline($message . '  ');
28
        if ($retVal !== 0) {
29
            $this->cross();
30
        } else {
31
            $this->tick();
32
        }
33
    }
34
}
35