@@ -6,7 +6,7 @@ |
||
| 6 | 6 | use Fusonic\OpenGraph\Objects\Website; |
| 7 | 7 | use Fusonic\OpenGraph\Publisher; |
| 8 | 8 | |
| 9 | -require __DIR__ . "/../vendor/autoload.php"; |
|
| 9 | +require __DIR__."/../vendor/autoload.php"; |
|
| 10 | 10 | |
| 11 | 11 | // Construct a new Open Graph object |
| 12 | 12 | $website = new Website(); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $name = $property->key; |
| 112 | 112 | $value = $property->value; |
| 113 | 113 | |
| 114 | - switch($name) { |
|
| 114 | + switch ($name) { |
|
| 115 | 115 | case Property::AUDIO: |
| 116 | 116 | case Property::AUDIO_URL: |
| 117 | 117 | $this->audios[] = new Audio($value); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | private function handleImageAttribute(Image $element, string $name, string $value): void |
| 217 | 217 | { |
| 218 | - switch($name) |
|
| 218 | + switch ($name) |
|
| 219 | 219 | { |
| 220 | 220 | case Property::IMAGE_HEIGHT: |
| 221 | 221 | $element->height = (int)$value; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | private function handleVideoAttribute(Video $element, string $name, string $value): void |
| 239 | 239 | { |
| 240 | - switch($name) |
|
| 240 | + switch ($name) |
|
| 241 | 241 | { |
| 242 | 242 | case Property::VIDEO_HEIGHT: |
| 243 | 243 | $element->height = (int)$value; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | private function handleAudioAttribute(Audio $element, string $name, string $value): void |
| 258 | 258 | { |
| 259 | - switch($name) |
|
| 259 | + switch ($name) |
|
| 260 | 260 | { |
| 261 | 261 | case Property::AUDIO_TYPE: |
| 262 | 262 | $element->type = $value; |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | protected function convertToBoolean(string $value): bool |
| 280 | 280 | { |
| 281 | - switch(strtolower($value)) |
|
| 281 | + switch (strtolower($value)) |
|
| 282 | 282 | { |
| 283 | 283 | case "1": |
| 284 | 284 | case "true": |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | public function generateHtml(ObjectBase $object): string |
| 31 | 31 | { |
| 32 | 32 | $html = ""; |
| 33 | - $format = "<meta property=\"%s\" content=\"%s\"" . ($this->doctype == self::DOCTYPE_XHTML ? " />" : ">"); |
|
| 33 | + $format = "<meta property=\"%s\" content=\"%s\"".($this->doctype == self::DOCTYPE_XHTML ? " />" : ">"); |
|
| 34 | 34 | |
| 35 | 35 | foreach ($object->getProperties() as $property) { |
| 36 | 36 | if ($html !== "") { |
@@ -3,11 +3,11 @@ |
||
| 3 | 3 | use Symfony\Component\HttpClient\NativeHttpClient; |
| 4 | 4 | use Symfony\Component\HttpClient\Psr18Client; |
| 5 | 5 | |
| 6 | -require __DIR__ . "/../vendor/autoload.php"; |
|
| 6 | +require __DIR__."/../vendor/autoload.php"; |
|
| 7 | 7 | |
| 8 | 8 | // Initialize new Psr\HttpClient implementation. This example uses Symfony's implementation from the symfony/http-client |
| 9 | 9 | // package but you can use any implementation provided by your framework of choice. |
| 10 | -$client = new Psr18Client(new NativeHttpClient([ "headers" => [ "User-Agent" => "facebookexternalhit/1.1" ] ])); |
|
| 10 | +$client = new Psr18Client(new NativeHttpClient(["headers" => ["User-Agent" => "facebookexternalhit/1.1"]])); |
|
| 11 | 11 | |
| 12 | 12 | // Create a new crawler |
| 13 | 13 | $crawler = new Fusonic\OpenGraph\Consumer($client, $client); |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | $crawler->addHTMLContent($content, 'UTF-8'); |
| 92 | 92 | |
| 93 | 93 | $properties = []; |
| 94 | - foreach(['name', 'property'] as $t) |
|
| 94 | + foreach (['name', 'property'] as $t) |
|
| 95 | 95 | { |
| 96 | 96 | // Get all meta-tags starting with "og:" |
| 97 | 97 | $ogMetaTags = $crawler->filter("meta[{$t}^='og:']"); |