Completed
Push — master ( 63d559...0e0340 )
by Mahmoud
03:20
created

ResolveClassTask::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace App\Containers\Documentation\Tasks;
4
5
use App\Ship\Parents\Tasks\Task;
6
7
/**
8
 * Class ResolveClassTask.
9
 *
10
 * @author Mahmoud Zalt <[email protected]>
11
 */
12
class ResolveClassTask extends Task
13
{
14
15
    /**
16
     * string
17
     */
18
    const TYPES_CLASSES_NAMESPACE = 'App\Containers\Documentation\Objects\\';
19
20
    /**
21
     * string
22
     */
23
    const TYPES_CLASSES_POSTFIX = 'Api';
24
25
26
    /**
27
     * @param $types
28
     */
29
    public function run($types)
30
    {
31
        // generate the full namespace of the types class based on this function param
32
        if (!class_exists($typeClass = self::TYPES_CLASSES_NAMESPACE . ucwords($types) . self::TYPES_CLASSES_POSTFIX)) {
33
            throw new WrongDocTypeException("The Documentation type ($typeClass) is not supported!");
34
        }
35
36
        return $typeClass;
37
    }
38
39
}
40