Completed
Push — master ( d7f072...e80481 )
by Shcherbak
05:37
created

CustomFileFinder::getFiles()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
ccs 0
cts 8
cp 0
rs 9.4285
cc 2
eloc 6
nc 2
nop 0
crap 6
1
<?php
2
3
  namespace Funivan\Cs\FileFinder;
4
5
  use Symfony\Component\Finder\Finder;
6
  use Symfony\Component\Finder\SplFileInfo;
7
8
  /**
9
   * @author Ivan Shcherbak <[email protected]> 2016
10
   */
11
  class CustomFileFinder implements FileFinderInterface {
12
13
    /**
14
     * @var Finder
15
     */
16
    private $finder;
17
18
19
    /**
20
     * @param Finder $finder
21
     */
22
    public function __construct(Finder $finder) {
23
      $this->finder = $finder;
24
    }
25
26
27
    /**
28
     * @return FileInfoCollection
29
     */
30
    public function getFileCollection() {
31
      $filesCollection = new FileInfoCollection();
32
33
      $files = $this->finder->files();
34
      /** @var SplFileInfo $file */
35
      foreach ($files as $file) {
36
        $filesCollection[] = new File($file->getRealPath(), File::STATUS_UNKNOWN);
37
      }
38
39
      return $filesCollection;
40
    }
41
42
  }