@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Lepton\Http\Response; |
| 4 | 4 | |
| 5 | - class SuccessResponse extends HttpResponse |
|
| 5 | + class SuccessResponse extends HttpResponse |
|
| 6 | 6 | { |
| 7 | 7 | |
| 8 | 8 | public function __construct( |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Lepton\Http\Response; |
| 4 | 4 | |
| 5 | - class FileResponse extends SuccessResponse |
|
| 5 | + class FileResponse extends SuccessResponse |
|
| 6 | 6 | { |
| 7 | 7 | |
| 8 | 8 | public function __construct( |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Lepton\Http\Response; |
| 4 | 4 | |
| 5 | - class NotFoundResponse extends HttpResponse |
|
| 5 | + class NotFoundResponse extends HttpResponse |
|
| 6 | 6 | { |
| 7 | 7 | |
| 8 | 8 | public function __construct( |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Lepton\Http\Response; |
| 4 | 4 | |
| 5 | - class InternalErrorResponse extends HttpResponse |
|
| 5 | + class InternalErrorResponse extends HttpResponse |
|
| 6 | 6 | { |
| 7 | 7 | |
| 8 | 8 | public function __construct( |
@@ -81,49 +81,49 @@ discard block |
||
| 81 | 81 | public function __construct(protected string $model) |
| 82 | 82 | { |
| 83 | 83 | $this->lookup_map = array( |
| 84 | - "equals" => [ |
|
| 84 | + "equals" => [ |
|
| 85 | 85 | "operator" => "=", |
| 86 | 86 | "rhs" => fn ($x) => $x |
| 87 | - ], |
|
| 88 | - "startswith" => [ |
|
| 87 | + ], |
|
| 88 | + "startswith" => [ |
|
| 89 | 89 | "operator" => "LIKE", |
| 90 | 90 | "rhs" => fn ($x) => sprintf('%s%%', $x) |
| 91 | - ], |
|
| 91 | + ], |
|
| 92 | 92 | |
| 93 | - "endswith" => [ |
|
| 93 | + "endswith" => [ |
|
| 94 | 94 | "operator" => "LIKE", |
| 95 | 95 | "rhs" => fn ($x) => sprintf('%%%s', $x) |
| 96 | - ], |
|
| 96 | + ], |
|
| 97 | 97 | |
| 98 | - "contains" => [ |
|
| 98 | + "contains" => [ |
|
| 99 | 99 | "operator" => "LIKE", |
| 100 | 100 | "rhs" => fn ($x) => sprintf('%%%s%%', $x) |
| 101 | - ], |
|
| 101 | + ], |
|
| 102 | 102 | |
| 103 | - "lte" => [ |
|
| 103 | + "lte" => [ |
|
| 104 | 104 | "operator" => "<=", |
| 105 | 105 | "rhs" => fn ($x) => $x |
| 106 | - ], |
|
| 106 | + ], |
|
| 107 | 107 | |
| 108 | - "gte" => [ |
|
| 108 | + "gte" => [ |
|
| 109 | 109 | "operator" => ">=", |
| 110 | 110 | "rhs" => fn ($x) => $x |
| 111 | - ], |
|
| 111 | + ], |
|
| 112 | 112 | |
| 113 | - "lt" => [ |
|
| 113 | + "lt" => [ |
|
| 114 | 114 | "operator" => "<", |
| 115 | 115 | "rhs" => fn ($x) => $x |
| 116 | - ], |
|
| 116 | + ], |
|
| 117 | 117 | |
| 118 | - "gt" => [ |
|
| 118 | + "gt" => [ |
|
| 119 | 119 | "operator" => ">", |
| 120 | 120 | "rhs" => fn ($x) => $x |
| 121 | - ], |
|
| 121 | + ], |
|
| 122 | 122 | |
| 123 | - "neq" => [ |
|
| 123 | + "neq" => [ |
|
| 124 | 124 | "operator" => "<>", |
| 125 | 125 | "rhs" => fn ($x) => $x |
| 126 | - ] |
|
| 126 | + ] |
|
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | $this->filters = array(); |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | $query .= sprintf(" ORDER BY %s", $modifiers); |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - //if(strpos($query, "ORDER BY")) die (print_r($query)); |
|
| 496 | + //if(strpos($query, "ORDER BY")) die (print_r($query)); |
|
| 497 | 497 | return array($query, $values); |
| 498 | 498 | } |
| 499 | 499 | |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | } |
| 569 | 569 | }, $modifiers, array_keys($modifiers)) |
| 570 | 570 | );*/ |
| 571 | - } |
|
| 571 | + } |
|
| 572 | 572 | |
| 573 | 573 | |
| 574 | 574 | private function buildWhereClause($filters) |
@@ -674,9 +674,9 @@ discard block |
||
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | return array( |
| 677 | - "column" => $last->getColumnFromField($column), |
|
| 678 | - "condition" => $condition, |
|
| 679 | - "join" => $join |
|
| 677 | + "column" => $last->getColumnFromField($column), |
|
| 678 | + "condition" => $condition, |
|
| 679 | + "join" => $join |
|
| 680 | 680 | ); |
| 681 | 681 | } |
| 682 | 682 | } |
@@ -58,13 +58,13 @@ |
||
| 58 | 58 | if($matcher instanceof MatchRoute) { |
| 59 | 59 | |
| 60 | 60 | foreach($this->middlewares as $middleware => $args){ |
| 61 | - $middlewareInstance = new $middleware(); |
|
| 62 | - $middlewareInstance->addMatcher($matcher); |
|
| 63 | - $middlewareInstance->setRequest($this->request); |
|
| 64 | - $middlewareResult = $middlewareInstance(...$args); |
|
| 65 | - if($middlewareResult instanceof HttpResponse){ |
|
| 61 | + $middlewareInstance = new $middleware(); |
|
| 62 | + $middlewareInstance->addMatcher($matcher); |
|
| 63 | + $middlewareInstance->setRequest($this->request); |
|
| 64 | + $middlewareResult = $middlewareInstance(...$args); |
|
| 65 | + if($middlewareResult instanceof HttpResponse){ |
|
| 66 | 66 | return $middlewareResult; |
| 67 | - } |
|
| 67 | + } |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | Application::$controller = $matcher->controller; |
@@ -52,14 +52,14 @@ |
||
| 52 | 52 | return new MatchFile(filePath: $filePath, contentType: $contentType); |
| 53 | 53 | } else { |
| 54 | 54 | die($filePath); |
| 55 | - return new Match404(); |
|
| 55 | + return new Match404(); |
|
| 56 | 56 | } |
| 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 | - } |
|
| 63 | - return new FileResponse($match->filePath, $match->contentType); |
|
| 62 | + } |
|
| 63 | + return new FileResponse($match->filePath, $match->contentType); |
|
| 64 | 64 | } |
| 65 | 65 | } |