Completed
Pull Request — master (#615)
by
unknown
02:51
created
src/SelfUpdateCommand.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -29,6 +29,10 @@
 block discarded – undo
29 29
 
30 30
     protected $currentVersion;
31 31
 
32
+    /**
33
+     * @param string $name
34
+     * @param string $gitHubRepository
35
+     */
32 36
     public function __construct( $name = null, $currentVersion = null, $gitHubRepository = null) {
33 37
         parent::__construct( $name );
34 38
         $this->currentVersion = $currentVersion;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 
30 30
     protected $currentVersion;
31 31
 
32
-    public function __construct( $name = null, $currentVersion = null, $gitHubRepository = null) {
33
-        parent::__construct( $name );
32
+    public function __construct($name = null, $currentVersion = null, $gitHubRepository = null) {
33
+        parent::__construct($name);
34 34
         $this->currentVersion = $currentVersion;
35 35
         $this->gitHubRepository = $gitHubRepository;
36 36
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $this
45 45
             ->setName('self-update')
46
-            ->setAliases(array( 'selfupdate' ))
46
+            ->setAliases(array('selfupdate'))
47 47
             ->setDescription('Updates the robo.phar to the latest version.')
48 48
             ->setHelp(
49 49
                 <<<EOT
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
         $releases = file_get_contents('https://api.github.com/repos/' . $this->gitHubRepository . '/releases', false, $context);
70 70
         $releases = json_decode($releases);
71 71
 
72
-        if (! isset($releases[0])) {
72
+        if (!isset($releases[0])) {
73 73
             throw new \Exception('API error - no release found at GitHub repository ' . $this->gitHubRepository);
74 74
         }
75 75
 
76 76
         $version = $releases[0]->tag_name;
77 77
         $url     = $releases[0]->assets[0]->browser_download_url;
78 78
 
79
-        return [ $version, $url ];
79
+        return [$version, $url];
80 80
     }
81 81
 
82 82
     public function isEnabled() {
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
         $tempFilename  = dirname($localFilename) . '/' . basename($localFilename, '.phar') . '-temp.phar';
96 96
 
97 97
         // check for permissions in local filesystem before start connection process
98
-        if (! is_writable($tempDirectory = dirname($tempFilename))) {
98
+        if (!is_writable($tempDirectory = dirname($tempFilename))) {
99 99
             throw new \Exception(
100 100
                 $programName . ' update failed: the "' . $tempDirectory .
101 101
                 '" directory used to download the temp file could not be written'
102 102
             );
103 103
         }
104 104
 
105
-        if (! is_writable($localFilename)) {
105
+        if (!is_writable($localFilename)) {
106 106
             throw new \Exception(
107 107
                 $programName . ' update failed: the "' . $localFilename . '" file could not be written (execute with sudo)'
108 108
             );
109 109
         }
110 110
 
111
-        list( $latest, $downloadUrl ) = $this->getLatestReleaseFromGithub();
111
+        list($latest, $downloadUrl) = $this->getLatestReleaseFromGithub();
112 112
 
113 113
 
114 114
         if ($this->currentVersion == $latest) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             $this->_exit();
138 138
         } catch (\Exception $e) {
139 139
             @unlink($tempFilename);
140
-            if (! $e instanceof \UnexpectedValueException && ! $e instanceof \PharException) {
140
+            if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
141 141
                 throw $e;
142 142
             }
143 143
             $output->writeln('<error>The download is corrupted (' . $e->getMessage() . ').</error>');
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $createRoboFile = new Command('init');
42 42
         $createRoboFile->setDescription("Intitalizes basic RoboFile in current dir");
43
-        $createRoboFile->setCode(function () use ($roboClass, $roboFile) {
43
+        $createRoboFile->setCode(function() use ($roboClass, $roboFile) {
44 44
             $output = Robo::output();
45 45
             $output->writeln("<comment>  ~~~ Welcome to Robo! ~~~~ </comment>");
46
-            $output->writeln("<comment>  ". basename($roboFile) ." will be created in the current directory </comment>");
46
+            $output->writeln("<comment>  " . basename($roboFile) . " will be created in the current directory </comment>");
47 47
             file_put_contents(
48 48
                 $roboFile,
49 49
                 '<?php'
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     }
61 61
 
62 62
     protected function addSelfUpdateCommand() {
63
-        $selfUpdateCommand = new SelfUpdateCommand( 'self:update', Robo::VERSION, 'consolidation/robo' );
64
-        $this->add( $selfUpdateCommand );
63
+        $selfUpdateCommand = new SelfUpdateCommand('self:update', Robo::VERSION, 'consolidation/robo');
64
+        $this->add($selfUpdateCommand);
65 65
     }
66 66
 }
Please login to merge, or discard this patch.