This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Consolidation\SiteAlias\Cli; |
||
4 | |||
5 | use Consolidation\SiteAlias\SiteAliasFileLoader; |
||
6 | use Consolidation\SiteAlias\SiteAliasManager; |
||
7 | use Consolidation\SiteAlias\Util\YamlDataFileLoader; |
||
8 | use Consolidation\SiteAlias\SiteSpecParser; |
||
9 | use Consolidation\SiteAlias\SiteAliasName; |
||
10 | |||
11 | class SiteAliasCommands extends \Robo\Tasks |
||
12 | { |
||
13 | protected $aliasLoader; |
||
14 | |||
15 | /** |
||
16 | * List available site aliases. |
||
17 | * |
||
18 | * @command site:list |
||
19 | * @format yaml |
||
20 | * @return array |
||
21 | */ |
||
22 | public function siteList(array $varArgs) |
||
23 | { |
||
24 | $this->aliasLoader = new SiteAliasFileLoader(); |
||
25 | $ymlLoader = new YamlDataFileLoader(); |
||
26 | $this->aliasLoader->addLoader('yml', $ymlLoader); |
||
27 | $aliasName = $this->getLocationsAndAliasName($varArgs, $this->aliasLoader); |
||
0 ignored issues
–
show
|
|||
28 | |||
29 | $this->manager = new SiteAliasManager($this->aliasLoader); |
||
30 | |||
31 | return $this->renderAliases($this->manager->getMultiple($aliasName)); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Load available site aliases. |
||
36 | * |
||
37 | * @command site:load |
||
38 | * @format yaml |
||
39 | * @return array |
||
40 | */ |
||
41 | public function siteLoad(array $dirs) |
||
42 | { |
||
43 | $this->aliasLoader = new SiteAliasFileLoader(); |
||
44 | $ymlLoader = new YamlDataFileLoader(); |
||
45 | $this->aliasLoader->addLoader('yml', $ymlLoader); |
||
46 | |||
47 | foreach ($dirs as $dir) { |
||
48 | $this->io()->note("Add search location: $dir"); |
||
0 ignored issues
–
show
The method
Robo\Common\IO::io() has been deprecated with message: Use a style injector instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
49 | $this->aliasLoader->addSearchLocation($dir); |
||
50 | } |
||
51 | |||
52 | $all = $this->aliasLoader->loadAll(); |
||
53 | |||
54 | return $this->renderAliases($all); |
||
55 | } |
||
56 | |||
57 | protected function getLocationsAndAliasName($varArgs) |
||
58 | { |
||
59 | $aliasName = ''; |
||
60 | foreach ($varArgs as $arg) { |
||
61 | if (SiteAliasName::isAliasName($arg)) { |
||
62 | $this->io()->note("Alias parameter: '$arg'"); |
||
0 ignored issues
–
show
The method
Robo\Common\IO::io() has been deprecated with message: Use a style injector instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
63 | $aliasName = $arg; |
||
64 | } else { |
||
65 | $this->io()->note("Add search location: $arg"); |
||
0 ignored issues
–
show
The method
Robo\Common\IO::io() has been deprecated with message: Use a style injector instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
66 | $this->aliasLoader->addSearchLocation($arg); |
||
67 | } |
||
68 | } |
||
69 | return $aliasName; |
||
70 | } |
||
71 | |||
72 | protected function renderAliases($all) |
||
73 | { |
||
74 | if (empty($all)) { |
||
75 | throw new \Exception("No aliases found"); |
||
76 | } |
||
77 | |||
78 | $result = []; |
||
79 | foreach ($all as $name => $alias) { |
||
80 | $result[$name] = $alias->export(); |
||
81 | } |
||
82 | |||
83 | return $result; |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Show contents of a single site alias. |
||
88 | * |
||
89 | * @command site:get |
||
90 | * @format yaml |
||
91 | * @return array |
||
92 | */ |
||
93 | public function siteGet(array $varArgs) |
||
94 | { |
||
95 | $this->aliasLoader = new SiteAliasFileLoader(); |
||
96 | $ymlLoader = new YamlDataFileLoader(); |
||
97 | $this->aliasLoader->addLoader('yml', $ymlLoader); |
||
98 | $aliasName = $this->getLocationsAndAliasName($varArgs, $this->aliasLoader); |
||
0 ignored issues
–
show
The call to
SiteAliasCommands::getLocationsAndAliasName() has too many arguments starting with $this->aliasLoader .
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. In this case you can add the
Loading history...
|
|||
99 | |||
100 | $manager = new SiteAliasManager($this->aliasLoader); |
||
101 | $result = $manager->get($aliasName); |
||
102 | if (!$result) { |
||
103 | throw new \Exception("No alias found"); |
||
104 | } |
||
105 | |||
106 | return $result->export(); |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * Access a value from a single alias. |
||
111 | * |
||
112 | * @command site:value |
||
113 | * @format yaml |
||
114 | * @return string |
||
115 | */ |
||
116 | public function siteValue(array $varArgs) |
||
117 | { |
||
118 | $this->aliasLoader = new SiteAliasFileLoader(); |
||
119 | $ymlLoader = new YamlDataFileLoader(); |
||
120 | $this->aliasLoader->addLoader('yml', $ymlLoader); |
||
121 | $key = array_pop($varArgs); |
||
122 | $aliasName = $this->getLocationsAndAliasName($varArgs, $this->aliasLoader); |
||
0 ignored issues
–
show
The call to
SiteAliasCommands::getLocationsAndAliasName() has too many arguments starting with $this->aliasLoader .
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. In this case you can add the
Loading history...
|
|||
123 | |||
124 | $manager = new SiteAliasManager($this->aliasLoader); |
||
125 | $result = $manager->get($aliasName); |
||
126 | if (!$result) { |
||
127 | throw new \Exception("No alias found"); |
||
128 | } |
||
129 | |||
130 | return $result->get($key); |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * Parse a site specification. |
||
135 | * |
||
136 | * @command site-spec:parse |
||
137 | * @format yaml |
||
138 | * @return array |
||
139 | */ |
||
140 | public function parse($spec, $options = ['root' => '']) |
||
141 | { |
||
142 | $parser = new SiteSpecParser(); |
||
143 | return $parser->parse($spec, $options['root']); |
||
144 | } |
||
145 | } |
||
146 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.