mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 22:17:26 +01:00
Optimized Exceptions
This commit is contained in:
parent
130682ef6c
commit
67428c2fea
@ -16,7 +16,7 @@ use App\Entity\Attribut\LayerAttribut;
|
|||||||
use App\Entity\Attribut\RelationAttribut;
|
use App\Entity\Attribut\RelationAttribut;
|
||||||
use App\Entity\Attribut\PriorityAttribut;
|
use App\Entity\Attribut\PriorityAttribut;
|
||||||
use App\Entity\Source\SourceInterface;
|
use App\Entity\Source\SourceInterface;
|
||||||
use App\Exception\NoValidChoice;
|
use App\Exception\NoValidChoiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -100,7 +100,7 @@ class Right extends AbstractMeta implements RightInterface
|
|||||||
public function setType(string $type): void
|
public function setType(string $type): void
|
||||||
{
|
{
|
||||||
if (!array_key_exists($type, RightType::getChoices())) {
|
if (!array_key_exists($type, RightType::getChoices())) {
|
||||||
throw new NoValidChoice();
|
throw new NoValidChoiceException();
|
||||||
}
|
}
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ class Right extends AbstractMeta implements RightInterface
|
|||||||
public function setLayer(string $layer): void
|
public function setLayer(string $layer): void
|
||||||
{
|
{
|
||||||
if (!array_key_exists($layer, LayerType::getChoices())) {
|
if (!array_key_exists($layer, LayerType::getChoices())) {
|
||||||
throw new NoValidChoice();
|
throw new NoValidChoiceException();
|
||||||
}
|
}
|
||||||
$this->layer = $layer;
|
$this->layer = $layer;
|
||||||
}
|
}
|
||||||
|
9
application/src/Exception/AllreadySetException.php
Normal file
9
application/src/Exception/AllreadySetException.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exception;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
|
||||||
|
|
||||||
|
final class AllreadySetException extends ConflictHttpException
|
||||||
|
{
|
||||||
|
}
|
@ -1,7 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exception;
|
|
||||||
|
|
||||||
class NoValidChoice extends \Exception
|
|
||||||
{
|
|
||||||
}
|
|
7
application/src/Exception/NoValidChoiceException.php
Normal file
7
application/src/Exception/NoValidChoiceException.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exception;
|
||||||
|
|
||||||
|
final class NoValidChoiceException extends \Exception
|
||||||
|
{
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Exception;
|
namespace App\Exception;
|
||||||
|
|
||||||
class NotDefinedException extends \Exception
|
final class NotDefinedException extends \Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = null)
|
public function __construct($message = null)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Exception;
|
namespace App\Exception;
|
||||||
|
|
||||||
class NotProcessedException extends \Exception
|
final class NotProcessedException extends \Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = null)
|
public function __construct($message = null)
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Exception;
|
namespace App\Exception;
|
||||||
|
|
||||||
class NotSortableException extends \Exception
|
final class NotSortableException extends \Exception
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Exception;
|
namespace App\Exception;
|
||||||
|
|
||||||
class RecursiveException extends \Exception
|
final class RecursiveException extends \Exception
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,6 @@ namespace App\Exception;
|
|||||||
|
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
|
|
||||||
class SourceAccessDenied extends AccessDeniedHttpException
|
final class SourceAccessDenied extends AccessDeniedHttpException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ use App\Entity\Meta\RightInterface;
|
|||||||
use App\Entity\Meta\Right;
|
use App\Entity\Meta\Right;
|
||||||
use App\Entity\Meta\Law;
|
use App\Entity\Meta\Law;
|
||||||
use App\DBAL\Types\LayerType;
|
use App\DBAL\Types\LayerType;
|
||||||
use App\Exception\NoValidChoice;
|
use App\Exception\NoValidChoiceException;
|
||||||
use App\Entity\Source\AbstractSource;
|
use App\Entity\Source\AbstractSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +77,7 @@ class RightTest extends TestCase
|
|||||||
$this->assertNull($this->right->setType($key));
|
$this->assertNull($this->right->setType($key));
|
||||||
$this->assertEquals($key, $this->right->getType());
|
$this->assertEquals($key, $this->right->getType());
|
||||||
}
|
}
|
||||||
$this->expectException(NoValidChoice::class);
|
$this->expectException(NoValidChoiceException::class);
|
||||||
$this->right->setType('NoneValidType');
|
$this->right->setType('NoneValidType');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class RightTest extends TestCase
|
|||||||
$this->assertNull($this->right->setLayer($key));
|
$this->assertNull($this->right->setLayer($key));
|
||||||
$this->assertEquals($key, $this->right->getLayer());
|
$this->assertEquals($key, $this->right->getLayer());
|
||||||
}
|
}
|
||||||
$this->expectException(NoValidChoice::class);
|
$this->expectException(NoValidChoiceException::class);
|
||||||
$this->right->setLayer('NoneValidLayer');
|
$this->right->setLayer('NoneValidLayer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user