Browse Source

PSR-12 compatibility

Maurits van der Schee 5 years ago
parent
commit
cfa24ddd40
1 changed files with 59 additions and 81 deletions
  1. 59
    81
      api.php

+ 59
- 81
api.php View File

3385
 
3385
 
3386
     class TempFileCache implements Cache
3386
     class TempFileCache implements Cache
3387
     {
3387
     {
3388
-        const SUFFIX = 'cache';
3388
+        public const SUFFIX = 'cache';
3389
 
3389
 
3390
         private $path;
3390
         private $path;
3391
         private $segments;
3391
         private $segments;
3534
 
3534
 
3535
     class ReflectedColumn implements \JsonSerializable
3535
     class ReflectedColumn implements \JsonSerializable
3536
     {
3536
     {
3537
-        const DEFAULT_LENGTH = 255;
3538
-        const DEFAULT_PRECISION = 19;
3539
-        const DEFAULT_SCALE = 4;
3537
+        public const DEFAULT_LENGTH = 255;
3538
+        public const DEFAULT_PRECISION = 19;
3539
+        public const DEFAULT_SCALE = 4;
3540
 
3540
 
3541
         private $name;
3541
         private $name;
3542
         private $type;
3542
         private $type;
3573
             return new ReflectedColumn($name, $type, $length, $precision, $scale, $nullable, $pk, $fk);
3573
             return new ReflectedColumn($name, $type, $length, $precision, $scale, $nullable, $pk, $fk);
3574
         }
3574
         }
3575
 
3575
 
3576
-        public static function fromJson( /* object */$json): ReflectedColumn
3576
+        public static function fromJson(/* object */$json): ReflectedColumn
3577
         {
3577
         {
3578
             $name = $json->name;
3578
             $name = $json->name;
3579
             $type = $json->type;
3579
             $type = $json->type;
3727
             return new ReflectedDatabase($tableTypes);
3727
             return new ReflectedDatabase($tableTypes);
3728
         }
3728
         }
3729
 
3729
 
3730
-        public static function fromJson( /* object */$json): ReflectedDatabase
3730
+        public static function fromJson(/* object */$json): ReflectedDatabase
3731
         {
3731
         {
3732
             $tableTypes = (array) $json->tables;
3732
             $tableTypes = (array) $json->tables;
3733
             return new ReflectedDatabase($tableTypes);
3733
             return new ReflectedDatabase($tableTypes);
3837
             return new ReflectedTable($name, $type, array_values($columns));
3837
             return new ReflectedTable($name, $type, array_values($columns));
3838
         }
3838
         }
3839
 
3839
 
3840
-        public static function fromJson( /* object */$json): ReflectedTable
3840
+        public static function fromJson(/* object */$json): ReflectedTable
3841
         {
3841
         {
3842
             $name = $json->name;
3842
             $name = $json->name;
3843
             $type = $json->type;
3843
             $type = $json->type;
4020
             return true;
4020
             return true;
4021
         }
4021
         }
4022
 
4022
 
4023
-        public function addTable( /* object */$definition)
4023
+        public function addTable(/* object */$definition)
4024
         {
4024
         {
4025
             $newTable = ReflectedTable::fromJson($definition);
4025
             $newTable = ReflectedTable::fromJson($definition);
4026
             if (!$this->db->definition()->addTable($newTable)) {
4026
             if (!$this->db->definition()->addTable($newTable)) {
4077
             }
4077
             }
4078
             return true;
4078
             return true;
4079
         }
4079
         }
4080
-
4081
     }
4080
     }
4082
 }
4081
 }
4083
 
4082
 
4213
         {
4212
         {
4214
             return $this->responder->success($this->cache->clear());
4213
             return $this->responder->success($this->cache->clear());
4215
         }
4214
         }
4216
-
4217
     }
4215
     }
4218
 }
4216
 }
4219
 
4217
 
4440
                 return $this->responder->success($response);
4438
                 return $this->responder->success($response);
4441
             }
4439
             }
