@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | $url .= 'g/'; |
57 | 57 | } |
58 | 58 | |
59 | - $url .= $dimensions['w'] . '/' . $dimensions['h']; |
|
59 | + $url .= $dimensions['w'].'/'.$dimensions['h']; |
|
60 | 60 | |
61 | 61 | $category = ['abstract', 'city', 'nature', 'moutains']; |
62 | - $url .= '/' . $category[array_rand($category, 1)] . '/'; |
|
62 | + $url .= '/'.$category[array_rand($category, 1)].'/'; |
|
63 | 63 | |
64 | 64 | return $url; |
65 | 65 | } |
66 | 66 | |
67 | 67 | protected function downloadMedia($url) |
68 | 68 | { |
69 | - $filepath = sys_get_temp_dir() . '/' . uniqid() . '.jpg'; |
|
69 | + $filepath = sys_get_temp_dir().'/'.uniqid().'.jpg'; |
|
70 | 70 | $ch = curl_init($url); |
71 | 71 | $fp = fopen($filepath, 'wb'); |
72 | 72 | curl_setopt($ch, CURLOPT_FILE, $fp); |
@@ -81,16 +81,16 @@ discard block |
||
81 | 81 | protected function fetchFromCache($dimensions) |
82 | 82 | { |
83 | 83 | $fs = new Filesystem(); |
84 | - $cacheDir = $_SERVER['HOME'] . '/.symfony/media'; |
|
84 | + $cacheDir = $_SERVER['HOME'].'/.symfony/media'; |
|
85 | 85 | if (!$fs->exists($cacheDir)) { |
86 | 86 | $fs->mkdir($cacheDir, 0777); |
87 | 87 | } else { |
88 | - $cacheDir .= '/' . $dimensions['w'] . '-' . $dimensions['h']; |
|
88 | + $cacheDir .= '/'.$dimensions['w'].'-'.$dimensions['h']; |
|
89 | 89 | if (!$fs->exists($cacheDir)) { |
90 | 90 | $fs->mkdir($cacheDir, 0777); |
91 | 91 | } else { |
92 | 92 | $finder = new Finder(); |
93 | - $files = $finder->in($cacheDir . '/')->files(); |
|
93 | + $files = $finder->in($cacheDir.'/')->files(); |
|
94 | 94 | if ($files->count() === 3) { |
95 | 95 | $iterator = $finder->getIterator(); |
96 | 96 | $iterator->rewind(); |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | protected function storeInCache($dimensions, File $file) |
110 | 110 | { |
111 | 111 | $fs = new Filesystem(); |
112 | - $cacheDir = $_SERVER['HOME'] . '/.symfony/media/' . $dimensions['w'] . '-' . $dimensions['h']; |
|
112 | + $cacheDir = $_SERVER['HOME'].'/.symfony/media/'.$dimensions['w'].'-'.$dimensions['h']; |
|
113 | 113 | if (!$fs->exists($cacheDir)) { |
114 | 114 | $fs->mkdir($cacheDir, 0777); |
115 | 115 | } |
116 | - $fs->copy($file->getRealPath(), $cacheDir . '/' . $file->getFilename()); |
|
116 | + $fs->copy($file->getRealPath(), $cacheDir.'/'.$file->getFilename()); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | } |