@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | { |
| 210 | 210 | $lines = file($filename, FILE_IGNORE_NEW_LINES); |
| 211 | 211 | |
| 212 | - if(!$lines) { |
|
| 212 | + if (!$lines) { |
|
| 213 | 213 | return []; |
| 214 | 214 | } |
| 215 | 215 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function fileName(string $path): string |
| 229 | 229 | { |
| 230 | - return (string)pathinfo($path, PATHINFO_FILENAME); |
|
| 230 | + return (string) pathinfo($path, PATHINFO_FILENAME); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function extension(string $path): string |
| 239 | 239 | { |
| 240 | - return (string)pathinfo($path, PATHINFO_EXTENSION); |
|
| 240 | + return (string) pathinfo($path, PATHINFO_EXTENSION); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | if (!empty($value)) { |
| 83 | 83 | $captcha = CaptchaManager::getHandler(); |
| 84 | 84 | |
| 85 | - if (!$captcha->verify($value)){ |
|
| 85 | + if (!$captcha->verify($value)) { |
|
| 86 | 86 | $this->addError($field, 'captcha', $param); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -124,8 +124,9 @@ |
||
| 124 | 124 | */ |
| 125 | 125 | public function verify(string $code): bool |
| 126 | 126 | { |
| 127 | - if (is_null($this->secretKey)) |
|
| 128 | - throw new Exception('The secret key is not set'); |
|
| 127 | + if (is_null($this->secretKey)) { |
|
| 128 | + throw new Exception('The secret key is not set'); |
|
| 129 | + } |
|
| 129 | 130 | |
| 130 | 131 | if (empty($code)) { |
| 131 | 132 | $this->errorCodes = ['internal-empty-response']; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $this->matchedRoutes = $this->findMatches($uri); |
| 103 | 103 | |
| 104 | 104 | if (empty($this->matchedRoutes)) { |
| 105 | - stop(function () { |
|
| 105 | + stop(function() { |
|
| 106 | 106 | $this->handleNotFound(); |
| 107 | 107 | }); |
| 108 | 108 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $routePattern = '(\/)?'; |
| 204 | 204 | $routeParams = []; |
| 205 | 205 | |
| 206 | - $lastIndex = (int)array_key_last($routeSegments); |
|
| 206 | + $lastIndex = (int) array_key_last($routeSegments); |
|
| 207 | 207 | |
| 208 | 208 | foreach ($routeSegments as $index => $segment) { |
| 209 | 209 | $segmentParam = $this->getSegmentParam($segment, $index, $lastIndex); |
@@ -182,20 +182,20 @@ |
||
| 182 | 182 | self::$connection = $config; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - public function setData(array $data) |
|
| 186 | - { |
|
| 187 | - $this->data = $data; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - public function setModifiedFields($modifiedFields) |
|
| 191 | - { |
|
| 192 | - $this->modifiedFields = $modifiedFields; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - public function setIsNew($isNew) |
|
| 196 | - { |
|
| 197 | - $this->isNew = $isNew; |
|
| 198 | - } |
|
| 185 | + public function setData(array $data) |
|
| 186 | + { |
|
| 187 | + $this->data = $data; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + public function setModifiedFields($modifiedFields) |
|
| 191 | + { |
|
| 192 | + $this->modifiedFields = $modifiedFields; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + public function setIsNew($isNew) |
|
| 196 | + { |
|
| 197 | + $this->isNew = $isNew; |
|
| 198 | + } |
|
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | 201 | * @inheritDoc |
@@ -35,15 +35,15 @@ |
||
| 35 | 35 | return $this->getOrmModel()->find_many(); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @param int $perPage |
|
| 40 | - * @param int $currentPage |
|
| 41 | - * @return PaginatorInterface |
|
| 42 | - */ |
|
| 43 | - public function paginate(int $perPage, int $currentPage = 1): PaginatorInterface |
|
| 44 | - { |
|
| 45 | - return new Paginator($this, $perPage, $currentPage); |
|
| 46 | - } |
|
| 38 | + /** |
|
| 39 | + * @param int $perPage |
|
| 40 | + * @param int $currentPage |
|
| 41 | + * @return PaginatorInterface |
|
| 42 | + */ |
|
| 43 | + public function paginate(int $perPage, int $currentPage = 1): PaginatorInterface |
|
| 44 | + { |
|
| 45 | + return new Paginator($this, $perPage, $currentPage); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * @inheritDoc |
@@ -144,12 +144,12 @@ |
||
| 144 | 144 | */ |
| 145 | 145 | public function get(); |
| 146 | 146 | |
| 147 | - /** |
|
| 148 | - * @param int $perPage |
|
| 149 | - * @param int $currentPage |
|
| 150 | - * @return PaginatorInterface |
|
| 151 | - */ |
|
| 152 | - public function paginate(int $perPage, int $currentPage = 1): PaginatorInterface; |
|
| 147 | + /** |
|
| 148 | + * @param int $perPage |
|
| 149 | + * @param int $currentPage |
|
| 150 | + * @return PaginatorInterface |
|
| 151 | + */ |
|
| 152 | + public function paginate(int $perPage, int $currentPage = 1): PaginatorInterface; |
|
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | 155 | * Returns the count |
@@ -4,35 +4,35 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface PaginatorInterface |
| 6 | 6 | { |
| 7 | - public function getPagination(bool $withBaseUrl): ?string; |
|
| 7 | + public function getPagination(bool $withBaseUrl): ?string; |
|
| 8 | 8 | |
| 9 | - public function currentPageNumber(): int; |
|
| 9 | + public function currentPageNumber(): int; |
|
| 10 | 10 | |
| 11 | - public function currentPageLink(bool $withBaseUrl): ?string; |
|
| 11 | + public function currentPageLink(bool $withBaseUrl): ?string; |
|
| 12 | 12 | |
| 13 | - public function previousPageLink(bool $withBaseUrl): ?string; |
|
| 13 | + public function previousPageLink(bool $withBaseUrl): ?string; |
|
| 14 | 14 | |
| 15 | - public function previousPageNumber(): ?int; |
|
| 15 | + public function previousPageNumber(): ?int; |
|
| 16 | 16 | |
| 17 | - public function firstPageLink(bool $withBaseUrl): ?string; |
|
| 17 | + public function firstPageLink(bool $withBaseUrl): ?string; |
|
| 18 | 18 | |
| 19 | - public function nextPageLink(bool $withBaseUrl): ?string; |
|
| 19 | + public function nextPageLink(bool $withBaseUrl): ?string; |
|
| 20 | 20 | |
| 21 | - public function nextPageNumber(): ?int; |
|
| 21 | + public function nextPageNumber(): ?int; |
|
| 22 | 22 | |
| 23 | - public function lastPageLink(bool $withBaseUrl): ?string; |
|
| 23 | + public function lastPageLink(bool $withBaseUrl): ?string; |
|
| 24 | 24 | |
| 25 | - public function lastPageNumber(); |
|
| 25 | + public function lastPageNumber(); |
|
| 26 | 26 | |
| 27 | - public function firstItem(); |
|
| 27 | + public function firstItem(); |
|
| 28 | 28 | |
| 29 | - public function lastItem(); |
|
| 29 | + public function lastItem(); |
|
| 30 | 30 | |
| 31 | - public function perPage(); |
|
| 31 | + public function perPage(); |
|
| 32 | 32 | |
| 33 | - public function total(); |
|
| 33 | + public function total(); |
|
| 34 | 34 | |
| 35 | - public function links(bool $withBaseUrl); |
|
| 35 | + public function links(bool $withBaseUrl); |
|
| 36 | 36 | |
| 37 | - public function data(); |
|
| 37 | + public function data(); |
|
| 38 | 38 | } |
@@ -11,67 +11,67 @@ |
||
| 11 | 11 | |
| 12 | 12 | class Paginator extends BasePaginator |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * @var SleekDbal |
|
| 16 | - */ |
|
| 17 | - private $dbal; |
|
| 14 | + /** |
|
| 15 | + * @var SleekDbal |
|
| 16 | + */ |
|
| 17 | + private $dbal; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var array |
|
| 21 | - */ |
|
| 22 | - public $data; |
|
| 19 | + /** |
|
| 20 | + * @var array |
|
| 21 | + */ |
|
| 22 | + public $data; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @param $sleekDbal |
|
| 26 | - * @param int $perPage |
|
| 27 | - * @param int $page |
|
| 28 | - * @throws DatabaseException |
|
| 29 | - * @throws ModelException |
|
| 30 | - * @throws IOException |
|
| 31 | - * @throws InvalidArgumentException |
|
| 32 | - * @throws InvalidConfigurationException |
|
| 33 | - */ |
|
| 34 | - public function __construct($sleekDbal, int $perPage, int $page = 1) |
|
| 35 | - { |
|
| 36 | - /** @var SleekDbal $sleekDbal */ |
|
| 37 | - $this->total = count($sleekDbal->getBuilder()->getQuery()->fetch()); |
|
| 38 | - $this->dbal = $sleekDbal; |
|
| 39 | - $this->dbal->limit($perPage)->offset($perPage * ($page - 1)); |
|
| 40 | - $this->data = $this->dbal->getBuilder()->getQuery()->fetch(); |
|
| 41 | - $this->perPage = $perPage; |
|
| 42 | - $this->page = $page; |
|
| 43 | - $this->baseUrl = base_url(); |
|
| 44 | - } |
|
| 24 | + /** |
|
| 25 | + * @param $sleekDbal |
|
| 26 | + * @param int $perPage |
|
| 27 | + * @param int $page |
|
| 28 | + * @throws DatabaseException |
|
| 29 | + * @throws ModelException |
|
| 30 | + * @throws IOException |
|
| 31 | + * @throws InvalidArgumentException |
|
| 32 | + * @throws InvalidConfigurationException |
|
| 33 | + */ |
|
| 34 | + public function __construct($sleekDbal, int $perPage, int $page = 1) |
|
| 35 | + { |
|
| 36 | + /** @var SleekDbal $sleekDbal */ |
|
| 37 | + $this->total = count($sleekDbal->getBuilder()->getQuery()->fetch()); |
|
| 38 | + $this->dbal = $sleekDbal; |
|
| 39 | + $this->dbal->limit($perPage)->offset($perPage * ($page - 1)); |
|
| 40 | + $this->data = $this->dbal->getBuilder()->getQuery()->fetch(); |
|
| 41 | + $this->perPage = $perPage; |
|
| 42 | + $this->page = $page; |
|
| 43 | + $this->baseUrl = base_url(); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @return mixed |
|
| 48 | - */ |
|
| 49 | - public function firstItem() |
|
| 50 | - { |
|
| 51 | - return $this->data[array_key_first($this->data)]; |
|
| 52 | - } |
|
| 46 | + /** |
|
| 47 | + * @return mixed |
|
| 48 | + */ |
|
| 49 | + public function firstItem() |
|
| 50 | + { |
|
| 51 | + return $this->data[array_key_first($this->data)]; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @return mixed |
|
| 56 | - */ |
|
| 57 | - public function lastItem() |
|
| 58 | - { |
|
| 59 | - return $this->data[array_key_last($this->data)]; |
|
| 60 | - } |
|
| 54 | + /** |
|
| 55 | + * @return mixed |
|
| 56 | + */ |
|
| 57 | + public function lastItem() |
|
| 58 | + { |
|
| 59 | + return $this->data[array_key_last($this->data)]; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @return array|SleekDbal[] |
|
| 64 | - */ |
|
| 65 | - public function data(): array |
|
| 66 | - { |
|
| 67 | - $result = array_map(function ($element) { |
|
| 68 | - $item = clone $this->dbal; |
|
| 69 | - $item->setData($element); |
|
| 70 | - $item->setModifiedFields($element); |
|
| 71 | - $item->setIsNew(false); |
|
| 72 | - return $item; |
|
| 73 | - }, $this->data); |
|
| 62 | + /** |
|
| 63 | + * @return array|SleekDbal[] |
|
| 64 | + */ |
|
| 65 | + public function data(): array |
|
| 66 | + { |
|
| 67 | + $result = array_map(function ($element) { |
|
| 68 | + $item = clone $this->dbal; |
|
| 69 | + $item->setData($element); |
|
| 70 | + $item->setModifiedFields($element); |
|
| 71 | + $item->setIsNew(false); |
|
| 72 | + return $item; |
|
| 73 | + }, $this->data); |
|
| 74 | 74 | |
| 75 | - return $result ?? []; |
|
| 76 | - } |
|
| 75 | + return $result ?? []; |
|
| 76 | + } |
|
| 77 | 77 | } |
| 78 | 78 | \ No newline at end of file |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | */ |
| 65 | 65 | public function data(): array |
| 66 | 66 | { |
| 67 | - $result = array_map(function ($element) { |
|
| 67 | + $result = array_map(function($element) { |
|
| 68 | 68 | $item = clone $this->dbal; |
| 69 | 69 | $item->setData($element); |
| 70 | 70 | $item->setModifiedFields($element); |