Completed
Push — master ( e3793e...0dd56b )
by Quentin
23:42
created

CreateGlobalCommand::createTemplate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 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
    protected function createTemplate($templateClass)
21
    {
22
        return (new $templateClass())
23
            ->setGlobal()
24
            ->setTemplateType($this->templateType)
25
            ->setContentType($this->contentType)
26
        ;
27
    }
28
29
    /**
30
     * Define action content type.
31
     *
32
     * @param ContentTypeInterface $contentType
33
     *
34
     * @return self
35
     */
36
    public function setContentType(ContentTypeInterface $contentType)
37
    {
38
        $this->contentType = $contentType;
39
40
        return $this;
41
    }
42
}
43