コード例 #1
0
ファイル: Response.php プロジェクト: jivoo/jivoo
 /**
  * Set value of property.
  * @param string $name Property name.
  * @param string $value Value of property.
  * @throws InvalidPropertyException If unknown property.
  */
 public function __set($property, $value)
 {
     switch ($property) {
         case 'status':
         case 'modified':
         case 'maxAge':
             $this->{$property} = $value;
             return;
         case 'type':
             $this->type = Utilities::convertType($value);
             return;
     }
     throw new InvalidPropertyException(tr('Invalid property: %1', $property));
 }
コード例 #2
0
ファイル: Request.php プロジェクト: jivoo/jivoo
 /**
  * Whether or not the client accepts the specified type. If the type is
  * omitted then a list of acceptable types is returned.
  * @param string $type Type, can be a MIME type or a file extension known by
  * {@see Utilities::convertType()}.
  * @return bool|string[] True if client accepts provided type, false otherwise.
  * List of accepted MIME types if type parameter omitted.
  */
 public function accepts($type = null)
 {
     if (!isset($type)) {
         return $this->accepts;
     }
     return in_array(Utilities::convertType($type), $this->accepts);
 }