Passed
Branch feature/first-implementation (72fcf8)
by Andrea Marco
04:38
created

DefaultDtoQualifier::qualify()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
namespace Cerbero\LaravelDto\Console;
4
5
/**
6
 * The default DTO qualifier.
7
 *
8
 */
9
class DefaultDtoQualifier implements DtoQualifierContract
10
{
11
    /**
12
     * Retrieve the fully qualified DTO class name for the given model.
13
     *
14
     * @param string $model
15
     * @return string
16
     */
17
    public function qualify(string $model): string
18
    {
19
        $segments = explode('\\', $model);
20
        $baseName = array_pop($segments);
21
        $segments[] = 'Dtos';
22
        $segments[] = $baseName . 'Data';
23
24
        return implode('\\', $segments);
25
    }
26
}
27