4442
         }
4440
         }
4443
-
4444
     }
4441
     }
4445
 }
4442
 }
4446
 
4443
 
4466
         {
4463
         {
4467
             return ResponseFactory::fromObject(ResponseFactory::OK, $result);
4464
             return ResponseFactory::fromObject(ResponseFactory::OK, $result);
4468
         }
4465
         }
4469
-
4470
     }
4466
     }
4471
 }
4467
 }
4472
 
4468
 
4494
         {
4490
         {
4495
             return $this->responder->success($this->openApi->get());
4491
             return $this->responder->success($this->openApi->get());
4496
         }
4492
         }
4497
-
4498
     }
4493
     }
4499
 }
4494
 }
4500
 
4495
 
4675
                 return $this->responder->success($this->service->increment($table, $id, $record, $params));
4670
                 return $this->responder->success($this->service->increment($table, $id, $record, $params));
4676
             }
4671
             }
4677
         }
4672
         }
4678
-
4679
     }
4673
     }
4680
 }
4674
 }
4681
 
4675
 
4689
         public function error(int $error, string $argument, $details = null): ResponseInterface;
4683
         public function error(int $error, string $argument, $details = null): ResponseInterface;
4690
 
4684
 
4691
         public function success($result): ResponseInterface;
4685
         public function success($result): ResponseInterface;
4692
-
4693
     }
4686
     }
4694
 }
4687
 }
4695
 
4688
 
4755
             }
4748
             }
4756
             return $value;
4749
             return $value;
4757
         }
4750
         }
4758
-
4759
     }
4751
     }
4760
 }
4752
 }
4761
 
4753
 
4866
             }
4858
             }
4867
             return implode(',', $results);
4859
             return implode(',', $results);
4868
         }
4860
         }
4869
-
4870
     }
4861
     }
4871
 }
4862
 }
4872
 
4863
 
5520
             $type = $this->typeConverter->fromJdbc($column->getType());
5511
             $type = $this->typeConverter->fromJdbc($column->getType());
5521
             if ($column->hasPrecision() && $column->hasScale()) {
5512
             if ($column->hasPrecision() && $column->hasScale()) {
5522
                 $size = '(' . $column->getPrecision() . ',' . $column->getScale() . ')';
5513
                 $size = '(' . $column->getPrecision() . ',' . $column->getScale() . ')';
5523
-            } else if ($column->hasPrecision()) {
5514
+            } elseif ($column->hasPrecision()) {
5524
                 $size = '(' . $column->getPrecision() . ')';
5515
                 $size = '(' . $column->getPrecision() . ')';
5525
-            } else if ($column->hasLength()) {
5516
+            } elseif ($column->hasLength()) {
5526
                 $size = '(' . $column->getLength() . ')';
5517
                 $size = '(' . $column->getLength() . ')';
5527
             } else {
5518
             } else {
5528
                 $size = '';
5519
                 $size = '';
6516
             return [$lon, $lat];
6507
             return [$lon, $lat];
6517
         }
6508
         }
6518
 
6509
 
6519
-        private function convertRecordToFeature( /*object*/$record, string $primaryKeyColumnName, string $geometryColumnName)
6510
+        private function convertRecordToFeature(/*object*/$record, string $primaryKeyColumnName, string $geometryColumnName)
6520
         {
6511
         {
6521
             $id = null;
6512
             $id = null;
6522
             if ($primaryKeyColumnName) {
6513
             if ($primaryKeyColumnName) {
6667
 
6658
 
6668
     class VariableStore
6659
     class VariableStore
6669
     {
6660
     {
6670
-        static $values = array();
6661
+        public static $values = array();
6671
 
6662
 
6672
         public static function get(string $key)
6663
         public static function get(string $key)
6673
         {
6664
         {
6860
             }
6851
             }
6861
             return $response;
6852
             return $response;
6862
         }
6853
         }
6863
-
6864
     }
6854
     }
6865
 }
6855
 }
6866
 
6856
 
