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

ChunkFileFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A create() 0 4 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