1 | <?php |
||
21 | class SiteProcess extends ProcessBase |
||
22 | { |
||
23 | /** @var AliasRecord */ |
||
24 | protected $siteAlias; |
||
25 | /** @var string[] */ |
||
26 | protected $args; |
||
27 | /** @var string[] */ |
||
28 | protected $options; |
||
29 | /** @var string[] */ |
||
30 | protected $optionsPassedAsArgs; |
||
31 | /** @var string */ |
||
32 | protected $cd; |
||
33 | /** @var TransportManager */ |
||
34 | protected $transportManager; |
||
35 | |||
36 | /** |
||
37 | * Process arguments and options per the site alias and build the |
||
38 | * actual command to run. |
||
39 | */ |
||
40 | public function __construct(AliasRecord $siteAlias, $args, $options = [], $optionsPassedAsArgs = []) |
||
49 | |||
50 | /** |
||
51 | * @inheritdoc |
||
52 | */ |
||
53 | public function setWorkingDirectory($cwd) |
||
58 | |||
59 | public function chdirToSiteRoot($shouldUseSiteRoot = true) |
||
67 | |||
68 | /** |
||
69 | * Take all of our individual arguments and process them for use. |
||
70 | */ |
||
71 | protected function processArgs() |
||
96 | |||
97 | public function setTransportManager($transportManager) |
||
101 | |||
102 | protected function getTransportManager() |
||
109 | |||
110 | /** |
||
111 | * Ask the transport manager for the correct transport for the |
||
112 | * provided alias. |
||
113 | */ |
||
114 | protected function getTransport(AliasRecord $siteAlias) |
||
118 | |||
119 | /** |
||
120 | * @inheritDoc |
||
121 | */ |
||
122 | public function getCommandLine() |
||
133 | |||
134 | /** |
||
135 | * @inheritDoc |
||
136 | */ |
||
137 | public function start(callable $callback = null) |
||
142 | |||
143 | /** |
||
144 | * @inheritDoc |
||
145 | */ |
||
146 | public function wait(callable $callback = null) |
||
151 | |||
152 | /** |
||
153 | * interpolate examines each of the arguments in the provided argument list |
||
154 | * and replaces any token found therein with the value for that key as |
||
155 | * pulled from the given site alias. |
||
156 | * |
||
157 | * Example: "git -C {{root}} status" |
||
158 | * |
||
159 | * The token "{{root}}" will be converted to a value via $siteAlias->get('root'). |
||
160 | * The result will replace the token. |
||
161 | * |
||
162 | * It is possible to use dot notation in the keys to access nested elements |
||
163 | * within the site alias record. |
||
164 | * |
||
165 | * @param AliasRecord $siteAlias |
||
166 | * @param type $args |
||
167 | * @return type |
||
168 | */ |
||
169 | protected function interpolate($args) |
||
182 | } |
||
183 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.