2016-04-17 12:29:23 +03:00
|
|
|
<?php
|
2017-10-12 11:13:20 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2016-07-19 19:01:39 +03:00
|
|
|
namespace Shlinkio\Shlink\Core\Exception;
|
2016-04-17 12:29:23 +03:00
|
|
|
|
|
|
|
class InvalidUrlException extends RuntimeException
|
|
|
|
{
|
2017-12-27 18:23:54 +03:00
|
|
|
public static function fromUrl($url, \Throwable $previous = null)
|
2016-04-17 12:29:23 +03:00
|
|
|
{
|
|
|
|
$code = isset($previous) ? $previous->getCode() : -1;
|
2017-12-27 18:23:54 +03:00
|
|
|
return new static(sprintf('Provided URL "%s" is not an existing and valid URL', $url), $code, $previous);
|
2016-04-17 12:29:23 +03:00
|
|
|
}
|
|
|
|
}
|