UserLoginPageController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 57.14%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 15
ccs 4
cts 7
cp 0.5714
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 8 4
1
<?php
2
namespace UserManagement\Page;
3
4
use PageController;
0 ignored issues
show
Bug introduced by
The type PageController 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...
5
use SilverStripe\Security\Security;
6
use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator;
7
use SilverStripe\Core\Injector\Injector;
8
use SilverStripe\SiteConfig\SiteConfig;
9
10
/**
11
 * Class UserLoginPageController
12
 *
13
 * @package user-management
14
 */
15
class UserLoginPageController extends PageController
16
{
17
    /**
18
     * @var string
19
     */
20
    private static $url_segment = 'user-login';
0 ignored issues
show
introduced by
The private property $url_segment is not used, and could be removed.
Loading history...
21
22 1
    public function init()
23
    {
24 1
        parent::init();
25 1
        $member = Security::getCurrentUser();
26 1
        if ($member && $member->exists()) {
27
            $config = SiteConfig::current_site_config();
28
            if ($config->LoginCallBackUrl()->URLSegment) {
29
                return $this->redirect($config->LoginCallBackUrl()->URLSegment);
30
            }
31
        }
32
    }
33
}
34