@@ -34,15 +34,15 @@ |
||
| 34 | 34 | protected $comodojo_configuration_persistence; |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * {@inheritDoc} |
|
| 38 | - */ |
|
| 37 | + * {@inheritDoc} |
|
| 38 | + */ |
|
| 39 | 39 | public function deactivate(Composer $composer, IOInterface $io){ |
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * {@inheritDoc} |
|
| 45 | - */ |
|
| 44 | + * {@inheritDoc} |
|
| 45 | + */ |
|
| 46 | 46 | public function uninstall(Composer $composer, IOInterface $io){ |
| 47 | 47 | |
| 48 | 48 | } |
@@ -29,9 +29,13 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $name = $this->getParameters()->get('config-file'); |
| 31 | 31 | |
| 32 | - if ( $name === null ) throw new InstallerException("No config-file name specified"); |
|
| 32 | + if ( $name === null ) { |
|
| 33 | + throw new InstallerException("No config-file name specified"); |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | - if ( file_exists($name) && is_readable($name) ) return json_decode(file_get_contents($name), true); |
|
| 36 | + if ( file_exists($name) && is_readable($name) ) { |
|
| 37 | + return json_decode(file_get_contents($name), true); |
|
| 38 | + } |
|
| 35 | 39 | |
| 36 | 40 | return []; |
| 37 | 41 | |
@@ -44,14 +48,18 @@ discard block |
||
| 44 | 48 | |
| 45 | 49 | $name = $this->getParameters()->get('config-file'); |
| 46 | 50 | |
| 47 | - if ( $name === null ) throw new InstallerException("No config-file name specified"); |
|
| 51 | + if ( $name === null ) { |
|
| 52 | + throw new InstallerException("No config-file name specified"); |
|
| 53 | + } |
|
| 48 | 54 | |
| 49 | 55 | $filedata = json_encode($data); |
| 50 | 56 | |
| 51 | 57 | if ( |
| 52 | 58 | ( file_exists($name) && is_writable($name) ) || |
| 53 | 59 | is_writeable(pathinfo($name, PATHINFO_DIRNAME)) |
| 54 | - ) return file_put_contents($name, $filedata, LOCK_EX); |
|
| 60 | + ) { |
|
| 61 | + return file_put_contents($name, $filedata, LOCK_EX); |
|
| 62 | + } |
|
| 55 | 63 | |
| 56 | 64 | throw new InstallerException("Cannot write to configuration file $name"); |
| 57 | 65 | |
@@ -39,9 +39,13 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $name = $this->getParameters()->get('config-file'); |
| 41 | 41 | |
| 42 | - if ( $name === null ) throw new InstallerException("No config-file name specified"); |
|
| 42 | + if ( $name === null ) { |
|
| 43 | + throw new InstallerException("No config-file name specified"); |
|
| 44 | + } |
|
| 43 | 45 | |
| 44 | - if ( file_exists($name) && is_readable($name) ) return Yaml::parse(file_get_contents($name)); |
|
| 46 | + if ( file_exists($name) && is_readable($name) ) { |
|
| 47 | + return Yaml::parse(file_get_contents($name)); |
|
| 48 | + } |
|
| 45 | 49 | |
| 46 | 50 | return []; |
| 47 | 51 | |
@@ -54,7 +58,9 @@ discard block |
||
| 54 | 58 | |
| 55 | 59 | $name = $this->getParameters()->get('config-file'); |
| 56 | 60 | |
| 57 | - if ( $name === null ) throw new InstallerException("No config-file name specified"); |
|
| 61 | + if ( $name === null ) { |
|
| 62 | + throw new InstallerException("No config-file name specified"); |
|
| 63 | + } |
|
| 58 | 64 | |
| 59 | 65 | $config_depth = $this->getParameters()->get('depth'); |
| 60 | 66 | |
@@ -65,7 +71,9 @@ discard block |
||
| 65 | 71 | if ( |
| 66 | 72 | ( file_exists($name) && is_writable($name) ) || |
| 67 | 73 | is_writeable(pathinfo($name, PATHINFO_DIRNAME)) |
| 68 | - ) return file_put_contents($name, $filedata, LOCK_EX); |
|
| 74 | + ) { |
|
| 75 | + return file_put_contents($name, $filedata, LOCK_EX); |
|
| 76 | + } |
|
| 69 | 77 | |
| 70 | 78 | throw new InstallerException("Cannot write to configuration file $name"); |
| 71 | 79 | |
@@ -46,8 +46,12 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function __construct($name, array $content) { |
| 48 | 48 | |
| 49 | - if ( empty($content['driver']) ) throw new InstallerException("Missing driver for field $name"); |
|
| 50 | - if ( empty($content['persistence']) ) throw new InstallerException("Missing persistence for field $name"); |
|
| 49 | + if ( empty($content['driver']) ) { |
|
| 50 | + throw new InstallerException("Missing driver for field $name"); |
|
| 51 | + } |
|
| 52 | + if ( empty($content['persistence']) ) { |
|
| 53 | + throw new InstallerException("Missing persistence for field $name"); |
|
| 54 | + } |
|
| 51 | 55 | |
| 52 | 56 | $this->properties = [ |
| 53 | 57 | "driver" => $content['driver'], |
@@ -56,8 +60,12 @@ discard block |
||
| 56 | 60 | "persistence-source" => null |
| 57 | 61 | ]; |
| 58 | 62 | |
| 59 | - if ( !empty($content['driver-source']) ) $this->properties['driver-source'] = $content['driver-source']; |
|
| 60 | - if ( !empty($content['persistence-source']) ) $this->properties['persistence-source'] = $content['persistence-source']; |
|
| 63 | + if ( !empty($content['driver-source']) ) { |
|
| 64 | + $this->properties['driver-source'] = $content['driver-source']; |
|
| 65 | + } |
|
| 66 | + if ( !empty($content['persistence-source']) ) { |
|
| 67 | + $this->properties['persistence-source'] = $content['persistence-source']; |
|
| 68 | + } |
|
| 61 | 69 | |
| 62 | 70 | $parameters = isset($content['params']) && is_array($content['params']) ? $content['params'] : [] ; |
| 63 | 71 | |
@@ -57,7 +57,9 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function __construct(array $parameters = []) { |
| 59 | 59 | |
| 60 | - if ( isset($parameters['package-types']) ) $this->package_types = $parameters['package-types']; |
|
| 60 | + if ( isset($parameters['package-types']) ) { |
|
| 61 | + $this->package_types = $parameters['package-types']; |
|
| 62 | + } |
|
| 61 | 63 | |
| 62 | 64 | $this->global_config = new InstallerConfigurationGlobalParser($parameters); |
| 63 | 65 | |
@@ -67,7 +69,9 @@ discard block |
||
| 67 | 69 | } |
| 68 | 70 | } |
| 69 | 71 | |
| 70 | - if ( isset($parameters['post-installer-script']) ) $this->post_install_script = $parameters['post-installer-script']; |
|
| 72 | + if ( isset($parameters['post-installer-script']) ) { |
|
| 73 | + $this->post_install_script = $parameters['post-installer-script']; |
|
| 74 | + } |
|
| 71 | 75 | |
| 72 | 76 | } |
| 73 | 77 | |