Finished parameter management cleanup

This commit is contained in:
Kevin Frantz 2019-03-29 00:00:26 +01:00
parent 84e7122913
commit 4114586b26
4 changed files with 11 additions and 17 deletions

View File

@ -4,15 +4,15 @@ namespace Infinito\Domain\ParameterManagement;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Request;
use Infinito\Exception\UnvalidParameterException;
use Infinito\Exception\NotDefinedException;
/**
* @todo Rename class!
* This class exists out of refactoring reasons.
* Feel free to merge it with ValidGetParametersServices.
*
* @author kevinfrantz
*/
class OptionalGetParameterService implements OptionalGetParameterServiceInterface
abstract class AbstractGetParameterService implements GetParameterServiceInterface
{
/**
* @var Request
@ -21,14 +21,8 @@ class OptionalGetParameterService implements OptionalGetParameterServiceInterfac
/**
* @param string $key
*
* @deprecated
*
* @throws UnvalidParameterException If the parameter is not valid
*/
protected function validateParameter(string $key): void
{
}
abstract protected function validateParameter(string $key): void;
/**
* @param RequestStack $requestStack
@ -57,7 +51,7 @@ class OptionalGetParameterService implements OptionalGetParameterServiceInterfac
/**
* {@inheritdoc}
*
* @see \Infinito\Domain\ParameterManagement\OptionalGetParameterServiceInterface::hasParameter()
* @see \Infinito\Domain\ParameterManagement\GetParameterServiceInterface::hasParameter()
*/
public function hasParameter(string $key): bool
{
@ -69,7 +63,7 @@ class OptionalGetParameterService implements OptionalGetParameterServiceInterfac
/**
* {@inheritdoc}
*
* @see \Infinito\Domain\ParameterManagement\OptionalGetParameterServiceInterface::getParameter()
* @see \Infinito\Domain\ParameterManagement\GetParameterServiceInterface::getParameter()
*/
public function getParameter(string $key)
{

View File

@ -7,7 +7,7 @@ namespace Infinito\Domain\ParameterManagement;
*
* @author kevinfrantz
*/
interface OptionalGetParameterServiceInterface
interface GetParameterServiceInterface
{
/**
* @param string $key

View File

@ -5,6 +5,6 @@ namespace Infinito\Domain\ParameterManagement;
/**
* @author kevinfrantz
*/
interface ValidGetParameterServiceInterface extends OptionalGetParameterServiceInterface
interface ValidGetParameterServiceInterface extends GetParameterServiceInterface
{
}

View File

@ -9,7 +9,7 @@ use Infinito\Exception\UnvalidGetParameterException;
/**
* @author kevinfrantz
*/
final class ValidGetParametersService extends OptionalGetParameterService implements ValidGetParameterServiceInterface
final class ValidGetParametersService extends AbstractGetParameterService implements ValidGetParameterServiceInterface
{
/**
* @var ParameterFactoryInterface
@ -34,9 +34,9 @@ final class ValidGetParametersService extends OptionalGetParameterService implem
}
/**
* {@inheritdoc}
* @param string $key
*
* @see \Infinito\Domain\ParameterManagement\OptionalGetParameterService::validateParameter()
* @throws UnvalidGetParameterException
*/
protected function validateParameter(string $key): void
{