Initial release
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the MNC\ChileanRut library.
|
||||
*
|
||||
* (c) Matías Navarro Carter <mnavarrocarter@gmail.com>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace MNC\ChileanRut\Exception;
|
||||
|
||||
use MNC\ChileanRut\Rut\Rut;
|
||||
use MNC\ChileanRut\Rut;
|
||||
|
||||
/**
|
||||
* Class InvalidRutException
|
||||
* @package MNC\ChileanRut\Rut
|
||||
* Class InvalidRutException.
|
||||
*
|
||||
* @author Matías Navarro Carter <mnavarro@option.cl>
|
||||
*/
|
||||
class InvalidRutException extends \LogicException
|
||||
@@ -18,11 +26,15 @@ class InvalidRutException extends \LogicException
|
||||
|
||||
/**
|
||||
* InvalidRutException constructor.
|
||||
* @param Rut $rut
|
||||
*
|
||||
* @param Rut $rut
|
||||
* @param string|null $message
|
||||
*/
|
||||
public function __construct(Rut $rut)
|
||||
public function __construct(Rut $rut, string $message = null)
|
||||
{
|
||||
$message = sprintf('Rut %s is not a valid rut.', $rut->format(Rut::FORMAT_READABLE));
|
||||
if (null === $message) {
|
||||
$message = sprintf('Rut %s is not a valid rut.', $rut->format(Rut::FORMAT_READABLE));
|
||||
}
|
||||
$this->rut = $rut;
|
||||
parent::__construct($message);
|
||||
}
|
||||
@@ -34,4 +46,4 @@ class InvalidRutException extends \LogicException
|
||||
{
|
||||
return $this->rut;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user