1 | <?php |
||
17 | class DeployController extends Controller |
||
18 | { |
||
19 | /** |
||
20 | * The origin of the webhook request. |
||
21 | * |
||
22 | * @var Morphatic\AutoDeploy\Origins\OriginInterface |
||
23 | */ |
||
24 | private $origin; |
||
25 | |||
26 | /** |
||
27 | * The URL of the repo to be cloned. |
||
28 | * |
||
29 | * @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 | /** |
||
76 | * Create a new DeployController instance. |
||
77 | * |
||
78 | * @param Morphatic\AutoDeploy\Origins\OriginInterface $origin The origin of the webhook |
||
1 ignored issue
–
show
|
|||
79 | * @param AdamBrett\ShellWrapper\Runners\Exec $exec The shell command execution class |
||
1 ignored issue
–
show
|
|||
80 | */ |
||
81 | 36 | public function __construct(OriginInterface $origin, Exec $exec) |
|
91 | |||
92 | /** |
||
93 | * Handles incoming webhook requests. |
||
94 | */ |
||
95 | 12 | public function index() |
|
130 | |||
131 | /** |
||
132 | * Runs a shell command, logs, and handles the result. |
||
133 | * |
||
134 | * @param AdamBrett\ShellWrapper\CommandInterface $cmd The text of the command to be run |
||
1 ignored issue
–
show
|
|||
135 | * |
||
136 | * @return bool True if the command was successful, false on error |
||
137 | */ |
||
138 | 12 | private function ex(CommandInterface $cmd) |
|
152 | |||
153 | /** |
||
154 | * Backup the database. |
||
155 | * |
||
156 | * @return bool True if the database was successfully backed up. False on error. |
||
157 | */ |
||
158 | 12 | private function backupDatabase() |
|
201 | |||
202 | /** |
||
203 | * Create a new directory parallel to the webroot and clone the project into that directory. |
||
204 | * |
||
205 | * @return bool True if the clone is successful. False otherwise. |
||
206 | */ |
||
207 | 10 | private function pull() |
|
228 | |||
229 | /** |
||
230 | * Update composer and run composer update. |
||
231 | * |
||
232 | * @return bool True if the update is successful. False otherwise. |
||
233 | */ |
||
234 | 8 | private function composer() |
|
248 | |||
249 | /** |
||
250 | * Run npm update. |
||
251 | * |
||
252 | * @return bool True if npm is successful. False otherwise. |
||
253 | */ |
||
254 | 8 | private function npm() |
|
264 | |||
265 | /** |
||
266 | * Run any necessary database migrations. |
||
267 | * |
||
268 | * @return bool True if the migration is successful. False otherwise. |
||
269 | */ |
||
270 | 8 | private function migrate() |
|
283 | |||
284 | /** |
||
285 | * Run any necessary database migrations. |
||
286 | * |
||
287 | * @return bool True if the migration is successful. False otherwise. |
||
288 | */ |
||
289 | 8 | private function seed() |
|
300 | |||
301 | /** |
||
302 | * Symlinks the new deploy directory to the webroot. |
||
303 | * |
||
304 | * @return bool True if the symlink is successful. False otherwise. |
||
305 | */ |
||
306 | 8 | private function deploy() |
|
318 | } |
||
319 |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.