7371
     use Psr\Http\Message\ResponseInterface;
7361
     use Psr\Http\Message\ResponseInterface;
7372
     use Psr\Http\Message\ServerRequestInterface;
7362
     use Psr\Http\Message\ServerRequestInterface;
7373
     use Psr\Http\Server\RequestHandlerInterface;
7363
     use Psr\Http\Server\RequestHandlerInterface;
7374
-    use Tqdev\PhpCrudApi\Column\ReflectionService;
7375
     use Tqdev\PhpCrudApi\Column\Reflection\ReflectedTable;
7364
     use Tqdev\PhpCrudApi\Column\Reflection\ReflectedTable;
7365
+    use Tqdev\PhpCrudApi\Column\ReflectionService;
7376
     use Tqdev\PhpCrudApi\Controller\Responder;
7366
     use Tqdev\PhpCrudApi\Controller\Responder;
7377
     use Tqdev\PhpCrudApi\Middleware\Base\Middleware;
7367
     use Tqdev\PhpCrudApi\Middleware\Base\Middleware;
7378
     use Tqdev\PhpCrudApi\Middleware\Router\Router;
7368
     use Tqdev\PhpCrudApi\Middleware\Router\Router;
7895
     use Psr\Http\Message\ResponseInterface;
7885
     use Psr\Http\Message\ResponseInterface;
7896
     use Psr\Http\Message\ServerRequestInterface;
7886
     use Psr\Http\Message\ServerRequestInterface;
7897
     use Psr\Http\Server\RequestHandlerInterface;
7887
     use Psr\Http\Server\RequestHandlerInterface;
7898
-    use Tqdev\PhpCrudApi\Column\ReflectionService;
7899
     use Tqdev\PhpCrudApi\Column\Reflection\ReflectedTable;
7888
     use Tqdev\PhpCrudApi\Column\Reflection\ReflectedTable;
7889
+    use Tqdev\PhpCrudApi\Column\ReflectionService;
7900
     use Tqdev\PhpCrudApi\Controller\Responder;
7890
     use Tqdev\PhpCrudApi\Controller\Responder;
7901
     use Tqdev\PhpCrudApi\Middleware\Base\Middleware;
7891
     use Tqdev\PhpCrudApi\Middleware\Base\Middleware;
7902
     use Tqdev\PhpCrudApi\Middleware\Router\Router;
7892
     use Tqdev\PhpCrudApi\Middleware\Router\Router;
7959
     use Psr\Http\Message\ResponseInterface;
7949
     use Psr\Http\Message\ResponseInterface;
7960
     use Psr\Http\Message\ServerRequestInterface;
7950
     use Psr\Http\Message\ServerRequestInterface;
7961
     use Psr\Http\Server\RequestHandlerInterface;
7951
     use Psr\Http\Server\RequestHandlerInterface;
7962
-    use Tqdev\PhpCrudApi\Column\ReflectionService;
7963
     use Tqdev\PhpCrudApi\Column\Reflection\ReflectedTable;
7952
     use Tqdev\PhpCrudApi\Column\Reflection\ReflectedTable;
7953
+    use Tqdev\PhpCrudApi\Column\ReflectionService;
7964
     use Tqdev\PhpCrudApi\Controller\Responder;
7954
     use Tqdev\PhpCrudApi\Controller\Responder;
7965
     use Tqdev\PhpCrudApi\Middleware\Base\Middleware;
7955
     use Tqdev\PhpCrudApi\Middleware\Base\Middleware;
7966
     use Tqdev\PhpCrudApi\Middleware\Router\Router;
7956
     use Tqdev\PhpCrudApi\Middleware\Router\Router;
8476
         {
8466
         {
8477
             return $this->builder->build();
8467
             return $this->builder->build();
8478
         }
8468
         }
8479
-
8480
     }
8469
     }
8481
 }
8470
 }
8482
 
8471
 
8618
             }
8607
             }
8619
             return $condition;
8608
             return $condition;
8620
         }
8609
         }
8621
-
8622
     }
