UserProfilePageController::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\Member;
6
use SilverStripe\Security\Security;
7
use UserManagement\Forms\ProfileForm;
8
use SilverStripe\SiteConfig\SiteConfig;
9
10
/**
11
 * Class UserProfilePageController
12
 *
13
 * @package user-management
14
 */
15
class UserProfilePageController extends PageController
16
{
17
    /**
18
     * @var string
19
     */
20
    private static $url_segment = 'my-profile';
0 ignored issues
show
introduced by
The private property $url_segment is not used, and could be removed.
Loading history...
21
22
    /**
23
     * @var array
24
     */
25
    private static $allowed_actions = array('ProfileForm');
0 ignored issues
show
introduced by
The private property $allowed_actions is not used, and could be removed.
Loading history...
26
27
    /**
28
     * @var mixed
29
     */
30
    private $member = false;
31
32 2
    public function init()
33
    {
34 2
        parent::init();
35
36 2
        $this->member = Security::getCurrentUser();
37
    }
38
    
39
    /**
40
     * Returns the profile form
41
     * @return \UserManagement\Forms\ProfileForm
42
     */
43 2
    public function ProfileForm()
44
    {
45
46 2
        $form = new ProfileForm($this, 'ProfileForm');
47 2
        $form->loadDataFrom($this->member);
48 2
        return $form;
49
    }
50
}
51