mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-09 08:43:13 +08:00
Created Core module
This commit is contained in:
6
module/Core/src/Exception/ExceptionInterface.php
Normal file
6
module/Core/src/Exception/ExceptionInterface.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace Shlinkio\Shlink\Core\Exception;
|
||||
|
||||
interface ExceptionInterface
|
||||
{
|
||||
}
|
||||
6
module/Core/src/Exception/InvalidArgumentException.php
Normal file
6
module/Core/src/Exception/InvalidArgumentException.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace Shlinkio\Shlink\Core\Exception;
|
||||
|
||||
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
15
module/Core/src/Exception/InvalidShortCodeException.php
Normal file
15
module/Core/src/Exception/InvalidShortCodeException.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace Shlinkio\Shlink\Core\Exception;
|
||||
|
||||
class InvalidShortCodeException extends RuntimeException
|
||||
{
|
||||
public static function fromShortCode($shortCode, $charSet, \Exception $previous = null)
|
||||
{
|
||||
$code = isset($previous) ? $previous->getCode() : -1;
|
||||
return new static(
|
||||
sprintf('Provided short code "%s" does not match the char set "%s"', $shortCode, $charSet),
|
||||
$code,
|
||||
$previous
|
||||
);
|
||||
}
|
||||
}
|
||||
11
module/Core/src/Exception/InvalidUrlException.php
Normal file
11
module/Core/src/Exception/InvalidUrlException.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Shlinkio\Shlink\Core\Exception;
|
||||
|
||||
class InvalidUrlException extends RuntimeException
|
||||
{
|
||||
public static function fromUrl($url, \Exception $previous = null)
|
||||
{
|
||||
$code = isset($previous) ? $previous->getCode() : -1;
|
||||
return new static(sprintf('Provided URL "%s" is not an exisitng and valid URL', $url), $code, $previous);
|
||||
}
|
||||
}
|
||||
6
module/Core/src/Exception/RuntimeException.php
Normal file
6
module/Core/src/Exception/RuntimeException.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace Shlinkio\Shlink\Core\Exception;
|
||||
|
||||
class RuntimeException extends \RuntimeException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user