Passed
Push — v5 ( c0775f...b45ef7 )
by Alexey
16:22
created

UsersAppAdminController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A loginAction() 0 5 2
A loginAsAction() 0 4 1
1
<?php
2
3
/**
4
 * Users admin 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
12
namespace Inji\Users;
13
use Inji\Admin\AdminController;
14
15
class UsersAppAdminController extends AdminController {
16
17
    public function loginAction() {
18
        if (!Users\User::$cur->user_id) {
0 ignored issues
show
Bug introduced by
The type Inji\Users\Users\User 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...
19
            $this->view->page(['page' => 'login', 'content' => 'login']);
0 ignored issues
show
Bug introduced by
The method page() does not exist on Inji\Module. It seems like you code against a sub-type of Inji\Module such as Inji\View or Inji\Db. ( Ignorable by Annotation )

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

19
            $this->view->/** @scrutinizer ignore-call */ 
20
                         page(['page' => 'login', 'content' => 'login']);
Loading history...
Bug Best Practice introduced by
The property view does not exist on Inji\Users\UsersAppAdminController. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
The method page() does not exist on null. ( Ignorable by Annotation )

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

19
            $this->view->/** @scrutinizer ignore-call */ 
20
                         page(['page' => 'login', 'content' => 'login']);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20
        } else {
21
            $this->view->page(['content' => 'profile']);
22
        }
23
    }
24
25
    public function loginAsAction($userId) {
26
        $user = Users\User::get($userId);
27
        App::$cur->users->newSession($user);
0 ignored issues
show
Bug introduced by
The type Inji\Users\App 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...
28
        Tools::redirect('/', 'Теперь вы на сайте под пользователем ' . $user->name());
0 ignored issues
show
Bug introduced by
The type Inji\Users\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...
29
    }
30
31
}
32