bluzphp /
skeleton
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * REST controller for HEAD method |
||
| 4 | * |
||
| 5 | * @category Application |
||
| 6 | * |
||
| 7 | * @author Anton Shevchuk |
||
| 8 | * @created 19.02.15 16:27 |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace Application; |
||
| 12 | |||
| 13 | use Bluz\Crud\Table; |
||
|
0 ignored issues
–
show
|
|||
| 14 | use Bluz\Db\Exception\TableNotFoundException; |
||
|
0 ignored issues
–
show
The type
Bluz\Db\Exception\TableNotFoundException was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 15 | use Bluz\Http\Exception\NotFoundException; |
||
|
0 ignored issues
–
show
The type
Bluz\Http\Exception\NotFoundException was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 16 | use Bluz\Proxy\Request; |
||
|
0 ignored issues
–
show
The type
Bluz\Proxy\Request was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 17 | use Bluz\Proxy\Response; |
||
|
0 ignored issues
–
show
The type
Bluz\Proxy\Response was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 18 | |||
| 19 | /** |
||
| 20 | * @accept JSON |
||
| 21 | * @method HEAD |
||
| 22 | * |
||
| 23 | * @param Table $crud |
||
| 24 | * @param mixed $primary |
||
| 25 | * |
||
| 26 | * @return void |
||
| 27 | * @throws TableNotFoundException |
||
| 28 | * @throws NotFoundException |
||
| 29 | */ |
||
| 30 | return function (Table $crud, $primary) { |
||
| 31 | if (!empty($primary)) { |
||
| 32 | // @throws NotFoundException |
||
| 33 | $result = [$crud->readOne($primary)]; |
||
| 34 | } else { |
||
| 35 | $params = Request::getParams(); |
||
| 36 | |||
| 37 | // setup default offset and limit - safe way |
||
| 38 | $offset = Request::getParam('offset', 0); |
||
| 39 | $limit = Request::getParam('limit', 10); |
||
| 40 | |||
| 41 | if ($range = Request::getHeader('Range')) { |
||
| 42 | list(, $offset, $last) = preg_split('/[-=]/', $range); |
||
| 43 | // for better compatibility |
||
| 44 | $limit = $last - $offset; |
||
| 45 | } |
||
| 46 | $result = $crud->readSet($offset, $limit, $params); |
||
| 47 | 1 | } |
|
| 48 | |||
| 49 | $size = strlen(json_encode($result)); |
||
| 50 | |||
| 51 | Response::addHeader('Content-Length', $size); |
||
| 52 | }; |
||
| 53 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths