Nette\Http\Url::getQueryParameter PHP Method

getQueryParameter() public method

public getQueryParameter ( $name, $default = NULL ) : mixed
return mixed
    public function getQueryParameter($name, $default = NULL)
    {
        return isset($this->query[$name]) ? $this->query[$name] : $default;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Fetches video data by youtube url
  * @param  string  $videoUrl YouTube url
  * @return Video
  */
 public function getVideoByUrl($videoUrl)
 {
     $url = new Nette\Http\Url($videoUrl);
     if (stripos($url->host, 'youtu.be') !== false) {
         return $this->getVideo(trim($url->getPath(), '/'));
     }
     $videoId = $url->getQueryParameter('v');
     if (stripos($url->host, 'youtube.com') === false || $videoId === null) {
         throw new Nette\InvalidArgumentException('videoUrl must be valid youtube url.');
     }
     return $this->getVideo($videoId);
 }
All Usage Examples Of Nette\Http\Url::getQueryParameter