@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | */ |
29 | 29 | private $objGitHub; |
30 | 30 | |
31 | - public function __construct ( $version = null ) |
|
31 | + public function __construct($version = null) |
|
32 | 32 | { |
33 | - $this->objGitHub = GitHub::getInstance (); |
|
34 | - if ( is_null ( $version ) ) |
|
33 | + $this->objGitHub = GitHub::getInstance(); |
|
34 | + if (is_null($version)) |
|
35 | 35 | { |
36 | - $version = $this->objGitHub->getLastVersion (); |
|
36 | + $version = $this->objGitHub->getLastVersion(); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $this->versionUpdate = $version; |
@@ -44,58 +44,58 @@ discard block |
||
44 | 44 | |
45 | 45 | } |
46 | 46 | |
47 | - public function update () |
|
47 | + public function update() |
|
48 | 48 | { |
49 | - if ( Version::HasNewVersion () && ! Version::equalVersion ( $this->versionUpdate ) |
|
49 | + if (Version::HasNewVersion() && ! Version::equalVersion($this->versionUpdate) |
|
50 | 50 | ) |
51 | 51 | { |
52 | - $content = $this->objGitHub->getContent ( $this->objGitHub->getLastPhar () , true ); |
|
53 | - if ( $content ) |
|
52 | + $content = $this->objGitHub->getContent($this->objGitHub->getLastPhar(), true); |
|
53 | + if ($content) |
|
54 | 54 | { |
55 | - $this->objGitHub->putContent ( $this->tempFileName , $content ); |
|
55 | + $this->objGitHub->putContent($this->tempFileName, $content); |
|
56 | 56 | } |
57 | 57 | } else |
58 | 58 | { |
59 | - throw new \Exception ( "\033[0;31mError: Esta versão é a atual\033[0m\n" ); |
|
59 | + throw new \Exception("\033[0;31mError: Esta versão é a atual\033[0m\n"); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $this; |
63 | 63 | } |
64 | 64 | |
65 | - public function downloadVersion ( $version ) |
|
65 | + public function downloadVersion($version) |
|
66 | 66 | { |
67 | - if ( Version::existVersion ( $version ) && ! Version::equalVersion ( $version ) ) |
|
67 | + if (Version::existVersion($version) && ! Version::equalVersion($version)) |
|
68 | 68 | { |
69 | - $content = $this->objGitHub->getContent ( $this->objGitHub->getPharByVersion ( $version ) , true ); |
|
69 | + $content = $this->objGitHub->getContent($this->objGitHub->getPharByVersion($version), true); |
|
70 | 70 | |
71 | - if ( $content ) |
|
71 | + if ($content) |
|
72 | 72 | { |
73 | - $this->objGitHub->putContent ( $this->tempFileName , $content ); |
|
73 | + $this->objGitHub->putContent($this->tempFileName, $content); |
|
74 | 74 | } |
75 | 75 | } else |
76 | 76 | { |
77 | - if ( ! Version::existVersion ( $version ) ) |
|
77 | + if ( ! Version::existVersion($version)) |
|
78 | 78 | { |
79 | - throw new \Exception ( "\033[0;31mError: Esta versão não existe\033[0m\n" ); |
|
79 | + throw new \Exception("\033[0;31mError: Esta versão não existe\033[0m\n"); |
|
80 | 80 | } |
81 | - throw new \Exception ( "\033[0;31mError: Esta versão é a atual\033[0m\n" ); |
|
81 | + throw new \Exception("\033[0;31mError: Esta versão é a atual\033[0m\n"); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $this; |
85 | 85 | } |
86 | 86 | |
87 | - public function modifyTempName () |
|
87 | + public function modifyTempName() |
|
88 | 88 | { |
89 | - if ( file_exists ( realpath ( $this->tempFileName ) ) ) |
|
89 | + if (file_exists(realpath($this->tempFileName))) |
|
90 | 90 | { |
91 | - $fileName = realpath ( self::$fileName . self::$extencion ); |
|
92 | - if ( file_exists ( $fileName ) ) |
|
91 | + $fileName = realpath(self::$fileName . self::$extencion); |
|
92 | + if (file_exists($fileName)) |
|
93 | 93 | { |
94 | - unlink ( $fileName ); |
|
94 | + unlink($fileName); |
|
95 | 95 | } |
96 | 96 | |
97 | - chmod ( $this->tempFileName , 0777 ); |
|
98 | - rename ( $this->tempFileName , self::$fileName . self::$extencion ); |
|
97 | + chmod($this->tempFileName, 0777); |
|
98 | + rename($this->tempFileName, self::$fileName . self::$extencion); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 |