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

PagesIndex::getDataProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 2
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