Files
shlink/module/Core/src/Exception/InvalidUrlException.php
T

17 lines
441 B
PHP
Raw Normal View History

<?php
2017-10-12 10:13:20 +02:00
declare(strict_types=1);
2016-07-19 18:01:39 +02:00
namespace Shlinkio\Shlink\Core\Exception;
use Throwable;
2019-02-26 22:56:43 +01:00
use function sprintf;
class InvalidUrlException extends RuntimeException
{
2019-02-17 20:28:34 +01:00
public static function fromUrl(string $url, Throwable $previous = null): self
{
2018-11-17 19:23:25 +01:00
$code = $previous !== null ? $previous->getCode() : -1;
2017-12-27 16:23:54 +01:00
return new static(sprintf('Provided URL "%s" is not an existing and valid URL', $url), $code, $previous);
}
}