CodeceptionGoal   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 9
Bugs 0 Features 0
Metric Value
wmc 11
c 9
b 0
f 0
lcom 1
cbo 1
dl 0
loc 51
ccs 0
cts 24
cp 0
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A actionMake() 0 4 1
A actionLoad() 0 4 1
A actionConfig() 0 4 1
A actionRun() 0 4 1
A build() 0 4 1
A actionBuild() 0 7 2
A bootstrap() 0 4 1
A actionBootstrap() 0 7 3
1
<?php
2
3
/*
4
 * Codeception plugin for HiDev
5
 *
6
 * @link      https://github.com/hiqdev/hidev-codeception
7
 * @package   hidev-codeception
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hidev\codeception\goals;
13
14
/**
15
 * Goal for Codeception.
16
 */
17
class CodeceptionGoal extends \hidev\controllers\CommonController
18
{
19
    public $isBuilt        = false;
20
    public $isBootstrapped = false;
21
22
    public function actionMake()
23
    {
24
        return $this->runActions('load, config, build, run');
25
    }
26
27
    public function actionLoad()
28
    {
29
        $this->isBootstrapped = $this->config->get('codeception.yml')->exists();
0 ignored issues
show
Documentation introduced by
The property config does not exist on object<hidev\codeception\goals\CodeceptionGoal>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
30
    }
31
32
    public function actionConfig()
33
    {
34
        $this->runRequest('codeception.yml');
35
    }
36
37
    public function actionRun()
38
    {
39
        return $this->passthru('codecept', 'run');
40
    }
41
42
    public function build()
43
    {
44
        return $this->passthru('codecept', 'build');
45
    }
46
47
    public function actionBuild()
48
    {
49
        if (!$this->isBuilt) {
50
            $this->isBuilt = true;
51
            return $this->build();
52
        }
53
    }
54
55
    public function bootstrap()
56
    {
57
        return $this->passthru('codecept', 'bootstrap');
58
    }
59
60
    public function actionBootstrap($force = false)
61
    {
62
        if (!$this->isBootstrapped || $force) {
63
            $this->isBootstrapped = true;
64
            return $this->bootstrap();
65
        }
66
    }
67
}
68