Completed
Push — master ( 807037...c31f5c )
by Andrii
02:09
created

NginxController   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 49
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A actionDump() 0 4 1
A actionDeploy() 0 4 1
A actionLetsencrypt() 0 4 1
A actionStart() 0 4 1
A actionStop() 0 4 1
A actionReload() 0 4 1
A actionRestart() 0 4 1
A actionStatus() 0 4 1
A getComponent() 0 4 1
1
<?php
2
/**
3
 * Nginx plugin for HiDev.
4
 *
5
 * @see      https://github.com/hiqdev/hidev-nginx
6
 * @package   hidev-nginx
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2016-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\nginx\console;
12
13
/**
14
 * NGINX management.
15
 */
16
class NginxController extends \hidev\base\Controller
17
{
18
    public $defaultAction = 'dump';
19
20
    public function actionDump()
21
    {
22
        return $this->getComponent()->dump();
23
    }
24
25
    public function actionDeploy()
26
    {
27
        return $this->getComponent()->deploy();
28
    }
29
30
    public function actionLetsencrypt()
31
    {
32
        return $this->getComponent()->letsencrypt();
33
    }
34
35
    public function actionStart()
36
    {
37
        return $this->getComponent()->start();
38
    }
39
40
    public function actionStop()
41
    {
42
        return $this->getComponent()->stop();
43
    }
44
45
    public function actionReload()
46
    {
47
        return $this->getComponent()->reload();
48
    }
49
50
    public function actionRestart()
51
    {
52
        return $this->getComponent()->restart();
53
    }
54
55
    public function actionStatus()
56
    {
57
        return $this->getComponent()->status();
58
    }
59
60
    public function getComponent()
61
    {
62
        return $this->take('nginx');
0 ignored issues
show
Documentation Bug introduced by
The method take does not exist on object<hidev\nginx\console\NginxController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
63
    }
64
}
65