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

CustomFileFinder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 32
wmc 3
lcom 1
cbo 3
ccs 0
cts 11
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getFileCollection() 0 11 2
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
  }