Completed
Push — master ( 2038e8...a5b302 )
by Andrii
01:52
created

PagesIndex   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 23
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getStorage() 0 5 1
A createFromDir() 0 8 1
A getDataProvider() 0 3 1
1
<?php
2
3
namespace hiqdev\yii2\modules\pages\models;
4
5
use Yii;
6
7
class PagesIndex
8
{
9
    protected $pages = [];
10
11
    public static function getStorage()
12
    {
13
        /// TODO ...
14
        return Yii::$app->getModule('pages')->getStorage();
15
    }
16
17
    public static function createFromDir($path)
18
    {
19
        $list = static::getStorage()->listContents($path);
20
        var_dump($list);die();
0 ignored issues
show
Security Debugging Code introduced by
var_dump($list); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
Coding Style Compatibility introduced by
The method createFromDir() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
21
        $index = new static();
0 ignored issues
show
Unused Code introduced by
$index = new static(); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
22
23
        return $index;
24
    }
25
26
    public function getDataProvider()
27
    {
28
    }
29
}
30