Issues (1519)

Callbacks/appControllers/CallbacksController.php (3 issues)

1
<?php
2
3
/**
4
 * Callbacks app controller
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
class CallbacksController extends Controller {
0 ignored issues
show
The type 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
13
    public function indexAction($categoryCode = '') {
14
        $category = null;
15
        if ($categoryCode) {
16
            $category = Callbacks\Category::get($categoryCode, 'alias');
17
            if (!$category) {
18
                $category = Callbacks\Category::get($categoryCode);
19
            }
20
        }
21
        if ($category) {
22
            $callbacks = $category->callbacks(['where' => [['view', 1]], 'order' => ['weight', 'asc']]);
23
        } else {
24
            $callbacks = Callbacks\Callback::getList(['where' => [['category_id', 0], ['view', 1]], 'order' => ['weight', 'asc']]);
25
        }
26
        $this->view->setTitle($category ? $category->name : 'Отзывы');
27
        $this->view->page([
28
            'page' => $category ? $category->resolveTemplate() : 'current',
29
            'content' => $category ? $category->resolveViewer() : 'index',
30
            'data' => compact('category', 'callbacks')
31
        ]);
32
    }
33
34
    public function viewAction($callbackId) {
35
        $callback = Callbacks\Callback::get((int) $callbackId);
36
        if (!$callback) {
37
            Tools::header(404);
0 ignored issues
show
The type Tools 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...
38
            Tools::redirect('/', 'Отзыв не найден', 'danger');
39
        }
40
        $this->view->setTitle('Отзыв: ' . $callback->name);
0 ignored issues
show
The property name does not exist on false.
Loading history...
41
        $this->view->page(['data' => compact('callback')]);
42
    }
43
44
}
45