1 | <?php |
||
16 | class Exec { |
||
17 | /** |
||
18 | * @var string[] |
||
19 | */ |
||
20 | private $prefixes; |
||
21 | /** |
||
22 | * @var string[] |
||
23 | */ |
||
24 | private $output; |
||
25 | /** |
||
26 | * @var int |
||
27 | */ |
||
28 | private $status; |
||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $lastCommand; |
||
33 | |||
34 | /** |
||
35 | * Create a new callable `Exec` object. |
||
36 | * |
||
37 | * @param string[] $prefixes,... Optional arguments will always be added to the beginning of the command. |
||
|
|||
38 | * |
||
39 | * @return \nochso\Omni\Exec |
||
40 | */ |
||
41 | public static function create(...$prefixes) { |
||
46 | |||
47 | /** |
||
48 | * Run a command with auto-escaped arguments. |
||
49 | * |
||
50 | * @param string[] $arguments,... Optional arguments will be added after the prefixes. |
||
51 | * |
||
52 | * @return $this |
||
53 | */ |
||
54 | public function run(...$arguments) { |
||
61 | |||
62 | /** |
||
63 | * getCommand returns the string to be used by `\exec()`. |
||
64 | * |
||
65 | * @param string[] $arguments,... |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getCommand(...$arguments) { |
||
81 | |||
82 | /** |
||
83 | * getLastCommand returns the string last used by a previous call to `run()`. |
||
84 | * |
||
85 | * @return string|null |
||
86 | */ |
||
87 | public function getLastCommand() { |
||
90 | |||
91 | /** |
||
92 | * getOutput of last execution. |
||
93 | * |
||
94 | * @return string[] |
||
95 | */ |
||
96 | public function getOutput() { |
||
99 | |||
100 | /** |
||
101 | * getStatus code of last execution. |
||
102 | * |
||
103 | * @return int |
||
104 | */ |
||
105 | public function getStatus() { |
||
108 | |||
109 | /** |
||
110 | * __invoke allows using this object as a callable by calling `run()`. |
||
111 | * |
||
112 | * e.g. `$runner('argument');` |
||
113 | * |
||
114 | * @param array $arguments,... |
||
115 | * |
||
116 | * @return \nochso\Omni\Exec |
||
117 | */ |
||
118 | public function __invoke(...$arguments) { |
||
121 | |||
122 | /** |
||
123 | * @param string $argument |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | private function escapeArgument($argument) { |
||
137 | |||
138 | /** |
||
139 | * @param string $argument |
||
140 | * |
||
141 | * @return string |
||
142 | */ |
||
143 | private function escapeLinuxArgument($argument) { |
||
151 | |||
152 | /** |
||
153 | * @param string $argument |
||
154 | * |
||
155 | * @return string |
||
156 | * |
||
157 | * @link https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ |
||
158 | */ |
||
159 | private function escapeWindowsArgument($argument) { |
||
187 | } |
||
188 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.