コード例 #1
0
 /**
  * This exception is thrown when an unsupported response format was requested.
  *
  * @param string $encoder (default: null)
  */
 public function __construct($encoder = null)
 {
     if (!empty($encoder)) {
         $encoder = 'Unsupported format "' . $encoder . '" requested.';
     }
     parent::__construct(406, $encoder);
 }
コード例 #2
0
 /**
  * This exception should be thrown when a resource could not be processed
  * due to invalid attributes.
  * 
  * @param  string $resource
  * @param  mixed  $identifier  (default: null)
  */
 public function __construct($resource, $identifier = '')
 {
     $message = 'Nothing was found for resource [' . $resource . ']';
     if (!empty($identifier)) {
         $message .= ' using "' . $identifier . '" as identifier.';
     } else {
         $message .= '.';
     }
     parent::__construct(404, $message);
 }
コード例 #3
0
 /**
  * This exception should be thrown when a resource could not be processed
  * due to invalid attributes.
  * 
  * @param string $resource
  * @param array  $errors
  */
 public function __construct($resource, $errors)
 {
     parent::__construct(406, 'Invalid attributes given for [' . $resource . '].', $errors);
 }