@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | echo "Running...".PHP_EOL; |
| 20 | 20 | |
| 21 | - if(is_dir($this->sass_directory)) { |
|
| 21 | + if (is_dir($this->sass_directory)) { |
|
| 22 | 22 | // Clean output folder |
| 23 | 23 | array_map('unlink', array_filter((array) glob($this->css_directory."*"))); |
| 24 | 24 | |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | $this->updateMainFiles(); |
| 29 | 29 | |
| 30 | 30 | // Compile the files |
| 31 | - foreach($this->fileHashes as $file => $hash) { |
|
| 31 | + foreach ($this->fileHashes as $file => $hash) { |
|
| 32 | 32 | |
| 33 | 33 | $file = realpath($file); |
| 34 | 34 | $fileDependancies = $this->compileFile($file); |
| 35 | 35 | $this->fileHashes[$file] = filemtime($file); |
| 36 | 36 | $this->dependancyTree[$file] = $fileDependancies; |
| 37 | - foreach($fileDependancies as $dep) { |
|
| 37 | + foreach ($fileDependancies as $dep) { |
|
| 38 | 38 | $this->fileHashes[realpath($dep)] = filemtime($dep); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | echo "Dependancies tree built.".PHP_EOL.PHP_EOL; |
| 44 | 44 | |
| 45 | 45 | // Compute md5 hash for files |
| 46 | - foreach($this->dependancyTree as $file => $where) { |
|
| 46 | + foreach ($this->dependancyTree as $file => $where) { |
|
| 47 | 47 | $fileHashes[$file] = filemtime($file); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -68,24 +68,24 @@ discard block |
||
| 68 | 68 | //Start the PHP built-in web server |
| 69 | 69 | $command = sprintf('php -S localhost:5555 -t %s %s/webserver.php', $this->application, $this->application); |
| 70 | 70 | $this->webServerProcess = proc_open($command, [STDIN, STDOUT, STDERR], $pipes); |
| 71 | - while(true) { |
|
| 72 | - if($this->compile_sass) { |
|
| 71 | + while (true) { |
|
| 72 | + if ($this->compile_sass) { |
|
| 73 | 73 | $this->cleanDeletedFiles(); |
| 74 | 74 | $this->updateMainFiles(); |
| 75 | - foreach($this->fileHashes as $file => $hash) { |
|
| 75 | + foreach ($this->fileHashes as $file => $hash) { |
|
| 76 | 76 | $file = realpath($file); |
| 77 | - if(file_exists($file)) { |
|
| 77 | + if (file_exists($file)) { |
|
| 78 | 78 | $newHash = filemtime($file); |
| 79 | - if($newHash != $hash) { |
|
| 79 | + if ($newHash != $hash) { |
|
| 80 | 80 | echo "\e[93mFile $file modified!\e[39m".PHP_EOL; |
| 81 | 81 | $this->fileHashes[$file] = $newHash; |
| 82 | 82 | |
| 83 | 83 | // if it's a main file |
| 84 | - if(key_exists($file, $this->dependancyTree)) { |
|
| 84 | + if (key_exists($file, $this->dependancyTree)) { |
|
| 85 | 85 | $this->dependancyTree[$file] = $this->compileFile($file); |
| 86 | 86 | } else { // if it's an included file |
| 87 | - foreach($this->dependancyTree as $main => $dependancies) { |
|
| 88 | - if(in_array($file, $dependancies)) { |
|
| 87 | + foreach ($this->dependancyTree as $main => $dependancies) { |
|
| 88 | + if (in_array($file, $dependancies)) { |
|
| 89 | 89 | $this->dependancyTree[$main] = $this->compileFile($main); |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | public function cleanDeletedFiles() |
| 114 | 114 | { |
| 115 | 115 | |
| 116 | - foreach($this->fileHashes as $file => $hash) { |
|
| 117 | - if(!file_exists($file)) { |
|
| 116 | + foreach ($this->fileHashes as $file => $hash) { |
|
| 117 | + if (!file_exists($file)) { |
|
| 118 | 118 | unset($fileHashes[$file]); |
| 119 | - foreach($this->dependancyTree as $main => $dependancies) { |
|
| 120 | - if($main == $file) { |
|
| 119 | + foreach ($this->dependancyTree as $main => $dependancies) { |
|
| 120 | + if ($main == $file) { |
|
| 121 | 121 | unset($this->dependancyTree[$main]); |
| 122 | 122 | } |
| 123 | - if(in_array($file, $dependancies)) { |
|
| 123 | + if (in_array($file, $dependancies)) { |
|
| 124 | 124 | $key = array_search($file, $dependancies); |
| 125 | 125 | unset($this->dependancyTree[$main][$key]); |
| 126 | 126 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | if (is_file($inputFile)) { |
| 141 | 141 | // Set the path to the output CSS file |
| 142 | 142 | $outputFile = preg_replace('/(.*)\.(sass|scss)$/', '$1.css', basename($inputFile)); |
| 143 | - $outputFile = $this->css_directory.$outputFile; |
|
| 143 | + $outputFile = $this->css_directory.$outputFile; |
|
| 144 | 144 | // Compile the SCSS code into CSS |
| 145 | 145 | try { |
| 146 | 146 | $result = $compiler->compileString(file_get_contents($inputFile)); |
@@ -175,14 +175,14 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | public function updateMainFiles() |
| 177 | 177 | { |
| 178 | - $files = glob($this->sass_directory . '/*'); // Get all files in the directory |
|
| 178 | + $files = glob($this->sass_directory.'/*'); // Get all files in the directory |
|
| 179 | 179 | |
| 180 | 180 | |
| 181 | 181 | foreach ($files as $file) { |
| 182 | 182 | $file = realpath($file); |
| 183 | - $pattern = '/^\/.+\/[^_]*[.](scss|sass)/'; // Specify the regex pattern for file names |
|
| 184 | - if(preg_match($pattern, $file)) { |
|
| 185 | - if(! array_key_exists($file, $this->fileHashes)) { |
|
| 183 | + $pattern = '/^\/.+\/[^_]*[.](scss|sass)/'; // Specify the regex pattern for file names |
|
| 184 | + if (preg_match($pattern, $file)) { |
|
| 185 | + if (!array_key_exists($file, $this->fileHashes)) { |
|
| 186 | 186 | $this->fileHashes[$file] = 0; |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | // Add base_url to $pattern, if needed |
| 28 | 28 | |
| 29 | - $link = "%s/%s"; |
|
| 29 | + $link = "%s/%s"; |
|
| 30 | 30 | $pattern = sprintf($link, Application::getAppConfig()->base_url, $pattern); |
| 31 | 31 | // If it matches, return the match |
| 32 | 32 | $parameters = $resolver->match($pattern); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | // Check if callback is a controller method |
| 35 | 35 | $controller = $callback[0]; |
| 36 | 36 | $method = $callback[1]; |
| 37 | - if (! method_exists($controller, $method)) { |
|
| 37 | + if (!method_exists($controller, $method)) { |
|
| 38 | 38 | throw new Exceptions\ControllerNotFoundException("Invalid Controller and/or method in routes.php"); |
| 39 | 39 | } |
| 40 | 40 | return new MatchRoute(controller: $controller, method: $method, parameters: $parameters); |
@@ -51,25 +51,25 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | protected function handle(BaseMatch $matcher): HttpResponse |
| 53 | 53 | { |
| 54 | - if($matcher instanceof Match404) { |
|
| 54 | + if ($matcher instanceof Match404) { |
|
| 55 | 55 | return new NotFoundResponse(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if($matcher instanceof MatchRoute) { |
|
| 58 | + if ($matcher instanceof MatchRoute) { |
|
| 59 | 59 | |
| 60 | - foreach($this->middlewares as $middleware => $args){ |
|
| 60 | + foreach ($this->middlewares as $middleware => $args) { |
|
| 61 | 61 | $middlewareInstance = new $middleware(); |
| 62 | 62 | $middlewareInstance->addMatcher($matcher); |
| 63 | 63 | $middlewareInstance->setRequest($this->request); |
| 64 | 64 | $middlewareResult = $middlewareInstance(...$args); |
| 65 | - if($middlewareResult instanceof HttpResponse){ |
|
| 65 | + if ($middlewareResult instanceof HttpResponse) { |
|
| 66 | 66 | return $middlewareResult; |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | Application::$controller = $matcher->controller; |
| 71 | 71 | $controller = new $matcher->controller(); |
| 72 | - $method = $matcher->method; |
|
| 72 | + $method = $matcher->method; |
|
| 73 | 73 | return $controller->$method(...$matcher->parameters); |
| 74 | 74 | } |
| 75 | 75 | throw new \Exception("Wrong matcher!"); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | $root = Application::$documentRoot; |
| 19 | 19 | $root .= Application::getAppConfig()->base_url; |
| 20 | - $filePath = $root."/".Application::getAppConfig()->static_files_dir. "/". $url; |
|
| 20 | + $filePath = $root."/".Application::getAppConfig()->static_files_dir."/".$url; |
|
| 21 | 21 | |
| 22 | 22 | // Check if the file exists |
| 23 | 23 | if (file_exists($filePath)) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public function handle($match): FileResponse|NotFoundResponse{ |
| 60 | - if($match instanceof Match404){ |
|
| 60 | + if ($match instanceof Match404) { |
|
| 61 | 61 | return new NotFoundResponse(); |
| 62 | 62 | } |
| 63 | 63 | return new FileResponse($match->filePath, $match->contentType); |
@@ -14,18 +14,17 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | protected function handle(mixed ...$middlewareParams): HttpResponse|Request |
| 16 | 16 | { |
| 17 | - if($this->match instanceof MatchRoute) { |
|
| 17 | + if ($this->match instanceof MatchRoute) { |
|
| 18 | 18 | $reflection = new \ReflectionMethod($this->match->controller, $this->match->method); |
| 19 | 19 | $attributes = $reflection->getAttributes(); |
| 20 | 20 | |
| 21 | 21 | foreach ($attributes as $attribute) { |
| 22 | - if(is_subclass_of($attribute->getName(), AbstractAccessControlAttribute::class)) { |
|
| 22 | + if (is_subclass_of($attribute->getName(), AbstractAccessControlAttribute::class)) { |
|
| 23 | 23 | return |
| 24 | - $this->checkPermissions($attribute->getName(), ...($attribute->getArguments()))? |
|
| 25 | - $this->request : |
|
| 26 | - new RedirectResponse( |
|
| 24 | + $this->checkPermissions($attribute->getName(), ...($attribute->getArguments())) ? |
|
| 25 | + $this->request : new RedirectResponse( |
|
| 27 | 26 | Application::getAuthConfig()->login_url, |
| 28 | - redirect_after: $this->request->url |
|
| 27 | + redirect_after : $this->request->url |
|
| 29 | 28 | ); |
| 30 | 29 | } |
| 31 | 30 | |
@@ -36,7 +35,7 @@ discard block |
||
| 36 | 35 | |
| 37 | 36 | |
| 38 | 37 | protected function checkPermissions(string $modifier, mixed ...$params):bool{ |
| 39 | - if($modifier == LoginRequired::class){ |
|
| 38 | + if ($modifier == LoginRequired::class) { |
|
| 40 | 39 | $authenticator = new \Lepton\Authenticator\UserAuthenticator(); |
| 41 | 40 | return $authenticator->isLoggedIn(); |
| 42 | 41 | } |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | $this->rbac_class = $middlewareParams["rbac_class"] ?? throw new \Exception("You have to define a RBAC class"); |
| 21 | 21 | |
| 22 | 22 | $rbac_interfaces = class_implements($this->rbac_class); |
| 23 | - if(! in_array(\Lepton\Authenticator\RBAC\RBACInterface::class, $rbac_interfaces)) { |
|
| 23 | + if (!in_array(\Lepton\Authenticator\RBAC\RBACInterface::class, $rbac_interfaces)) { |
|
| 24 | 24 | throw new \Exception("RBAC class has to implement \Lepton\Authenticator\RBAC\RBACInterface"); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $this->user_class = $middlewareParams["user_class"] ?? throw new \Exception("You have to define a User class"); |
| 28 | 28 | |
| 29 | 29 | $user_interfaces = class_implements($this->user_class); |
| 30 | - if(! in_array(\Lepton\Authenticator\RBAC\UserInterface::class, $user_interfaces)) { |
|
| 30 | + if (!in_array(\Lepton\Authenticator\RBAC\UserInterface::class, $user_interfaces)) { |
|
| 31 | 31 | throw new \Exception("User class has to implement \Lepton\Authenticator\RBAC\UserInterface"); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -38,18 +38,18 @@ discard block |
||
| 38 | 38 | protected function checkPermissions(string $modifier, mixed ...$params): bool |
| 39 | 39 | { |
| 40 | 40 | |
| 41 | - if($modifier == LoginRequired::class) { |
|
| 41 | + if ($modifier == LoginRequired::class) { |
|
| 42 | 42 | |
| 43 | 43 | $level = isset($params[0]) ? $params[0] : 1; |
| 44 | 44 | $authenticator = new \Lepton\Authenticator\UserAuthenticator(); |
| 45 | 45 | $loggedIn = $authenticator->isLoggedIn(); |
| 46 | - if(! $loggedIn) { |
|
| 46 | + if (!$loggedIn) { |
|
| 47 | 47 | return false; |
| 48 | 48 | } |
| 49 | 49 | $user = $authenticator->getLoggedUser(); |
| 50 | 50 | $num_privileges = $user->privileges->and(livello__gte: $level)->count(); |
| 51 | 51 | return ($num_privileges > 0); |
| 52 | - } elseif($modifier == PermissionRequired::class){ |
|
| 52 | + } elseif ($modifier == PermissionRequired::class) { |
|
| 53 | 53 | $user = (new UserAuthenticator)->getLoggedUser(); |
| 54 | 54 | die(print_r($params)); |
| 55 | 55 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | parent::__construct(headers: ["Content-Type" => "application/json"]); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - public function sendBody(){ |
|
| 15 | + public function sendBody() { |
|
| 16 | 16 | echo json_encode($this->array); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | $session_hash = bin2hex(random_bytes(32)); |
| 45 | 45 | $_SESSION['user_id'] = $user->getPk(); |
| 46 | 46 | $_SESSION['session_hash'] = $session_hash; |
| 47 | - if($this->config->login_use_unique_hash) { |
|
| 47 | + if ($this->config->login_use_unique_hash) { |
|
| 48 | 48 | $hashField = $this->config->hash_field; |
| 49 | 49 | $user->$hashField = $session_hash; |
| 50 | 50 | $user->save(); |
| 51 | 51 | } |
| 52 | - if(isset($this->config->access_field)){ |
|
| 52 | + if (isset($this->config->access_field)) { |
|
| 53 | 53 | $accessField = $this->config->access_field; |
| 54 | 54 | date_default_timezone_set('Europe/Rome'); |
| 55 | - $user->$accessField = date('Y-m-d H:i:s', time());; |
|
| 55 | + $user->$accessField = date('Y-m-d H:i:s', time()); ; |
|
| 56 | 56 | $user->save(); |
| 57 | 57 | } |
| 58 | 58 | return true; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Hash the password |
| 104 | - if (! $password) { |
|
| 104 | + if (!$password) { |
|
| 105 | 105 | $password = $this->randomPassword(length: $password_length); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | if ($this->isLoggedIn()) { |
| 136 | 136 | if (isset($_SESSION['user_id'])) { |
| 137 | - if(isset($this->config->hash_field)) { |
|
| 137 | + if (isset($this->config->hash_field)) { |
|
| 138 | 138 | $user = $this->getUserById($_SESSION['user_id']); |
| 139 | 139 | $hashField = $this->config->hash_field; |
| 140 | 140 | $user->$hashField = ""; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | protected array $custom_filters; |
| 15 | 15 | public string $baseLink; |
| 16 | 16 | |
| 17 | - public function url($string){ |
|
| 17 | + public function url($string) { |
|
| 18 | 18 | return Application::getDir()."/".$string; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | Liquid::set('INCLUDE_SUFFIX', 'html'); |
| 24 | 24 | Liquid::set('INCLUDE_PREFIX', ''); |
| 25 | 25 | $path = "app/Views"; |
| 26 | - $template = new Template($path); |
|
| 26 | + $template = new Template($path); |
|
| 27 | 27 | $template->registerFilter(new SiteFilter()); |
| 28 | 28 | |
| 29 | - if(isset($this->custom_filters)){ |
|
| 30 | - foreach($this->custom_filters as $filter){ |
|
| 29 | + if (isset($this->custom_filters)) { |
|
| 30 | + foreach ($this->custom_filters as $filter) { |
|
| 31 | 31 | $template->registerFilter(new $filter()); |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | $template->parseFile($view); |
| 35 | - $parameters = array_map(function ($x) { |
|
| 35 | + $parameters = array_map(function($x) { |
|
| 36 | 36 | if ($x instanceof QuerySet) { |
| 37 | 37 | return $x->do(); |
| 38 | 38 | } else { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | if (!isset(static::$tableName)) { |
| 102 | 102 | $class = new \ReflectionClass(get_class($this)); |
| 103 | 103 | try { |
| 104 | - $className = explode("\\", $class->getName()); |
|
| 104 | + $className = explode("\\", $class->getName()); |
|
| 105 | 105 | static::$tableName = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', end($className))); |
| 106 | 106 | } catch (\Exception $e) { |
| 107 | 107 | throw new Exceptions\TableNameNotSetException($class); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->pkName = $maybeField->getName(); |
| 140 | 140 | |
| 141 | 141 | // If column name is not set, use field name |
| 142 | - if($field->db_column() == "") { |
|
| 142 | + if ($field->db_column() == "") { |
|
| 143 | 143 | $field->set_db_column($maybeField->getName()); |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | elseif ($fieldType->getName() == DataTypes\ForeignKey::class) { |
| 151 | 151 | $this->foreignKeys[$maybeField->getName()] = $field; |
| 152 | 152 | // If column name is not set, build it as {fieldName}_{parentPrimaryKeyName} |
| 153 | - if($field->db_column() == "") { |
|
| 153 | + if ($field->db_column() == "") { |
|
| 154 | 154 | $props = (new \ReflectionClass($field->parent))->getProperties(\ReflectionProperty::IS_PROTECTED); |
| 155 | 155 | $parentPkName = ""; |
| 156 | - foreach($props as $prop) { |
|
| 156 | + foreach ($props as $prop) { |
|
| 157 | 157 | $attributes = $prop->getAttributes(DataTypes\PrimaryKey::class); |
| 158 | - if(count($attributes)) { |
|
| 158 | + if (count($attributes)) { |
|
| 159 | 159 | $parentPkName = $prop->getName(); |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $this->fields[$maybeField->getName()] = $field; |
| 177 | 177 | |
| 178 | 178 | // If column name is not set, use field name |
| 179 | - if($field->db_column() == "") { |
|
| 179 | + if ($field->db_column() == "") { |
|
| 180 | 180 | $field->set_db_column($maybeField->getName()); |
| 181 | 181 | } |
| 182 | 182 | $this->db_columns[$maybeField->getName()] = $field->db_column(); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | if (is_subclass_of(($attribute->getName()), DataTypes\Field::class)) { |
| 243 | 243 | // A field should have only one field type |
| 244 | 244 | if (is_null($fieldType)) { |
| 245 | - $fieldType = $attribute; |
|
| 245 | + $fieldType = $attribute; |
|
| 246 | 246 | } else { |
| 247 | 247 | throw new Exceptions\MultipleFieldAttributeException($prop); |
| 248 | 248 | } |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | private function checkFieldsAreProtected() |
| 266 | 266 | { |
| 267 | 267 | $properties = (new \ReflectionClass(get_class($this)))->getProperties( |
| 268 | - \ReflectionProperty::IS_PUBLIC | |
|
| 269 | - \ReflectionProperty::IS_READONLY | |
|
| 268 | + \ReflectionProperty::IS_PUBLIC| |
|
| 269 | + \ReflectionProperty::IS_READONLY| |
|
| 270 | 270 | \ReflectionProperty::IS_STATIC |
| 271 | 271 | ); |
| 272 | 272 | foreach ($properties as $prop) { |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | return $parent; |
| 302 | 302 | } elseif ($property == $this->pkName) { |
| 303 | 303 | return $this->getPk(); |
| 304 | - } elseif($this->isReverseForeignKey($property)) { |
|
| 304 | + } elseif ($this->isReverseForeignKey($property)) { |
|
| 305 | 305 | $child = $this->reverseForeignKeys[$property]->child; |
| 306 | 306 | $arguments = [ |
| 307 | 307 | $this->reverseForeignKeys[$property]->foreignKey => $this |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $this->$property = $value; |
| 338 | 338 | } |
| 339 | 339 | } elseif (array_key_exists($property, $this->foreignKeys)) { |
| 340 | - if(is_null($value)){ |
|
| 340 | + if (is_null($value)) { |
|
| 341 | 341 | $this->$property = $value; |
| 342 | 342 | $this->editedFields[] = $property; |
| 343 | 343 | $this->editedFields = array_unique($this->editedFields); |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | if (array_key_exists($field, $this->fields)) { |
| 596 | 596 | return $this->$field; |
| 597 | 597 | } elseif (array_key_exists($field, $this->foreignKeys)) { |
| 598 | - if(is_null($this->$field)) return NULL; |
|
| 598 | + if (is_null($this->$field)) return NULL; |
|
| 599 | 599 | return ($this->$field)->getPk(); |
| 600 | 600 | } |
| 601 | 601 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | */ |
| 613 | 613 | public static function get(...$filters): Model|bool |
| 614 | 614 | { |
| 615 | - if ((count($filters) == 1) && array_key_first($filters) == 0) { |
|
| 615 | + if ((count($filters) == 1) && array_key_first($filters) == 0) { |
|
| 616 | 616 | $filters = array((new static())->pkName => $filters[0]); |
| 617 | 617 | } |
| 618 | 618 | |