@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $name = $property->key; |
130 | 130 | $value = $property->value; |
131 | 131 | |
132 | - switch($name) { |
|
132 | + switch ($name) { |
|
133 | 133 | case Property::AUDIO: |
134 | 134 | case Property::AUDIO_URL: |
135 | 135 | $this->audios[] = new Audio($value); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | private function handleImageAttribute(Image $element, $name, $value) |
237 | 237 | { |
238 | - switch($name) |
|
238 | + switch ($name) |
|
239 | 239 | { |
240 | 240 | case Property::IMAGE_HEIGHT: |
241 | 241 | $element->height = (int)$value; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | private function handleVideoAttribute(Video $element, $name, $value) |
259 | 259 | { |
260 | - switch($name) |
|
260 | + switch ($name) |
|
261 | 261 | { |
262 | 262 | case Property::VIDEO_HEIGHT: |
263 | 263 | $element->height = (int)$value; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | private function handleAudioAttribute(Audio $element, $name, $value) |
278 | 278 | { |
279 | - switch($name) |
|
279 | + switch ($name) |
|
280 | 280 | { |
281 | 281 | case Property::AUDIO_TYPE: |
282 | 282 | $element->type = $value; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | protected function convertToBoolean($value) |
296 | 296 | { |
297 | - switch(strtolower($value)) |
|
297 | + switch (strtolower($value)) |
|
298 | 298 | { |
299 | 299 | case "1": |
300 | 300 | case "true": |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function generateHtml(ObjectBase $object) |
28 | 28 | { |
29 | 29 | $html = ""; |
30 | - $format = "<meta property=\"%s\" content=\"%s\"" . ($this->doctype == self::DOCTYPE_XHTML ? " />" : ">"); |
|
30 | + $format = "<meta property=\"%s\" content=\"%s\"".($this->doctype == self::DOCTYPE_XHTML ? " />" : ">"); |
|
31 | 31 | |
32 | 32 | foreach ($object->getProperties() as $property) { |
33 | 33 | if ($html !== "") { |
@@ -80,6 +80,9 @@ discard block |
||
80 | 80 | return $page; |
81 | 81 | } |
82 | 82 | |
83 | + /** |
|
84 | + * @param string $content |
|
85 | + */ |
|
83 | 86 | private function extractOpenGraphData($content) |
84 | 87 | { |
85 | 88 | $crawler = new Crawler; |
@@ -93,6 +96,10 @@ discard block |
||
93 | 96 | // Create clean property array |
94 | 97 | $props = Linq::from($ogMetaTags) |
95 | 98 | ->select( |
99 | + |
|
100 | + /** |
|
101 | + * @param string $tag |
|
102 | + */ |
|
96 | 103 | function (\DOMElement $tag) use ($t) { |
97 | 104 | $name = strtolower(trim($tag->getAttribute($t))); |
98 | 105 | $value = trim($tag->getAttribute("content")); |
@@ -107,6 +114,10 @@ discard block |
||
107 | 114 | // Create new object of the correct type |
108 | 115 | $typeProperty = Linq::from($properties) |
109 | 116 | ->firstOrNull( |
117 | + |
|
118 | + /** |
|
119 | + * @param string $property |
|
120 | + */ |
|
110 | 121 | function (Property $property) { |
111 | 122 | return $property->key === Property::TYPE; |
112 | 123 | } |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | $crawler->addHTMLContent($content, 'UTF-8'); |
87 | 87 | |
88 | 88 | $properties = []; |
89 | - foreach(['name', 'property'] as $t) |
|
89 | + foreach (['name', 'property'] as $t) |
|
90 | 90 | { |
91 | 91 | // Get all meta-tags starting with "og:" |
92 | 92 | $ogMetaTags = $crawler->filter("meta[{$t}^='og:']"); |
93 | 93 | // Create clean property array |
94 | 94 | $props = Linq::from($ogMetaTags) |
95 | 95 | ->select( |
96 | - function (\DOMElement $tag) use ($t) { |
|
96 | + function(\DOMElement $tag) use ($t) { |
|
97 | 97 | $name = strtolower(trim($tag->getAttribute($t))); |
98 | 98 | $value = trim($tag->getAttribute("content")); |
99 | 99 | return new Property($name, $value); |
@@ -107,13 +107,12 @@ discard block |
||
107 | 107 | // Create new object of the correct type |
108 | 108 | $typeProperty = Linq::from($properties) |
109 | 109 | ->firstOrNull( |
110 | - function (Property $property) { |
|
110 | + function(Property $property) { |
|
111 | 111 | return $property->key === Property::TYPE; |
112 | 112 | } |
113 | 113 | ); |
114 | 114 | switch ($typeProperty !== null ? $typeProperty->value : null) { |
115 | - default: |
|
116 | - $object = new Website(); |
|
115 | + default : $object = new Website(); |
|
117 | 116 | break; |
118 | 117 | } |
119 | 118 |