Conditions | 5 |
Paths | 16 |
Total Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function getProcessCommand(): string |
||
24 | { |
||
25 | $delimiter = 'EOF-LARAVEL-SERVER-MONITOR'; |
||
26 | |||
27 | $definition = $this->getDefinition(); |
||
28 | |||
29 | $portArgument = empty($this->host->port) ? '' : "-p {$this->host->port}"; |
||
30 | |||
31 | $sshCommandPrefix = config('server-monitor.ssh_command_prefix'); |
||
32 | $sshCommandSuffix = config('server-monitor.ssh_command_suffix'); |
||
33 | |||
34 | $result = 'ssh'; |
||
35 | if ($sshCommandPrefix) { |
||
36 | $result .= ' '.$sshCommandPrefix; |
||
37 | } |
||
38 | $result .= ' '.$this->getTarget(); |
||
39 | if ($portArgument) { |
||
40 | $result .= ' '.$portArgument; |
||
41 | } |
||
42 | if ($sshCommandSuffix) { |
||
43 | $result .= ' '.$sshCommandSuffix; |
||
44 | } |
||
45 | $result .= " 'bash -se <<$delimiter".PHP_EOL |
||
46 | .'set -e'.PHP_EOL |
||
47 | .$definition->command().PHP_EOL |
||
48 | .$delimiter."'"; |
||
49 | |||
50 | return $result; |
||
51 | } |
||
52 | |||
66 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: