Skip to content

Commit 78dddcc

Browse files
committed
Reformats all the code according to the project's code style.
1 parent 2642a0d commit 78dddcc

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

git-deploy

30.3 KB
Binary file not shown.

tools/src/Config.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
namespace Brunodebarros\Gitdeploy;
4+
45
use Brunodebarros\Gitdeploy\Helpers;
56

67
class Config {
@@ -42,7 +43,7 @@ public static function getArgs() {
4243
'target_commit' => isset($opts['r']) ? $opts['r'] : 'HEAD',
4344
'list_only' => isset($opts['l']),
4445
'revert' => isset($opts['revert']),
45-
'repo_path' => $repo_path
46+
'repo_path' => $repo_path,
4647
);
4748
}
4849

@@ -71,10 +72,10 @@ public static function getServers($config_file) {
7172
'clean_directories' => array(),
7273
'ignore_files' => array(),
7374
'ignore_directories' => array(),
74-
'upload_untracked' => array()
75-
), $options);
75+
'upload_untracked' => array(),
76+
), $options);
7677

77-
if (!isset($options['pass']) && ! isset($options['sftp_key'])) {
78+
if (!isset($options['pass']) && !isset($options['sftp_key'])) {
7879
$options['pass'] = self::promptPassword();
7980
}
8081

@@ -88,7 +89,7 @@ public static function getServers($config_file) {
8889
continue;
8990
} else {
9091
unset($options['skip']);
91-
$type = "Brunodebarros\\Gitdeploy\\".ucfirst(strtolower($options['scheme']));
92+
$type = "Brunodebarros\\Gitdeploy\\" . ucfirst(strtolower($options['scheme']));
9293
$return[$uri] = new $type($options, $config_file);
9394
}
9495
}
@@ -107,8 +108,8 @@ public static function promptPassword() {
107108
}
108109

109110
$command = "/usr/bin/env bash -c 'read -s -p \""
110-
. addslashes($prompt)
111-
. "\" mypassword && echo \$mypassword'";
111+
. addslashes($prompt)
112+
. "\" mypassword && echo \$mypassword'";
112113
$password = rtrim(shell_exec($command));
113114
echo "\n";
114115

tools/src/Ftp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function set_file($file, $contents, $die_if_fail = false) {
7878
$path = "";
7979

8080
for ($i = 0; $i < $dir_part_count; $i++) {
81-
$path.= $dir[$i] . '/';
81+
$path .= $dir[$i] . '/';
8282

8383
if (!isset($this->existing_paths_cache[$path])) {
8484
$origin = ftp_pwd($this->connection);

tools/src/Git.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
namespace Brunodebarros\Gitdeploy;
4+
45
use Brunodebarros\Gitdeploy\Helpers;
56

67
class Git {
@@ -50,7 +51,7 @@ public function get_changes($target_commit, $current_commit) {
5051
$return = array(
5152
'upload' => array(),
5253
'delete' => array(),
53-
'submodules' => $submodule_paths
54+
'submodules' => $submodule_paths,
5455
);
5556

5657
$command = str_replace(array("\n", "\r\n"), '', $command);
@@ -87,7 +88,7 @@ public function get_changes($target_commit, $current_commit) {
8788

8889
protected function get_file_contents($path) {
8990
$temp = tempnam(sys_get_temp_dir(), "git-deploy-");
90-
$this->exec('show "'.$path.'"', "> \"$temp\"");
91+
$this->exec('show "' . $path . '"', "> \"$temp\"");
9192
return file_get_contents($temp);
9293
}
9394

tools/src/Server.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
namespace Brunodebarros\Gitdeploy;
4+
45
use Brunodebarros\Gitdeploy\Helpers;
56

67
abstract class Server {
@@ -19,8 +20,8 @@ public function __construct($server, $deploy_script = 'deploy.ini') {
1920
$this->server = $server;
2021
$this->clean_directories = $server['clean_directories'];
2122
$this->ignore_files = array_merge(array(
22-
'.gitignore', '.gitattributes', '.gitmodules', 'deploy.ini', 'git-deploy', $deploy_script
23-
), $server['ignore_files']);
23+
'.gitignore', '.gitattributes', '.gitmodules', 'deploy.ini', 'git-deploy', $deploy_script,
24+
), $server['ignore_files']);
2425
$this->ignore_directories = $server['ignore_directories'];
2526
$this->upload_untracked = $server['upload_untracked'];
2627
$this->host = "{$server['scheme']}://{$server['user']}@{$server['host']}:{$server['port']}{$server['path']}";
@@ -85,7 +86,7 @@ public function deploy(Git $git, $target_commit, $is_revert = false, $list_only
8586

8687
$submodule_meta[$submodule] = array(
8788
'target_subcommit' => $target_subcommit,
88-
'current_subcommit' => $current_subcommit
89+
'current_subcommit' => $current_subcommit,
8990
);
9091

9192
foreach ($subchanges['upload'] as $file => $contents) {
@@ -164,10 +165,11 @@ protected function set_current_commit($target_commit, $list_only = false) {
164165
}
165166

166167
if (isset($this->server['maintenance_file'])) {
167-
if (isset($this->server['maintenance_off_value']))
168+
if (isset($this->server['maintenance_off_value'])) {
168169
$this->set_file($this->server['maintenance_file'], $this->server['maintenance_off_value']);
169-
else
170+
} else {
170171
$this->unset_file($this->server['maintenance_file']);
172+
}
171173
Helpers::logmessage("Turned maintenance mode off.");
172174
}
173175

tools/src/Sftp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function connect($test = false) {
1717

1818
if (isset($server['sftp_key'])) {
1919
$key = new \phpseclib\Crypt\RSA();
20-
if (isset($server['pass']) && ! empty($server['pass'])) {
20+
if (isset($server['pass']) && !empty($server['pass'])) {
2121
$key->setPassword($server['pass']);
2222
}
2323
$key->loadKey(file_get_contents($server['sftp_key']));
@@ -78,7 +78,7 @@ public function set_file($file, $contents) {
7878
$path = "";
7979

8080
for ($i = 0; $i < $dir_part_count; $i++) {
81-
$path.= $dir[$i] . '/';
81+
$path .= $dir[$i] . '/';
8282

8383
if (!isset($this->existing_paths_cache[$path])) {
8484
$origin = $this->connection->pwd();

0 commit comments

Comments
 (0)