Initial commit

This commit is contained in:
2021-01-19 18:19:37 +01:00
commit 6524a071df
14506 changed files with 1808535 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
/**
* Class AdminAccessDenied
* @package Thelia\Exception
* @author Manuel Raynaud <manu@raynaud.io>
*/
class AdminAccessDenied extends \RuntimeException
{
}

View File

@@ -0,0 +1,40 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Core\Translation\Translator;
use Thelia\Log\Tlog;
/**
* Thrown when an Expired Coupon is tried
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class CouponExpiredException extends \Exception
{
/**
* CouponExpiredException thrown when a Coupon is expired
*
* @param string $couponCode Coupon code
*/
public function __construct($couponCode)
{
$message = Translator::getInstance()->trans('Coupon %code is expired.', ['%code' => $couponCode ]);
Tlog::getInstance()->addWarning($message);
parent::__construct($message);
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Core\Translation\Translator;
use Thelia\Log\Tlog;
/**
* Thrown when a Coupon with no usage lect (etiher overall or per customer usage) is tried
*
* @package Coupon
* @author Franck Allimant <franck@cqfdev.fr>
*/
class CouponNoUsageLeftException extends \Exception
{
/**
* CouponExpiredException thrown when a Coupon is expired
*
* @param string $couponCode Coupon code
*/
public function __construct($couponCode)
{
$message = Translator::getInstance()->trans('Maximum usage count reached for coupon %code', ['%code' => $couponCode ]);
Tlog::getInstance()->addWarning($message);
parent::__construct($message);
}
}

View File

@@ -0,0 +1,38 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Core\Translation\Translator;
use Thelia\Log\Tlog;
/**
* Class CouponNotReleaseException
* @package Thelia\Exception
* @author Baixas Alban <abaixas@openstudio.fr>
*/
class CouponNotReleaseException extends \Exception
{
/**
* CouponNotReleaseException thrown when a Coupon is not release
*
* @param string $couponCode Coupon code
*/
public function __construct($couponCode)
{
$message = Translator::getInstance()->trans('Coupon %code is not release.', ['%code' => $couponCode]);
Tlog::getInstance()->addWarning($message);
parent::__construct($message);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
/**
* Class CustomerException
* @package Thelia\Exception
* @author Manuel Raynaud <manu@raynaud.io>
*/
class CustomerException extends \RuntimeException
{
}

View File

@@ -0,0 +1,25 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Log\Tlog;
class DocumentException extends \RuntimeException
{
public function __construct($message, $code = null, $previous = null)
{
Tlog::getInstance()->addError($message);
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Log\Tlog;
class FileException extends \RuntimeException
{
public function __construct($message, $code = null, $previous = null)
{
Tlog::getInstance()->addError($message);
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
/**
* Class FileNotFoundException
* @package Thelia\Exception
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class FileNotFoundException extends \ErrorException
{
}

View File

@@ -0,0 +1,22 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
/**
* Class FileNotReadableException
* @package Thelia\Exception
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class FileNotReadableException extends \Exception
{
}

View File

@@ -0,0 +1,22 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
/**
* Class HttpUrlException
* @package Thelia\Exception
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class HttpUrlException extends \Exception
{
}

View File

@@ -0,0 +1,25 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Log\Tlog;
class ImageException extends \RuntimeException
{
public function __construct($message, $code = null, $previous = null)
{
Tlog::getInstance()->addError($message);
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,34 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Core\Translation\Translator;
use Thelia\Log\Tlog;
/**
* Class InactiveCouponException
* @package Thelia\Exception
* @author Manuel Raynaud <manu@raynaud.io>
*/
class InactiveCouponException extends \RuntimeException
{
public function __construct($couponCode)
{
$message = Translator::getInstance()->trans('Coupon code %code is disabled.', ['%code' => $couponCode ]);
Tlog::getInstance()->addWarning($message);
parent::__construct($message);
}
}

View File

@@ -0,0 +1,17 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
class InvalidCartException extends \RuntimeException
{
}

View File

@@ -0,0 +1,38 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Log\Tlog;
/**
* Thrown when a Condition is badly implemented
*
* @package Condition
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class InvalidConditionException extends \RuntimeException
{
/**
* InvalidConditionOperatorException thrown when a Condition is badly implemented
*
* @param string $className Class name
*/
public function __construct($className)
{
$message = 'Invalid Condition given to ' . $className;
Tlog::getInstance()->addError($message);
parent::__construct($message);
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Log\Tlog;
/**
* Thrown when a Condition receive an invalid Operator
*
* @package Condition
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class InvalidConditionOperatorException extends \RuntimeException
{
/**
* InvalidConditionOperatorException thrown when a Condition is given a bad Operator
*
* @param string $className Class name
* @param string $parameter array key parameter
*/
public function __construct($className, $parameter)
{
$message = 'Invalid Operator for Condition ' . $className . ' on parameter ' . $parameter;
Tlog::getInstance()->addError($message);
parent::__construct($message);
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Log\Tlog;
/**
* Thrown when a Condition receives an invalid Parameter
*
* @package Condition
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class InvalidConditionValueException extends \RuntimeException
{
/**
* InvalidConditionValueException thrown when a Condition is given a bad Parameter
*
* @param string $className Class name
* @param string $parameter array key parameter
*/
public function __construct($className, $parameter)
{
$message = 'Invalid Parameter for Condition ' . $className . ' on parameter ' . $parameter;
Tlog::getInstance()->addError($message);
parent::__construct($message);
}
}

View File

@@ -0,0 +1,50 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
/**
* Class InvalidModuleException
* @package Thelia\Exception
* @author Julien Chanséaume <jchanseaume@openstudio.fr>
*/
class InvalidModuleException extends \RuntimeException
{
protected $errors = [];
public function __construct(array $errors = [])
{
parent::__construct();
$this->errors = $errors;
}
/**
* @return array
*/
public function getErrors()
{
return $this->errors;
}
public function getErrorsAsString($separator = "\n")
{
$message = '';
/** @var \Exception $error */
foreach ($this->errors as $error) {
$message .= $error->getMessage() . $separator;
}
return rtrim($message, $separator);
}
}

View File

@@ -0,0 +1,17 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
class MemberAccessException extends \LogicException
{
}

View File

@@ -0,0 +1,35 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Log\Tlog;
/**
* Thrown when the Facade is not set
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class MissingFacadeException extends \RuntimeException
{
/**
* {@inheritdoc}
*/
public function __construct($message, $code = null, $previous = null)
{
Tlog::getInstance()->addError($message);
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,28 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
class ModuleException extends \RuntimeException
{
const UNKNOWN_EXCEPTION = 0;
const CODE_NOT_FOUND = 404;
public function __construct($message, $code = null, $previous = null)
{
if ($code === null) {
$code = self::UNKNOWN_EXCEPTION;
}
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,26 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
use Symfony\Component\DependencyInjection\Exception\BadMethodCallException;
/**
* Thrown when an Abstract method has not been implemented
*
* @package Exception
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class NotImplementedException extends BadMethodCallException
{
}

View File

@@ -0,0 +1,42 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
class OrderException extends \RuntimeException
{
/**
* @var string The cart template name
*/
public $cartRoute = "cart.view";
public $orderDeliveryRoute = "order.delivery";
public $arguments = array();
const UNKNOWN_EXCEPTION = 0;
const CART_EMPTY = 100;
const UNDEFINED_DELIVERY = 200;
const DELIVERY_MODULE_UNAVAILABLE = 201;
public function __construct($message, $code = null, $arguments = array(), $previous = null)
{
if (\is_array($arguments)) {
$this->arguments = $arguments;
}
if ($code === null) {
$code = self::UNKNOWN_EXCEPTION;
}
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,45 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
class TaxEngineException extends \RuntimeException
{
const UNKNOWN_EXCEPTION = 0;
const BAD_RECORDED_TYPE = 101;
const BAD_RECORDED_REQUIREMENTS = 102;
const TAX_TYPE_BAD_ABSTRACT_METHOD = 201;
const TAX_TYPE_REQUIREMENT_NOT_FOUND = 202;
const TAX_TYPE_BAD_REQUIREMENT_VALUE = 203;
const UNDEFINED_PRODUCT = 501;
const UNDEFINED_COUNTRY = 502;
const UNDEFINED_TAX_RULES_COLLECTION = 503;
const UNDEFINED_REQUIREMENTS = 504;
const UNDEFINED_REQUIREMENT_VALUE = 505;
const UNDEFINED_TAX_RULE = 506;
const NO_TAX_IN_TAX_RULES_COLLECTION = 507;
const BAD_AMOUNT_FORMAT = 601;
const FEATURE_BAD_EXPECTED_VALUE = 701;
public function __construct($message, $code = null, $previous = null)
{
if ($code === null) {
$code = self::UNKNOWN_EXCEPTION;
}
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,43 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
/**
* these exception are non fatal exception, due to thelia process exception
* or customer random navigation
*
* they redirect the customer who trig them to a specific error page // @todo
*
* Class TheliaProcessException
* @package Thelia\Exception
*/
class TheliaProcessException extends \RuntimeException
{
public $data = null;
const UNKNOWN_EXCEPTION = 0;
const CART_ITEM_NOT_ENOUGH_STOCK = 100;
const NO_PLACED_ORDER = 101;
const PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER = 102;
public function __construct($message, $code = null, $data = null, $previous = null)
{
$this->data = $data;
if ($code === null) {
$code = self::UNKNOWN_EXCEPTION;
}
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,28 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
class TypeException extends \RuntimeException
{
const UNKNOWN_EXCEPTION = 0;
const MODEL_NOT_FOUND = 404;
public function __construct($message, $code = null, $previous = null)
{
if ($code === null) {
$code = self::UNKNOWN_EXCEPTION;
}
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,23 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
/**
* Class UnmatchableConditionException
* UnmatchableConditionException thrown when a condition can't be check (if customer is not connected)
* @package Thelia\Exception
* @author Baixas Alban <abaixas@openstudio.fr>
*/
class UnmatchableConditionException extends \RuntimeException
{
}

View File

@@ -0,0 +1,32 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
class UrlRewritingException extends \Exception
{
const UNKNOWN_EXCEPTION = 0;
const URL_ALREADY_EXISTS = 100;
const URL_NOT_FOUND = 404;
const RESOLVER_NULL_SEARCH = 800;
public function __construct($message, $code = null, $previous = null)
{
if ($code === null) {
$code = self::UNKNOWN_EXCEPTION;
}
parent::__construct($message, $code, $previous);
}
}