/** * @dataProvider headerDataProvider */ public function testHeadersSetter($headers) { $exception = new UnauthorizedHttpException('Challenge'); $exception->setHeaders($headers); $this->assertSame($headers, $exception->getHeaders()); }
public function __construct($challenge = "Token", $message = "Authorization Failed", \Exception $previous = null, $code = 0) { parent::__construct($challenge, $message, $previous, $code); }
public function __construct() { parent::__construct('WWW-Authenticate: Basic realm="My Realm"'); }
public function __construct($challenge = "Acl", $message = "Not enough permissions for the resource", \Exception $previous = null, $code = 0) { parent::__construct($challenge, $message, $previous, $code); }
/** * An enhanced constructor that allows for passing the default \Exception parameters, as well as an array of additional * attributes followed by any number of additional arguments that will be passed to sprintf against the message. * * @param string|null $message An error message string (optionally fed to sprintf if optional args are given) * @param int|null $code The error code (which should be from ORMExceptionInterface). If null, the value * of ExceptionInterface::CODE_GENERIC will be used. * @param mixed $previous The previous exception (when re-thrown within another exception), if applicable. * @param mixed[]|null $attributes An optional array of attributes to pass. Will be provided in the debug output. * @param mixed ...$sprintfArgs Optional additional parameters that will be passed to sprintf against the * message string provided. */ public function __construct($message = null, $code = null, $previous = null, array $attributes = null, ...$sprintfArgs) { parent::__construct($this->getFinalCode((int) $code), $this->getFinalMessage((string) $message, ...$sprintfArgs), $this->getFinalPreviousException($previous), $attributes, $this->getFinalCode((int) $code)); $this->setAttributes((array) $attributes); }