1 | <?php namespace Arcanedev\SeoHelper\Entities\OpenGraph; |
||
12 | class Graph implements OpenGraphContract |
||
13 | { |
||
14 | /* ------------------------------------------------------------------------------------------------ |
||
15 | | Traits |
||
16 | | ------------------------------------------------------------------------------------------------ |
||
17 | */ |
||
18 | use Configurable; |
||
19 | |||
20 | /* ------------------------------------------------------------------------------------------------ |
||
21 | | Properties |
||
22 | | ------------------------------------------------------------------------------------------------ |
||
23 | */ |
||
24 | /** |
||
25 | * The Open Graph meta collection. |
||
26 | * |
||
27 | * @var \Arcanedev\SeoHelper\Contracts\Entities\MetaCollection |
||
28 | */ |
||
29 | protected $metas; |
||
30 | |||
31 | /* ------------------------------------------------------------------------------------------------ |
||
32 | | Constructor |
||
33 | | ------------------------------------------------------------------------------------------------ |
||
34 | */ |
||
35 | /** |
||
36 | * Make Graph instance. |
||
37 | * |
||
38 | * @param array $configs |
||
39 | */ |
||
40 | 320 | public function __construct(array $configs = []) |
|
47 | |||
48 | /** |
||
49 | * Start the engine. |
||
50 | */ |
||
51 | 320 | private function init() |
|
60 | |||
61 | /* ------------------------------------------------------------------------------------------------ |
||
62 | | Properties |
||
63 | | ------------------------------------------------------------------------------------------------ |
||
64 | */ |
||
65 | /** |
||
66 | * Set the open graph prefix. |
||
67 | * |
||
68 | * @param string $prefix |
||
69 | * |
||
70 | * @return \Arcanedev\SeoHelper\Entities\OpenGraph\Graph |
||
71 | */ |
||
72 | 320 | public function setPrefix($prefix) |
|
78 | |||
79 | /** |
||
80 | * Set type property. |
||
81 | * |
||
82 | * @param string $type |
||
83 | * |
||
84 | * @return \Arcanedev\SeoHelper\Entities\OpenGraph\Graph |
||
85 | */ |
||
86 | 320 | public function setType($type) |
|
90 | |||
91 | /** |
||
92 | * Set title property. |
||
93 | * |
||
94 | * @param string $title |
||
95 | * |
||
96 | * @return \Arcanedev\SeoHelper\Entities\OpenGraph\Graph |
||
97 | */ |
||
98 | 320 | public function setTitle($title) |
|
102 | |||
103 | /** |
||
104 | * Set description property. |
||
105 | * |
||
106 | * @param string $description |
||
107 | * |
||
108 | * @return \Arcanedev\SeoHelper\Entities\OpenGraph\Graph |
||
109 | */ |
||
110 | 320 | public function setDescription($description) |
|
114 | |||
115 | /** |
||
116 | * Set url property. |
||
117 | * |
||
118 | * @param string $url |
||
119 | * |
||
120 | * @return \Arcanedev\SeoHelper\Entities\OpenGraph\Graph |
||
121 | */ |
||
122 | 16 | public function setUrl($url) |
|
126 | |||
127 | /** |
||
128 | * Set image property. |
||
129 | * |
||
130 | * @param string $image |
||
131 | * |
||
132 | * @return \Arcanedev\SeoHelper\Entities\OpenGraph\Graph |
||
133 | */ |
||
134 | 16 | public function setImage($image) |
|
138 | |||
139 | /** |
||
140 | * Set site name property. |
||
141 | * |
||
142 | * @param string $siteName |
||
143 | * |
||
144 | * @return \Arcanedev\SeoHelper\Entities\OpenGraph\Graph |
||
145 | */ |
||
146 | 320 | public function setSiteName($siteName) |
|
150 | |||
151 | /** |
||
152 | * Add many open graph properties. |
||
153 | * |
||
154 | * @param array $properties |
||
155 | * |
||
156 | * @return \Arcanedev\SeoHelper\Entities\OpenGraph\Graph |
||
157 | */ |
||
158 | 320 | public function addProperties(array $properties) |
|
164 | |||
165 | /** |
||
166 | * Add an open graph property. |
||
167 | * |
||
168 | * @param string $property |
||
169 | * @param string $content |
||
170 | * |
||
171 | * @return \Arcanedev\SeoHelper\Entities\OpenGraph\Graph |
||
172 | */ |
||
173 | 320 | public function addProperty($property, $content) |
|
179 | |||
180 | /* ------------------------------------------------------------------------------------------------ |
||
181 | | Main Functions |
||
182 | | ------------------------------------------------------------------------------------------------ |
||
183 | */ |
||
184 | /** |
||
185 | * Render the tag. |
||
186 | * |
||
187 | * @return string |
||
188 | */ |
||
189 | 240 | public function render() |
|
193 | |||
194 | /** |
||
195 | * Render the tag. |
||
196 | * |
||
197 | * @return string |
||
198 | */ |
||
199 | 64 | public function __toString() |
|
203 | } |
||
204 |