Completed
Push — master ( 4f9307...39bfd4 )
by Arthur
12s queued 10s
created
src/WebThumbnailer/Finder/DefaultFinder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
             return $this->url;
61 61
         }
62 62
 
63
-        if (empty($thumbnail) && ! empty($headers) && strpos($headers[0], '200') === false) {
63
+        if (empty($thumbnail) && !empty($headers) && strpos($headers[0], '200') === false) {
64 64
             return false;
65 65
         }
66 66
 
67 67
         // With curl, the thumb is extracted during the download
68
-        if ($this->webAccess instanceof WebAccessCUrl && ! empty($thumbnail)) {
68
+        if ($this->webAccess instanceof WebAccessCUrl && !empty($thumbnail)) {
69 69
             return $thumbnail;
70 70
         }
71 71
 
72
-        return ! empty($content) ? static::extractMetaTag($content) : false;
72
+        return !empty($content) ? static::extractMetaTag($content) : false;
73 73
     }
74 74
 
75 75
     /**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
          *
100 100
          * @return int|false length of $data or false if we need to stop the download
101 101
          */
102
-        return function ($ch, $data) use ($url, &$content, &$thumbnail, &$isRedirected) {
102
+        return function($ch, $data) use ($url, &$content, &$thumbnail, &$isRedirected) {
103 103
             $content .= $data;
104 104
             $responseCode = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
105 105
             if (!empty($responseCode) && in_array($responseCode, [301, 302])) {
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             }
112 112
             // After a redirection, the content type will keep the previous request value
113 113
             // until it finds the next content-type header.
114
-            if (! $isRedirected || strpos(strtolower($data), 'content-type') !== false) {
114
+            if (!$isRedirected || strpos(strtolower($data), 'content-type') !== false) {
115 115
                 $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
116 116
             }
117 117
             // we look for image, and ignore application/octet-stream,
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
         $propertiesKey = ['property', 'name', 'itemprop'];
156 156
         $properties = implode('|', $propertiesKey);
157 157
         // Try to retrieve OpenGraph image.
158
-        $ogRegex = '#<meta[^>]+(?:' . $properties . ')=["\']?og:image["\'\s][^>]*content=["\']?(.*?)["\'\s>]#';
158
+        $ogRegex = '#<meta[^>]+(?:'.$properties.')=["\']?og:image["\'\s][^>]*content=["\']?(.*?)["\'\s>]#';
159 159
         // If the attributes are not in the order property => content (e.g. Github)
160 160
         // New regex to keep this readable... more or less.
161
-        $ogRegexReverse = '#<meta[^>]+content=["\']?([^"\'\s]+)[^>]+(?:' . $properties . ')=["\']?og:image["\'\s/>]#';
161
+        $ogRegexReverse = '#<meta[^>]+content=["\']?([^"\'\s]+)[^>]+(?:'.$properties.')=["\']?og:image["\'\s/>]#';
162 162
 
163 163
         if (
164 164
             preg_match($ogRegex, $content, $matches) > 0
Please login to merge, or discard this patch.
src/WebThumbnailer/Finder/QueryRegexFinder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         }
84 84
 
85 85
         // With curl, the thumb is extracted during the download
86
-        if ($this->webAccess instanceof WebAccessCUrl && ! empty($thumbnail)) {
86
+        if ($this->webAccess instanceof WebAccessCUrl && !empty($thumbnail)) {
87 87
             return $thumbnail;
88 88
         }
89 89
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
          *
117 117
          * @return int|false length of $data or false if we need to stop the download
118 118
          */
119
-        return function ($ch, $data) use (&$content, &$thumbnail, &$isRedirected) {
119
+        return function($ch, $data) use (&$content, &$thumbnail, &$isRedirected) {
120 120
             $content .= $data;
121 121
             $responseCode = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
122 122
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             }
130 130
             // After a redirection, the content type will keep the previous request value
131 131
             // until it finds the next content-type header.
132
-            if (! $isRedirected || strpos(strtolower($data), 'content-type') !== false) {
132
+            if (!$isRedirected || strpos(strtolower($data), 'content-type') !== false) {
133 133
                 $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
134 134
             }
135 135
             if (!empty($contentType) && strpos($contentType, 'text/html') === false) {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         if (preg_match($this->urlRegex, $content, $matches) !== 0) {
161 161
             $total = count($matches);
162 162
             for ($i = 1; $i < $total; $i++) {
163
-                $thumbnailUrl = str_replace('${' . $i . '}', $matches[$i], $thumbnailUrl);
163
+                $thumbnailUrl = str_replace('${'.$i.'}', $matches[$i], $thumbnailUrl);
164 164
             }
165 165
 
166 166
             // Match only options (not ${number})
Please login to merge, or discard this patch.