DummyFileReaderFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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