8610
     }
8623
 }
8611
 }
8624
 
8612
 
8641
         {
8629
         {
8642
             return $this;
8630
             return $this;
8643
         }
8631
         }
8644
-
8645
     }
8632
     }
8646
 }
8633
 }
8647
 
8634
 
8758
 
8745
 
8759
     class ListDocument implements \JsonSerializable
8746
     class ListDocument implements \JsonSerializable
8760
     {
8747
     {
8761
-
8762
         private $records;
8748
         private $records;
8763
 
8749
 
8764
         private $results;
8750
         private $results;
8803
 
8789
 
8804
     class ColumnIncluder
8790
     class ColumnIncluder
8805
     {
8791
     {
8806
-
8807
         private function isMandatory(string $tableName, string $columnName, array $params): bool
8792
         private function isMandatory(string $tableName, string $columnName, array $params): bool
8808
         {
8793
         {
8809
             return isset($params['mandatory']) && in_array($tableName . "." . $columnName, $params['mandatory']);
8794
             return isset($params['mandatory']) && in_array($tableName . "." . $columnName, $params['mandatory']);
8810
         }
8795
         }
8811
 
8796
 
8812
-        private function select(string $tableName, bool $primaryTable, array $params, string $paramName,
8813
-            array $columnNames, bool $include): array{
8797
+        private function select(
8798
+            string $tableName,
8799
+            bool $primaryTable,
8800
+            array $params,
8801
+            string $paramName,
8802
+            array $columnNames,
8803
+            bool $include
8804
+        ): array {
8814
             if (!isset($params[$paramName])) {
8805
             if (!isset($params[$paramName])) {
8815
                 return $columnNames;
8806
                 return $columnNames;
8816
             }
8807
             }
8860
             }
8851
             }
8861
             return $results;
8852
             return $results;
8862
         }
8853
         }
8863
-
8864
     }
8854
     }
8865
 }
8855
 }
8866
 
8856
 
8871
 
8861
 
8872
     class ErrorCode
8862
     class ErrorCode
8873
     {
8863
     {
8874
-
8875
         private $code;
8864
         private $code;
8876
         private $message;
8865
         private $message;
8877
         private $status;
8866
         private $status;
8878
 
8867
 
8879
-        const ERROR_NOT_FOUND = 9999;
8880
-        const ROUTE_NOT_FOUND = 1000;
8881
-        const TABLE_NOT_FOUND = 1001;
8882
-        const ARGUMENT_COUNT_MISMATCH = 1002;
8883
-        const RECORD_NOT_FOUND = 1003;
8884
-        const ORIGIN_FORBIDDEN = 1004;
8885
-        const COLUMN_NOT_FOUND = 1005;
8886
-        const TABLE_ALREADY_EXISTS = 1006;
8887
-        const COLUMN_ALREADY_EXISTS = 1007;
8888
-        const HTTP_MESSAGE_NOT_READABLE = 1008;
8889
-        const DUPLICATE_KEY_EXCEPTION = 1009;
8890
-        const DATA_INTEGRITY_VIOLATION = 1010;
8891
-        const AUTHENTICATION_REQUIRED = 1011;
8892
-        const AUTHENTICATION_FAILED = 1012;
8893
-        const INPUT_VALIDATION_FAILED = 1013;
8894
-        const OPERATION_FORBIDDEN = 1014;
8895
-        const OPERATION_NOT_SUPPORTED = 1015;
8896
-        const TEMPORARY_OR_PERMANENTLY_BLOCKED = 1016;
8897
-        const BAD_OR_MISSING_XSRF_TOKEN = 1017;
8898
-        const ONLY_AJAX_REQUESTS_ALLOWED = 1018;
8899
-        const PAGINATION_FORBIDDEN = 1019;
8868
+        public const ERROR_NOT_FOUND = 9999;
8869
+        public const ROUTE_NOT_FOUND = 1000;
8870
+        public const TABLE_NOT_FOUND = 1001;
8871
+        public const ARGUMENT_COUNT_MISMATCH = 1002;
8872
+        public const RECORD_NOT_FOUND = 1003;
8873
+        public const ORIGIN_FORBIDDEN = 1004;
8874
+        public const COLUMN_NOT_FOUND = 1005;
8875
+        public const TABLE_ALREADY_EXISTS = 1006;
8876
+        public const COLUMN_ALREADY_EXISTS = 1007;
8877
+        public const HTTP_MESSAGE_NOT_READABLE = 1008;
8878
+        public const DUPLICATE_KEY_EXCEPTION = 1009;
8879
+        public const DATA_INTEGRITY_VIOLATION = 1010;
8880
+        public const AUTHENTICATION_REQUIRED = 1011;
8881
+        public const AUTHENTICATION_FAILED = 1012;
8882
+        public const INPUT_VALIDATION_FAILED = 1013;
8883
+        public const OPERATION_FORBIDDEN = 1014;
8884
+        public const OPERATION_NOT_SUPPORTED = 1015;
8885
+        public const TEMPORARY_OR_PERMANENTLY_BLOCKED = 1016;
8886
+        public const BAD_OR_MISSING_XSRF_TOKEN = 1017;
8887
+        public const ONLY_AJAX_REQUESTS_ALLOWED = 1018;
8888
+        public const PAGINATION_FORBIDDEN = 1019;
8900
 
8889
 
8901
         private $values = [
8890
         private $values = [
8902
             9999 => ["%s", ResponseFactory::INTERNAL_SERVER_ERROR],
8891
             9999 => ["%s", ResponseFactory::INTERNAL_SERVER_ERROR],
8946
         {
8935
         {
8947
             return $this->status;
8936
             return $this->status;
8948
         }
8937
         }
8949
-
8950
     }
8938
     }
8951
 }
8939
 }
