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.
Completed
Push — master ( 951ad1...29ba67 )
by Alexey
08:55
created

FApplication::setMbEncoding()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * @author Sergey Glagolev <[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
8
 *
9
 * @property FController $controller
10
 * @property SClientScript $clientScript
11
 * @property SAssetManager $assetManager
12
 * @property ScriptsFactory $mainscript
13
 * @property FWebUser $user
14
 * @property FUrlManager $urlManager
15
 * @property SFormatter $format
16
 * @property Email $email
17
 * @property SNotification $notification
18
 * @property RequestRedirectComponent $requestRedirect
19
 * @property EPhpThumb $phpThumb
20
 * @property Meta $meta
21
 * @property CAttributeCollection $params
22
 */
23
class FApplication extends CWebApplication
24
{
25
  /**
26
   * @param CController $controller
27
   * @param CAction $action
28
   *
29
   * @return bool
30
   */
31 22
  public function beforeControllerAction($controller, $action)
32
  {
33 22
    $this->getComponent('meta');
34 22
    $this->onBeforeControllerAction(new CEvent($this));
35
36 22
    return parent::beforeControllerAction($controller, $action);
37
  }
38
39 22
  public function onBeforeControllerAction(CEvent $event)
40
  {
41 22
    $this->raiseEvent('onBeforeControllerAction', $event);
42 22
  }
43
44
  protected function init()
45
  {
46
    parent::init();
47
48
    $this->setProjectName();
49
  }
50
51
  protected function setProjectName()
0 ignored issues
show
Coding Style introduced by
setProjectName uses the super-global variable $_SERVER which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
52
  {
53
    if( empty($this->params->project) && isset($_SERVER['SERVER_NAME']) )
54
    {
55
      $this->params->project = preg_replace("/^www./", '', Yii::app()->request->getServerName());
56
    }
57
  }
58
}