FileReaderFactory::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
namespace Balloon\Reader\Factory;
3
4
use Balloon\Reader\FileReader;
5
use Balloon\Reader\IFileReader;
6
7
/**
8
 * Class FileReaderFactory
9
 * @package Balloon\Reader\Factory
10
 * @author Raphaël Lefebvre <[email protected]>
11
 */
12
class FileReaderFactory implements IFileReaderFactory
13
{
14
    /**
15
     * @var bool
16
     */
17
    private $useIncludePath;
18
19
    /**
20
     * @var resource
21
     */
22
    private $context;
23
24
    /**
25
     * @param bool $useIncludePath
26
     * @param resource $context
0 ignored issues
show
Documentation introduced by
Should the type for parameter $context not be resource|null?

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...
27
     */
28
    public function __construct($useIncludePath = false, $context = null)
29
    {
30
        $this->useIncludePath = $useIncludePath;
31
        $this->context = $context;
32
    }
33
34
    /**
35
     * @param $filePath
36
     * @return IFileReader
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use FileReader.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
37
     */
38
    public function create($filePath)
39
    {
40
        return new FileReader($filePath, $this->useIncludePath, $this->context);
41
    }
42
}
43