Implemented short code generation based on a provided long URL

This commit is contained in:
Alejandro Celaya
2016-04-17 11:29:23 +02:00
parent b436edb991
commit 93c2c1298a
7 changed files with 182 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
<?php
namespace Acelaya\UrlShortener\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);
}
}