/** * Returns the id found in a facebook url * * @param Url $url * * @return string */ private function getId(Url $url) { if ($url->hasQueryParameter('story_fbid')) { $this->isEmbeddable = true; return $url->getQueryParameter('story_fbid'); } if ($url->hasQueryParameter('fbid')) { return $url->getQueryParameter('fbid'); } if ($url->hasQueryParameter('id')) { return $url->getQueryParameter('id'); } if ($url->getDirectoryPosition(0) === 'events') { $this->isEmbeddable = true; return $url->getDirectoryPosition(1); } if ($url->getDirectoryPosition(0) === 'pages') { return $url->getDirectoryPosition(2); } if ($url->getDirectoryPosition(1) === 'posts') { $this->isEmbeddable = true; return $url->getDirectoryPosition(2); } if ($url->getDirectoryPosition(2) === 'posts') { $this->isEmbeddable = true; return $url->getDirectoryPosition(3); } return $url->getDirectoryPosition(0); }