DummyFileReaderFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A create() 0 4 1
1
<?php
2
namespace Balloon\Reader\Factory;
3
4
use Balloon\Reader\DummyFileReader;
5
use Balloon\Reader\IFileReader;
6
7
/**
8
 * Class DummyFileReaderFactory
9
 * @package Balloon\Reader\Factory
10
 * @author Raphaël Lefebvre <[email protected]>
11
 */
12
class DummyFileReaderFactory implements IFileReaderFactory
13
{
14
    /**
15
     * @var IFileReader
16
     */
17
    private $fileReader;
18
19
    /**
20
     * @param IFileReader $fileReader
0 ignored issues
show
Documentation introduced by
Should the type for parameter $fileReader not be null|IFileReader?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
21
     */
22
    public function __construct(IFileReader $fileReader = null)
23
    {
24
        $this->fileReader = $fileReader ? : new DummyFileReader();
25
    }
26
27
    /**
28
     * @param string $filePath
29
     * @return IFileReader
30
     */
31
    public function create($filePath)
32
    {
33
        return $this->fileReader;
34
    }
35
}
36