| @@ -62,7 +62,7 @@ | ||
| 62 | 62 | |
| 63 | 63 | $process->setTimeout(null); | 
| 64 | 64 | |
| 65 | -        $process = $process->mustRun(function ($type, $buffer) { | |
| 65 | +        $process = $process->mustRun(function($type, $buffer) { | |
| 66 | 66 |              if (Process::ERR === $type) { | 
| 67 | 67 | $this->logger->log(Str::prefix(rtrim($buffer, PHP_EOL), '| <stream>err ::</> ')); | 
| 68 | 68 |              } else { | 
| @@ -237,8 +237,8 @@ discard block | ||
| 237 | 237 | // the $paths can be glob() patterns, so this method needs to resolve them | 
| 238 | 238 | public function controllersToRemove(array $paths) : self | 
| 239 | 239 |      { | 
| 240 | -        $absoluteGlobPaths = array_map(function ($globPath) { | |
| 241 | - return $this->localProjectDir.DIRECTORY_SEPARATOR.$globPath; | |
| 240 | +        $absoluteGlobPaths = array_map(function($globPath) { | |
| 241 | + return $this->localProjectDir . DIRECTORY_SEPARATOR . $globPath; | |
| 242 | 242 | }, $paths); | 
| 243 | 243 | |
| 244 | 244 | $localAbsolutePaths = []; | 
| @@ -246,7 +246,7 @@ discard block | ||
| 246 | 246 | $localAbsolutePaths = array_merge($localAbsolutePaths, glob($path)); | 
| 247 | 247 | } | 
| 248 | 248 | |
| 249 | -        $localRelativePaths = array_map(function ($absolutePath) { | |
| 249 | +        $localRelativePaths = array_map(function($absolutePath) { | |
| 250 | 250 | $relativePath = str_replace($this->localProjectDir, '', $absolutePath); | 
| 251 | 251 | $this->validatePathIsRelativeToProject($relativePath, 'controllersToRemove'); | 
| 252 | 252 | |
| @@ -309,7 +309,7 @@ discard block | ||
| 309 | 309 | |
| 310 | 310 |          foreach ($paths as $path) { | 
| 311 | 311 | $this->validatePathIsRelativeToProject($path, __METHOD__); | 
| 312 | -            if (is_dir($this->localProjectDir.DIRECTORY_SEPARATOR.$path)) { | |
| 312 | +            if (is_dir($this->localProjectDir . DIRECTORY_SEPARATOR . $path)) { | |
| 313 | 313 | $this->sharedDirs[] = rtrim($path, DIRECTORY_SEPARATOR); | 
| 314 | 314 |              } else { | 
| 315 | 315 | $this->sharedFiles[] = $path; | 
| @@ -356,7 +356,7 @@ discard block | ||
| 356 | 356 | |
| 357 | 357 | private function validatePathIsRelativeToProject($path, $methodName) : void | 
| 358 | 358 |      { | 
| 359 | -        if (!is_readable($this->localProjectDir.DIRECTORY_SEPARATOR.$path)) { | |
| 359 | +        if (!is_readable($this->localProjectDir . DIRECTORY_SEPARATOR . $path)) { | |
| 360 | 360 |              throw new InvalidConfigurationException(sprintf('The "%s" value given in %s() is not relative to the project root directory or is not readable.', $path, $methodName)); | 
| 361 | 361 | } | 
| 362 | 362 | } | 
| @@ -62,7 +62,7 @@ | ||
| 62 | 62 | private function writeToLogFile(string $message) : void | 
| 63 | 63 |      { | 
| 64 | 64 | $loggedMessage = $this->processLogMessageForFile($message); | 
| 65 | - file_put_contents($this->logFilePath, $loggedMessage.PHP_EOL, FILE_APPEND); | |
| 65 | + file_put_contents($this->logFilePath, $loggedMessage . PHP_EOL, FILE_APPEND); | |
| 66 | 66 | } | 
| 67 | 67 | |
| 68 | 68 | private function processLogMessageForFile(string $message) : string | 
| @@ -29,8 +29,8 @@ discard block | ||
| 29 | 29 |      { | 
| 30 | 30 | $text = is_array($text) ? $text : explode(PHP_EOL, $text); | 
| 31 | 31 | |
| 32 | -        return implode(PHP_EOL, array_map(function ($line) use ($prefix) { | |
| 33 | - return $prefix.$line; | |
| 32 | +        return implode(PHP_EOL, array_map(function($line) use ($prefix) { | |
| 33 | + return $prefix . $line; | |
| 34 | 34 | }, $text)); | 
| 35 | 35 | } | 
| 36 | 36 | |
| @@ -52,7 +52,7 @@ discard block | ||
| 52 | 52 | return json_encode($value, JSON_UNESCAPED_SLASHES); | 
| 53 | 53 | } | 
| 54 | 54 | |
| 55 | - return (string) $value; | |
| 55 | + return (string)$value; | |
| 56 | 56 | } | 
| 57 | 57 | |
| 58 | 58 | public static function formatAsTable(array $data, bool $sortKeys = true) : string | 
| @@ -9,7 +9,7 @@ | ||
| 9 | 9 | class ArtisanDeployerProvider extends ServiceProvider | 
| 10 | 10 |  { | 
| 11 | 11 | |
| 12 | -    public function register(){ | |
| 12 | +    public function register() { | |
| 13 | 13 | $this->commands([ | 
| 14 | 14 | DeployCommand::class, | 
| 15 | 15 | RollbackCommand::class | 
| @@ -346,7 +346,7 @@ discard block | ||
| 346 | 346 |      { | 
| 347 | 347 |          $this->log('<h2>Clearing controllers</>'); | 
| 348 | 348 |          foreach ($this->getServers()->findByRoles([Server::ROLE_APP]) as $server) { | 
| 349 | -            $absolutePaths = array_map(function ($relativePath) use ($server) { | |
| 349 | +            $absolutePaths = array_map(function($relativePath) use ($server) { | |
| 350 | 350 |                  return $server->resolveProperties(sprintf('{{ project_dir }}/%s', $relativePath)); | 
| 351 | 351 | }, $this->getConfig(Option::controllersToRemove)); | 
| 352 | 352 | |
| @@ -408,7 +408,7 @@ discard block | ||
| 408 | 408 | } | 
| 409 | 409 | |
| 410 | 410 | $relativeDirsToRemove = array_slice($releaseDirs, 0, -$this->getConfig(Option::keepReleases)); | 
| 411 | -        $absoluteDirsToRemove = array_map(function ($v) { | |
| 411 | +        $absoluteDirsToRemove = array_map(function($v) { | |
| 412 | 412 |              return sprintf('%s/releases/%s', $this->getConfig(Option::deployDir), $v); | 
| 413 | 413 | }, $relativeDirsToRemove); | 
| 414 | 414 | |
| @@ -274,7 +274,9 @@ | ||
| 274 | 274 | private function doCreateSharedFiles() : void | 
| 275 | 275 |      { | 
| 276 | 276 |          $this->log('<h2>Creating symlinks for shared files</>'); | 
| 277 | - if (!is_array($this->getConfig(Option::sharedFiles))) return; | |
| 277 | +        if (!is_array($this->getConfig(Option::sharedFiles))) { | |
| 278 | + return; | |
| 279 | + } | |
| 278 | 280 | |
| 279 | 281 |          foreach ($this->getConfig(Option::sharedFiles) as $sharedFile) { | 
| 280 | 282 | $sharedFileParentDir = dirname($sharedFile); | 
| @@ -29,7 +29,7 @@ | ||
| 29 | 29 | */ | 
| 30 | 30 | public function findByRoles(array $roles) : array | 
| 31 | 31 |      { | 
| 32 | -        return array_filter($this->servers, function (Server $server) use ($roles) { | |
| 32 | +        return array_filter($this->servers, function(Server $server) use ($roles) { | |
| 33 | 33 | return !empty(array_intersect($roles, $server->getRoles())); | 
| 34 | 34 | }); | 
| 35 | 35 | } | 
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 | $this->properties = new ParameterBag($properties); | 
| 24 | 24 | |
| 25 | 25 | // add the 'ssh://' scheme so the URL parsing works as expected | 
| 26 | - $params = parse_url(Str::startsWith($dsn, 'ssh://') ? $dsn : 'ssh://'.$dsn); | |
| 26 | + $params = parse_url(Str::startsWith($dsn, 'ssh://') ? $dsn : 'ssh://' . $dsn); | |
| 27 | 27 | |
| 28 | 28 | $this->user = $params['user'] ?? null; | 
| 29 | 29 | |
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 | |
| 38 | 38 | public function __toString() : string | 
| 39 | 39 |      { | 
| 40 | -        return sprintf('%s%s', $this->getUser() ? $this->getUser().'@' : '', $this->getHost()); | |
| 40 | +        return sprintf('%s%s', $this->getUser() ? $this->getUser() . '@' : '', $this->getHost()); | |
| 41 | 41 | } | 
| 42 | 42 | |
| 43 | 43 | public function isLocalHost() : bool | 
| @@ -48,7 +48,7 @@ discard block | ||
| 48 | 48 | public function resolveProperties(string $expression) : string | 
| 49 | 49 |      { | 
| 50 | 50 | $definedProperties = $this->properties; | 
| 51 | -        $resolved = preg_replace_callback('/(\{\{\s*(?<propertyName>.+)\s*\}\})/U', function (array $matches) use ($definedProperties, $expression) { | |
| 51 | +        $resolved = preg_replace_callback('/(\{\{\s*(?<propertyName>.+)\s*\}\})/U', function(array $matches) use ($definedProperties, $expression) { | |
| 52 | 52 | $propertyName = trim($matches['propertyName']); | 
| 53 | 53 |              if (!$definedProperties->has($propertyName)) { | 
| 54 | 54 |                  throw new \InvalidArgumentException(sprintf('The "%s" property in "%s" expression is not a valid server property.', $propertyName, $expression)); | 
| @@ -89,8 +89,8 @@ discard block | ||
| 89 | 89 |          return sprintf('ssh %s%s%s%s', | 
| 90 | 90 |              $this->properties->get('use_ssh_agent_forwarding') ? '-A ' : '', | 
| 91 | 91 | $this->user ?? '', | 
| 92 | - $this->user ? '@'.$this->host : $this->host, | |
| 93 | - $this->port ? ' -p '.$this->port : '' | |
| 92 | + $this->user ? '@' . $this->host : $this->host, | |
| 93 | + $this->port ? ' -p ' . $this->port : '' | |
| 94 | 94 | ); | 
| 95 | 95 | } | 
| 96 | 96 | |