Completed
Pull Request — 2.1 (#1090)
by Paweł
09:07
created

ArticleDocument   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 122
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 17
lcom 1
cbo 0
dl 0
loc 122
rs 10
c 0
b 0
f 0

17 Methods

Rating   Name   Duplication   Size   Complexity  
A getVersion() 0 4 1
A getLayout() 0 4 1
A getComponentTextStyles() 0 4 1
A setComponentTextStyles() 0 4 1
A addComponent() 0 4 1
A getComponents() 0 4 1
A getIdentifier() 0 4 1
A setIdentifier() 0 4 1
A getLanguage() 0 4 1
A setLanguage() 0 4 1
A setTitle() 0 4 1
A getTitle() 0 4 1
A getSubtitle() 0 4 1
A setSubtitle() 0 4 1
A setLayout() 0 4 1
A getMetadata() 0 4 1
A setMetadata() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Core Bundle.
7
 *
8
 * Copyright 2020 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2020 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Bundle\CoreBundle\AppleNews\Document;
18
19
use SWP\Bundle\CoreBundle\AppleNews\Component\ComponentInterface;
20
21
/**
22
 * The root object of an Apple News article, containing required properties,
23
 * metadata, content, layout, and styles.
24
 */
25
class ArticleDocument
26
{
27
    public const APPLE_NEWS_FORMAT_VERSION = '1.7';
28
29
    private $title;
30
31
    private $subtitle = '';
32
33
    private $components = [];
34
35
    /** @var Metadata */
36
    private $metadata;
37
38
    /**
39
     * @return string
40
     */
41
    public function getVersion(): string
42
    {
43
        return $this->version;
44
    }
45
46
    /**
47
     * @return Layout
48
     */
49
    public function getLayout(): Layout
50
    {
51
        return $this->layout;
52
    }
53
54
    /**
55
     * @return ComponentTextStyles
56
     */
57
    public function getComponentTextStyles(): ComponentTextStyles
58
    {
59
        return $this->componentTextStyles;
60
    }
61
62
    private $identifier;
63
64
    private $language;
65
66
    private $version = self::APPLE_NEWS_FORMAT_VERSION;
67
68
    /** @var Layout */
69
    private $layout;
70
71
    /** @var ComponentTextStyles */
72
    private $componentTextStyles;
73
74
    /**
75
     * @param ComponentTextStyles $componentTextStyles
76
     */
77
    public function setComponentTextStyles(ComponentTextStyles $componentTextStyles): void
78
    {
79
        $this->componentTextStyles = $componentTextStyles;
80
    }
81
82
    public function addComponent(ComponentInterface $component): void
83
    {
84
        $this->components[] = $component;
85
    }
86
87
    public function getComponents(): array
88
    {
89
        return $this->components;
90
    }
91
92
    public function getIdentifier(): string
93
    {
94
        return $this->identifier;
95
    }
96
97
    public function setIdentifier(string $identifier): void
98
    {
99
        $this->identifier = $identifier;
100
    }
101
102
    public function getLanguage(): string
103
    {
104
        return $this->language;
105
    }
106
107
    public function setLanguage(string $language): void
108
    {
109
        $this->language = $language;
110
    }
111
112
    public function setTitle(string $title): void
113
    {
114
        $this->title = $title;
115
    }
116
117
    public function getTitle(): string
118
    {
119
        return $this->title;
120
    }
121
122
    public function getSubtitle(): string
123
    {
124
        return $this->subtitle;
125
    }
126
127
    public function setSubtitle(string $subtitle): void
128
    {
129
        $this->subtitle = $subtitle;
130
    }
131
132
    public function setLayout(Layout $layout): void
133
    {
134
        $this->layout = $layout;
135
    }
136
137
    public function getMetadata(): Metadata
138
    {
139
        return $this->metadata;
140
    }
141
142
    public function setMetadata(Metadata $metadata): void
143
    {
144
        $this->metadata = $metadata;
145
    }
146
}
147