Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
30 | 7 | public function create(SplFileInfo $file) : File |
|
31 | { |
||
32 | 7 | $relativeSource = substr($file->getPathname(), strlen($this->sourceDirectory)); |
|
33 | 7 | $relativeSource = ltrim($relativeSource, DIRECTORY_SEPARATOR); |
|
34 | |||
35 | 7 | if (Strings::endsWith($file->getPath(), '_posts')) { |
|
36 | 2 | return new PostFile($file, $relativeSource); |
|
37 | } |
||
38 | |||
39 | 5 | return new File($file, $relativeSource); |
|
40 | } |
||
41 | } |
||
42 |