@@ -99,7 +99,7 @@ public static function installBinary($testing = false): void
9999 {
100100 $ platform = self ::detectPlatform ($ testing );
101101
102- if (!array_key_exists ($ platform , self ::SUPPORTED_PLATFORMS )) {
102+ if (! array_key_exists ($ platform , self ::SUPPORTED_PLATFORMS )) {
103103 throw new \RuntimeException ("Platform $ platform is not supported " );
104104 }
105105
@@ -113,8 +113,8 @@ public static function installBinary($testing = false): void
113113 $ targetFile .= '.exe ' ;
114114 }
115115
116- if (!is_dir ($ binDir )) {
117- if (!mkdir ($ binDir , 0755 , true )) {
116+ if (! is_dir ($ binDir )) {
117+ if (! mkdir ($ binDir , 0755 , true )) {
118118 throw new \RuntimeException ("Failed to create directory: $ binDir " );
119119 }
120120 }
@@ -135,6 +135,7 @@ public static function installBinary($testing = false): void
135135 $ fp = fopen ($ tempFile , 'w ' );
136136 if ($ fp === false ) {
137137 curl_close ($ ch );
138+
138139 throw new \RuntimeException ("Failed to open temporary file for writing " );
139140 }
140141
@@ -145,7 +146,7 @@ public static function installBinary($testing = false): void
145146 CURLOPT_FAILONERROR => true ,
146147 CURLOPT_TIMEOUT => 300 ,
147148 CURLOPT_CONNECTTIMEOUT => 30 ,
148- CURLOPT_HTTPHEADER => ['User-Agent: volt-test-php-sdk ' ]
149+ CURLOPT_HTTPHEADER => ['User-Agent: volt-test-php-sdk ' ],
149150 ]);
150151
151152 if (curl_exec ($ ch ) === false ) {
@@ -160,15 +161,15 @@ public static function installBinary($testing = false): void
160161 curl_close ($ ch );
161162 fclose ($ fp );
162163
163- if (!file_exists ($ tempFile ) || filesize ($ tempFile ) === 0 ) {
164+ if (! file_exists ($ tempFile ) || filesize ($ tempFile ) === 0 ) {
164165 throw new \RuntimeException ("Downloaded file is empty or missing " );
165166 }
166167
167- if (!rename ($ tempFile , $ targetFile )) {
168+ if (! rename ($ tempFile , $ targetFile )) {
168169 throw new \RuntimeException ("Failed to move downloaded binary to: $ targetFile " );
169170 }
170171
171- if (!chmod ($ targetFile , 0755 )) {
172+ if (! chmod ($ targetFile , 0755 )) {
172173 throw new \RuntimeException ("Failed to set executable permissions on binary " );
173174 }
174175
@@ -179,6 +180,7 @@ public static function installBinary($testing = false): void
179180 if (file_exists ($ tempFile )) {
180181 unlink ($ tempFile );
181182 }
183+
182184 throw $ e ;
183185 }
184186 }
0 commit comments