1 | <?php |
||
35 | class OccRunner { |
||
36 | /** |
||
37 | * @var Locator $locator |
||
38 | */ |
||
39 | protected $locator; |
||
40 | |||
41 | /** |
||
42 | * @var bool |
||
43 | */ |
||
44 | protected $canUseProcess; |
||
45 | |||
46 | /** |
||
47 | * |
||
48 | * @param Locator $locator |
||
49 | * @param bool $canUseProcess |
||
50 | */ |
||
51 | 2 | public function __construct(Locator $locator, $canUseProcess){ |
|
55 | |||
56 | /** |
||
57 | * @param bool $canUseProcess |
||
58 | */ |
||
59 | public function setCanUseProcess($canUseProcess){ |
||
62 | |||
63 | /** |
||
64 | * @param $command |
||
65 | * @param array $args |
||
66 | * @param bool $asJson |
||
67 | * @return string |
||
68 | */ |
||
69 | 2 | public function run($command, $args = [], $asJson = false){ |
|
70 | 2 | if ($this->canUseProcess){ |
|
71 | 1 | $extra = $asJson ? '--output=json' : ''; |
|
72 | 1 | $cmdLine = trim($command . ' ' . $extra); |
|
73 | 1 | foreach ($args as $optionTitle => $optionValue){ |
|
74 | if (strpos($optionTitle, '--') === 0){ |
||
75 | $line = trim("$optionTitle=$optionValue"); |
||
76 | } else { |
||
77 | $line = $optionValue; |
||
78 | } |
||
79 | $escapedLine = ProcessUtils::escapeArgument($line); |
||
|
|||
80 | $cmdLine .= " $escapedLine"; |
||
81 | } |
||
82 | 1 | return $this->runAsProcess($cmdLine); |
|
83 | } else { |
||
84 | 1 | if ($asJson){ |
|
85 | 1 | $args['--output'] = 'json'; |
|
86 | } |
||
87 | 1 | $response = $this->runAsRequest($command, $args); |
|
88 | 1 | $decodedResponse = json_decode($response, true); |
|
89 | 1 | return $decodedResponse['response']; |
|
90 | } |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * @param $command |
||
95 | * @param array $args |
||
96 | * @return mixed |
||
97 | */ |
||
98 | 5 | public function runJson($command, $args = []){ |
|
109 | |||
110 | /** |
||
111 | * @param $command |
||
112 | * @param $args |
||
113 | * @return string |
||
114 | */ |
||
115 | protected function runAsRequest($command, $args){ |
||
142 | |||
143 | /** |
||
144 | * @return mixed |
||
145 | */ |
||
146 | protected function getApplication(){ |
||
151 | |||
152 | /** |
||
153 | * @param $cmdLine |
||
154 | * @return string |
||
155 | */ |
||
156 | protected function runAsProcess($cmdLine){ |
||
168 | } |
||
169 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.