Issues (5)

src/VPA/Console/Nodes.php (4 issues)

1
<?php
2
3
namespace VPA\Console;
4
5
use VPA\Console\Glyphs\Div;
6
use VPA\Console\Glyphs\Table;
7
use VPA\Console\Glyphs\Text;
8
9
trait Nodes
10
{
11
    abstract public function __get(string $name);
12
13
    public function addTable(array $config = []): Table
14 8
    {
15
        $table = new Table($this->globalConfig);
0 ignored issues
show
Bug Best Practice introduced by
The property globalConfig does not exist on VPA\Console\Nodes. Since you implemented __get, consider adding a @property annotation.
Loading history...
16 8
        $table->setConfig(array_merge($table->getConfig(), $config));
17 8
        $this->addChild($table);
0 ignored issues
show
It seems like addChild() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        $this->/** @scrutinizer ignore-call */ 
18
               addChild($table);
Loading history...
18 8
        return $table;
19 8
    }
20
21
    public function addDiv(array $config = []): Div
22 4
    {
23
        $div = new Div($this->globalConfig);
0 ignored issues
show
Bug Best Practice introduced by
The property globalConfig does not exist on VPA\Console\Nodes. Since you implemented __get, consider adding a @property annotation.
Loading history...
24 4
        $div->setConfig(array_merge($div->getConfig(), $config));
25 4
        $this->addChild($div);
26 4
        return $div;
27 4
    }
28
29
    public function addText(array $config = []): Text
30 26
    {
31
        $text = new Text($this->globalConfig);
0 ignored issues
show
Bug Best Practice introduced by
The property globalConfig does not exist on VPA\Console\Nodes. Since you implemented __get, consider adding a @property annotation.
Loading history...
32 26
        // Colors are inherited from the parent and override default values
33
        $symbolConfig = [
34 26
            'mode' => $this->__get('mode'),
35 26
            'color' => $this->__get('color'),
36 26
            'borderColor' => $this->__get('borderColor'),
37 26
            'backgroundColor' => $this->__get('backgroundColor'),
38
        ];
39 26
        $text->setConfig(array_merge($text->getConfig(), $symbolConfig, $config));
40 26
        $this->addChild($text);
41 26
        return $text;
42
    }
43
}
44