1. Go to this page and download the library: Download igsem/api-exceptions library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
igsem / api-exceptions example snippets
use Igsem\ApiExceptions\Loggers\PhalconLogger;
/**
* Initializes the logger
*/
protected function initLogger()
{
/** @var \Phalcon\Config $config */
$config = $this->diContainer->getShared('config');
$path = $config->get('logger')->toArray()['path'];
$this->diContainer->setShared('logger', new PhalconLogger($path));
}
namespace Igsem\ApiExceptions\Exceptions;
/**
* Created by PhpStorm.
* User: juliuskoronci
* Date: 23/04/2017
* Time: 11:54
*/
class InvalidParametersException extends \Exception implements ApiExceptionInterface
{
/** @var array - used to pass additional info for dev env */
private $debug;
/**
* TokenException constructor.
* @param string $message
* @param int $code
* @param \Throwable|null $previous
* @param array $debug
*/
public function __construct(
$message = StatusCodes::INVALID_PARAMETERS_MESSAGE,
$code = StatusCodes::INVALID_PARAMETERS_CODE,
\Throwable $previous = null,
$debug = []
)
{
/**
* Set Default if null provided because of debug
*/
$message = $message??StatusCodes::INVALID_PARAMETERS_MESSAGE;
$code = $code??StatusCodes::INVALID_PARAMETERS_CODE;
parent::__construct($message, $code, $previous);
$this->debug = $debug;
}
/**
* @return array
*/
public function getDebug(): array
{
return $this->debug;
}
/**
* @param array $debug
*/
public function setDebug(array $debug = [])
{
$this->debug = $debug;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.