LocalUploadController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getUploadComponent() 0 9 2
1
<?php
2
3
namespace Itstructure\MFUploader\controllers\upload;
4
5
use yii\base\InvalidConfigException;
6
use Itstructure\MFUploader\interfaces\UploadComponentInterface;
7
8
/**
9
 * Class LocalUploadController
10
 * Upload controller class to upload files in local directory.
11
 *
12
 * @package Itstructure\MFUploader\controllers\upload
13
 *
14
 * @author Andrey Girnik <[email protected]>
15
 */
16
class LocalUploadController extends CommonUploadController
17
{
18
    /**
19
     * Get local upload component.
20
     *
21
     * @throws InvalidConfigException
22
     *
23
     * @return UploadComponentInterface
24
     */
25
    protected function getUploadComponent(): UploadComponentInterface
26
    {
27
        $uploadComponent = $this->module->get('local-upload-component');
28
29
        if (!($uploadComponent instanceof UploadComponentInterface)) {
30
            throw new InvalidConfigException("local-upload-component must be implemented of UploadComponentInterface.");
31
        }
32
33
        return $uploadComponent;
34
    }
35
}
36