@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | protected function initHasAcceptsMediaWithValidation() |
| 26 | 26 | { |
| 27 | - $this->acceptsMedia(function ($file) { |
|
| 27 | + $this->acceptsMedia(function($file) { |
|
| 28 | 28 | /** @var AbstractValidator $validator */ |
| 29 | 29 | $validator = $this->getValidator(); |
| 30 | 30 | $constraint = $this->getConstraint(); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | protected function initHasAcceptsMediaEmpty() |
| 41 | 41 | { |
| 42 | - $this->acceptsMedia(function () { |
|
| 42 | + $this->acceptsMedia(function() { |
|
| 43 | 43 | return true; |
| 44 | 44 | }); |
| 45 | 45 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function setFileFromSymfonyFile($file) |
| 74 | 74 | { |
| 75 | 75 | $this->file = $file; |
| 76 | - $this->setPathToFile($file->getPath().'/'.$file->getFilename()); |
|
| 76 | + $this->setPathToFile($file->getPath() . '/' . $file->getFilename()); |
|
| 77 | 77 | $this->setFileName(pathinfo($file->getFilename(), PATHINFO_BASENAME)); |
| 78 | 78 | $this->mediaName = pathinfo($file->getFilename(), PATHINFO_FILENAME); |
| 79 | 79 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | public function setFileFromUploadedFile($file) |
| 89 | 89 | { |
| 90 | 90 | $this->file = $file; |
| 91 | - $this->setPathToFile($file->getPath().'/'.$file->getFilename()); |
|
| 91 | + $this->setPathToFile($file->getPath() . '/' . $file->getFilename()); |
|
| 92 | 92 | $this->setFileName($file->getClientOriginalName()); |
| 93 | 93 | $this->mediaName = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME); |
| 94 | 94 | |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | { |
| 49 | 49 | $media = $this->getMedia(); |
| 50 | 50 | $destination = PathGeneratorFactory::create()::getBasePathForMediaOriginal($media); |
| 51 | - $destination .= DIRECTORY_SEPARATOR.$media->getCollection()->getStrategy()::makeFileName($this); |
|
| 51 | + $destination .= DIRECTORY_SEPARATOR . $media->getCollection()->getStrategy()::makeFileName($this); |
|
| 52 | 52 | |
| 53 | 53 | $media->generateFileFromContent($destination, fopen($this->getPathToFile(), 'r')); |
| 54 | 54 | |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | $firstName = $this->getClassFirstName(); |
| 97 | 97 | $contraintFirstName = str_replace('Validator', 'Constraint', $firstName); |
| 98 | 98 | |
| 99 | - return str_replace('\Validators\\'.$firstName, '\Constraints\\'.$contraintFirstName, $className); |
|
| 99 | + return str_replace('\Validators\\' . $firstName, '\Constraints\\' . $contraintFirstName, $className); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $constraint = $this->getConstraint(); |
| 56 | 56 | |
| 57 | 57 | if ($constraint->mimeTypes) { |
| 58 | - $mimeTypes = (array) $constraint->mimeTypes; |
|
| 58 | + $mimeTypes = (array)$constraint->mimeTypes; |
|
| 59 | 59 | $mime = $this->determineMime(); |
| 60 | 60 | foreach ($mimeTypes as $mimeType) { |
| 61 | 61 | if ($mimeType === $mime) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $height = $size[1]; |
| 49 | 49 | |
| 50 | 50 | if ($constraint->minWidth) { |
| 51 | - if (!ctype_digit((string) $constraint->minWidth)) { |
|
| 51 | + if (!ctype_digit((string)$constraint->minWidth)) { |
|
| 52 | 52 | throw new Exception(sprintf('"%s" is not a valid minimum width', |
| 53 | 53 | $constraint->minWidth)); |
| 54 | 54 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | if ($constraint->maxWidth) { |
| 67 | - if (!ctype_digit((string) $constraint->maxWidth)) { |
|
| 67 | + if (!ctype_digit((string)$constraint->maxWidth)) { |
|
| 68 | 68 | throw new Exception(sprintf('"%s" is not a valid maximum width', |
| 69 | 69 | $constraint->maxWidth)); |
| 70 | 70 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | if ($constraint->minHeight) { |
| 82 | - if (!ctype_digit((string) $constraint->minHeight)) { |
|
| 82 | + if (!ctype_digit((string)$constraint->minHeight)) { |
|
| 83 | 83 | throw new Exception(sprintf('"%s" is not a valid minimum height', |
| 84 | 84 | $constraint->minHeight)); |
| 85 | 85 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | if ($constraint->maxHeight) { |
| 97 | - if (!ctype_digit((string) $constraint->maxHeight)) { |
|
| 97 | + if (!ctype_digit((string)$constraint->maxHeight)) { |
|
| 98 | 98 | throw new Exception(sprintf('"%s" is not a valid maximum height', |
| 99 | 99 | $constraint->maxHeight)); |
| 100 | 100 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | $ratio = round($width / $height, 2); |
| 110 | 110 | if (null !== $constraint->minRatio) { |
| 111 | - if (!is_numeric((string) $constraint->minRatio)) { |
|
| 111 | + if (!is_numeric((string)$constraint->minRatio)) { |
|
| 112 | 112 | throw new Exception(sprintf('"%s" is not a valid minimum ratio', |
| 113 | 113 | $constraint->minRatio)); |
| 114 | 114 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | if (null !== $constraint->maxRatio) { |
| 124 | - if (!is_numeric((string) $constraint->maxRatio)) { |
|
| 124 | + if (!is_numeric((string)$constraint->maxRatio)) { |
|
| 125 | 125 | throw new Exception(sprintf('"%s" is not a valid maximum ratio', |
| 126 | 126 | $constraint->maxRatio)); |
| 127 | 127 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | return static::transformFileName($path, $extension); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - throw new \RuntimeException(__METHOD__.' needs a UploadedFile|SplFileInfo|string instance or a file path string'); |
|
| 42 | + throw new \RuntimeException(__METHOD__ . ' needs a UploadedFile|SplFileInfo|string instance or a file path string'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -16,6 +16,6 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public static function transformFileName($path, $extension) |
| 18 | 18 | { |
| 19 | - return date('Y-m-d-').md5($path.time()).'.'.$extension; |
|
| 19 | + return date('Y-m-d-') . md5($path . time()) . '.' . $extension; |
|
| 20 | 20 | } |
| 21 | 21 | } |
@@ -17,6 +17,6 @@ |
||
| 17 | 17 | { |
| 18 | 18 | $name = pathinfo($path, PATHINFO_FILENAME); |
| 19 | 19 | |
| 20 | - return $name.'.'.$extension; |
|
| 20 | + return $name . '.' . $extension; |
|
| 21 | 21 | } |
| 22 | 22 | } |