@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | $this->mediaManager = $mediaManager; |
16 | 16 | } |
17 | 17 | |
18 | - public function randomMedia ($width = null, $height = null, $type = "color") |
|
18 | + public function randomMedia($width = null, $height = null, $type = "color") |
|
19 | 19 | { |
20 | 20 | $file = $this->downloadMedia($this->generateUrl($width, $height, $type)); |
21 | 21 | $media = $this->mediaManager->upload($file); |
22 | 22 | return $media; |
23 | 23 | } |
24 | 24 | |
25 | - protected function generateUrl ($width = null, $height = null, $type = "color") |
|
25 | + protected function generateUrl($width = null, $height = null, $type = "color") |
|
26 | 26 | { |
27 | 27 | $url = "http://lorempixel.com/"; |
28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $url .= 'g/'; |
31 | 31 | } |
32 | 32 | |
33 | - if($width === null && $height !== null) { |
|
33 | + if ($width === null && $height !== null) { |
|
34 | 34 | $width = round($height * 4 / 3); |
35 | 35 | } elseif ($width !== null && $height === null) { |
36 | 36 | $height = round($width * 3 / 4); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $filepath = sys_get_temp_dir().'/tmp.jpg'; |
52 | 52 | $ch = curl_init($url); |
53 | - $fp = fopen($filepath,'wb'); |
|
53 | + $fp = fopen($filepath, 'wb'); |
|
54 | 54 | curl_setopt($ch, CURLOPT_FILE, $fp); |
55 | 55 | curl_setopt($ch, CURLOPT_HEADER, 0); |
56 | 56 | curl_exec($ch); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function __construct(EntityManager $entityManager, $uploadDir, $allowedMimetypes) |
32 | 32 | { |
33 | 33 | $this->entityManager = $entityManager; |
34 | -if(substr($uploadDir, -1) !== '/') { |
|
34 | +if (substr($uploadDir, -1) !== '/') { |
|
35 | 35 | $uploadDir = $uploadDir.'/'; |
36 | 36 | } |
37 | 37 | $this->uploadDir = $uploadDir; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | // Sanitizing the filename |
73 | 73 | $slugify = new Slugify(); |
74 | -if($file instanceof UploadedFile) { |
|
74 | +if ($file instanceof UploadedFile) { |
|
75 | 75 | $filename = $slugify->slugify($file->getClientOriginalName()); |
76 | 76 | } else { |
77 | 77 | $filename = $slugify->slugify($file->getFilename()); |