@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | |
35 | 35 | public function onlyModules(): Collection |
36 | 36 | { |
37 | - return $this->collection()->reject(function ($item) { |
|
37 | + return $this->collection()->reject(function($item) { |
|
38 | 38 | return ($item instanceof ActsAsParent); |
39 | 39 | }); |
40 | 40 | } |
41 | 41 | |
42 | 42 | public function onlyPages(): Collection |
43 | 43 | { |
44 | - return $this->collection()->filter(function ($item) { |
|
44 | + return $this->collection()->filter(function($item) { |
|
45 | 45 | return ($item instanceof ActsAsParent); |
46 | 46 | }); |
47 | 47 | } |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | // } |
97 | 97 | |
98 | 98 | // Remove duplicate models |
99 | - $collection = $collection->unique(function ($model) { |
|
99 | + $collection = $collection->unique(function($model) { |
|
100 | 100 | return (new ModelReference(get_class($model), $model->id))->get(); |
101 | 101 | }); |
102 | 102 | |
103 | 103 | // Filter out our parent |
104 | - return $this->collection = $collection->reject(function ($item) { |
|
104 | + return $this->collection = $collection->reject(function($item) { |
|
105 | 105 | return ($item instanceof $this->parent && $item->id == $this->parent->id); |
106 | 106 | })->values(); |
107 | 107 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | - return static::$loadedSnippets = new self($files->map(function (SplFileInfo $file) { |
|
39 | + return static::$loadedSnippets = new self($files->map(function(SplFileInfo $file) { |
|
40 | 40 | $path = $file->getRealPath(); |
41 | 41 | |
42 | 42 | if (0 === strpos($path, resource_path('views')) && false !== strpos($file->getBasename(), '.blade.php')) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $loadedSnippets = static::load(); |
56 | 56 | |
57 | - return $loadedSnippets->first(function (Snippet $snippet) use ($key) { |
|
57 | + return $loadedSnippets->first(function(Snippet $snippet) use ($key) { |
|
58 | 58 | return $snippet->key() == $key; |
59 | 59 | }); |
60 | 60 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function toClips(): array |
87 | 87 | { |
88 | - return $this->map(function ($snippet) { |
|
88 | + return $this->map(function($snippet) { |
|
89 | 89 | return [$snippet->label(), $snippet->placeholder()]; |
90 | 90 | })->toArray(); |
91 | 91 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | return $value; |
13 | 13 | } |
14 | 14 | |
15 | - $value = preg_replace_callback(static::$pattern, function ($matches) { |
|
15 | + $value = preg_replace_callback(static::$pattern, function($matches) { |
|
16 | 16 | |
17 | 17 | // First entry of matches contains our full captured group, which we want to replace. |
18 | 18 | // Second entry is the text itself, without the brackets |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | if (in_array($menu->order, $sequence)) { |
55 | 55 | foreach ($sequence as $id => $order) { |
56 | 56 | if ($order < $menu->order) { |
57 | - } else { |
|
57 | + }else { |
|
58 | 58 | $sequence[$id]++; |
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - $sequence = $sequence + [$menu->id => $menu->order]; |
|
63 | + $sequence = $sequence+[$menu->id => $menu->order]; |
|
64 | 64 | |
65 | 65 | asort($sequence); |
66 | 66 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | private function reorder(array $sequence) |
71 | 71 | { |
72 | - array_walk($sequence, function ($order, $id) { |
|
72 | + array_walk($sequence, function($order, $id) { |
|
73 | 73 | MenuItem::withoutGlobalScope(SoftDeletingScope::class) |
74 | 74 | ->where('id', $id) |
75 | 75 | ->update(['order' => $order]); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if ($item->ofType(static::TYPE_INTERNAL) && $page = $item->page) { |
105 | 105 | if (public_method_exists($page, 'isArchived') && $page->isArchived()) { |
106 | 106 | unset($items[$k]); |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | $item->url = self::composePageUrl($item, $page); |
109 | 109 | $item->page_label = public_method_exists($page, 'menuLabel') ? $page->menuLabel() : ''; |
110 | 110 | $item->hidden_in_menu = $page->hidden_in_menu; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | 'id' => $node->id, |
154 | 154 | 'type' => $node->type, |
155 | 155 | 'label' => $node->label, |
156 | - 'page_label' => $node->page_label, // Extra info when dealing with internal links |
|
156 | + 'page_label' => $node->page_label, // Extra info when dealing with internal links |
|
157 | 157 | 'url' => $node->url, |
158 | 158 | 'order' => $node->order, |
159 | 159 | 'page_id' => $node->page_id, |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | $collection = NodeCollection::fromArray($items); |
27 | 27 | |
28 | - $collection->mapRecursive(function ($node) { |
|
28 | + $collection->mapRecursive(function($node) { |
|
29 | 29 | return $node->replaceEntry((new MenuItem())->entry($node)); |
30 | 30 | }); |
31 | 31 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function items(): NodeCollection |
43 | 43 | { |
44 | 44 | if (!$this->includeHidden) { |
45 | - $this->collection = $this->collection->shake(function ($node) { |
|
45 | + $this->collection = $this->collection->shake(function($node) { |
|
46 | 46 | return !$node->hidden_in_menu && !$node->draft; |
47 | 47 | }); |
48 | 48 | } |
@@ -55,22 +55,22 @@ discard block |
||
55 | 55 | $this->collection = $this->items(); |
56 | 56 | |
57 | 57 | if ($id) { |
58 | - $this->collection = $this->collection->prune(function ($node) use ($id) { |
|
58 | + $this->collection = $this->collection->prune(function($node) use ($id) { |
|
59 | 59 | return !in_array($id, $node->pluckAncestors('id')); |
60 | 60 | }); |
61 | 61 | } |
62 | 62 | |
63 | - $menu = $this->collection->mapRecursive(function ($node) { |
|
63 | + $menu = $this->collection->mapRecursive(function($node) { |
|
64 | 64 | $entry = $node->entry(); |
65 | 65 | $label = $entry->label; |
66 | - $entry->label = $node->depth() != 0 ? (str_repeat('-', $node->depth())) . '>' : ''; |
|
66 | + $entry->label = $node->depth() != 0 ? (str_repeat('-', $node->depth())).'>' : ''; |
|
67 | 67 | $entry->label .= $label; |
68 | 68 | |
69 | 69 | return $node->replaceEntry($entry); |
70 | 70 | }); |
71 | 71 | |
72 | 72 | $menuitems = collect(); |
73 | - $menu->flatten()->each(function ($node) use ($menuitems) { |
|
73 | + $menu->flatten()->each(function($node) use ($menuitems) { |
|
74 | 74 | $menuitems[] = [ |
75 | 75 | 'label' => $node->label, |
76 | 76 | 'id' => $node->id, |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $models = UrlRecord::allOnlineModels($locale); |
77 | 77 | |
78 | 78 | $this->urls = $models |
79 | - ->reject(function (ProvidesUrl $model) use ($locale) { |
|
79 | + ->reject(function(ProvidesUrl $model) use ($locale) { |
|
80 | 80 | // In case the url is not found or present for given locale. |
81 | 81 | return !$model->url($locale); |
82 | 82 | }) |
83 | - ->map(function (ProvidesUrl $model) use ($locale, $alternateLocales) { |
|
83 | + ->map(function(ProvidesUrl $model) use ($locale, $alternateLocales) { |
|
84 | 84 | $url = $model->url($locale); |
85 | 85 | |
86 | 86 | $alternateUrls = []; |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | { |
102 | 102 | $pool = new Pool($this->httpClient, $this->crawlableUrlGenerator(), [ |
103 | 103 | 'concurrency' => 5, |
104 | - 'fulfilled' => function (Response $response, $index) { |
|
104 | + 'fulfilled' => function(Response $response, $index) { |
|
105 | 105 | if ($response->getStatusCode() !== \Symfony\Component\HttpFoundation\Response::HTTP_OK) { |
106 | 106 | unset($this->urls[$index]); |
107 | 107 | } |
108 | 108 | }, |
109 | - 'rejected' => function (RequestException $reason, $index) { |
|
109 | + 'rejected' => function(RequestException $reason, $index) { |
|
110 | 110 | unset($this->urls[$index]); |
111 | 111 | }, |
112 | 112 | ]); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $files = $this->filesystem->files($directory); |
30 | 30 | |
31 | - return collect($files)->filter(function ($file) { |
|
31 | + return collect($files)->filter(function($file) { |
|
32 | 32 | return (Str::startsWith($file->getFileName(), 'sitemap-') && Str::endsWith($file->getFileName(), '.xml')); |
33 | 33 | }); |
34 | 34 | } |
@@ -18,11 +18,11 @@ |
||
18 | 18 | $urlRecord = UrlRecord::find($id); |
19 | 19 | |
20 | 20 | if (!$urlRecord) { |
21 | - return response()->json(['No url record found by id ' . $id], 500); |
|
21 | + return response()->json(['No url record found by id '.$id], 500); |
|
22 | 22 | } |
23 | 23 | |
24 | - if (! $urlRecord->isRedirect()) { |
|
25 | - return response()->json(['Url with id ' . $id . ' is not a redirect'], 500); |
|
24 | + if (!$urlRecord->isRedirect()) { |
|
25 | + return response()->json(['Url with id '.$id.' is not a redirect'], 500); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $this->pointChildRedirectsToParent($urlRecord, $urlRecord->redirect_id); |