Completed
Pull Request — master (#30)
by Christian
02:27
created

FileInfo::getParsedSql()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 7
cts 7
cp 1
rs 9.4285
cc 3
eloc 8
nc 3
nop 0
crap 3
1
<?php
2
3
namespace uuf6429\ElderBrother\Change;
4
5
use PHPSQLParser\PHPSQLParser;
6
use Symfony\Component\Finder;
7
8
class FileInfo extends Finder\SplFileInfo
9
{
10
    /** @var array|false */
11
    protected $parsedSql;
12
13
    /**
14
     * @return array
15
     */
16 1
    public function getParsedSql()
17
    {
18 1
        if ($this->parsedSql === null) {
19 1
            if($this->isFile()){
20 1
                $parser = new PHPSQLParser($this->getContents());
21 1
                $this->parsedSql = $parser->parsed;
22
            }else{
23 1
                $this->parsedSql = false;
24
            }
25
        }
26
27 1
        return $this->parsedSql;
28
    }
29
}
30