Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
lennyrouanet committed Apr 15, 2022
1 parent 082a76b commit 4230868
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Dependencies
composer.lock
vendor/*

# Dev
.DS_Store
.nova/*
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
# error
Error
# Error

## Requirments

PHP >= 8.0


## Install

`composer require phant/error`

## List

- AlreadyDone
- AlreadyExists
- NotAuthorized
- NotCompliant
- NotExist
- NotFound
14 changes: 14 additions & 0 deletions component/Abstract/Error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);

namespace Phant\Error\Abstract;

abstract class Error extends \Exception
{
function __construct(?string $detail = null)
{
if ($detail) {
$this->message .= ' (' . $detail . ')';
}
}
}
8 changes: 8 additions & 0 deletions component/AlreadyDone.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
declare(strict_types=1);

namespace Phant\Error;

class AlreadyDone extends \Phant\Error\Abstract\Error
{
}
8 changes: 8 additions & 0 deletions component/AlreadyExists.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
declare(strict_types=1);

namespace Phant\Error;

class AlreadyExists extends \Phant\Error\Abstract\Error
{
}
8 changes: 8 additions & 0 deletions component/NotAuthorized.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
declare(strict_types=1);

namespace Phant\Error;

class NotAuthorized extends \Phant\Error\Abstract\Error
{
}
8 changes: 8 additions & 0 deletions component/NotCompliant.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
declare(strict_types=1);

namespace Phant\Error;

class NotCompliant extends \Phant\Error\Abstract\Error
{
}
8 changes: 8 additions & 0 deletions component/NotExist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
declare(strict_types=1);

namespace Phant\Error;

class NotExist extends \Phant\Error\Abstract\Error
{
}
8 changes: 8 additions & 0 deletions component/NotFound.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
declare(strict_types=1);

namespace Phant\Error;

class NotFound extends \Phant\Error\Abstract\Error
{
}
26 changes: 26 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "phant/error",
"description": "Manage error easily",
"license": "MIT",
"keywords": ["error manager", "error component", "error exception"],
"authors": [
{
"name": "Lenny ROUANET",
"email": "[email protected]"
}
],
"require": {
"php": "^8.0"
},
"require-dev": {
"phpstan/phpstan": "^1.4"
},
"scripts": {
"analyse": "vendor/bin/phpstan analyse component --memory-limit=4G"
},
"autoload": {
"psr-4": {
"Phant\\Error\\": "component/"
}
}
}
12 changes: 12 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<phpunit bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="component">
<directory>test</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">component</directory>
</include>
</coverage>
</phpunit>

0 comments on commit 4230868

Please sign in to comment.