2023-09-12

This commit is contained in:
Juan Pablo Vial
2023-09-13 18:51:46 -03:00
parent fa15da1ee2
commit 0cd357b6cb
47 changed files with 1225 additions and 102 deletions

View File

@ -0,0 +1,15 @@
<?php
namespace Incoviba\Common\Implement\Exception;
use Exception;
use Throwable;
class EmptyResponse extends Exception
{
public function __construct(string $uri = "", ?Throwable $previous = null)
{
$message = "Empty Response from {$uri}";
$code = 800;
parent::__construct($message, $code, $previous);
}
}

View File

@ -5,11 +5,12 @@ use Incoviba\Common\Implement\Repository\Mapper;
class Boolean extends Mapper
{
public function __construct(string $column, ?string $property = null)
public function __construct(string $column, ?string $property = null, bool $default = false)
{
$this->setFunction(function($data) use ($column) {
return $data[$column] !== 0;
});
$this->setDefault($default);
if ($property !== null) {
$this->setProperty($property);
}