Completed
Push — master ( 8e0587...afc775 )
by recca
01:27
created

ChunkFileFactory::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 2
eloc 2
nc 2
nop 1
1
<?php
2
3
namespace Recca0120\Upload;
4
5
class ChunkFileFactory
6
{
7
    /**
8
     * __construct.
9
     *
10
     * @param \Recca0120\Upload\Filesystem $files
11
     */
12
    public function __construct(Filesystem $files = null)
13
    {
14
        $this->files = $files ?: new Filesystem();
0 ignored issues
show
Bug introduced by
The property files does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
15
    }
16
17
    /**
18
     * create.
19
     *
20
     * @return \Recca0120\Upload\ChunkFile
21
     */
22
    public function create($name, $chunksPath, $storagePath, $token = null)
23
    {
24
        return new ChunkFile($name, $chunksPath, $storagePath, $token, $this->files);
25
    }
26
}
27