GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FWebUser::init()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2.0054

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
ccs 8
cts 9
cp 0.8889
crap 2.0054
1
<?php
2
/**
3
 * @author Alexey Tatarinov <[email protected]>
4
 * @link https://github.com/shogodev/argilla/
5
 * @copyright Copyright &copy; 2003-2014 Shogo
6
 * @license http://argilla.ru/LICENSE
7
 * @package frontend.components.auth
8
 * @property User $data
9
 * @property UserProfile $profile
10
 * @property string $email
11
 * @property string $name
12
 */
13
class FWebUser extends CWebUser
14
{
15
  private $data = null;
16
17 1
  public function init()
18
  {
19 1
    parent::init();
20
21 1
    if( $this->isGuest )
22 1
    {
23 1
      $this->data = new User();
24 1
      $this->data->profile = new UserProfile();
25 1
    }
26
    else
27
    {
28
      $this->data = User::model()->findByPk($this->getId());
29
    }
30 1
  }
31
32
  /**
33
   * @return User|null
34
   */
35 7
  public function getData()
36
  {
37 7
    return $this->data;
38
  }
39
40
  /**
41
   * @return null|UserProfile
42
   */
43 7
  public function getProfile()
44
  {
45 7
    return $this->getData()->profile;
46
  }
47
48
  /**
49
   * @return string
50
   */
51 3 View Code Duplication
  public function getEmail()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
52
  {
53 3
    if( !empty($this->getData()->email) )
54 3
      return $this->getData()->email;
55
56 2
    if( isset($this->getData()->socials) )
57 2
    {
58 2
      foreach($this->getData()->socials as $social)
59
      {
60
        if( !empty($social->email) )
61
          return $social->email;
62 2
      }
63 2
    }
64
65 2
    return '';
66
  }
67
68
  /**
69
   * @return string
70
   */
71 7 View Code Duplication
  public function getName()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
72
  {
73 7
    if( !empty($this->getProfile()->name) )
74 7
      return $this->getProfile()->name;
75
76 4
    if( isset($this->getData()->socials) )
77 4
    {
78 4
      foreach($this->getData()->socials as $social)
79
      {
80
        if( !empty($social->name) )
81
          return $social->name;
82 4
      }
83 4
    }
84
85 4
    return '';
86
  }
87
}