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.

TemplateController::beforeAction()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Alexey Tatarinov <[email protected]>
4
 * @link https://github.com/shogodev/argilla/
5
 * @copyright Copyright &copy; 2003-2015 Shogo
6
 * @license http://argilla.ru/LICENSE
7
 */
8
class TemplateController extends FController
9
{
10
  protected function beforeAction($action)
11
  {
12
    if( !YII_DEBUG )
13
    {
14
      throw new CHttpException(404, 'Страница не найдена');
15
    }
16
17
    return parent::beforeAction($action);
18
  }
19
20
  public function actionIndex($url)
21
  {
22
    if( !file_exists(Yii::getPathOfAlias('frontend.views.template').DIRECTORY_SEPARATOR.$url.'.php') )
23
      throw new CHttpException(500, 'Файл '.$url.' не найден');
24
25
    $this->breadcrumbs = array('Шаблон '.$url);
26
27
    if( file_exists(Yii::getPathOfAlias('frontend.views.layouts').DIRECTORY_SEPARATOR.$url.'.php') )
28
      $this->layout = $url;
29
30
    $this->render($url);
31
  }
32
33
  public function actionBasket($step)
34
  {
35
    $this->basket->clear();
36
    $this->basket->add(array('type' => 'product', 'id' => 1));
37
    $this->basket->add(array('type' => 'product', 'id' => 2));
38
    $this->basket->add(array('type' => 'product', 'id' => 3));
39
    $this->basket->add(array('type' => 'product', 'id' => 4));
40
41
    switch( $step )
42
    {
43
      case 1:
44
        $this->forward('order/firstStep', false);
45
      break;
46
47
      case 2:
48
        $this->forward('order/secondStep', false);
49
      break;
50
51
      case 3:
52
        Yii::app()->session['orderSuccess'] = true;
53
        Yii::app()->session['orderId'] = 1234;
54
        $this->forward('order/thirdStep', false);
55
      break;
56
    }
57
58
    $this->basket->clear();
59
  }
60
61
  public function actionProfileData($url)
62
  {
63
    $login = new Login();
64
    $login->login = Yii::app()->request->getParam('empty', false) ? 'test2' : 'test';
65
    $login->password = '123';
66
    $login->authenticate(null, null);
67
68
    switch( $url )
69
    {
70
      case 'personal':
71
        $this->forward('userProfile/data', false);
72
      break;
73
74
      case 'personal_password':
75
        $this->forward('userProfile/changePassword', false);
76
        break;
77
78
      case 'personal_history':
79
        $this->forward('userProfile/historyOrders', false);
80
      break;
81
    }
82
83
    Yii::app()->user->logout(false);
84
  }
85
86
  public function actionEmail()
87
  {
88
    $data = array();
89
    $data['host'] = Yii::app()->request->hostInfo;
90
    $data['project'] = Yii::app()->params->project;
91
    $data['subject'] = Yii::app()->params->project;
92
93 View Code Duplication
    if( $contact = $this->getHeaderContacts() )
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
94
    {
95
      $data['emails'] = $contact->getFields('emails');
96
      $data['email'] = Arr::get($data['emails'], 0, '');
97
      $data['phones'] = $contact->getFields('phones');
98
      $data['phone'] = Arr::get($data['phones'], 0, '');
99
    }
100
    $data['model'] = Order::model()->findByPk(2);
101
102
    $content = $this->renderPartial('frontend.views.email.order', $data, true);
103
    $this->renderPartial('frontend.views.email.layouts.main', CMap::mergeArray($data, array('content' => $content)), false, true);
104
  }
105
}
106