33namespace DivineOmega \HCLParser ;
44
55/**
6- * Class Installer
7- * @package DivineOmega\HCLParser
6+ * Class Installer.
87 */
98abstract class Installer
109{
1110 /**
12- * json2hcl Version we want to use
11+ * json2hcl Version we want to use.
12+ *
1313 * @see https://github.com/kvz/json2hcl/releases
1414 */
1515 const JSON2HCL_VERSION = '0.0.6 ' ;
1616
1717 /**
18- * Returns the correct binary filename according to the Operating System and Architecture
18+ * Returns the correct binary filename according to the Operating System and Architecture.
1919 */
2020 public static function getBinaryFilename ()
2121 {
22- # Defaults
22+ // Defaults
2323 $ osString = 'linux ' ;
2424 $ architecture = 'amd64 ' ;
2525
26- # Switch architecture if needed
26+ // Switch architecture if needed
2727 if (2147483647 == PHP_INT_MAX ) {
2828 $ architecture = '386 ' ;
2929 }
3030
31- # Switch Operating System if needed
32- switch (TRUE ) {
31+ // Switch Operating System if needed
32+ switch (true ) {
3333 case stristr (PHP_OS , 'DAR ' ):
3434 $ osString = 'darwin ' ;
3535 break ;
@@ -38,27 +38,27 @@ public static function getBinaryFilename()
3838 break ;
3939 }
4040
41- return sprintf ('json2hcl_v%s_%s_%s ' ,self ::JSON2HCL_VERSION , $ osString , $ architecture );
41+ return sprintf ('json2hcl_v%s_%s_%s ' , self ::JSON2HCL_VERSION , $ osString , $ architecture );
4242 }
4343
4444 public static function installBinaries ()
4545 {
4646 $ binaryUrls = [
47- sprintf ('https://github.com/kvz/json2hcl/releases/download/v%s/%s ' , self ::JSON2HCL_VERSION , self ::getBinaryFilename () )
47+ sprintf ('https://github.com/kvz/json2hcl/releases/download/v%s/%s ' , self ::JSON2HCL_VERSION , self ::getBinaryFilename ()),
4848 ];
4949
5050 foreach ($ binaryUrls as $ binaryUrl ) {
51- $ destination = __DIR__ . '/../bin/ ' . basename ($ binaryUrl );
51+ $ destination = __DIR__ . '/../bin/ ' . basename ($ binaryUrl );
5252
53- # Skip if file exists
53+ // Skip if file exists
5454 if (file_exists ($ destination )) {
5555 continue ;
5656 }
5757
58- # Download
58+ // Download
5959 file_put_contents ($ destination , file_get_contents ($ binaryUrl ));
6060
61- # Make executable
61+ // Make executable
6262 chmod ($ destination , 0755 );
6363 }
6464 }
0 commit comments