@@ -89,7 +89,7 @@ |
||
89 | 89 | Event::on( |
90 | 90 | CraftVariable::class, |
91 | 91 | CraftVariable::EVENT_INIT, |
92 | - function (Event $event) { |
|
92 | + function(Event $event) { |
|
93 | 93 | /** @var CraftVariable $variable */ |
94 | 94 | $variable = $event->sender; |
95 | 95 | $variable->set('similar', SimilarVariable::class); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | // Write down elements per site and similar counts |
139 | 139 | $queryConditions[$siteId][] = $elementId; |
140 | - $key = $siteId . '-' . $elementId; |
|
140 | + $key = $siteId.'-'.$elementId; |
|
141 | 141 | $similarCounts[$key] = $config['count']; |
142 | 142 | } |
143 | 143 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $query = $this->getElementQuery($elementClass, $criteria); |
151 | 151 | |
152 | 152 | // Make sure we fetch the elements that are similar only |
153 | - $query->on(ElementQuery::EVENT_AFTER_PREPARE, function (CancelableEvent $event) use ($queryConditions) { |
|
153 | + $query->on(ElementQuery::EVENT_AFTER_PREPARE, function(CancelableEvent $event) use ($queryConditions) { |
|
154 | 154 | /** @var ElementQuery $query */ |
155 | 155 | $query = $event->sender; |
156 | 156 | $first = true; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | foreach ($elements as $element) { |
170 | 170 | // The `count` property is added dynamically by our CountBehavior behavior |
171 | - $key = $element->siteId . '-' . $element->id; |
|
171 | + $key = $element->siteId.'-'.$element->id; |
|
172 | 172 | if (!empty($similarCounts[$key])) { |
173 | 173 | /** @noinspection PhpUndefinedFieldInspection */ |
174 | 174 | $element->count = $similarCounts[$key]; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | if (empty($data['criteria']['orderBy'])) { |
179 | - usort($elements, function ($a, $b) { |
|
179 | + usort($elements, function($a, $b) { |
|
180 | 180 | return $a->count < $b->count ? 1 : ($a->count == $b->count ? 0 : -1); |
181 | 181 | }); |
182 | 182 | } |