Esempio n. 1
0
 /**
  * Constructor
  *
  * @throws \BLW\Model\InvalidArgumentException If <code>$Location</code> is invalid.
  *
  * @param \BLW\Type\IURI $Location
  *            Value of Location header
  */
 public function __construct(IURI $Location)
 {
     // 1. Header type
     $this->_Type = 'Location';
     // 2. Header value
     // Validate $Location
     if ($Location->isValid() && $Location->isAbsolute()) {
         // Base
         $this->_Value = @strval($Location);
         // Invalid $Location
     } else {
         throw new InvalidArgumentException(0);
     }
 }
Esempio n. 2
0
 /**
  * Constructor
  *
  * @throws \BLW\Model\InvalidArgumentException If <code>$Base</code> is invalid.
  *
  * @param \BLW\Type\IURI $Base
  *            Value of Content-Base header
  */
 public function __construct(IURI $Base)
 {
     // 1. Header type
     $this->_Type = 'Content-Base';
     // 2. Header value
     // Validate $Base
     if ($Base->isValid() && $Base->isAbsolute()) {
         // Base
         $this->_Value = @strval($Base);
         // Invalid $Base
     } else {
         throw new InvalidArgumentException(0);
     }
 }
Esempio n. 3
0
 /**
  * Sets the last / current URI of this response.
  *
  * @param \BLW\Type\IURI $URI
  *            New request URI
  * @return integer Returns a <code>DataMapper</code> status code.
  */
 public function setURI($URI)
 {
     // Validate $RequestURI
     if ($URI instanceof IURI) {
         if ($URI->isValid() && $URI->isAbsolute()) {
             // Update $_URI
             $this->_URI = $URI;
             // Done
             return IDataMapper::UPDATED;
         }
     }
     // Invalid
     return IDataMapper::INVALID;
 }
Esempio n. 4
0
 /**
  * Set the request referer.
  *
  * <h4>Note</h4>
  *
  * <p>Fails if:</p>
  *
  * <ul>
  * <li>$URI is invalid</li>
  * <li>$URI is not absolute</li>
  * </ul>
  *
  * <hr>
  *
  * @param \BLW\Type\IURI $Referer
  *            Request referer URL.
  * @return integer Returns a <code>DataMapper</code> status code.
  */
 public function setReferer($Referer)
 {
     // Validate $URI
     if ($Referer instanceof IURI) {
         if ($Referer->isValid() && $Referer->isAbsolute()) {
             // Update $_Referer
             $this->_Referer = $Referer;
             // Done
             return IDataMapper::UPDATED;
         }
     }
     // Invalid
     return IDataMapper::INVALID;
 }