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.

PasswordsCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 67
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A actionCreate() 0 41 4
1
<?php
2
/**
3
 * @author Nikita Melnikov <[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.commands
8
 */
9
10
Yii::import('backend.components.db.*');
11
Yii::import('backend.components.auth.*');
12
Yii::import('backend.modules.rbac.models.*');
13
14
class PasswordsCommand extends CConsoleCommand
15
{
16
  /**
17
   * @var string
18
   */
19
  protected $username;
20
21
  /**
22
   * @var string
23
   */
24
  protected $password;
25
26
  /**
27
   * @var BUser
28
   */
29
  protected $user;
30
31
  /**
32
   * Обновление пароля у пользователя / Добавление нового пользователя
33
   *
34
   * @param string $user
35
   * @param string $password
36
   *
37
   * @return int
38
   */
39
  public function actionCreate($user, $password)
40
  {
41
    $this->username = $user;
42
    $this->password = $password;
43
44
    try
45
    {
46
      $criteria = new CDbCriteria();
47
      $criteria->compare('username', $this->username);
48
49
      $this->user = BUser::model()->find($criteria);
50
51
      if( $this->user === null )
52
      {
53
        $this->user           = new BUser();
54
        $this->user->username = $this->username;
55
      }
56
      elseif( !$this->confirm('Пользователь уже существует, обновить его пароль?', false) )
57
        return 1;
58
59
      $this->user->setNewPassword($this->password);
60
      $this->user->save();
61
62
      echo "----------------------------------------------------".PHP_EOL;
63
      echo "\tSuccess".PHP_EOL;
64
      echo "----------------------------------------------------".PHP_EOL;
65
      echo "\tUser: " . $this->user->username.PHP_EOL;
66
      echo "\tPassword: ";
67
      echo $this->password.PHP_EOL;
68
    }
69
    catch( CException $e )
0 ignored issues
show
Bug introduced by
The class CException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
70
    {
71
      echo "\tFailure".PHP_EOL;
72
      echo "----------------------------------------------------".PHP_EOL;
73
      echo "\t".$e->getMessage().PHP_EOL;
74
75
    }
76
    echo "----------------------------------------------------".PHP_EOL;
77
78
    return 0;
79
  }
80
}