@@ -141,7 +141,7 @@ |
||
141 | 141 | $tmp = []; |
142 | 142 | if (null === $node) { |
143 | 143 | $node = $value; |
144 | - } else { |
|
144 | + }else { |
|
145 | 145 | $tmp = $this->getTmpAttribute($node); |
146 | 146 | } |
147 | 147 | if (null !== $node) { |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | $customKey = $customKey ?: Security::getInstance()->getSessionKey(self::CUSTOM_LOCALE_SESSION_KEY); |
55 | 55 | } |
56 | 56 | if (null !== $customKey) { |
57 | - Logger::log('[' . self::class . '] Custom key detected: ' . $customKey, LOG_INFO); |
|
58 | - self::$filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', $customKey, self::$locale . '.json']); |
|
59 | - } else { |
|
60 | - self::$filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', self::$locale . '.json']); |
|
57 | + Logger::log('['.self::class.'] Custom key detected: '.$customKey, LOG_INFO); |
|
58 | + self::$filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', $customKey, self::$locale.'.json']); |
|
59 | + }else { |
|
60 | + self::$filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', self::$locale.'.json']); |
|
61 | 61 | } |
62 | 62 | if (file_exists(self::$filename)) { |
63 | - Logger::log('[' . self::class . '] Custom locale detected: ' . $customKey . ' [' . self::$locale . ']', LOG_INFO); |
|
63 | + Logger::log('['.self::class.'] Custom locale detected: '.$customKey.' ['.self::$locale.']', LOG_INFO); |
|
64 | 64 | self::$translations = json_decode(file_get_contents(self::$filename), true); |
65 | 65 | } elseif (null !== $customKey) { |
66 | 66 | self::checkLoad(null, $forceReload, true); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function getFilters() |
82 | 82 | { |
83 | 83 | return array( |
84 | - new TwigFilter('trans', function ($message) { |
|
84 | + new TwigFilter('trans', function($message) { |
|
85 | 85 | return self::_($message); |
86 | 86 | }), |
87 | 87 | ); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | self::checkLoad($customKey, $forceReload); |
107 | 107 | if (array_key_exists($message, self::$translations)) { |
108 | 108 | $translation = self::$translations[$message]; |
109 | - } else { |
|
109 | + }else { |
|
110 | 110 | $translation = gettext($message); |
111 | 111 | } |
112 | 112 | if (self::$generate) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | protected $isMultipart = false; |
71 | 71 | |
72 | 72 | private function closeConnection() { |
73 | - if(null !== $this->con) { |
|
73 | + if (null !== $this->con) { |
|
74 | 74 | curl_close($this->con); |
75 | 75 | } |
76 | 76 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function setIsJson($isJson = true) { |
235 | 235 | $this->isJson = $isJson; |
236 | - if($isJson) { |
|
236 | + if ($isJson) { |
|
237 | 237 | $this->setIsMultipart(false); |
238 | 238 | } |
239 | 239 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function setIsMultipart($isMultipart = true) { |
252 | 252 | $this->isMultipart = $isMultipart; |
253 | - if($isMultipart) { |
|
253 | + if ($isMultipart) { |
|
254 | 254 | $this->setIsJson(false); |
255 | 255 | } |
256 | 256 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $this->url = NULL; |
271 | 271 | $this->params = array(); |
272 | 272 | $this->headers = array(); |
273 | - Logger::log('Context service for ' . static::class . ' cleared!'); |
|
273 | + Logger::log('Context service for '.static::class.' cleared!'); |
|
274 | 274 | $this->closeConnection(); |
275 | 275 | } |
276 | 276 | |
@@ -313,18 +313,18 @@ discard block |
||
313 | 313 | } |
314 | 314 | |
315 | 315 | protected function applyOptions() { |
316 | - if(count($this->options)) { |
|
316 | + if (count($this->options)) { |
|
317 | 317 | curl_setopt_array($this->con, $this->options); |
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
321 | 321 | protected function applyHeaders() { |
322 | 322 | $headers = []; |
323 | - foreach($this->headers as $key => $value) { |
|
324 | - $headers[] = $key . ': ' . $value; |
|
323 | + foreach ($this->headers as $key => $value) { |
|
324 | + $headers[] = $key.': '.$value; |
|
325 | 325 | } |
326 | 326 | $headers[self::PSFS_TRACK_HEADER] = Logger::getUid(); |
327 | - if(count($headers)) { |
|
327 | + if (count($headers)) { |
|
328 | 328 | curl_setopt($this->con, CURLOPT_HTTPHEADER, $headers); |
329 | 329 | } |
330 | 330 | } |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | * @return int |
334 | 334 | */ |
335 | 335 | private function parseServiceType() { |
336 | - if($this->getIsJson()) { |
|
336 | + if ($this->getIsJson()) { |
|
337 | 337 | return ServiceHelper::TYPE_JSON; |
338 | 338 | } |
339 | - if($this->getIsMultipart()) { |
|
339 | + if ($this->getIsMultipart()) { |
|
340 | 340 | return ServiceHelper::TYPE_MULTIPART; |
341 | 341 | } |
342 | 342 | return ServiceHelper::TYPE_HTTP; |
@@ -349,9 +349,9 @@ discard block |
||
349 | 349 | case Request::VERB_GET: |
350 | 350 | default: |
351 | 351 | $this->addOption(CURLOPT_CUSTOMREQUEST, Request::VERB_GET); |
352 | - if(!empty($this->params)) { |
|
352 | + if (!empty($this->params)) { |
|
353 | 353 | $sep = false === strpos($this->getUrl(), '?') ? '?' : ''; |
354 | - $this->url = $this->url . $sep . http_build_query($this->params); |
|
354 | + $this->url = $this->url.$sep.http_build_query($this->params); |
|
355 | 355 | } |
356 | 356 | break; |
357 | 357 | case Request::VERB_POST: |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | $this->applyOptions(); |
384 | 384 | $this->applyHeaders(); |
385 | 385 | $verbose = null; |
386 | - if('debug' === Config::getParam('log.level')) { |
|
386 | + if ('debug' === Config::getParam('log.level')) { |
|
387 | 387 | curl_setopt($this->con, CURLOPT_VERBOSE, true); |
388 | 388 | $verbose = fopen('php://temp', 'wb+'); |
389 | 389 | curl_setopt($this->con, CURLOPT_STDERR, $verbose); |
390 | 390 | } |
391 | 391 | $result = curl_exec($this->con); |
392 | 392 | $this->setResult($this->isJson ? json_decode($result, true) : $result); |
393 | - if('debug' === Config::getParam('log.level')) { |
|
393 | + if ('debug' === Config::getParam('log.level')) { |
|
394 | 394 | rewind($verbose); |
395 | 395 | $verboseLog = stream_get_contents($verbose); |
396 | 396 | Logger::log($verboseLog, LOG_DEBUG, [ |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | ]); |
401 | 401 | $this->info['verbose'] = $verboseLog; |
402 | 402 | } |
403 | - Logger::log($this->url . ' response: ', LOG_DEBUG, is_array($this->result) ? $this->result : [$this->result]); |
|
403 | + Logger::log($this->url.' response: ', LOG_DEBUG, is_array($this->result) ? $this->result : [$this->result]); |
|
404 | 404 | $this->info = array_merge($this->info, curl_getinfo($this->con)); |
405 | 405 | } |
406 | 406 |