8952
 
8940
 
8961
 
8949
 
8962
     class FilterInfo
8950
     class FilterInfo
8963
     {
8951
     {
8964
-
8965
         private function addConditionFromFilterPath(PathTree $conditions, array $path, ReflectedTable $table, array $params)
8952
         private function addConditionFromFilterPath(PathTree $conditions, array $path, ReflectedTable $table, array $params)
8966
         {
8953
         {
8967
             $key = 'filter' . implode('', $path);
8954
             $key = 'filter' . implode('', $path);
9004
         {
8991
         {
9005
             return $this->combinePathTreeOfConditions($this->getConditionsAsPathTree($table, $params));
8992
             return $this->combinePathTreeOfConditions($this->getConditionsAsPathTree($table, $params));
9006
         }
8993
         }
9007
-
9008
     }
8994
     }
9009
 }
8995
 }
9010
 
8996
 
9031
 
9017
 
9032
     class OrderingInfo
9018
     class OrderingInfo
9033
     {
9019
     {
9034
-
9035
         public function getColumnOrdering(ReflectedTable $table, array $params): array
9020
         public function getColumnOrdering(ReflectedTable $table, array $params): array
9036
         {
9021
         {
9037
             $fields = array();
9022
             $fields = array();
9078
 
9063
 
9079
     class PaginationInfo
9064
     class PaginationInfo
9080
     {
9065
     {
9081
-
9082
         public $DEFAULT_PAGE_SIZE = 20;
9066
         public $DEFAULT_PAGE_SIZE = 20;
9083
 
9067
 
9084
         public function hasPage(array $params): bool
9068
         public function hasPage(array $params): bool
9141
             }
9125
             }
9142
             return $pageLimit;
9126
             return $pageLimit;
9143
         }
9127
         }
9144
-
9145
     }
9128
     }
9146
 }
9129
 }
9147
 
9130
 
9150
 
9133
 
9151
     class PathTree implements \JsonSerializable
9134
     class PathTree implements \JsonSerializable
