@@ -58,7 +58,7 @@ |
||
| 58 | 58 | $response->setExpires(date_create()->modify('+1 years')); |
| 59 | 59 | |
| 60 | 60 | $response->setCallback( |
| 61 | - function () use ($stream) { |
|
| 61 | + function() use ($stream) { |
|
| 62 | 62 | if (ftell($stream['stream']) !== 0) { |
| 63 | 63 | rewind($stream['stream']); |
| 64 | 64 | } |
@@ -68,12 +68,10 @@ |
||
| 68 | 68 | ); |
| 69 | 69 | |
| 70 | 70 | return $response; |
| 71 | - } |
|
| 72 | - else { |
|
| 71 | + } else { |
|
| 73 | 72 | throw $this->createNotFoundException('Derived image could not be created'); |
| 74 | 73 | } |
| 75 | - } |
|
| 76 | - else { |
|
| 74 | + } else { |
|
| 77 | 75 | throw $this->createNotFoundException('The file does not exist'); |
| 78 | 76 | } |
| 79 | 77 | } |
@@ -98,8 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | if (empty($coordinates)) { |
| 100 | 100 | $geometry = new CoordinateGeometry(0, 0, $image->getWidth(), $image->getHeight()); |
| 101 | - } |
|
| 102 | - else { |
|
| 101 | + } else { |
|
| 103 | 102 | $cropCoordinates = explode(':', $coordinates)[0]; |
| 104 | 103 | $points = explode(',', $cropCoordinates); |
| 105 | 104 | $geometry = new CoordinateGeometry( |
@@ -145,8 +144,7 @@ discard block |
||
| 145 | 144 | if (strpos($styleName, 'custom_') === 0) { |
| 146 | 145 | return $this->styleDataFromCustomStyleString($styleName); |
| 147 | 146 | } |
| 148 | - } |
|
| 149 | - else { |
|
| 147 | + } else { |
|
| 150 | 148 | return $this->styles[$styleName]; |
| 151 | 149 | } |
| 152 | 150 | |
@@ -240,8 +238,7 @@ discard block |
||
| 240 | 238 | // We need to derive the width. |
| 241 | 239 | $scaledDimensions = $this->getScaledDimensions($image, $styleData); |
| 242 | 240 | $width = $scaledDimensions['width']; |
| 243 | - } |
|
| 244 | - else { |
|
| 241 | + } else { |
|
| 245 | 242 | $width = $styleData['width']; |
| 246 | 243 | } |
| 247 | 244 | |
@@ -268,8 +265,7 @@ discard block |
||
| 268 | 265 | |
| 269 | 266 | if (!empty($styleName)) { |
| 270 | 267 | $stylePath = $this->buildStylePath($styleName, $filename); |
| 271 | - } |
|
| 272 | - else { |
|
| 268 | + } else { |
|
| 273 | 269 | $stylePath = $filename; |
| 274 | 270 | } |
| 275 | 271 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $question->setValidator(['Sensio\Bundle\GeneratorBundle\Command\Validators', 'validateBundleName']); |
| 155 | 155 | $question->setNormalizer( |
| 156 | - function ($value) { |
|
| 156 | + function($value) { |
|
| 157 | 157 | return $value ? trim($value) : ''; |
| 158 | 158 | } |
| 159 | 159 | ); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $input->getOption('entity_name') |
| 177 | 177 | ); |
| 178 | 178 | $question->setValidator( |
| 179 | - function ($answer) { |
|
| 179 | + function($answer) { |
|
| 180 | 180 | // Should only contain letters. |
| 181 | 181 | $valid = preg_match('/^[a-zA-Z]+$/', $answer); |
| 182 | 182 | if (!$valid) { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | ); |
| 191 | 191 | $question->setNormalizer( |
| 192 | - function ($value) { |
|
| 192 | + function($value) { |
|
| 193 | 193 | return $value ? trim($value) : ''; |
| 194 | 194 | } |
| 195 | 195 | ); |
@@ -269,18 +269,18 @@ discard block |
||
| 269 | 269 | ), 'yes' |
| 270 | 270 | ); |
| 271 | 271 | $question->setNormalizer( |
| 272 | - function ($value) { |
|
| 272 | + function($value) { |
|
| 273 | 273 | return $value[0] == 'y' ? 'y' : 'n'; |
| 274 | 274 | } |
| 275 | 275 | ); |
| 276 | 276 | $question->setValidator( |
| 277 | - function ($answer) { |
|
| 277 | + function($answer) { |
|
| 278 | 278 | // Should only contain letters. |
| 279 | 279 | $allowed = [ |
| 280 | 280 | 'y', |
| 281 | 281 | 'n', |
| 282 | 282 | ]; |
| 283 | - $valid = in_array($answer, $allowed); |
|
| 283 | + $valid = in_array($answer, $allowed); |
|
| 284 | 284 | if (!$valid) { |
| 285 | 285 | throw new \RuntimeException( |
| 286 | 286 | 'Only allowed values are ' . implode(', ', $allowed) |
@@ -138,8 +138,7 @@ |
||
| 138 | 138 | throw new \RuntimeException( |
| 139 | 139 | 'Aborting, overwrite permission is needed.' |
| 140 | 140 | ); |
| 141 | - } |
|
| 142 | - else { |
|
| 141 | + } else { |
|
| 143 | 142 | $this->overwrite = true; |
| 144 | 143 | } |
| 145 | 144 | } |
@@ -141,8 +141,7 @@ |
||
| 141 | 141 | $output->write('Updating the routing: '); |
| 142 | 142 | if ('annotation' != $format) { |
| 143 | 143 | $runner($this->updateRouting($questionHelper, $input, $output, $bundle, $format, $entity, $prefix)); |
| 144 | - } |
|
| 145 | - else { |
|
| 144 | + } else { |
|
| 146 | 145 | $runner($this->updateAnnotationRouting($bundle, $entity, $prefix)); |
| 147 | 146 | } |
| 148 | 147 | |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | |
| 45 | 45 | $builder->addEventListener( |
| 46 | 46 | FormEvents::PRE_SET_DATA, |
| 47 | - function (FormEvent $event) { |
|
| 47 | + function(FormEvent $event) { |
|
| 48 | 48 | $image = $event->getData(); |
| 49 | 49 | $form = $event->getForm(); |
| 50 | 50 | // Conditionally add form elements. |
@@ -56,8 +56,7 @@ |
||
| 56 | 56 | 'data' => $image, |
| 57 | 57 | ] |
| 58 | 58 | ); |
| 59 | - } |
|
| 60 | - else { |
|
| 59 | + } else { |
|
| 61 | 60 | $form->add('file', FileType::class, ['label' => 'Upload an image']); |
| 62 | 61 | } |
| 63 | 62 | } |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | // Create the image_entity_class parameter. |
| 40 | 40 | if (!empty($config['image_entity_class'])) { |
| 41 | 41 | $container->setParameter('responsive_image.entity_class', $config['image_entity_class']); |
| 42 | - } |
|
| 43 | - else { |
|
| 42 | + } else { |
|
| 44 | 43 | $container->setParameter('responsive_image.entity_class', ''); |
| 45 | 44 | } |
| 46 | 45 | |
@@ -96,8 +96,7 @@ discard block |
||
| 96 | 96 | } catch (\Exception $e) { |
| 97 | 97 | // @TODO: Throw exception |
| 98 | 98 | } |
| 99 | - } |
|
| 100 | - else { |
|
| 99 | + } else { |
|
| 101 | 100 | // throw InvalidArgumentException:: |
| 102 | 101 | } |
| 103 | 102 | } |
@@ -123,8 +122,7 @@ discard block |
||
| 123 | 122 | { |
| 124 | 123 | if (!empty($style)) { |
| 125 | 124 | $path = $this->styleManager->getStylePath($image, $style); |
| 126 | - } |
|
| 127 | - else { |
|
| 125 | + } else { |
|
| 128 | 126 | $path = $image->getPath(); |
| 129 | 127 | } |
| 130 | 128 | $this->fileSystem->delete($path); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $this->image->resize( |
| 99 | 99 | $width, |
| 100 | 100 | $height, |
| 101 | - function ($constraint) { |
|
| 101 | + function($constraint) { |
|
| 102 | 102 | $constraint->aspectRatio(); |
| 103 | 103 | } |
| 104 | 104 | ); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $this->image->fit( |
| 178 | 178 | $this->styleData['width'], |
| 179 | 179 | $this->styleData['height'], |
| 180 | - function ($constraint) { |
|
| 180 | + function($constraint) { |
|
| 181 | 181 | $constraint->upsize(); |
| 182 | 182 | } |
| 183 | 183 | ); |
@@ -153,8 +153,7 @@ |
||
| 153 | 153 | // just cut out the crop rectangle. |
| 154 | 154 | if (empty($this->getCoordinates('focus'))) { |
| 155 | 155 | $this->doCropRectangle(); |
| 156 | - } |
|
| 157 | - else { |
|
| 156 | + } else { |
|
| 158 | 157 | |
| 159 | 158 | $focusOffsetFinder = new FocusCropDataCalculator( |
| 160 | 159 | $this->getCoordinates('crop'), |
@@ -161,10 +161,10 @@ |
||
| 161 | 161 | $focusY2 = $this->focusCoordinates[3]; |
| 162 | 162 | |
| 163 | 163 | if ($type == 'near') { |
| 164 | - $point = ${'focus' . $axis . '1'} - ${'crop' . $axis . '1'}; |
|
| 164 | + $point = ${'focus' . $axis . '1'} -${'crop' . $axis . '1'}; |
|
| 165 | 165 | } |
| 166 | 166 | else { |
| 167 | - $point = ${'focus' . $axis . '2'} - ${'crop' . $axis . '1'}; |
|
| 167 | + $point = ${'focus' . $axis . '2'} -${'crop' . $axis . '1'}; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | return $point; |
@@ -76,12 +76,10 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | if ($imageAspectRatio > $styleAspectRatio) { |
| 78 | 78 | $axis = 'x'; |
| 79 | - } |
|
| 80 | - else { |
|
| 79 | + } else { |
|
| 81 | 80 | if ($imageAspectRatio < $styleAspectRatio) { |
| 82 | 81 | $axis = 'y'; |
| 83 | - } |
|
| 84 | - else { |
|
| 82 | + } else { |
|
| 85 | 83 | return [ |
| 86 | 84 | 'width' => $newWidth, |
| 87 | 85 | 'height' => $newHeight, |
@@ -162,8 +160,7 @@ discard block |
||
| 162 | 160 | |
| 163 | 161 | if ($type == 'near') { |
| 164 | 162 | $point = ${'focus' . $axis . '1'} - ${'crop' . $axis . '1'}; |
| 165 | - } |
|
| 166 | - else { |
|
| 163 | + } else { |
|
| 167 | 164 | $point = ${'focus' . $axis . '2'} - ${'crop' . $axis . '1'}; |
| 168 | 165 | } |
| 169 | 166 | |