@@ -21,9 +21,9 @@ |
||
21 | 21 | | |
22 | 22 | */ |
23 | 23 | |
24 | - 'driver' => 'array_response', |
|
24 | + 'driver' => 'array_response', |
|
25 | 25 | |
26 | - /* |
|
26 | + /* |
|
27 | 27 | |-------------------------------------------------------------------------- |
28 | 28 | | API Errors Key |
29 | 29 | |-------------------------------------------------------------------------- |
@@ -29,9 +29,9 @@ |
||
29 | 29 | | |
30 | 30 | */ |
31 | 31 | |
32 | - 'driver' => 'rest', |
|
32 | + 'driver' => 'rest', |
|
33 | 33 | |
34 | - /* |
|
34 | + /* |
|
35 | 35 | |-------------------------------------------------------------------------- |
36 | 36 | | HTTP method request parameter |
37 | 37 | |-------------------------------------------------------------------------- |
@@ -16,9 +16,9 @@ |
||
16 | 16 | | |
17 | 17 | */ |
18 | 18 | |
19 | - 'driver' => 'http_status_code', |
|
19 | + 'driver' => 'http_status_code', |
|
20 | 20 | |
21 | - /* |
|
21 | + /* |
|
22 | 22 | |-------------------------------------------------------------------------- |
23 | 23 | | HTTP Status Codes |
24 | 24 | |-------------------------------------------------------------------------- |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function bindPaths(Container $app) |
70 | 70 | { |
71 | - $app->bind('trucker.bootstrapper', function ($app) { |
|
71 | + $app->bind('trucker.bootstrapper', function($app) { |
|
72 | 72 | return new Bootstrapper($app); |
73 | 73 | }); |
74 | 74 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | { |
90 | 90 | $app->bindIf('files', 'Illuminate\Filesystem\Filesystem'); |
91 | 91 | |
92 | - $app->bindIf('config', function ($app) { |
|
93 | - $fileloader = new FileLoader($app['files'], __DIR__ . '/../config'); |
|
92 | + $app->bindIf('config', function($app) { |
|
93 | + $fileloader = new FileLoader($app['files'], __DIR__.'/../config'); |
|
94 | 94 | |
95 | 95 | return new Repository($fileloader, 'config'); |
96 | 96 | }, true); |
@@ -110,56 +110,56 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function bindClasses(Container $app) |
112 | 112 | { |
113 | - $app->singleton('trucker.urls', function ($app) { |
|
113 | + $app->singleton('trucker.urls', function($app) { |
|
114 | 114 | return new Url\UrlGenerator($app); |
115 | 115 | }); |
116 | 116 | |
117 | - $app->singleton('trucker.config-manager', function ($app) { |
|
117 | + $app->singleton('trucker.config-manager', function($app) { |
|
118 | 118 | return new Support\ConfigManager($app); |
119 | 119 | }); |
120 | 120 | |
121 | - $app->bind('trucker.instance-finder', function ($app) { |
|
121 | + $app->bind('trucker.instance-finder', function($app) { |
|
122 | 122 | return new Finders\InstanceFinder($app); |
123 | 123 | }); |
124 | 124 | |
125 | - $app->bind('trucker.collection-finder', function ($app) { |
|
125 | + $app->bind('trucker.collection-finder', function($app) { |
|
126 | 126 | return new Finders\CollectionFinder($app); |
127 | 127 | }); |
128 | 128 | |
129 | - $app->bind('trucker.response', function ($app) { |
|
129 | + $app->bind('trucker.response', function($app) { |
|
130 | 130 | return new Responses\Response($app); |
131 | 131 | }); |
132 | 132 | |
133 | - $app->bind('trucker.model', function () { |
|
133 | + $app->bind('trucker.model', function() { |
|
134 | 134 | return new Resource\Model(); |
135 | 135 | }); |
136 | 136 | |
137 | 137 | //Factories |
138 | - $app->bind('trucker.conditions', function ($app) { |
|
138 | + $app->bind('trucker.conditions', function($app) { |
|
139 | 139 | return new Factories\QueryConditionFactory($app); |
140 | 140 | }); |
141 | 141 | |
142 | - $app->bind('trucker.transporter', function ($app) { |
|
142 | + $app->bind('trucker.transporter', function($app) { |
|
143 | 143 | return new Factories\ApiTransporterFactory($app); |
144 | 144 | }); |
145 | 145 | |
146 | - $app->bind('trucker.order', function ($app) { |
|
146 | + $app->bind('trucker.order', function($app) { |
|
147 | 147 | return new Factories\QueryResultOrderFactory($app); |
148 | 148 | }); |
149 | 149 | |
150 | - $app->bind('trucker.interpreter', function ($app) { |
|
150 | + $app->bind('trucker.interpreter', function($app) { |
|
151 | 151 | return new Factories\ResponseInterpreterFactory($app); |
152 | 152 | }); |
153 | 153 | |
154 | - $app->bind('trucker.error-handler', function ($app) { |
|
154 | + $app->bind('trucker.error-handler', function($app) { |
|
155 | 155 | return new Factories\ErrorHandlerFactory($app); |
156 | 156 | }); |
157 | 157 | |
158 | - $app->bind('trucker.request-factory', function ($app) { |
|
158 | + $app->bind('trucker.request-factory', function($app) { |
|
159 | 159 | return new Factories\RequestFactory($app); |
160 | 160 | }); |
161 | 161 | |
162 | - $app->bind('trucker.auth', function ($app) { |
|
162 | + $app->bind('trucker.auth', function($app) { |
|
163 | 163 | return new Factories\AuthFactory($app); |
164 | 164 | }); |
165 | 165 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | protected function registerConfig(Container $app) |
177 | 177 | { |
178 | 178 | // Register config file(filename) |
179 | - $app['config']->package('indatus/trucker', __DIR__ . '/../config'); |
|
179 | + $app['config']->package('indatus/trucker', __DIR__.'/../config'); |
|
180 | 180 | $app['config']->getLoader(); |
181 | 181 | |
182 | 182 | // Register custom config |
183 | 183 | $custom = $app['path.trucker.config']; |
184 | 184 | if (file_exists($custom)) { |
185 | - $app['config']->afterLoading('trucker', function ($group, $items) use ($custom) { |
|
186 | - $customItems = $custom . '/' . $group . '.php'; |
|
185 | + $app['config']->afterLoading('trucker', function($group, $items) use ($custom) { |
|
186 | + $customItems = $custom.'/'.$group.'.php'; |
|
187 | 187 | if (!file_exists($customItems)) { |
188 | 188 | return $items; |
189 | 189 | } |
@@ -216,7 +216,7 @@ |
||
216 | 216 | $request = $this->request; |
217 | 217 | $this->request->getEventDispatcher()->addListener( |
218 | 218 | 'request.error', |
219 | - function (Event $event) use ($httpStatus, $stopPropagation, $func, $request) { |
|
219 | + function(Event $event) use ($httpStatus, $stopPropagation, $func, $request) { |
|
220 | 220 | if ($httpStatus == -1 || $event['response']->getStatusCode() == $httpStatus) { |
221 | 221 | // Stop other events from firing if needed |
222 | 222 | if ($stopPropagation) { |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $ext = end($mimeExp); |
336 | 336 | $output_file = implode( |
337 | 337 | DIRECTORY_SEPARATOR, |
338 | - [$this->getScratchDiskLocation(), uniqid("tmp_{$property}_", true) . ".$ext"] |
|
338 | + [$this->getScratchDiskLocation(), uniqid("tmp_{$property}_", true).".$ext"] |
|
339 | 339 | ); |
340 | 340 | $f = fopen($output_file, 'wb'); |
341 | 341 | fwrite($f, $image); |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | Config::get('request.base_uri'), |
517 | 517 | UrlGenerator::getDeleteUri( |
518 | 518 | $this, |
519 | - [':' . $this->getIdentityProperty() => $this->getId()] |
|
519 | + [':'.$this->getIdentityProperty() => $this->getId()] |
|
520 | 520 | ), |
521 | 521 | 'PUT', |
522 | 522 | [], //no extra headers |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | Config::get('request.base_uri'), |
578 | 578 | UrlGenerator::getDeleteUri( |
579 | 579 | $this, |
580 | - [':' . $this->getIdentityProperty() => $this->getId()] |
|
580 | + [':'.$this->getIdentityProperty() => $this->getId()] |
|
581 | 581 | ), |
582 | 582 | 'DELETE', |
583 | 583 | [], //no extra headers |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | { |
94 | 94 | $quoted = preg_quote($cap, '/'); |
95 | 95 | |
96 | - return preg_replace('/(?:' . $quoted . ')+$/', '', $value) . $cap; |
|
96 | + return preg_replace('/(?:'.$quoted.')+$/', '', $value).$cap; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | // Asterisks are translated into zero-or-more regular expression wildcards |
116 | 116 | // to make it convenient to check if the strings starts with the given |
117 | 117 | // pattern such as "library/*", making any string check convenient. |
118 | - $pattern = str_replace('\*', '.*', $pattern) . '\z'; |
|
118 | + $pattern = str_replace('\*', '.*', $pattern).'\z'; |
|
119 | 119 | |
120 | - return (bool) preg_match('#^' . $pattern . '#', $value); |
|
120 | + return (bool) preg_match('#^'.$pattern.'#', $value); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | return $value; |
148 | 148 | } |
149 | 149 | |
150 | - return rtrim(mb_substr($value, 0, $limit, 'UTF-8')) . $end; |
|
150 | + return rtrim(mb_substr($value, 0, $limit, 'UTF-8')).$end; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public static function words($value, $words = 100, $end = '...') |
175 | 175 | { |
176 | - preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $value, $matches); |
|
176 | + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches); |
|
177 | 177 | |
178 | 178 | if (!isset($matches[0])) { |
179 | 179 | return $value; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | return $value; |
184 | 184 | } |
185 | 185 | |
186 | - return rtrim($matches[0]) . $end; |
|
186 | + return rtrim($matches[0]).$end; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | // Convert all dashes/undescores into separator |
304 | 304 | $flip = '-' == $separator ? '_' : '-'; |
305 | 305 | |
306 | - $title = preg_replace('![' . preg_quote($flip) . ']+!u', $separator, $title); |
|
306 | + $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title); |
|
307 | 307 | |
308 | 308 | // Remove all characters that are not the separator, letters, numbers, or whitespace. |
309 | - $title = preg_replace('![^' . preg_quote($separator) . '\pL\pN\s]+!u', '', mb_strtolower($title)); |
|
309 | + $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title)); |
|
310 | 310 | |
311 | 311 | // Replace all separator characters and whitespace by a single separator |
312 | - $title = preg_replace('![' . preg_quote($separator) . '\s]+!u', $separator, $title); |
|
312 | + $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title); |
|
313 | 313 | |
314 | 314 | return trim($title, $separator); |
315 | 315 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public static function snake($value, $delimiter = '_') |
326 | 326 | { |
327 | - $replace = '$1' . $delimiter . '$2'; |
|
327 | + $replace = '$1'.$delimiter.'$2'; |
|
328 | 328 | |
329 | 329 | return ctype_lower($value) ? $value : strtolower(preg_replace('/(.)([A-Z])/', $replace, $value)); |
330 | 330 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function get($option) |
54 | 54 | { |
55 | - return $this->app['config']->get('trucker::' . $option); |
|
55 | + return $this->app['config']->get('trucker::'.$option); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function set($option, $value) |
67 | 67 | { |
68 | - return $this->app['config']->set('trucker::' . $option, $value); |
|
68 | + return $this->app['config']->set('trucker::'.$option, $value); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | // Return path to Laravel configuration |
49 | 49 | if ($this->app->bound('path')) { |
50 | - $laravel = $this->app['path'] . '/config/packages/indatus/trucker'; |
|
50 | + $laravel = $this->app['path'].'/config/packages/indatus/trucker'; |
|
51 | 51 | if (file_exists($laravel)) { |
52 | 52 | return $laravel; |
53 | 53 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function exportConfiguration() |
63 | 63 | { |
64 | - $source = __DIR__ . '/../config'; |
|
64 | + $source = __DIR__.'/../config'; |
|
65 | 65 | $destination = $this->getConfigurationPath(); |
66 | 66 | |
67 | 67 | // Unzip configuration files |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $files = $this->app['files']->files($folder); |
83 | 83 | foreach ($files as $file) { |
84 | 84 | foreach ($values as $name => $value) { |
85 | - $contents = str_replace('{' . $name . '}', $value, file_get_contents($file)); |
|
85 | + $contents = str_replace('{'.$name.'}', $value, file_get_contents($file)); |
|
86 | 86 | $this->app['files']->put($file, $contents); |
87 | 87 | } |
88 | 88 | } |
@@ -105,29 +105,29 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function bindConfiguration() |
107 | 107 | { |
108 | - $path = $this->app['path.base'] ? $this->app['path.base'] . '/' : ''; |
|
108 | + $path = $this->app['path.base'] ? $this->app['path.base'].'/' : ''; |
|
109 | 109 | $logs = $this->app->bound('path.storage') ? str_replace($this->unifySlashes($path), null, $this->unifySlashes($this->app['path.storage'])) : '.trucker'; |
110 | 110 | |
111 | 111 | $paths = [ |
112 | 112 | 'config' => '.trucker', |
113 | - 'logs' => $logs . '/logs', |
|
113 | + 'logs' => $logs.'/logs', |
|
114 | 114 | ]; |
115 | 115 | |
116 | 116 | foreach ($paths as $key => $file) { |
117 | - $filename = $path . $file; |
|
117 | + $filename = $path.$file; |
|
118 | 118 | |
119 | 119 | // Check whether we provided a file or folder |
120 | - if (!is_dir($filename) and file_exists($filename . '.php')) { |
|
120 | + if (!is_dir($filename) and file_exists($filename.'.php')) { |
|
121 | 121 | $filename .= '.php'; |
122 | 122 | } |
123 | 123 | |
124 | 124 | // Use configuration in current folder if none found |
125 | - $realpath = realpath('.') . '/' . $file; |
|
125 | + $realpath = realpath('.').'/'.$file; |
|
126 | 126 | if (!file_exists($filename) and file_exists($realpath)) { |
127 | 127 | $filename = $realpath; |
128 | 128 | } |
129 | 129 | |
130 | - $this->app->instance('path.trucker.' . $key, $filename); |
|
130 | + $this->app->instance('path.trucker.'.$key, $filename); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 |