Passed
Push — master ( fe5115...ad766b )
by Sergey
02:44
created
src/Traits/SeoManagerTrait.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
         $cleanModelNames = [];
114 114
         foreach ($models as $model) {
115 115
             $modelPath = $this->cleanFilePath($model);
116
-            $reflectionClass =(new \ReflectionClass($modelPath))->getParentClass();
117
-            if($reflectionClass !== false){
118
-                if($reflectionClass->getName() === "Illuminate\Database\Eloquent\Model" || $reflectionClass->getName() === "Illuminate\Foundation\Auth\User"){
116
+            $reflectionClass = (new \ReflectionClass($modelPath))->getParentClass();
117
+            if ($reflectionClass !== false) {
118
+                if ($reflectionClass->getName() === "Illuminate\Database\Eloquent\Model" || $reflectionClass->getName() === "Illuminate\Foundation\Auth\User") {
119 119
                     $cleanModel = [
120 120
                         'path' => $modelPath,
121 121
                         'name' => str_replace('.php', '', $model->getFilename())
@@ -196,30 +196,30 @@  discard block
 block discarded – undo
196 196
     private function getMetaData($property)
197 197
     {
198 198
         $route = \Route::current();
199
-        if (is_null($route)){
199
+        if (is_null($route)) {
200 200
             return null;
201 201
         }
202 202
         $uri = $route->uri();
203 203
         $seoManager = SeoManager::where('uri', $uri)->first();
204
-        if(is_null($seoManager)){
204
+        if (is_null($seoManager)) {
205 205
             return null;
206 206
         }
207 207
         $metaData = [];
208
-        if(count($seoManager->keywords) > 0){
208
+        if (count($seoManager->keywords) > 0) {
209 209
             $metaData['keywords'] = implode(', ', $seoManager->keywords);
210 210
         }
211
-        if($seoManager->description){
211
+        if ($seoManager->description) {
212 212
             $metaData['description'] = $seoManager->description;
213 213
         }
214
-        if($seoManager->title){
214
+        if ($seoManager->title) {
215 215
             $metaData['title'] = $seoManager->title;
216 216
         }
217
-        if($seoManager->url){
217
+        if ($seoManager->url) {
218 218
             $metaData['url'] = $seoManager->url;
219
-        }else{
219
+        } else {
220 220
             $metaData['url'] = url()->full();
221 221
         }
222
-        if($seoManager->author){
222
+        if ($seoManager->author) {
223 223
             $metaData['author'] = $seoManager->author;
224 224
         }
225 225
         if ($seoManager->mapping !== null) {
@@ -227,19 +227,19 @@  discard block
 block discarded – undo
227 227
         }
228 228
         if ($seoManager->og_data) {
229 229
             $ogData = $this->getOgData($seoManager, $route->parameters);
230
-            if($property === 'og_data'){
230
+            if ($property === 'og_data') {
231 231
                 $metaData['og_data'] = $ogData;
232
-            }else{
232
+            } else {
233 233
                 foreach ($ogData as $key => $og) {
234 234
                     $metaData[$key] = $og;
235 235
                 }
236 236
             }
237 237
         }
238 238
 
239
-        if($property !== null && !empty($property)){
240
-            if(isset($metaData[$property])){
239
+        if ($property !== null && !empty($property)) {
240
+            if (isset($metaData[$property])) {
241 241
                 return $metaData[$property];
242
-            }else{
242
+            } else {
243 243
                 return null;
244 244
             }
245 245
         }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     private function getDynamicTitle($params, $manager, $routeParams = null)
257 257
     {
258 258
         $dynamicTitle = '';
259
-        if(is_array($params)){
259
+        if (is_array($params)) {
260 260
             foreach ($params as $param) {
261 261
                 if ($this->isParam($param)) {
262 262
                     $param = $this->cleanParam($param);
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
             $mapped = (new $model);
344 344
             if ($routeParams) {
345 345
                 $mapped = $mapped->where($findBy, $routeParams[$paramsArray[0]])->first();
346
-            }else{
346
+            } else {
347 347
                 $mapped = $mapped->first();
348 348
             }
349 349
         }
Please login to merge, or discard this patch.