Skip to content

Commit 203c2c0

Browse files
authored
Merge pull request #1 from brispot/use-trait-exception-and-improve-parameter-exception
use trait exception and improve parameter exception
2 parents efc9e9f + ad598e1 commit 203c2c0

13 files changed

+179
-355
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
}
1414
},
1515
"minimum-stability": "dev",
16-
"prefer-stable": true
17-
}
16+
"prefer-stable": true,
17+
"require-dev": {
18+
"squizlabs/php_codesniffer": "*"
19+
}
20+
}

composer.lock

Lines changed: 101 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Exceptions/AccessException.php

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use Exception;
1919
use Brispot\PhpLib\Exceptions\ExceptionInterface;
20+
use Brispot\PhpLib\Exceptions\TraitException;
2021

2122
/**
2223
* Class AccessException
@@ -29,6 +30,7 @@
2930
*/
3031
class AccessException extends Exception implements ExceptionInterface
3132
{
33+
use TraitException;
3234
/* Properties */
3335
private string $errorCode;
3436
private string $errorMessage;
@@ -52,43 +54,4 @@ public function __construct(string $message = 'Akses tidak diijinkan', mixed $da
5254
parent::__construct($message, 1, null);
5355
}
5456

55-
/**
56-
* Get attribute errorCode
57-
*
58-
* @return string
59-
*/
60-
public function getErrorCode(): string
61-
{
62-
return $this->errorCode;
63-
}
64-
65-
/**
66-
* Get attribute errorMessage
67-
*
68-
* @return string
69-
*/
70-
public function getErrorMessage(): string
71-
{
72-
return $this->errorMessage;
73-
}
74-
75-
/**
76-
* Get attribute httpCode
77-
*
78-
* @return int
79-
*/
80-
public function getHttpCode(): int
81-
{
82-
return $this->httpCode;
83-
}
84-
85-
/**
86-
* Get attribute data
87-
*
88-
* @return mixed
89-
*/
90-
public function getData(): mixed
91-
{
92-
return $this->data;
93-
}
9457
}

src/Exceptions/DataNotFoundException.php

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use Exception;
1919
use Brispot\PhpLib\Exceptions\ExceptionInterface;
20+
use Brispot\PhpLib\Exceptions\TraitException;
2021

2122
/**
2223
* Class DataNotFoundException
@@ -29,6 +30,7 @@
2930
*/
3031
class DataNotFoundException extends Exception implements ExceptionInterface
3132
{
33+
use TraitException;
3234
/* Properties */
3335
private string $errorCode;
3436
private string $errorMessage;
@@ -52,43 +54,4 @@ public function __construct(string $message = 'Data tidak ditemukan', mixed $dat
5254
parent::__construct($message, 2, null);
5355
}
5456

55-
/**
56-
* Get attribute errorCode
57-
*
58-
* @return string
59-
*/
60-
public function getErrorCode(): string
61-
{
62-
return $this->errorCode;
63-
}
64-
65-
/**
66-
* Get attribute errorMessage
67-
*
68-
* @return string
69-
*/
70-
public function getErrorMessage(): string
71-
{
72-
return $this->errorMessage;
73-
}
74-
75-
/**
76-
* Get attribute httpCode
77-
*
78-
* @return int
79-
*/
80-
public function getHttpCode(): int
81-
{
82-
return $this->httpCode;
83-
}
84-
85-
/**
86-
* Get attribute data
87-
*
88-
* @return mixed
89-
*/
90-
public function getData(): mixed
91-
{
92-
return $this->data;
93-
}
9457
}

src/Exceptions/HeaderException.php

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use Exception;
1919
use Brispot\PhpLib\Exceptions\ExceptionInterface;
20+
use Brispot\PhpLib\Exceptions\TraitException;
2021

2122
/**
2223
* Class HeaderException
@@ -29,6 +30,7 @@
2930
*/
3031
class HeaderException extends Exception implements ExceptionInterface
3132
{
33+
use TraitException;
3234
/* Properties */
3335
private string $errorCode;
3436
private string $errorMessage;
@@ -52,43 +54,4 @@ public function __construct(string $message = 'Header Request tidak valid', mixe
5254
parent::__construct($message, 1, null);
5355
}
5456

55-
/**
56-
* Get attribute errorCode
57-
*
58-
* @return string
59-
*/
60-
public function getErrorCode(): string
61-
{
62-
return $this->errorCode;
63-
}
64-
65-
/**
66-
* Get attribute errorMessage
67-
*
68-
* @return string
69-
*/
70-
public function getErrorMessage(): string
71-
{
72-
return $this->errorMessage;
73-
}
74-
75-
/**
76-
* Get attribute httpCode
77-
*
78-
* @return int
79-
*/
80-
public function getHttpCode(): int
81-
{
82-
return $this->httpCode;
83-
}
84-
85-
/**
86-
* Get attribute data
87-
*
88-
* @return mixed
89-
*/
90-
public function getData(): mixed
91-
{
92-
return $this->data;
93-
}
9457
}

src/Exceptions/InvalidRuleException.php

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use Exception;
1919
use Brispot\PhpLib\Exceptions\ExceptionInterface;
20+
use Brispot\PhpLib\Exceptions\TraitException;
2021

2122
/**
2223
* Class InvalidRuleException
@@ -29,6 +30,7 @@
2930
*/
3031
class InvalidRuleException extends Exception implements ExceptionInterface
3132
{
33+
use TraitException;
3234
/* Properties */
3335
private string $errorCode;
3436
private string $errorMessage;
@@ -52,43 +54,4 @@ public function __construct(string $message = 'Validasi tidak terpenuhi', mixed
5254
parent::__construct($message, 3, null);
5355
}
5456

55-
/**
56-
* Get attribute errorCode
57-
*
58-
* @return string
59-
*/
60-
public function getErrorCode(): string
61-
{
62-
return $this->errorCode;
63-
}
64-
65-
/**
66-
* Get attribute errorMessage
67-
*
68-
* @return string
69-
*/
70-
public function getErrorMessage(): string
71-
{
72-
return $this->errorMessage;
73-
}
74-
75-
/**
76-
* Get attribute httpCode
77-
*
78-
* @return int
79-
*/
80-
public function getHttpCode(): int
81-
{
82-
return $this->httpCode;
83-
}
84-
85-
/**
86-
* Get attribute data
87-
*
88-
* @return mixed
89-
*/
90-
public function getData(): mixed
91-
{
92-
return $this->data;
93-
}
9457
}

0 commit comments

Comments
 (0)