@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | foreach ($data as $key => $value) { |
| 30 | 30 | try { |
| 31 | 31 | $realValue = $model->getByName($key); |
| 32 | - } catch (\Exception $e) { |
|
| 32 | + }catch (\Exception $e) { |
|
| 33 | 33 | $realValue = $value; |
| 34 | 34 | } |
| 35 | 35 | if (Api::API_MODEL_KEY_FIELD === $key) { |
| 36 | 36 | $result[$key] = (integer)$realValue; |
| 37 | - } else { |
|
| 37 | + }else { |
|
| 38 | 38 | $result[$key] = $realValue; |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @return array |
| 50 | 50 | * @throws \Propel\Runtime\Exception\PropelException |
| 51 | 51 | */ |
| 52 | - public static function mapArrayObject($namespace, ColumnMap $modelPk, array $query, array|ActiveRecordInterface $data = []) |
|
| 52 | + public static function mapArrayObject($namespace, ColumnMap $modelPk, array $query, array | ActiveRecordInterface $data = []) |
|
| 53 | 53 | { |
| 54 | 54 | $formatter = new ObjectFormatter(); |
| 55 | 55 | $formatter->setClass($namespace); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** @var ActiveRecordInterface $obj */ |
| 68 | 68 | $obj = @$formatter->getAllObjectsFromRow($objData); |
| 69 | 69 | $result = self::mapResult($obj, $data); |
| 70 | - if (!preg_match('/' . $modelPk->getPhpName() . '/i', $query[Api::API_FIELDS_RESULT_FIELD])) { |
|
| 70 | + if (!preg_match('/'.$modelPk->getPhpName().'/i', $query[Api::API_FIELDS_RESULT_FIELD])) { |
|
| 71 | 71 | unset($result[$modelPk->getPhpName()]); |
| 72 | 72 | } |
| 73 | 73 | return $result; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | protected function hydrateOrders() |
| 40 | 40 | { |
| 41 | 41 | if (count($this->query)) { |
| 42 | - Logger::log(static::class . ' gathering query string', LOG_DEBUG); |
|
| 42 | + Logger::log(static::class.' gathering query string', LOG_DEBUG); |
|
| 43 | 43 | foreach ($this->query as $key => $value) { |
| 44 | 44 | if ($key === self::API_ORDER_FIELD) { |
| 45 | 45 | $orders = json_decode($value, true); |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | protected function extractPagination() |
| 59 | 59 | { |
| 60 | - Logger::log(static::class . ' extract pagination start', LOG_DEBUG); |
|
| 60 | + Logger::log(static::class.' extract pagination start', LOG_DEBUG); |
|
| 61 | 61 | $page = array_key_exists(self::API_PAGE_FIELD, $this->query) ? $this->query[self::API_PAGE_FIELD] : 1; |
| 62 | 62 | $limit = array_key_exists(self::API_LIMIT_FIELD, $this->query) ? $this->query[self::API_LIMIT_FIELD] : 100; |
| 63 | - Logger::log(static::class . ' extract pagination end', LOG_DEBUG); |
|
| 63 | + Logger::log(static::class.' extract pagination end', LOG_DEBUG); |
|
| 64 | 64 | return array($page, (int)$limit); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | * @param ModelCriteria $query |
| 70 | 70 | * @throws \PSFS\base\exception\ApiException |
| 71 | 71 | */ |
| 72 | - protected function addOrders(ModelCriteria &$query) |
|
| 72 | + protected function addOrders(ModelCriteria & $query) |
|
| 73 | 73 | { |
| 74 | - Logger::log(static::class . ' extract orders start ', LOG_DEBUG); |
|
| 74 | + Logger::log(static::class.' extract orders start ', LOG_DEBUG); |
|
| 75 | 75 | $orderAdded = FALSE; |
| 76 | 76 | $tableMap = $this->getTableMap(); |
| 77 | 77 | foreach ($this->order->getOrders() as $field => $direction) { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $orderAdded = TRUE; |
| 80 | 80 | if ($direction === Order::ASC) { |
| 81 | 81 | $query->addAscendingOrderByColumn($column->getPhpName()); |
| 82 | - } else { |
|
| 82 | + }else { |
|
| 83 | 83 | $query->addDescendingOrderByColumn($column->getPhpName()); |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $query->addAscendingOrderByColumn($key); |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | - Logger::log(static::class . ' extract orders end', LOG_DEBUG); |
|
| 93 | + Logger::log(static::class.' extract orders end', LOG_DEBUG); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @param ModelCriteria $query |
| 100 | 100 | */ |
| 101 | - protected function addFilters(ModelCriteria &$query) |
|
| 101 | + protected function addFilters(ModelCriteria & $query) |
|
| 102 | 102 | { |
| 103 | 103 | if (count($this->query) > 0) { |
| 104 | 104 | $tableMap = $this->getTableMap(); |
@@ -126,10 +126,10 @@ discard block |
||
| 126 | 126 | $this->checkReturnFields($query); |
| 127 | 127 | if ($limit === -1) { |
| 128 | 128 | $this->list = $query->find($this->con); |
| 129 | - } else { |
|
| 129 | + }else { |
|
| 130 | 130 | $this->list = $query->paginate($page, $limit, $this->con); |
| 131 | 131 | } |
| 132 | - } catch (\Exception $e) { |
|
| 132 | + }catch (\Exception $e) { |
|
| 133 | 133 | Logger::log($e->getMessage(), LOG_ERR); |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | $header = null; |
| 138 | 138 | if ($this->hasHeader($name)) { |
| 139 | 139 | $header = $this->header[$name]; |
| 140 | - } else if (array_key_exists('h_' . strtolower($name), $this->query)) { |
|
| 141 | - $header = $this->query['h_' . strtolower($name)]; |
|
| 142 | - } else if (array_key_exists('HTTP_' . strtoupper(str_replace('-', '_', $name)), $this->server)) { |
|
| 143 | - $header = $this->getServer('HTTP_' . strtoupper(str_replace('-', '_', $name))); |
|
| 140 | + }else if (array_key_exists('h_'.strtolower($name), $this->query)) { |
|
| 141 | + $header = $this->query['h_'.strtolower($name)]; |
|
| 142 | + }else if (array_key_exists('HTTP_'.strtoupper(str_replace('-', '_', $name)), $this->server)) { |
|
| 143 | + $header = $this->getServer('HTTP_'.strtoupper(str_replace('-', '_', $name))); |
|
| 144 | 144 | } |
| 145 | 145 | return $header ?: $default; |
| 146 | 146 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $url = $this->getServer('HTTP_ORIGIN'); |
| 255 | 255 | } |
| 256 | 256 | ob_start(); |
| 257 | - header('Location: ' . $url); |
|
| 257 | + header('Location: '.$url); |
|
| 258 | 258 | ob_end_clean(); |
| 259 | 259 | Security::getInstance()->updateSession(); |
| 260 | 260 | exit(t('Redirect...')); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $url = $this->getServerName(); |
| 271 | 271 | $protocol = $hasProtocol ? $this->getProtocol() : '//'; |
| 272 | 272 | if (!empty($protocol)) { |
| 273 | - $url = $protocol . $url; |
|
| 273 | + $url = $protocol.$url; |
|
| 274 | 274 | } |
| 275 | 275 | return $this->checkServerPort($url); |
| 276 | 276 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | if (!in_array($port, [80, 443], true)) { |
| 294 | - $url .= ':' . $port; |
|
| 294 | + $url .= ':'.$port; |
|
| 295 | 295 | } |
| 296 | 296 | return $url; |
| 297 | 297 | } |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $filePath = ''; |
| 48 | 48 | if (!file_exists($filePath)) { |
| 49 | - $filePath = BASE_DIR . $string; |
|
| 49 | + $filePath = BASE_DIR.$string; |
|
| 50 | 50 | } |
| 51 | 51 | $filenamePath = AssetsHelper::findDomainPath($string, $filePath); |
| 52 | 52 | |
| 53 | 53 | $filePath = self::processAsset($string, $name, $return, $filenamePath); |
| 54 | 54 | $basePath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl(false)); |
| 55 | - $returnPath = empty($name) ? $basePath . '/' . $filePath : $name; |
|
| 55 | + $returnPath = empty($name) ? $basePath.'/'.$filePath : $name; |
|
| 56 | 56 | return $return ? $returnPath : ''; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $router = Router::getInstance(); |
| 70 | 70 | try { |
| 71 | 71 | return $router->getRoute($path, $absolute, $params); |
| 72 | - } catch (\Exception $e) { |
|
| 72 | + }catch (\Exception $e) { |
|
| 73 | 73 | Logger::log($e->getMessage()); |
| 74 | 74 | return $router->getRoute('', $absolute, $params); |
| 75 | 75 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $filenamePath = self::extractPathname($path, $domains); |
| 166 | 166 | // Check if resources has been copied to public folders |
| 167 | 167 | if (!$debug) { |
| 168 | - $cacheFilename = Config::getParam('cache.var', '__initial__') . '.file.cache'; |
|
| 168 | + $cacheFilename = Config::getParam('cache.var', '__initial__').'.file.cache'; |
|
| 169 | 169 | $cachedFiles = Cache::getInstance()->readFromCache($cacheFilename, |
| 170 | 170 | 1, fn() => [], Cache::JSON, true) ?: []; |
| 171 | 171 | // Force the resource copy |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * |
| 187 | 187 | * @return string|array |
| 188 | 188 | */ |
| 189 | - private static function extractPathname(string $path, $domains): string|array |
|
| 189 | + private static function extractPathname(string $path, $domains): string | array |
|
| 190 | 190 | { |
| 191 | 191 | $filenamePath = $path; |
| 192 | 192 | if (!empty($domains) && !file_exists($path)) { |
@@ -225,13 +225,13 @@ discard block |
||
| 225 | 225 | * @param string $base |
| 226 | 226 | * @param string $filePath |
| 227 | 227 | */ |
| 228 | - private static function putResourceContent(string|null $name, string $filenamePath, string $base, string $filePath): void |
|
| 228 | + private static function putResourceContent(string | null $name, string $filenamePath, string $base, string $filePath): void |
|
| 229 | 229 | { |
| 230 | 230 | $data = file_get_contents($filenamePath); |
| 231 | 231 | if (!empty($name)) { |
| 232 | - file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data); |
|
| 233 | - } else { |
|
| 234 | - file_put_contents($base . $filePath, $data); |
|
| 232 | + file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data); |
|
| 233 | + }else { |
|
| 234 | + file_put_contents($base.$filePath, $data); |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
@@ -244,15 +244,15 @@ discard block |
||
| 244 | 244 | * @return string |
| 245 | 245 | * @throws GeneratorException |
| 246 | 246 | */ |
| 247 | - private static function processAsset(string $string, string|null $name = null, bool $return = true, string $filenamePath = ''): string |
|
| 247 | + private static function processAsset(string $string, string | null $name = null, bool $return = true, string $filenamePath = ''): string |
|
| 248 | 248 | { |
| 249 | 249 | $filePath = $filenamePath; |
| 250 | 250 | if (file_exists($filenamePath)) { |
| 251 | 251 | list($base, $htmlBase, $filePath) = AssetsHelper::calculateAssetPath($string, $name, $return, $filenamePath); |
| 252 | 252 | //Creamos el directorio si no existe |
| 253 | - GeneratorHelper::createDir($base . $htmlBase); |
|
| 253 | + GeneratorHelper::createDir($base.$htmlBase); |
|
| 254 | 254 | //Si se ha modificado |
| 255 | - if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($filenamePath)) { |
|
| 255 | + if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($filenamePath)) { |
|
| 256 | 256 | if ($htmlBase === 'css') { |
| 257 | 257 | self::processCssLines($filenamePath); |
| 258 | 258 | } |