Initial xentral_oss_20.3.c9ffacf

This commit is contained in:
Alex
2021-05-21 08:49:41 +02:00
parent 5406e4a551
commit 34e5ac43d9
18884 changed files with 2109867 additions and 0 deletions
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Xentral\Modules\SubscriptionCycle\Exception;
use RuntimeException as SplRuntimeException;
final class AutoSubscriptionNotFoundException extends SplRuntimeException implements SubscriptionCycleExceptionInterface
{
}
@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Xentral\Modules\SubscriptionCycle\Exception;
final class InvalidArgumentException extends \InvalidArgumentException
{
}
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Xentral\Modules\SubscriptionCycle\Exception;
use RuntimeException as SplRuntimeException;
final class OrderNotFoundException extends SplRuntimeException implements SubscriptionCycleExceptionInterface
{
}
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Xentral\Modules\SubscriptionCycle\Exception;
use RuntimeException as SplRuntimeException;
final class RuntimeException extends SplRuntimeException implements SubscriptionCycleExceptionInterface
{
}
@@ -0,0 +1,9 @@
<?php
namespace Xentral\Modules\SubscriptionCycle\Exception;
use Xentral\Core\Exception\ModuleExceptionInterface;
interface SubscriptionCycleExceptionInterface extends ModuleExceptionInterface
{
}
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace Xentral\Modules\SubscriptionCycle\Exception;
use RuntimeException;
final class ValidationFailedException extends RuntimeException implements SubscriptionCycleExceptionInterface
{
/** @var array $errors */
private $errors = [];
/**
* @param array $errors
*
* @return self
*/
public static function fromErrors(array $errors)
{
$errorString = '';
foreach ($errors as $propertyName => $propertyErrors) {
$errorString .= implode("\r\n", $propertyErrors);
}
$exception = new self('Validation failed with following errors: ' . "\n\n" . $errorString);
$exception->errors = $errors;
return $exception;
}
/**
* @return array
*/
public function getErrors()
{
return $this->errors;
}
}