Completed
Push — master ( ea324c...2e8bb7 )
by Andrey
01:33
created

LocalUploadController::getUploadComponent()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 9
Ratio 90 %

Importance

Changes 0
Metric Value
dl 9
loc 10
c 0
b 0
f 0
rs 9.9332
nc 2
cc 2
nop 0
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 View Code Duplication
class LocalUploadController extends CommonUploadController
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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