Completed
Push — master ( 9b439e...de8363 )
by Igor
03:05
created

Storage::setFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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
 * This is the base storage
16
 */
17
abstract class Storage implements StorageInterface
18
{
19
    protected $file;
20
21 35
    public function setFile(\rkit\filemanager\models\File $file)
22
    {
23 35
        $this->file = $file;
24 35
    }
25
26 36
    public function getFile()
27
    {
28 36
        if ($this->file === null) {
29 1
            throw new InvalidParamException('The file is not initialized');
30
        }
31
32 35
        return $this->file;
33
    }
34
}
35