Beispiel #1
0
 /**
  * URL of the page. This URL must begin with the protocol (such as http) and end
  * with a trailing slash, if your web server requires it. This value must be
  * less than 2,048 characters.
  * @see http://www.sitemaps.org/protocol.php
  * @param string $location
  */
 public function set_loc($location)
 {
     if (strlen($location) > 2048) {
         throw new \LengthException('The location was too long, maximum length of 2,048 characters.');
     }
     $location = \Baseapp\Library\Sitemap::encode($location);
     if (!filter_var($location, FILTER_VALIDATE_URL)) {
         throw new \InvalidArgumentException('The location was not a valid URL');
     }
     $this->attributes['loc'] = $location;
     return $this;
 }