9152
     {
9135
     {
9153
-        const WILDCARD = '*';
9136
+        public const WILDCARD = '*';
9154
 
9137
 
9155
         private $tree;
9138
         private $tree;
9156
 
9139
 
9157
-        public function __construct( /* object */&$tree = null)
9140
+        public function __construct(/* object */&$tree = null)
9158
         {
9141
         {
9159
             if (!$tree) {
9142
             if (!$tree) {
9160
                 $tree = $this->newTree();
9143
                 $tree = $this->newTree();
9205
             foreach ($path as $key) {
9188
             foreach ($path as $key) {
9206
                 if (isset($tree->branches->$key)) {
9189
                 if (isset($tree->branches->$key)) {
9207
                     $tree = &$tree->branches->$key;
9190
                     $tree = &$tree->branches->$key;
9208
-                } else if (isset($tree->branches->$star)) {
9191
+                } elseif (isset($tree->branches->$star)) {
9209
                     $tree = &$tree->branches->$star;
9192
                     $tree = &$tree->branches->$star;
9210
                 } else {
9193
                 } else {
9211
                     return [];
9194
                     return [];
9214
             return $tree->values;
9197
             return $tree->values;
9215
         }
9198
         }
9216
 
9199
 
9217
-        public static function fromJson( /* object */$tree): PathTree
9200
+        public static function fromJson(/* object */$tree): PathTree
9218
         {
9201
         {
9219
             return new PathTree($tree);
9202
             return new PathTree($tree);
9220
         }
9203
         }
9353
 // file: src/Tqdev/PhpCrudApi/Record/RelationJoiner.php
9336
 // file: src/Tqdev/PhpCrudApi/Record/RelationJoiner.php
9354
 namespace Tqdev\PhpCrudApi\Record {
9337
 namespace Tqdev\PhpCrudApi\Record {
9355
 
9338
 
9356
-    use Tqdev\PhpCrudApi\Column\ReflectionService;
9357
     use Tqdev\PhpCrudApi\Column\Reflection\ReflectedTable;
9339
     use Tqdev\PhpCrudApi\Column\Reflection\ReflectedTable;
9340
+    use Tqdev\PhpCrudApi\Column\ReflectionService;
9358
     use Tqdev\PhpCrudApi\Database\GenericDB;
9341
     use Tqdev\PhpCrudApi\Database\GenericDB;
9359
     use Tqdev\PhpCrudApi\Middleware\Communication\VariableStore;
9342
     use Tqdev\PhpCrudApi\Middleware\Communication\VariableStore;
9360
     use Tqdev\PhpCrudApi\Record\Condition\ColumnCondition;
9343
     use Tqdev\PhpCrudApi\Record\Condition\ColumnCondition;
9362
 
9345
 
9363
     class RelationJoiner
9346
     class RelationJoiner
9364
     {
9347
     {
9365
-
9366
         private $reflection;
9348
         private $reflection;
9367
         private $ordering;
9349
         private $ordering;
9368
         private $columns;
9350
         private $columns;
9444
 
9426
 
9445
         private function addJoinsForTables(ReflectedTable $t1, PathTree $joins, array &$records, array $params, GenericDB $db)
9427
         private function addJoinsForTables(ReflectedTable $t1, PathTree $joins, array &$records, array $params, GenericDB $db)
9446
         {
9428
         {
9447
-
9448
             foreach ($joins->getKeys() as $t2Name) {
9429
             foreach ($joins->getKeys() as $t2Name) {
9449
-
9450
                 $t2 = $this->reflection->getTable($t2Name);
9430
                 $t2 = $this->reflection->getTable($t2Name);
9451
 
9431
 
9452
                 $belongsTo = count($t1->getFksTo($t2->getName())) > 0;
9432
                 $belongsTo = count($t1->getFksTo($t2->getName())) > 0;
9673
     use Tqdev\PhpCrudApi\Middleware\IpAddressMiddleware;
9653
     use Tqdev\PhpCrudApi\Middleware\IpAddressMiddleware;
9674
     use Tqdev\PhpCrudApi\Middleware\JoinLimitsMiddleware;
9654
     use Tqdev\PhpCrudApi\Middleware\JoinLimitsMiddleware;
9675
     use Tqdev\PhpCrudApi\Middleware\JwtAuthMiddleware;
9655
     use Tqdev\PhpCrudApi\Middleware\JwtAuthMiddleware;
9676
-    use Tqdev\PhpCrudApi\Middleware\ReconnectMiddleware;
9677
     use Tqdev\PhpCrudApi\Middleware\MultiTenancyMiddleware;
9656
     use Tqdev\PhpCrudApi\Middleware\MultiTenancyMiddleware;
9678
     use Tqdev\PhpCrudApi\Middleware\PageLimitsMiddleware;
9657
     use Tqdev\PhpCrudApi\Middleware\PageLimitsMiddleware;
9658
+    use Tqdev\PhpCrudApi\Middleware\ReconnectMiddleware;
9679
     use Tqdev\PhpCrudApi\Middleware\Router\SimpleRouter;
9659
     use Tqdev\PhpCrudApi\Middleware\Router\SimpleRouter;
9680
     use Tqdev\PhpCrudApi\Middleware\SanitationMiddleware;
9660
     use Tqdev\PhpCrudApi\Middleware\SanitationMiddleware;
9681
     use Tqdev\PhpCrudApi\Middleware\ValidationMiddleware;
9661
     use Tqdev\PhpCrudApi\Middleware\ValidationMiddleware;
10006
 // file: src/Tqdev/PhpCrudApi/RequestFactory.php
9986
 // file: src/Tqdev/PhpCrudApi/RequestFactory.php
10007
 namespace Tqdev\PhpCrudApi {
9987
 namespace Tqdev\PhpCrudApi {
10008
 
9988
 
10009
-    use Nyholm\Psr7Server\ServerRequestCreator;
10010
     use Nyholm\Psr7\Factory\Psr17Factory;
9989
     use Nyholm\Psr7\Factory\Psr17Factory;
9990
+    use Nyholm\Psr7Server\ServerRequestCreator;
10011
     use Psr\Http\Message\ServerRequestInterface;
9991
     use Psr\Http\Message\ServerRequestInterface;
10012
 
9992
 
10013
     class RequestFactory
9993
     class RequestFactory
10143
             }
10123
             }
10144
             return $allTableNames;
10124
             return $allTableNames;
10145
         }
10125
         }
10146
-
10147
     }
10126
     }
10148
 }
10127
 }
10149
 
10128
 
10155
 
10134
 
10156
     class ResponseFactory
10135
     class ResponseFactory
10157
     {
10136
     {
10158
-        const OK = 200;
10159
-        const UNAUTHORIZED = 401;
10160
-        const FORBIDDEN = 403;
10161
-        const NOT_FOUND = 404;
10162
-        const METHOD_NOT_ALLOWED = 405;
10163
-        const CONFLICT = 409;
10164
-        const UNPROCESSABLE_ENTITY = 422;
10165
-        const INTERNAL_SERVER_ERROR = 500;
10137
+        public const OK = 200;
10138
+        public const UNAUTHORIZED = 401;
10139
+        public const FORBIDDEN = 403;
10140
+        public const NOT_FOUND = 404;
10141
+        public const METHOD_NOT_ALLOWED = 405;
10142
+        public const CONFLICT = 409;
10143
+        public const UNPROCESSABLE_ENTITY = 422;
10144
+        public const INTERNAL_SERVER_ERROR = 500;
10166
 
10145
 
10167
         public static function fromHtml(int $status, string $html): ResponseInterface
10146
         public static function fromHtml(int $status, string $html): ResponseInterface
10168
         {
10147
         {
10192
             $psr17Factory = new Psr17Factory();
10171
             $psr17Factory = new Psr17Factory();
10193
             return $psr17Factory->createResponse($status);
10172
             return $psr17Factory->createResponse($status);
10194
         }
10173
         }
10195
-
10196
     }
10174
     }
10197
 }
10175
 }
10198
 
10176
 

Loading…
Cancel
Save