@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return HttpResponse |
86 | 86 | */ |
87 | 87 | public static function success($data = null, $api_code = null, array $placeholders = null, |
88 | - int $http_code = null, int $json_opts = null): HttpResponse |
|
88 | + int $http_code = null, int $json_opts = null): HttpResponse |
|
89 | 89 | { |
90 | 90 | return static::asSuccess($api_code) |
91 | 91 | ->withData($data) |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @return HttpResponse |
114 | 114 | */ |
115 | 115 | public static function error(int $api_code, array $placeholders = null, $data = null, int $http_code = null, |
116 | - int $json_opts = null): HttpResponse |
|
116 | + int $json_opts = null): HttpResponse |
|
117 | 117 | { |
118 | 118 | return static::asError($api_code) |
119 | 119 | ->withPlaceholders($placeholders) |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | public function withJsonOptions(int $json_opts = null): self |
198 | 198 | { |
199 | 199 | Validator::assertIsType('json_opts', $json_opts, [Type::INTEGER, |
200 | - Type::NULL]); |
|
200 | + Type::NULL]); |
|
201 | 201 | $this->json_opts = $json_opts; |
202 | 202 | |
203 | 203 | return $this; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | public function withDebugData(array $debug_data = null): self |
212 | 212 | { |
213 | 213 | Validator::assertIsType('$debug_data', $debug_data, [Type::ARRAY, |
214 | - Type::NULL]); |
|
214 | + Type::NULL]); |
|
215 | 215 | $this->debug_data = $debug_data; |
216 | 216 | |
217 | 217 | return $this; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | public function withMessage(string $msg = null): self |
226 | 226 | { |
227 | 227 | Validator::assertIsType('message', $msg, [Type::STRING, |
228 | - Type::NULL]); |
|
228 | + Type::NULL]); |
|
229 | 229 | $this->message = $msg; |
230 | 230 | |
231 | 231 | return $this; |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | * @noinspection PhpTooManyParametersInspection |
313 | 313 | */ |
314 | 314 | protected function make(bool $success, int $api_code, $msg_or_api_code, $data = null, |
315 | - int $http_code = null, array $placeholders = null, array $http_headers = null, |
|
316 | - int $json_opts = null, array $debug_data = null): HttpResponse |
|
315 | + int $http_code = null, array $placeholders = null, array $http_headers = null, |
|
316 | + int $json_opts = null, array $debug_data = null): HttpResponse |
|
317 | 317 | { |
318 | 318 | $http_headers = $http_headers ?? []; |
319 | 319 | $http_code = $http_code ?? ($success ? RB::DEFAULT_HTTP_CODE_OK : RB::DEFAULT_HTTP_CODE_ERROR); |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | * @noinspection PhpTooManyParametersInspection |
353 | 353 | */ |
354 | 354 | protected function buildResponse(bool $success, int $api_code, |
355 | - $msg_or_api_code, array $placeholders = null, |
|
356 | - $data = null, array $debug_data = null): array |
|
355 | + $msg_or_api_code, array $placeholders = null, |
|
356 | + $data = null, array $debug_data = null): array |
|
357 | 357 | { |
358 | 358 | // ensure $data is either @null, array or object of class with configured mapping. |
359 | 359 | $data = (new Converter())->convert($data); |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | $data = (new Converter())->convert($data); |
360 | 360 | if ($data !== null && !\is_object($data)) { |
361 | 361 | // ensure we get object in final JSON structure in data node |
362 | - $data = (object)$data; |
|
362 | + $data = (object) $data; |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | if ($data === null && Config::get(RB::CONF_KEY_DATA_ALWAYS_OBJECT, false)) { |
366 | - $data = (object)[]; |
|
366 | + $data = (object) []; |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | // get human readable message for API code or use message string (if given instead of API code) |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | |
386 | 386 | if ($debug_data !== null) { |
387 | 387 | $debug_key = Config::get(RB::CONF_KEY_DEBUG_DEBUG_KEY, RB::KEY_DEBUG); |
388 | - $response[ $debug_key ] = $debug_data; |
|
388 | + $response[$debug_key] = $debug_data; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | return $response; |
@@ -78,7 +78,7 @@ |
||
78 | 78 | |
79 | 79 | Util::sortArrayByPri($merged_config['converter']['classes']); |
80 | 80 | |
81 | - $this->app['config']->set($key, $merged_config); |
|
82 | - } |
|
81 | + $this->app['config']->set($key, $merged_config); |
|
82 | + } |
|
83 | 83 | |
84 | 84 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $worker = new $cfg[ RB::KEY_HANDLER ](); |
148 | 148 | $result = $worker->convert($data, $cfg); |
149 | 149 | $result = $cfg[ RB::KEY_KEY ] === null ? $result : [$cfg[ RB::KEY_KEY ] => $result]; |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | 152 | if ($result === null && \is_array($data)) { |
153 | 153 | $cfg = $this->getPrimitiveMappingConfigOrThrow($data); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | "Missing '{$key_name}' entry in '{$class_name}' class mapping config."); |
226 | 226 | } |
227 | 227 | |
228 | - Validator::assertIsType(RB::KEY_KEY, $class_config[$key_name], $allowed_types); |
|
228 | + Validator::assertIsType(RB::KEY_KEY, $class_config[$key_name], $allowed_types); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $result = null; |
61 | 61 | |
62 | 62 | $type = \gettype($data); |
63 | - $result = $this->primitives[ $type ] ?? null; |
|
63 | + $result = $this->primitives[$type] ?? null; |
|
64 | 64 | |
65 | 65 | if ($result === null) { |
66 | 66 | throw new Ex\ConfigurationNotFoundException( |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | $cls = \get_class($data); |
93 | 93 | if ($cls !== false) { |
94 | 94 | if (\array_key_exists($cls, $this->classes)) { |
95 | - $result = $this->classes[ $cls ]; |
|
95 | + $result = $this->classes[$cls]; |
|
96 | 96 | $debug_result = 'exact config match'; |
97 | 97 | } else { |
98 | 98 | // no exact match, then lets try with `instanceof` |
99 | 99 | foreach (\array_keys($this->classes) as $class_name) { |
100 | 100 | if ($data instanceof $class_name) { |
101 | - $result = $this->classes[ $class_name ]; |
|
101 | + $result = $this->classes[$class_name]; |
|
102 | 102 | $debug_result = "subclass of {$class_name}"; |
103 | 103 | break; |
104 | 104 | } |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | |
145 | 145 | if ($result === null && \is_object($data)) { |
146 | 146 | $cfg = $this->getClassMappingConfigOrThrow($data); |
147 | - $worker = new $cfg[ RB::KEY_HANDLER ](); |
|
147 | + $worker = new $cfg[RB::KEY_HANDLER](); |
|
148 | 148 | $result = $worker->convert($data, $cfg); |
149 | - $result = $cfg[ RB::KEY_KEY ] === null ? $result : [$cfg[ RB::KEY_KEY ] => $result]; |
|
149 | + $result = $cfg[RB::KEY_KEY] === null ? $result : [$cfg[RB::KEY_KEY] => $result]; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | if ($result === null && \is_array($data)) { |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | |
155 | 155 | $result = $this->convertArray($data); |
156 | 156 | if (!Util::isArrayWithNonNumericKeys($data)) { |
157 | - $result = [$cfg[ RB::KEY_KEY ] => $result]; |
|
157 | + $result = [$cfg[RB::KEY_KEY] => $result]; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | 161 | if (\is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
162 | - $result = [$this->getPrimitiveMappingConfigOrThrow($data)[ RB::KEY_KEY ] => $data]; |
|
162 | + $result = [$this->getPrimitiveMappingConfigOrThrow($data)[RB::KEY_KEY] => $data]; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | return $result; |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | |
180 | 180 | foreach ($data as $key => $val) { |
181 | 181 | if (\is_array($val)) { |
182 | - $data[ $key ] = $this->convertArray($val); |
|
182 | + $data[$key] = $this->convertArray($val); |
|
183 | 183 | } elseif (\is_object($val)) { |
184 | 184 | $cfg = $this->getClassMappingConfigOrThrow($val); |
185 | - $worker = new $cfg[ RB::KEY_HANDLER ](); |
|
185 | + $worker = new $cfg[RB::KEY_HANDLER](); |
|
186 | 186 | $converted_data = $worker->convert($val, $cfg); |
187 | - $data[ $key ] = $converted_data; |
|
187 | + $data[$key] = $converted_data; |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 |
@@ -10,57 +10,57 @@ |
||
10 | 10 | */ |
11 | 11 | return [ |
12 | 12 | |
13 | - 'ok' => 'Tamam', |
|
14 | - 'no_error_message' => 'Hata #:api_code', |
|
13 | + 'ok' => 'Tamam', |
|
14 | + 'no_error_message' => 'Hata #:api_code', |
|
15 | 15 | |
16 | - // Used by Exception Handler Helper (when used) |
|
17 | - 'uncaught_exception' => 'Yakalanmamış Hata: :message', |
|
18 | - 'http_exception' => 'HTTP Hatası: :message', |
|
16 | + // Used by Exception Handler Helper (when used) |
|
17 | + 'uncaught_exception' => 'Yakalanmamış Hata: :message', |
|
18 | + 'http_exception' => 'HTTP Hatası: :message', |
|
19 | 19 | |
20 | - // HttpException handler (added in 6.4.0) |
|
21 | - // Error messages for HttpException caught w/o custom messages |
|
22 | - // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
23 | - // Turkish Translated from https://tr.wikipedia.org/wiki/HTTP_durum_kodlar%C4%B1 |
|
24 | - 'http_400' => 'Kötü İstek', |
|
25 | - 'http_401' => 'Yetkisiz', |
|
26 | - 'http_402' => 'Ödeme Gerekli', |
|
27 | - 'http_403' => 'Yasaklandı', |
|
28 | - 'http_404' => 'Sayfa Bulunamadı', |
|
29 | - 'http_405' => 'İzin Verilmeyen Metod', |
|
30 | - 'http_406' => 'Kabul Edilemez', |
|
31 | - 'http_407' => 'Proxy Sunucusunda Giriş Yapmak Gerekli', |
|
32 | - 'http_408' => 'İstek Zaman Aşamına Uğradı', |
|
33 | - 'http_409' => 'Çakışma', |
|
34 | - 'http_410' => 'Bak', |
|
35 | - 'http_411' => 'Uzunluk Gerekli', |
|
36 | - 'http_412' => 'Ön Koşul Başarısız', |
|
37 | - 'http_413' => 'Girilen Veri Çok Fazla', |
|
38 | - 'http_414' => 'URI Çok Uzun', |
|
39 | - 'http_415' => 'Desteklenmeyen Medya Tipi', |
|
40 | - 'http_416' => 'İstenen Aralık Kabul Edilemez', |
|
41 | - 'http_417' => 'Beklenti Başarısız', |
|
42 | - 'http_421' => 'Yanlış Yönlendirilmiş Talep', |
|
43 | - 'http_422' => 'İşlenemeyen Varlık', |
|
44 | - 'http_423' => 'Kilitli', |
|
45 | - 'http_424' => 'Başarısız Bağımlılık', |
|
46 | - 'http_425' => 'Çok Erken', |
|
47 | - 'http_426' => 'Güncelleme Gerekli', |
|
48 | - 'http_428' => 'Ön Koşul Gerekli', |
|
49 | - 'http_429' => 'Çok Fazla İstek Gönderildi', |
|
50 | - 'http_431' => 'İstek Başlık Alanları Çok Büyük', |
|
51 | - 'http_451' => 'Yasal Nedenlerle Gösterilemiyor', |
|
20 | + // HttpException handler (added in 6.4.0) |
|
21 | + // Error messages for HttpException caught w/o custom messages |
|
22 | + // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
23 | + // Turkish Translated from https://tr.wikipedia.org/wiki/HTTP_durum_kodlar%C4%B1 |
|
24 | + 'http_400' => 'Kötü İstek', |
|
25 | + 'http_401' => 'Yetkisiz', |
|
26 | + 'http_402' => 'Ödeme Gerekli', |
|
27 | + 'http_403' => 'Yasaklandı', |
|
28 | + 'http_404' => 'Sayfa Bulunamadı', |
|
29 | + 'http_405' => 'İzin Verilmeyen Metod', |
|
30 | + 'http_406' => 'Kabul Edilemez', |
|
31 | + 'http_407' => 'Proxy Sunucusunda Giriş Yapmak Gerekli', |
|
32 | + 'http_408' => 'İstek Zaman Aşamına Uğradı', |
|
33 | + 'http_409' => 'Çakışma', |
|
34 | + 'http_410' => 'Bak', |
|
35 | + 'http_411' => 'Uzunluk Gerekli', |
|
36 | + 'http_412' => 'Ön Koşul Başarısız', |
|
37 | + 'http_413' => 'Girilen Veri Çok Fazla', |
|
38 | + 'http_414' => 'URI Çok Uzun', |
|
39 | + 'http_415' => 'Desteklenmeyen Medya Tipi', |
|
40 | + 'http_416' => 'İstenen Aralık Kabul Edilemez', |
|
41 | + 'http_417' => 'Beklenti Başarısız', |
|
42 | + 'http_421' => 'Yanlış Yönlendirilmiş Talep', |
|
43 | + 'http_422' => 'İşlenemeyen Varlık', |
|
44 | + 'http_423' => 'Kilitli', |
|
45 | + 'http_424' => 'Başarısız Bağımlılık', |
|
46 | + 'http_425' => 'Çok Erken', |
|
47 | + 'http_426' => 'Güncelleme Gerekli', |
|
48 | + 'http_428' => 'Ön Koşul Gerekli', |
|
49 | + 'http_429' => 'Çok Fazla İstek Gönderildi', |
|
50 | + 'http_431' => 'İstek Başlık Alanları Çok Büyük', |
|
51 | + 'http_451' => 'Yasal Nedenlerle Gösterilemiyor', |
|
52 | 52 | |
53 | - 'http_500' => 'Dahili Sunucu Hatası', |
|
54 | - 'http_501' => 'Uygulanamadı', |
|
55 | - 'http_502' => 'Hatalı Ağ Geçidi', |
|
56 | - 'http_503' => 'Hizmet Kullanılamıyor', |
|
57 | - 'http_504' => 'Ağ Geçidi Zaman Aşımı', |
|
58 | - 'http_505' => 'HTTP Versiyonu Desteklenmiyor', |
|
59 | - 'http_506' => 'Varyant Ayrıca Müzakere Ediyor', |
|
60 | - 'http_507' => 'Yetersiz Depolama Alanı', |
|
61 | - 'http_508' => 'Döngü Algılandı', |
|
62 | - 'http_509' => 'Atanmamış', |
|
63 | - 'http_510' => 'Uzatılmamış', |
|
64 | - 'http_511' => 'Ağ Kimlik Doğrulaması Gerekli', |
|
53 | + 'http_500' => 'Dahili Sunucu Hatası', |
|
54 | + 'http_501' => 'Uygulanamadı', |
|
55 | + 'http_502' => 'Hatalı Ağ Geçidi', |
|
56 | + 'http_503' => 'Hizmet Kullanılamıyor', |
|
57 | + 'http_504' => 'Ağ Geçidi Zaman Aşımı', |
|
58 | + 'http_505' => 'HTTP Versiyonu Desteklenmiyor', |
|
59 | + 'http_506' => 'Varyant Ayrıca Müzakere Ediyor', |
|
60 | + 'http_507' => 'Yetersiz Depolama Alanı', |
|
61 | + 'http_508' => 'Döngü Algılandı', |
|
62 | + 'http_509' => 'Atanmamış', |
|
63 | + 'http_510' => 'Uzatılmamış', |
|
64 | + 'http_511' => 'Ağ Kimlik Doğrulaması Gerekli', |
|
65 | 65 | ]; |
66 | 66 |
@@ -10,55 +10,55 @@ |
||
10 | 10 | */ |
11 | 11 | return [ |
12 | 12 | |
13 | - 'ok' => 'حسناً', |
|
14 | - 'no_error_message' => 'خطأ #:api_code', |
|
13 | + 'ok' => 'حسناً', |
|
14 | + 'no_error_message' => 'خطأ #:api_code', |
|
15 | 15 | |
16 | - // Used by Exception Handler Helper (when used) |
|
17 | - 'uncaught_exception' => 'استثناء غير ممسك: :message', |
|
18 | - 'http_exception' => 'HTTP استثناء: :message', |
|
16 | + // Used by Exception Handler Helper (when used) |
|
17 | + 'uncaught_exception' => 'استثناء غير ممسك: :message', |
|
18 | + 'http_exception' => 'HTTP استثناء: :message', |
|
19 | 19 | |
20 | - // HttpException handler (added in 6.4.0) |
|
21 | - // Error messages for HttpException caught w/o custom messages |
|
22 | - // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
23 | - 'http_400' => 'طلب غير صحيح', |
|
24 | - 'http_401' => 'غير مصرح به', |
|
25 | - 'http_402' => 'الدفع مطلوب', |
|
26 | - 'http_403' => 'ممنوع', |
|
27 | - 'http_404' => 'لا يوجد', |
|
28 | - 'http_405' => 'الأسلوب غير مسموح به', |
|
29 | - 'http_406' => 'غير مقبول', |
|
30 | - 'http_407' => 'مطلوب مصادقة الوكيل', |
|
31 | - 'http_408' => 'انتهاء مهلة الطلب', |
|
32 | - 'http_409' => 'تضارب', |
|
33 | - 'http_410' => 'انتهى', |
|
34 | - 'http_411' => 'الطول مطلوب', |
|
35 | - 'http_412' => 'فشل الشروط المسبقة', |
|
36 | - 'http_413' => 'حمولة كبيرة جدا', |
|
37 | - 'http_414' => 'URI طويل جداً', |
|
38 | - 'http_415' => 'نوع الوسائط غير مدعوم', |
|
39 | - 'http_416' => 'النطاق غير قابل للرضا', |
|
40 | - 'http_417' => 'فشل التوقعات', |
|
41 | - 'http_421' => 'طلب توجيه خاطئ', |
|
42 | - 'http_422' => 'كيان غير قابل ل المعالجة', |
|
43 | - 'http_423' => 'مؤمن', |
|
44 | - 'http_424' => 'إعتمادية فاشلة', |
|
45 | - 'http_425' => 'مبكر جداً', |
|
46 | - 'http_426' => 'الترقية مطلوبة', |
|
47 | - 'http_428' => 'شرط مسبق مطلوب', |
|
48 | - 'http_429' => 'طلبات كثيرة جداً', |
|
49 | - 'http_431' => 'حقول رأس الطلب كبيرة جداً', |
|
50 | - 'http_451' => 'غير متوفر لأسباب قانونية', |
|
20 | + // HttpException handler (added in 6.4.0) |
|
21 | + // Error messages for HttpException caught w/o custom messages |
|
22 | + // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
23 | + 'http_400' => 'طلب غير صحيح', |
|
24 | + 'http_401' => 'غير مصرح به', |
|
25 | + 'http_402' => 'الدفع مطلوب', |
|
26 | + 'http_403' => 'ممنوع', |
|
27 | + 'http_404' => 'لا يوجد', |
|
28 | + 'http_405' => 'الأسلوب غير مسموح به', |
|
29 | + 'http_406' => 'غير مقبول', |
|
30 | + 'http_407' => 'مطلوب مصادقة الوكيل', |
|
31 | + 'http_408' => 'انتهاء مهلة الطلب', |
|
32 | + 'http_409' => 'تضارب', |
|
33 | + 'http_410' => 'انتهى', |
|
34 | + 'http_411' => 'الطول مطلوب', |
|
35 | + 'http_412' => 'فشل الشروط المسبقة', |
|
36 | + 'http_413' => 'حمولة كبيرة جدا', |
|
37 | + 'http_414' => 'URI طويل جداً', |
|
38 | + 'http_415' => 'نوع الوسائط غير مدعوم', |
|
39 | + 'http_416' => 'النطاق غير قابل للرضا', |
|
40 | + 'http_417' => 'فشل التوقعات', |
|
41 | + 'http_421' => 'طلب توجيه خاطئ', |
|
42 | + 'http_422' => 'كيان غير قابل ل المعالجة', |
|
43 | + 'http_423' => 'مؤمن', |
|
44 | + 'http_424' => 'إعتمادية فاشلة', |
|
45 | + 'http_425' => 'مبكر جداً', |
|
46 | + 'http_426' => 'الترقية مطلوبة', |
|
47 | + 'http_428' => 'شرط مسبق مطلوب', |
|
48 | + 'http_429' => 'طلبات كثيرة جداً', |
|
49 | + 'http_431' => 'حقول رأس الطلب كبيرة جداً', |
|
50 | + 'http_451' => 'غير متوفر لأسباب قانونية', |
|
51 | 51 | |
52 | - 'http_500' => 'خطأ داخلي في الخادم', |
|
53 | - 'http_501' => 'لم يتم تنفيذه', |
|
54 | - 'http_502' => 'بوابة غير صالحة', |
|
55 | - 'http_503' => 'الخدمة غير متوفرة', |
|
56 | - 'http_504' => 'مهلة المنفذ', |
|
57 | - 'http_505' => 'إصدار HTTP غير مدعوم', |
|
58 | - 'http_506' => 'البديل أيضاً يتفاوض', |
|
59 | - 'http_507' => 'تخزين غير كاف', |
|
60 | - 'http_508' => 'تم الكشف عن حلقة تكرار', |
|
61 | - 'http_509' => 'غير معين', |
|
62 | - 'http_510' => 'غير موسعة', |
|
63 | - 'http_511' => 'مطلوب مصادقة شبكة الاتصال', |
|
52 | + 'http_500' => 'خطأ داخلي في الخادم', |
|
53 | + 'http_501' => 'لم يتم تنفيذه', |
|
54 | + 'http_502' => 'بوابة غير صالحة', |
|
55 | + 'http_503' => 'الخدمة غير متوفرة', |
|
56 | + 'http_504' => 'مهلة المنفذ', |
|
57 | + 'http_505' => 'إصدار HTTP غير مدعوم', |
|
58 | + 'http_506' => 'البديل أيضاً يتفاوض', |
|
59 | + 'http_507' => 'تخزين غير كاف', |
|
60 | + 'http_508' => 'تم الكشف عن حلقة تكرار', |
|
61 | + 'http_509' => 'غير معين', |
|
62 | + 'http_510' => 'غير موسعة', |
|
63 | + 'http_511' => 'مطلوب مصادقة شبكة الاتصال', |
|
64 | 64 | ]; |
@@ -22,19 +22,19 @@ |
||
22 | 22 | */ |
23 | 23 | final class ToArrayConverter implements ConverterContract |
24 | 24 | { |
25 | - /** |
|
26 | - * Returns array representation of the object. |
|
27 | - * |
|
28 | - * @param object $obj Object to be converted |
|
29 | - * @param array $config Converter config array to be used for this object (based on exact class |
|
30 | - * name match or inheritance). |
|
31 | - * |
|
32 | - * @return array |
|
33 | - */ |
|
34 | - public function convert(object $obj, /** @scrutinizer ignore-unused */ array $config): array |
|
35 | - { |
|
36 | - Validator::assertIsObject('obj', $obj); |
|
25 | + /** |
|
26 | + * Returns array representation of the object. |
|
27 | + * |
|
28 | + * @param object $obj Object to be converted |
|
29 | + * @param array $config Converter config array to be used for this object (based on exact class |
|
30 | + * name match or inheritance). |
|
31 | + * |
|
32 | + * @return array |
|
33 | + */ |
|
34 | + public function convert(object $obj, /** @scrutinizer ignore-unused */ array $config): array |
|
35 | + { |
|
36 | + Validator::assertIsObject('obj', $obj); |
|
37 | 37 | |
38 | - return $obj->toArray(null); |
|
39 | - } |
|
38 | + return $obj->toArray(null); |
|
39 | + } |
|
40 | 40 | } |
@@ -40,20 +40,20 @@ |
||
40 | 40 | $array = $original; |
41 | 41 | foreach ($merging as $m_key => $m_val) { |
42 | 42 | if (\array_key_exists($m_key, $original)) { |
43 | - $orig_type = \gettype($original[ $m_key ]); |
|
43 | + $orig_type = \gettype($original[$m_key]); |
|
44 | 44 | $m_type = \gettype($m_val); |
45 | 45 | if ($orig_type !== $m_type) { |
46 | 46 | throw new Ex\IncompatibleTypeException( |
47 | 47 | "mergeConfig(): Cannot merge '{$m_type}' into '{$orig_type}' for key '{$m_key}'."); |
48 | 48 | } |
49 | 49 | |
50 | - if (\is_array($merging[ $m_key ])) { |
|
51 | - $array[ $m_key ] = static::mergeConfig($original[ $m_key ], $m_val); |
|
50 | + if (\is_array($merging[$m_key])) { |
|
51 | + $array[$m_key] = static::mergeConfig($original[$m_key], $m_val); |
|
52 | 52 | } else { |
53 | - $array[ $m_key ] = $m_val; |
|
53 | + $array[$m_key] = $m_val; |
|
54 | 54 | } |
55 | 55 | } else { |
56 | - $array[ $m_key ] = $m_val; |
|
56 | + $array[$m_key] = $m_val; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 |