ChunkFileFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 22
ccs 5
cts 5
cp 1
rs 10
c 0
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 11
    public function __construct(Filesystem $files = null)
13
    {
14 11
        $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 11
    }
16
17
    /**
18
     * create.
19
     *
20
     * @return \Recca0120\Upload\ChunkFile
21
     */
22 1
    public function create($name, $chunksPath, $storagePath, $token = null, $mimeType = null)
23
    {
24 1
        return new ChunkFile($name, $chunksPath, $storagePath, $token, $mimeType, $this->files);
25
    }
26
}
27