[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of JSON-API. 5 * 6 * (c) Toby Zerner <[email protected]> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Tobscure\JsonApi\Exception\Handler; 13 14 use Exception; 15 use Tobscure\JsonApi\Exception\InvalidParameterException; 16 17 class InvalidParameterExceptionHandler implements ExceptionHandlerInterface 18 { 19 /** 20 * {@inheritdoc} 21 */ 22 public function manages(Exception $e) 23 { 24 return $e instanceof InvalidParameterException; 25 } 26 27 /** 28 * {@inheritdoc} 29 */ 30 public function handle(Exception $e) 31 { 32 $status = 400; 33 $error = []; 34 35 $code = $e->getCode(); 36 if ($code) { 37 $error['code'] = $code; 38 } 39 40 $invalidParameter = $e->getInvalidParameter(); 41 if ($invalidParameter) { 42 $error['source'] = ['parameter' => $invalidParameter]; 43 } 44 45 return new ResponseBag($status, [$error]); 46 } 47 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |