CreateGlobalCommand::setContentType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
ccs 3
cts 3
cp 1
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Synapse\Cmf\Framework\Theme\Template\Domain\Command;
4
5
use Synapse\Cmf\Framework\Theme\ContentType\Model\ContentTypeInterface;
6
7
/**
8
 * Global template creation command representation.
9
 */
10
class CreateGlobalCommand extends CreateCommand
11
{
12
    /**
13
     * @var ContentTypeInterface
14
     */
15
    protected $contentType;
16
17
    /**
18
     * @see CreateAction::createTemplate()
19
     */
20 2
    protected function createTemplate($templateClass)
21
    {
22 2
        return (new $templateClass())
23 2
            ->setGlobal()
24 2
            ->setTemplateType($this->templateType)
25 2
            ->setContentType($this->contentType)
26 1
        ;
27
    }
28
29
    /**
30
     * Define action content type.
31
     *
32
     * @param ContentTypeInterface $contentType
33
     *
34
     * @return self
35
     */
36 2
    public function setContentType(ContentTypeInterface $contentType)
37
    {
38 2
        $this->contentType = $contentType;
39
40 2
        return $this;
41
    }
42
}
43