1 | <?php |
||
17 | class DeployController extends Controller |
||
18 | 2 | { |
|
19 | 2 | /** |
|
20 | * The origin of the webhook request. |
||
21 | 2 | * |
|
22 | * @var Morphatic\AutoDeploy\Origins\OriginInterface |
||
23 | */ |
||
24 | private $origin; |
||
25 | |||
26 | 2 | /** |
|
27 | * The URL of the repo to be cloned. |
||
28 | * |
||
29 | 2 | * @var string |
|
30 | */ |
||
31 | private $repo_url; |
||
32 | |||
33 | /** |
||
34 | * The absolute path of the directory on the server that contains the project. |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | private $webroot; |
||
39 | |||
40 | /** |
||
41 | * The absolute path of the directory where the new deployment will be set up. |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | private $install_dir; |
||
46 | |||
47 | /** |
||
48 | * A log of the results of the entire deploy process. |
||
49 | * |
||
50 | * @var Monolog\Logger |
||
51 | */ |
||
52 | private $log; |
||
53 | |||
54 | /** |
||
55 | * The commit ID for this commit. |
||
56 | * |
||
57 | * @var string |
||
58 | */ |
||
59 | private $commit_id; |
||
60 | |||
61 | /** |
||
62 | * The commit ID for this commit. |
||
63 | * |
||
64 | * @var AdamBrett\ShellWrapper\Runners\Exec |
||
65 | */ |
||
66 | private $shell; |
||
67 | |||
68 | /** |
||
69 | * The result of this commit. |
||
70 | * |
||
71 | * @var array |
||
72 | */ |
||
73 | private $result; |
||
74 | |||
75 | public function __construct(OriginInterface $origin, Exec $exec) |
||
85 | |||
86 | /** |
||
87 | * Handles incoming webhook requests. |
||
88 | * |
||
89 | * @param Request $request The payload from the webhook origin, e.g. Github |
||
90 | */ |
||
91 | public function index(Request $request) |
||
125 | |||
126 | /** |
||
127 | * Runs a shell command, logs, and handles the result. |
||
128 | * |
||
129 | * @param AdamBrett\ShellWrapper\CommandInterface $cmd The text of the command to be run |
||
130 | * |
||
131 | * @return bool True if the command was successful, false on error |
||
132 | */ |
||
133 | private function ex(CommandInterface $cmd) |
||
147 | |||
148 | /** |
||
149 | * Backup the database. |
||
150 | * |
||
151 | * @return bool True if the database was successfully backed up. False on error. |
||
152 | */ |
||
153 | private function backupDatabase() |
||
196 | |||
197 | /** |
||
198 | * Create a new directory parallel to the webroot and clone the project into that directory. |
||
199 | * |
||
200 | * @return bool True if the clone is successful. False otherwise. |
||
201 | */ |
||
202 | private function pull() |
||
223 | |||
224 | /** |
||
225 | * Update composer and run composer update. |
||
226 | * |
||
227 | * @return bool True if the update is successful. False otherwise. |
||
228 | */ |
||
229 | private function composer() |
||
243 | |||
244 | /** |
||
245 | * Run npm update. |
||
246 | * |
||
247 | * @return bool True if npm is successful. False otherwise. |
||
248 | */ |
||
249 | private function npm() |
||
259 | |||
260 | /** |
||
261 | * Run any necessary database migrations. |
||
262 | * |
||
263 | * @return bool True if the migration is successful. False otherwise. |
||
264 | */ |
||
265 | private function migrate() |
||
278 | |||
279 | /** |
||
280 | * Run any necessary database migrations. |
||
281 | * |
||
282 | * @return bool True if the migration is successful. False otherwise. |
||
283 | */ |
||
284 | private function seed() |
||
295 | |||
296 | /** |
||
297 | * Symlinks the new deploy directory to the webroot. |
||
298 | * |
||
299 | * @return bool True if the symlink is successful. False otherwise. |
||
300 | */ |
||
301 | private function deploy() |
||
313 | } |
||
314 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..