mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 17:44:44 +08:00
Created UpdateTagAction
This commit is contained in:
26
module/Core/src/Exception/EntityDoesNotExistException.php
Normal file
26
module/Core/src/Exception/EntityDoesNotExistException.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace Shlinkio\Shlink\Core\Exception;
|
||||
|
||||
use Shlinkio\Shlink\Common\Exception\ExceptionInterface;
|
||||
|
||||
class EntityDoesNotExistException extends \RuntimeException implements ExceptionInterface
|
||||
{
|
||||
public static function createFromEntityAndConditions($entityName, array $conditions)
|
||||
{
|
||||
return new self(sprintf(
|
||||
'Entity of type %s with params [%s] does not exist',
|
||||
$entityName,
|
||||
static::serializeParams($conditions)
|
||||
));
|
||||
}
|
||||
|
||||
private static function serializeParams(array $params)
|
||||
{
|
||||
$result = [];
|
||||
foreach ($params as $key => $value) {
|
||||
$result[] = sprintf('"%s" => "%s"', $key, $value);
|
||||
}
|
||||
|
||||
return implode(', ', $result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user