Failed Conditions
Pull Request — master (#321)
by Anton
23:35 queued 08:33
created

application/modules/pages/controllers/index.php (4 issues)

Labels
Severity
1
<?php
2
/**
3
 * Static pages
4
 *
5
 * @author   Anton Shevchuk
6
 * @created  06.08.12 10:08
7
 */
8
9
namespace Application;
10
11
use Bluz\Controller\Controller;
0 ignored issues
show
The type Bluz\Controller\Controller 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Bluz\Proxy\HttpCacheControl;
0 ignored issues
show
The type Bluz\Proxy\HttpCacheControl 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Bluz\Proxy\Layout;
15
16
/**
17
 * @route /{$alias}.html
18
 *
19
 * @param string $alias
20
 *
21
 * @throws NotFoundException
22
 */
23
return function ($alias) {
24
    /**
25
     * @var Controller $this
26
     * @var Pages\Row $page
27
     */
28 2
    $page = Pages\Table::getInstance()->getByAlias($alias);
29
30 2
    if (!$page) {
31
        // throw NOT FOUND exception
32
        // all logic of error scenario you can found in default error controller
33
        // see /application/modules/error/controllers/index.php
34 1
        throw new NotFoundException;
35
    }
36
37
    // setup HTML layout data
38 1
    Layout::titlePrepend(esc($page->title));
0 ignored issues
show
The function esc was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
    Layout::titlePrepend(/** @scrutinizer ignore-call */ esc($page->title));
Loading history...
39 1
    Layout::meta('keywords', esc($page->keywords, ENT_QUOTES));
40 1
    Layout::meta('description', esc($page->description, ENT_QUOTES));
41
42
    // setup HTTP cache
43 1
    HttpCacheControl::setPublic();
44 1
    HttpCacheControl::setLastModified($page->updated ?: $page->created);
45
46
    // assign page to view
47 1
    $this->assign('page', $page);
48
};
49