Completed
Push — master ( f15f2a...6d9f7a )
by Igor
02:25
created

Storage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setFile() 0 4 1
A getFile() 0 8 2
1
<?php
2
3
/**
4
 * @link https://github.com/rkit/filemanager-yii2
5
 * @copyright Copyright (c) 2015 Igor Romanov
6
 * @license [MIT](http://opensource.org/licenses/MIT)
7
 */
8
9
namespace rkit\filemanager;
10
11
use yii\base\InvalidParamException;
12
use rkit\filemanager\StorageInterface;
13
14
/**
15
 * The base storage for all storages
16
 *
17
 * @author Igor Romanov <[email protected]>
18
 * @since 1.0
19
 */
20
abstract class Storage implements StorageInterface
21
{
22
    /**
23
     * @var File
24
     */
25
    private $file;
26
27
    /**
28
     * Set a file
29
     *
30
     * @param File $file File
31
     * @return string
32
     */
33 35
    public function setFile(\rkit\filemanager\models\File $file)
34
    {
35 35
        $this->file = $file;
0 ignored issues
show
Documentation Bug introduced by
It seems like $file of type object<rkit\filemanager\models\File> is incompatible with the declared type object<rkit\filemanager\File> of property $file.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
36 35
    }
37
38
    /**
39
     * Get a file
40
     *
41
     * @return File
42
     * @throws InvalidParamException
43
     */
44 35
    public function getFile()
45
    {
46 35
        if ($this->file === null) {
47 1
            throw new InvalidParamException('The file is not initialized');
48
        }
49
50 34
        return $this->file;
51
    }
52
}
53