@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function registerConfig() |
112 | 112 | { |
113 | - $this->publishes([__DIR__ .'/../config/control.php' => config_path('control.php'), |
|
113 | + $this->publishes([__DIR__.'/../config/control.php' => config_path('control.php'), |
|
114 | 114 | ], 'config'); |
115 | 115 | $this->mergeConfigFrom( |
116 | - __DIR__ .'/../config/control.php', 'control' |
|
116 | + __DIR__.'/../config/control.php', 'control' |
|
117 | 117 | ); |
118 | 118 | } |
119 | 119 | |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | public function registerFactories() |
126 | 126 | { |
127 | 127 | if (!app()->environment('production') && class_exists(\Faker\Factory::class)) { |
128 | - $this->app->make(Factory::class)->load(__DIR__ .'/../database/factories'); |
|
128 | + $this->app->make(Factory::class)->load(__DIR__.'/../database/factories'); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | 132 | public function registerMigrations() |
133 | 133 | { |
134 | - $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
134 | + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | public function bindContracts() |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | Route::prefix(config('control.api_prefix')) |
256 | 256 | ->middleware(config('control.api_middleware')) |
257 | 257 | ->namespace('BristolSU\ControlDB\Http\Controllers') |
258 | - ->group(__DIR__ . '/../routes/api.php'); |
|
258 | + ->group(__DIR__.'/../routes/api.php'); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function getById(int $id): RoleModel |
32 | 32 | { |
33 | - return $this->cache->remember(static::class . '@getById:' . $id, 5000, function() use ($id) { |
|
33 | + return $this->cache->remember(static::class.'@getById:'.$id, 5000, function() use ($id) { |
|
34 | 34 | return $this->roleRepository->getById($id); |
35 | 35 | }); |
36 | 36 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getByDataProviderId(int $dataProviderId): RoleModel |
50 | 50 | { |
51 | - return $this->cache->remember(static::class . '@getByDataProviderId:' . $dataProviderId, 5000, function() use ($dataProviderId) { |
|
51 | + return $this->cache->remember(static::class.'@getByDataProviderId:'.$dataProviderId, 5000, function() use ($dataProviderId) { |
|
52 | 52 | return $this->roleRepository->getByDataProviderId($dataProviderId); |
53 | 53 | }); |
54 | 54 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | public function getItem($column, $default = null) |
57 | 57 | { |
58 | - if(array_key_exists($column, $this->prepared) && $this->prepared[$column] !== null) { |
|
58 | + if (array_key_exists($column, $this->prepared) && $this->prepared[$column] !== null) { |
|
59 | 59 | return $this->prepared[$column]; |
60 | 60 | } |
61 | 61 | return $default; |
@@ -52,7 +52,7 @@ |
||
52 | 52 | |
53 | 53 | private function exportData() |
54 | 54 | { |
55 | - switch($this->argument('type')) { |
|
55 | + switch ($this->argument('type')) { |
|
56 | 56 | case 'user': |
57 | 57 | return app(User::class)->all(); |
58 | 58 | break; |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | public function getHeaders($items) |
16 | 16 | { |
17 | 17 | $headers = []; |
18 | - foreach($items as $item) { |
|
19 | - foreach($item->getColumnNames() as $column) { |
|
20 | - if(!in_array($column, $headers)) { |
|
18 | + foreach ($items as $item) { |
|
19 | + foreach ($item->getColumnNames() as $column) { |
|
20 | + if (!in_array($column, $headers)) { |
|
21 | 21 | $headers[] = $column; |
22 | 22 | } |
23 | 23 | } |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | $headers = $headers ?? $this->getHeaders($items); |
37 | 37 | |
38 | 38 | $rows = []; |
39 | - foreach($items as $item) { |
|
39 | + foreach ($items as $item) { |
|
40 | 40 | $row = []; |
41 | - foreach($headers as $header) { |
|
41 | + foreach ($headers as $header) { |
|
42 | 42 | $row[] = $item->getItem($header, $defaultIfNull); |
43 | 43 | } |
44 | 44 | $rows[] = $row; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | fputcsv($csv, $this->getHeaders($items)); |
57 | 57 | |
58 | - foreach($this->getRows($items, $headers, $defaultIfNull) as $row) { |
|
58 | + foreach ($this->getRows($items, $headers, $defaultIfNull) as $row) { |
|
59 | 59 | fputcsv($csv, $row); |
60 | 60 | } |
61 | 61 |
@@ -99,13 +99,13 @@ |
||
99 | 99 | protected function configurationFor($name) |
100 | 100 | { |
101 | 101 | $config = $this->container['config']["control.export.{$name}"]; |
102 | - if(is_null($config)) { |
|
102 | + if (is_null($config)) { |
|
103 | 103 | return null; |
104 | 104 | } |
105 | - if(!isset($config['formatters'])) { |
|
105 | + if (!isset($config['formatters'])) { |
|
106 | 106 | $config['formatters'] = []; |
107 | 107 | } |
108 | - foreach($this->formatters() as $formatter => $formatterConfig) { |
|
108 | + foreach ($this->formatters() as $formatter => $formatterConfig) { |
|
109 | 109 | $config['formatters'][$formatter] = $formatterConfig; |
110 | 110 | } |
111 | 111 |
@@ -15,19 +15,19 @@ |
||
15 | 15 | usort($items, function($a, $b) use ($column) { |
16 | 16 | $aVal = $a->getItem($column); |
17 | 17 | $bVal = $b->getItem($column); |
18 | - if(is_null($aVal) && is_null($bVal)) { |
|
18 | + if (is_null($aVal) && is_null($bVal)) { |
|
19 | 19 | return 0; |
20 | 20 | } |
21 | - if(is_null($aVal) && !is_null($bVal)) { |
|
21 | + if (is_null($aVal) && !is_null($bVal)) { |
|
22 | 22 | return 1; |
23 | 23 | } |
24 | - if(!is_null($aVal) && is_null($bVal)) { |
|
24 | + if (!is_null($aVal) && is_null($bVal)) { |
|
25 | 25 | return -1; |
26 | 26 | } |
27 | - if(is_string($aVal) || is_string($bVal)) { |
|
27 | + if (is_string($aVal) || is_string($bVal)) { |
|
28 | 28 | return $this->compareStrings($aVal, $bVal); |
29 | 29 | } |
30 | - if(is_int($aVal) || is_int($bVal)) { |
|
30 | + if (is_int($aVal) || is_int($bVal)) { |
|
31 | 31 | return $this->compareInts($aVal, $bVal); |
32 | 32 | } |
33 | 33 | return 0; |
@@ -11,8 +11,8 @@ |
||
11 | 11 | public function format($items) |
12 | 12 | { |
13 | 13 | $newItems = []; |
14 | - foreach($items as $item) { |
|
15 | - foreach($item->original()->users() as $user) { |
|
14 | + foreach ($items as $item) { |
|
15 | + foreach ($item->original()->users() as $user) { |
|
16 | 16 | $newItem = clone $item; |
17 | 17 | $dataUser = $user->data(); |
18 | 18 | $newItem->addRow('User ID', $user->id()); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function config(string $key, $default = null) |
64 | 64 | { |
65 | - if(array_key_exists($key, $this->config)) { |
|
65 | + if (array_key_exists($key, $this->config)) { |
|
66 | 66 | return $this->config[$key]; |
67 | 67 | } |
68 | 68 | return $default; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | protected function canHandle(FormattedItem $item): bool |
87 | 87 | { |
88 | - if($this->handles() === self::ALL) { |
|
88 | + if ($this->handles() === self::ALL) { |
|
89 | 89 | return true; |
90 | 90 | } |
91 | 91 | return $item->isType($this->handles()); |