Skip to content

Commit dbb7436

Browse files
committed
Create ConfigException.php
1 parent 84bc1a3 commit dbb7436

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/Kernel/ConfigException.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* @author : JIHAD SINNAOUR
4+
* @package : FloatPHP
5+
* @subpackage: Exceptions Component
6+
* @version : 1.0.0
7+
* @category : PHP framework
8+
* @copyright : (c) 2017 - 2021 JIHAD SINNAOUR <[email protected]>
9+
* @link : https://www.floatphp.com
10+
* @license : MIT License
11+
*/
12+
13+
namespace FloatPHP\Exceptions\Kernel;
14+
15+
use FloatPHP\Classes\System\Exception;
16+
17+
class ConfigException extends Exception
18+
{
19+
/**
20+
* @access public
21+
* @var int $code
22+
* @return string
23+
*/
24+
public function get($code = 1)
25+
{
26+
$header = "[FloatPHPException][{$code}]";
27+
$message = "{$header} Error : {$this->getError($code)}";
28+
$message .= "<br>{$header} Line : {$this->getLine()} in {$this->getFile()}";
29+
if ( $this->getMessage() ) {
30+
$message .= " ({$this->getMessage()})";
31+
}
32+
return $message;
33+
}
34+
35+
/**
36+
* @access private
37+
* @var int $code
38+
* @return string
39+
*/
40+
private function getError($code)
41+
{
42+
switch ( intval($code) ) {
43+
case 1:
44+
return 'Invalid Application Configuration';
45+
break;
46+
}
47+
return 'Unknown error';
48+
}
49+
}

0 commit comments

Comments
 (0)