さすがにServiceからHttpExceptionは雑すぎたか
This commit is contained in:
30
app/MetadataResolver/DeniedHostException.php
Normal file
30
app/MetadataResolver/DeniedHostException.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\MetadataResolver;
|
||||
|
||||
use Exception;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* メタデータの解決を禁止しているホストに対して取得を試み、ブロックされたことを表します。
|
||||
*/
|
||||
class DeniedHostException extends Exception
|
||||
{
|
||||
private $url;
|
||||
|
||||
public function __construct(string $url, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct("Access denied by system policy: $url", 0, $previous);
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
public function getUrl(): string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function getHost(): string
|
||||
{
|
||||
return parse_url($this->url, PHP_URL_HOST);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user