1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* This file is part of Laravel Zero. |
7
|
|
|
* |
8
|
|
|
* (c) Nuno Maduro <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace LaravelZero\Framework\Components\Logo; |
15
|
|
|
|
16
|
|
|
use Zend\Text\Figlet\Figlet as ZendFiglet; |
|
|
|
|
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @internal |
20
|
|
|
*/ |
21
|
|
|
final class FigletString |
22
|
|
|
{ |
23
|
|
|
|
24
|
|
|
private $string; |
25
|
|
|
|
26
|
|
|
private $figlet; |
27
|
|
|
|
28
|
|
|
public function __construct(string $name, $config) |
29
|
|
|
{ |
30
|
|
|
$this->string = $name; |
31
|
|
|
$this->figlet = new ZendFiglet(); |
32
|
|
|
|
33
|
|
|
$this->parseOptions($config); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
private function parseOptions($config) |
37
|
|
|
{ |
38
|
|
|
$this |
39
|
|
|
->font($config->get('logo.font')) |
40
|
|
|
->outputWidth($config->get('logo.outputWidth')) |
41
|
|
|
->justification($config->get('logo.justification')) |
42
|
|
|
->rightToLeft($config->get('logo.rightToLeft')); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
private function font($font) |
46
|
|
|
{ |
47
|
|
|
if(is_null($font)) { |
48
|
|
|
return $this; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
$this->figlet->setFont($font); |
52
|
|
|
return $this; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
private function outputWidth($outputWidth) |
56
|
|
|
{ |
57
|
|
|
$this->figlet->setOutputWidth($outputWidth); |
58
|
|
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
private function justification($justification) |
62
|
|
|
{ |
63
|
|
|
switch ($justification) { |
64
|
|
|
case 'left': |
65
|
|
|
$this->figlet->setJustification(ZendFiglet::JUSTIFICATION_LEFT); |
66
|
|
|
break; |
67
|
|
|
case 'center': |
68
|
|
|
$this->figlet->setJustification(ZendFiglet::JUSTIFICATION_LEFT); |
69
|
|
|
break; |
70
|
|
|
case 'right': |
71
|
|
|
$this->figlet->setJustification(ZendFiglet::JUSTIFICATION_LEFT); |
72
|
|
|
break; |
73
|
|
|
case null: |
74
|
|
|
// Let ZendFiglet handle the justification |
75
|
|
|
break; |
76
|
|
|
default: |
77
|
|
|
throw new \InvalidArgumentException("Invalid value given for the `logo.justification` option"); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
private function rightToLeft($rightToLeft) |
84
|
|
|
{ |
85
|
|
|
switch ($rightToLeft) { |
86
|
|
|
case 'right-to-left': |
87
|
|
|
$this->figlet->setRightToLeft(ZendFiglet::DIRECTION_RIGHT_TO_LEFT); |
88
|
|
|
break; |
89
|
|
|
case 'left-to-right': |
90
|
|
|
$this->figlet->setRightToLeft(ZendFiglet::DIRECTION_LEFT_TO_RIGHT); |
91
|
|
|
break; |
92
|
|
|
case null: |
93
|
|
|
// Let ZendFiglet handle this |
94
|
|
|
break; |
95
|
|
|
default: |
96
|
|
|
throw new \InvalidArgumentException("Invalid value given for the `logo.rightToLeft` option"); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function __toString() |
103
|
|
|
{ |
104
|
|
|
$rendered = $this->figlet->render($this->string); |
105
|
|
|
|
106
|
|
|
return "\n$rendered\n"; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths