Completed
Push — master ( 8968ac...61ba1e )
by
unknown
68:50 queued 04:35
created
src/SumoCoders/FrameworkCoreBundle/Form/Type/ImageType.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         $builder
39 39
             ->addEventListener(
40 40
                 FormEvents::PRE_SET_DATA,
41
-                function (FormEvent $event) use ($options) {
41
+                function(FormEvent $event) use ($options) {
42 42
                     $imageIsEmpty = ($event->getData() === null || empty($event->getData()->getFileName()));
43 43
                     $required = $imageIsEmpty && $options['required'];
44 44
                     $fileFieldOptions = [
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
             )
59 59
             ->addModelTransformer(
60 60
                 new CallbackTransformer(
61
-                    function (AbstractImage $image = null) {
61
+                    function(AbstractImage $image = null) {
62 62
                         return $image;
63 63
                     },
64
-                    function ($image) use ($options) {
64
+                    function($image) use ($options) {
65 65
                         if (!$image instanceof AbstractImage && !$image instanceof stdClass) {
66 66
                             throw new TransformationFailedException('Invalid class for the image');
67 67
                         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $resolver->setDefaults(
96 96
             [
97 97
                 'data_class' => AbstractImage::class,
98
-                'empty_data' => function () {
98
+                'empty_data' => function() {
99 99
                     return new class extends StdClass {
100 100
                         /** @var UploadedFile */
101 101
                         protected $file;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         }
170 170
 
171 171
         array_map(
172
-            function ($optionName) use ($options, &$view) {
172
+            function($optionName) use ($options, &$view) {
173 173
                 if (array_key_exists($optionName, $options) && !empty($options[$optionName])) {
174 174
                     $view->vars[$optionName] = $options[$optionName];
175 175
                 }
Please login to merge, or discard this patch.
src/SumoCoders/FrameworkCoreBundle/Form/Type/FileType.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         $builder
39 39
             ->addEventListener(
40 40
                 FormEvents::PRE_SET_DATA,
41
-                function (FormEvent $event) use ($options) {
41
+                function(FormEvent $event) use ($options) {
42 42
                     $fileIsEmpty = ($event->getData() === null || empty($event->getData()->getFileName()));
43 43
                     $required = $fileIsEmpty && $options['required'];
44 44
                     $fileFieldOptions = [
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
             )
59 59
             ->addModelTransformer(
60 60
                 new CallbackTransformer(
61
-                    function (AbstractFile $file = null) {
61
+                    function(AbstractFile $file = null) {
62 62
                         return $file;
63 63
                     },
64
-                    function ($file) use ($options) {
64
+                    function($file) use ($options) {
65 65
                         if (!$file instanceof AbstractFile && !$file instanceof stdClass) {
66 66
                             throw new TransformationFailedException('Invalid class for the file');
67 67
                         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                 'data_class' => AbstractFile::class,
98 98
                 'preview_label' => 'forms.labels.viewCurrentFile',
99 99
                 'remove_file_label' => 'forms.labels.removeFile',
100
-                'empty_data' => function () {
100
+                'empty_data' => function() {
101 101
                     return new class extends StdClass
102 102
                     {
103 103
                         /** @var UploadedFile */
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $view->vars['preview_url'] = $form->getData()->getWebPath();
170 170
         }
171 171
         array_map(
172
-            function ($optionName) use ($options, &$view) {
172
+            function($optionName) use ($options, &$view) {
173 173
                 if (array_key_exists($optionName, $options) && !empty($options[$optionName])) {
174 174
                     $view->vars[$optionName] = $options[$optionName];
175 175
                 }
Please login to merge, or discard this patch.
src/SumoCoders/FrameworkCoreBundle/ValueObject/AbstractFile.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function getAbsolutePath(): ?string
56 56
     {
57
-        return $this->fileName === null ? null : $this->getUploadRootDir() . '/' . $this->fileName;
57
+        return $this->fileName === null ? null : $this->getUploadRootDir().'/'.$this->fileName;
58 58
     }
59 59
 
60 60
     public function getWebPath(): string
61 61
     {
62 62
         $file = $this->getAbsolutePath();
63 63
         if (is_file($file) && file_exists($file)) {
64
-            return '/' . $this->getUploadDir() . '/' . $this->fileName;
64
+            return '/'.$this->getUploadDir().'/'.$this->fileName;
65 65
         }
66 66
 
67 67
         return '';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     protected function getUploadRootDir(): string
71 71
     {
72 72
         // the absolute directory path where uploaded documents should be saved
73
-        return __DIR__ . '/../../../../web/files/' . $this->getTrimmedUploadDir();
73
+        return __DIR__.'/../../../../web/files/'.$this->getTrimmedUploadDir();
74 74
     }
75 75
 
76 76
     protected function getTrimmedUploadDir(): string
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
         // do whatever you want to generate a unique name
145 145
         $filename = sha1(uniqid(mt_rand(), true));
146 146
         if ($this->namePrefix !== null) {
147
-            $filename = Urlizer::urlize($this->namePrefix) . '_' . $filename;
147
+            $filename = Urlizer::urlize($this->namePrefix).'_'.$filename;
148 148
         }
149
-        $this->fileName = $filename . '.' . $this->getFile()->guessExtension();
149
+        $this->fileName = $filename.'.'.$this->getFile()->guessExtension();
150 150
     }
151 151
 
152 152
     /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     protected function removeOldFile(): void
177 177
     {
178 178
         // delete the old file
179
-        $oldFile = $this->getUploadRootDir() . '/' . $this->oldFileName;
179
+        $oldFile = $this->getUploadRootDir().'/'.$this->oldFileName;
180 180
         if (is_file($oldFile) && file_exists($oldFile)) {
181 181
             unlink($oldFile);
182 182
         }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         return (string) $this->fileName;
213 213
     }
214 214
 
215
-    public static function fromString(?string $fileName): ?self
215
+    public static function fromString(?string $fileName) : ?self
216 216
     {
217 217
         return $fileName !== null ? new static($fileName) : null;
218 218
     }
Please login to merge, or discard this patch.
src/SumoCoders/FrameworkCoreBundle/ValueObject/AbstractImage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         $file = $this->getAbsolutePath();
31 31
 
32 32
         if (is_file($file) && file_exists($file)) {
33
-            return $webPath . $this->fileName;
33
+            return $webPath.$this->fileName;
34 34
         }
35 35
 
36 36
         return static::FALLBACK_IMAGE;
Please login to merge, or discard this patch.