@@ -66,7 +66,7 @@ |
||
| 66 | 66 | } catch (\Exception $e) { |
| 67 | 67 | throw new ServiceUnavailableHttpException( |
| 68 | 68 | null, |
| 69 | - 'Could not resolve host: '.$this->baseUri, |
|
| 69 | + 'Could not resolve host: ' . $this->baseUri, |
|
| 70 | 70 | $e, |
| 71 | 71 | $e->getCode() |
| 72 | 72 | ); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $this->container = $container; |
| 36 | 36 | $config = $this->processConfiguration(new Configuration(), $configs); |
| 37 | - $loader = new Loader\YamlFileLoader($this->container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 37 | + $loader = new Loader\YamlFileLoader($this->container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 38 | 38 | $loader->load('services.yml'); |
| 39 | 39 | |
| 40 | 40 | $this->checkAndSetSupportedClass($config); |
@@ -45,24 +45,24 @@ discard block |
||
| 45 | 45 | $clientConfig[$key] = $config['client'][$key]; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $this->container->setParameter($this->getAlias().'.client', $clientConfig); |
|
| 48 | + $this->container->setParameter($this->getAlias() . '.client', $clientConfig); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $options = array(); |
| 52 | - if ($this->container->hasParameter($this->getAlias().'.client.options')) { |
|
| 53 | - $options = $this->container->getParameter($this->getAlias().'.client.options'); |
|
| 52 | + if ($this->container->hasParameter($this->getAlias() . '.client.options')) { |
|
| 53 | + $options = $this->container->getParameter($this->getAlias() . '.client.options'); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - $this->container->setParameter($this->getAlias().'.client.options', $options); |
|
| 56 | + $this->container->setParameter($this->getAlias() . '.client.options', $options); |
|
| 57 | 57 | |
| 58 | 58 | if (!empty($config['version_class'])) { |
| 59 | - $this->container->setParameter($this->getAlias().'.version_class', $config['version_class']); |
|
| 59 | + $this->container->setParameter($this->getAlias() . '.version_class', $config['version_class']); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | $this->setDirectories($config); |
| 63 | 63 | |
| 64 | 64 | if (true === $config['monolog_channel']) { |
| 65 | - $this->container->setParameter($this->getAlias().'.monolog_channel', true); |
|
| 65 | + $this->container->setParameter($this->getAlias() . '.monolog_channel', true); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | foreach (array('temp_dir', 'target_dir') as $value) { |
| 91 | 91 | if ($this->isDefault($config[$value])) { |
| 92 | 92 | $this->container->setParameter( |
| 93 | - $this->getAlias().'.'.$value, |
|
| 93 | + $this->getAlias() . '.' . $value, |
|
| 94 | 94 | $this->checkDirType($value) |
| 95 | 95 | ); |
| 96 | 96 | } else { |
| 97 | 97 | $this->container->setParameter( |
| 98 | - $this->getAlias().'.'.$value, |
|
| 98 | + $this->getAlias() . '.' . $value, |
|
| 99 | 99 | $this->checkNotDefaultDirType($value, $config[$value]) |
| 100 | 100 | ); |
| 101 | 101 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | return $this->container->getParameter('kernel.cache_dir'); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - return $this->container->getParameter('kernel.root_dir').'/../'; |
|
| 111 | + return $this->container->getParameter('kernel.root_dir') . '/../'; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | private function checkNotDefaultDirType($dir, $configDir) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return $configDir; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - return $this->container->getParameter('kernel.root_dir').'/'.$configDir; |
|
| 120 | + return $this->container->getParameter('kernel.root_dir') . '/' . $configDir; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | private function isDefault($dir) |
@@ -132,17 +132,17 @@ discard block |
||
| 132 | 132 | protected function copyRemoteFile($fromUrl, $name) |
| 133 | 133 | { |
| 134 | 134 | try { |
| 135 | - $filePath = $this->tempDir.'/'.$name.'.zip'; |
|
| 135 | + $filePath = $this->tempDir . '/' . $name . '.zip'; |
|
| 136 | 136 | if (!file_exists($filePath)) { |
| 137 | 137 | $this->client->saveFile($fromUrl, $filePath); |
| 138 | 138 | |
| 139 | - $this->addLogInfo('Successfully downloaded update file: '.$filePath); |
|
| 139 | + $this->addLogInfo('Successfully downloaded update file: ' . $filePath); |
|
| 140 | 140 | |
| 141 | 141 | return true; |
| 142 | 142 | } |
| 143 | 143 | } catch (\Exception $e) { |
| 144 | 144 | throw new NotFoundHttpException( |
| 145 | - 'Could not find file at the specified path: '.$fromUrl, |
|
| 145 | + 'Could not find file at the specified path: ' . $fromUrl, |
|
| 146 | 146 | $e, |
| 147 | 147 | $e->getCode() |
| 148 | 148 | ); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | protected function sortPackagesByVersion(array $array = array()) |
| 159 | 159 | { |
| 160 | - usort($array, function ($first, $second) { |
|
| 160 | + usort($array, function($first, $second) { |
|
| 161 | 161 | if ($first instanceof UpdatePackage && $second instanceof UpdatePackage) { |
| 162 | 162 | return version::compare($first->getVersion(), $second->getVersion()); |
| 163 | 163 | } |
@@ -180,8 +180,8 @@ |
||
| 180 | 180 | { |
| 181 | 181 | $sortedVersions = $this->sortPackagesByVersion($this->availableUpdates['core']); |
| 182 | 182 | foreach ($sortedVersions as $update) { |
| 183 | - $packageName = $update->getVersion().'.zip'; |
|
| 184 | - $packagePath = $this->tempDir.'/'.$packageName; |
|
| 183 | + $packageName = $update->getVersion() . '.zip'; |
|
| 184 | + $packagePath = $this->tempDir . '/' . $packageName; |
|
| 185 | 185 | $this->addLogInfo('Started updating application\'s core...'); |
| 186 | 186 | if (!file_exists($packagePath)) { |
| 187 | 187 | throw new NotFoundHttpException(sprintf( |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | */ |
| 64 | 64 | public function testNoConfig() |
| 65 | 65 | { |
| 66 | - $this->container->expects($this->once()) |
|
| 66 | + $this->container->expects($this->once()) |
|
| 67 | 67 | ->method('hasParameter') |
| 68 | 68 | ->with('swp_updater.monolog_channel') |
| 69 | 69 | ->will($this->returnValue(false)); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $this->assertEquals($curlOptions, $container->getParameter('swp_updater.client.options')); |
| 50 | 50 | $this->assertEquals('Acme\DemoBundle\Version\Version', $container->getParameter('swp_updater.version.class')); |
| 51 | 51 | $this->assertEquals($container->getParameter('kernel.cache_dir'), $container->getParameter('swp_updater.temp_dir')); |
| 52 | - $this->assertEquals($container->getParameter('kernel.root_dir').'/../', $container->getParameter('swp_updater.target_dir')); |
|
| 52 | + $this->assertEquals($container->getParameter('kernel.root_dir') . '/../', $container->getParameter('swp_updater.target_dir')); |
|
| 53 | 53 | $this->assertFalse($container->hasParameter('swp_updater.monolog_channel')); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $config = $this->getConfig(); |
| 71 | 71 | $loader->load(array(array_merge($config, $directories)), $container); |
| 72 | 72 | $this->assertEquals( |
| 73 | - $container->getParameter('kernel.root_dir').'/some/temp/dir', |
|
| 73 | + $container->getParameter('kernel.root_dir') . '/some/temp/dir', |
|
| 74 | 74 | $container->getParameter('swp_updater.temp_dir') |
| 75 | 75 | ); |
| 76 | 76 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$file = __DIR__.'/../vendor/autoload.php'; |
|
| 3 | +$file = __DIR__ . '/../vendor/autoload.php'; |
|
| 4 | 4 | if (!file_exists($file)) { |
| 5 | 5 | throw new RuntimeException('Install dependencies using composer to run the test suite.'); |
| 6 | 6 | } |
@@ -25,8 +25,8 @@ |
||
| 25 | 25 | |
| 26 | 26 | function let() |
| 27 | 27 | { |
| 28 | - $config = array('base_uri' => 'http://httpbin.org'); |
|
| 29 | - $this->beConstructedWith($config); |
|
| 28 | + $config = array('base_uri' => 'http://httpbin.org'); |
|
| 29 | + $this->beConstructedWith($config); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | function it_should_make_a_call_to_remote_server() |
@@ -107,14 +107,14 @@ |
||
| 107 | 107 | |
| 108 | 108 | function it_should_save_the_file() |
| 109 | 109 | { |
| 110 | - $filePath = __DIR__.'/../../../file.png'; |
|
| 110 | + $filePath = __DIR__ . '/../../../file.png'; |
|
| 111 | 111 | $response = $this->saveFile('http://httpbin.org/image/png', $filePath); |
| 112 | 112 | $response->shouldBe(true); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | function it_should_not_save_the_file() |
| 116 | 116 | { |
| 117 | - $response = $this->saveFile('fake_url', __DIR__.'/../../../file.png'); |
|
| 117 | + $response = $this->saveFile('fake_url', __DIR__ . '/../../../file.png'); |
|
| 118 | 118 | $response->shouldBe(false); |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -107,14 +107,14 @@ |
||
| 107 | 107 | |
| 108 | 108 | function it_should_save_the_file() |
| 109 | 109 | { |
| 110 | - $filePath = __DIR__.'/../../../file.png'; |
|
| 110 | + $filePath = __DIR__ . '/../../../file.png'; |
|
| 111 | 111 | $response = $this->saveFile('http://httpbin.org/image/png', $filePath); |
| 112 | 112 | $response->shouldBe(true); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | function it_should_not_save_the_file() |
| 116 | 116 | { |
| 117 | - $response = $this->saveFile('fake_url', __DIR__.'/../../../file.png'); |
|
| 117 | + $response = $this->saveFile('fake_url', __DIR__ . '/../../../file.png'); |
|
| 118 | 118 | $response->shouldBe(false); |
| 119 | 119 | } |
| 120 | 120 | } |