FolderGenerator::generate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the PostmanGeneratorBundle package.
5
 *
6
 * (c) Vincent Chalamon <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace PostmanGeneratorBundle\Generator;
13
14
use Dunglas\ApiBundle\Api\ResourceInterface;
15
use PostmanGeneratorBundle\Model\Folder;
16
use Ramsey\Uuid\Uuid;
17
18
class FolderGenerator implements GeneratorInterface
19
{
20
    /**
21
     * {@inheritdoc}
22
     *
23
     * @return Folder
24
     */
25 1
    public function generate(ResourceInterface $resource = null)
26
    {
27 1
        $folder = new Folder();
28 1
        $folder->setId((string) Uuid::uuid4());
29 1
        $folder->setName($resource->getShortName());
30
31 1
        return $folder;
32
    }
33
}
34