@@ -13,10 +13,10 @@ |
||
13 | 13 | |
14 | 14 | private function serialize(array $properties) |
15 | 15 | { |
16 | - foreach ($properties as $key => $property){ |
|
17 | - if(is_object($property)){ |
|
16 | + foreach ($properties as $key => $property) { |
|
17 | + if (is_object($property)) { |
|
18 | 18 | $params[$this->camelToSnake($key)] = $this->serialize(get_object_vars($property)); |
19 | - }else { |
|
19 | + } else { |
|
20 | 20 | $params[$this->camelToSnake($key)] = $property; |
21 | 21 | } |
22 | 22 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | foreach ($properties as $key => $property){ |
17 | 17 | if(is_object($property)){ |
18 | 18 | $params[$this->camelToSnake($key)] = $this->serialize(get_object_vars($property)); |
19 | - }else { |
|
19 | + } else { |
|
20 | 20 | $params[$this->camelToSnake($key)] = $property; |
21 | 21 | } |
22 | 22 | } |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | ->selectRaw('count(*) AS count, contexts.department_number as department_number') |
16 | 16 | ->join('users', 'users.id', 'interactions.user_id') |
17 | 17 | ->join('contexts', 'users.context_id', 'contexts.id') |
18 | - ->where(function ($query) use ($type){ |
|
19 | - $query->when($type === 'follow', function ($query) { |
|
18 | + ->where(function($query) use ($type){ |
|
19 | + $query->when($type === 'follow', function($query) { |
|
20 | 20 | $query->where('follow', true); |
21 | 21 | $query->orWhere('done', true); |
22 | 22 | }) |
23 | - ->when($type === 'do', function ($query) { |
|
23 | + ->when($type === 'do', function($query) { |
|
24 | 24 | $query->where('done', true); |
25 | 25 | }); |
26 | 26 | }) |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | ->get(); |
31 | 31 | |
32 | 32 | $interactionsToReturn = []; |
33 | - foreach($interactions as $interaction){ |
|
33 | + foreach ($interactions as $interaction) { |
|
34 | 34 | $characteristicsModel = CharacteristicsModel::query()->where('code', $interaction->department_number)->first(); |
35 | - if(!isset($characteristicsModel)){ |
|
35 | + if (!isset($characteristicsModel)) { |
|
36 | 36 | continue; |
37 | 37 | } |
38 | 38 | $characteristicsModel->icon = route('api.icon.serve', ['id' => $characteristicsModel->uuid]); |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | ->join('contexts', 'users.context_id', 'contexts.id') |
54 | 54 | ->join('user_characteristics', 'user_characteristics.user_id', 'users.id') |
55 | 55 | ->join('characteristics', 'characteristics.id', 'user_characteristics.characteristic_id') |
56 | - ->where(function ($query) use ($type){ |
|
57 | - $query->when($type === 'follow', function ($query) { |
|
56 | + ->where(function($query) use ($type){ |
|
57 | + $query->when($type === 'follow', function($query) { |
|
58 | 58 | $query->where('follow', true); |
59 | 59 | $query->orWhere('done', true); |
60 | 60 | }) |
61 | - ->when($type === 'do', function ($query) { |
|
61 | + ->when($type === 'do', function($query) { |
|
62 | 62 | $query->where('done', true); |
63 | 63 | }); |
64 | 64 | }) |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | ->get(); |
72 | 72 | |
73 | 73 | $characteristicsToReturn = []; |
74 | - foreach($characteristicsCount as $characteristicCount){ |
|
74 | + foreach ($characteristicsCount as $characteristicCount) { |
|
75 | 75 | $characteristic = CharacteristicsModel::query()->find($characteristicCount->characteristic_id); |
76 | 76 | $characteristic->count = $characteristicCount->count; |
77 | 77 | $c = $characteristic->toArray(); |
@@ -17,13 +17,13 @@ |
||
17 | 17 | $uri = config('wiki.api_uri').'?action=query&list=search&srwhat=text&srsearch='.$search.'&srqiprofile=classic_noboostlinks&srnamespace=3000&format=json'; |
18 | 18 | try { |
19 | 19 | $response = $client->get($uri); |
20 | - }catch (\Throwable $e){ |
|
20 | + } catch (\Throwable $e) { |
|
21 | 21 | return ['results' => []]; |
22 | 22 | } |
23 | 23 | $content = json_decode($response->getBody()->getContents(), true); |
24 | - if(isset($content['query']['search'])){ |
|
24 | + if (isset($content['query']['search'])) { |
|
25 | 25 | $results = array_column($content['query']['search'], 'title'); |
26 | - return array_map(function ($item){ |
|
26 | + return array_map(function($item) { |
|
27 | 27 | return str_replace('Structure:', '', $item); |
28 | 28 | }, $results); |
29 | 29 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $uri = config('wiki.api_uri').'?action=query&list=search&srwhat=text&srsearch='.$search.'&srqiprofile=classic_noboostlinks&srnamespace=3000&format=json'; |
18 | 18 | try { |
19 | 19 | $response = $client->get($uri); |
20 | - }catch (\Throwable $e){ |
|
20 | + } catch (\Throwable $e){ |
|
21 | 21 | return ['results' => []]; |
22 | 22 | } |
23 | 23 | $content = json_decode($response->getBody()->getContents(), true); |