From 13cb3dbbdc25214d768b07c786df0d5068182a9f Mon Sep 17 00:00:00 2001 From: lovenunu Date: Mon, 14 Jul 2014 21:06:11 +0200 Subject: [PATCH] Fix cs and refactor FormFirewall raw values usage modified: core/lib/Thelia/Form/FirewallForm.php modified: core/lib/Thelia/Model/FormFirewallQuery.php modified: core/lib/Thelia/Model/Tax.php --- core/lib/Thelia/Form/FirewallForm.php | 14 ++++++++++---- core/lib/Thelia/Model/FormFirewallQuery.php | 1 - core/lib/Thelia/Model/Tax.php | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/core/lib/Thelia/Form/FirewallForm.php b/core/lib/Thelia/Form/FirewallForm.php index e39e45f92..831f69e97 100644 --- a/core/lib/Thelia/Form/FirewallForm.php +++ b/core/lib/Thelia/Form/FirewallForm.php @@ -22,8 +22,14 @@ use Thelia\Model\FormFirewallQuery; */ abstract class FirewallForm extends BaseForm { + /** + * Those values are for a "normal" security context + */ + const DEFAULT_TIME_TO_WAIT = 1; + const DEFAULT_ATTEMPTS = 3; + /** @var \Thelia\Model\FormFirewall */ - protected static $cachedInstance; + protected static $cachedInstance; public function __construct(Request $request, $type = "form", $data = array(), $options = array()) { @@ -81,7 +87,7 @@ abstract class FirewallForm extends BaseForm */ public function getConfigTime() { - return ConfigQuery::read("form_firewall_time_to_wait", 1); + return ConfigQuery::read("form_firewall_time_to_wait", static::DEFAULT_TIME_TO_WAIT); } /** @@ -91,6 +97,6 @@ abstract class FirewallForm extends BaseForm */ public function getConfigAttempts() { - return ConfigQuery::read("form_firewall_attempts", 2); + return ConfigQuery::read("form_firewall_attempts", static::DEFAULT_ATTEMPTS); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Model/FormFirewallQuery.php b/core/lib/Thelia/Model/FormFirewallQuery.php index a06620e1e..e7bfc54dd 100644 --- a/core/lib/Thelia/Model/FormFirewallQuery.php +++ b/core/lib/Thelia/Model/FormFirewallQuery.php @@ -4,7 +4,6 @@ namespace Thelia\Model; use Thelia\Model\Base\FormFirewallQuery as BaseFormFirewallQuery; - /** * Skeleton subclass for performing query and update operations on the 'form_firewall' table. * diff --git a/core/lib/Thelia/Model/Tax.php b/core/lib/Thelia/Model/Tax.php index a1a73bad7..c65bc0e69 100644 --- a/core/lib/Thelia/Model/Tax.php +++ b/core/lib/Thelia/Model/Tax.php @@ -59,14 +59,14 @@ class Tax extends BaseTax if (!class_exists($class)) { throw new TaxEngineException('Recorded type `' . $class . '` does not exists', TaxEngineException::BAD_RECORDED_TYPE); } - /** @var \Thelia\TaxEngine\BaseTaxType $instance */ + /** @var \Thelia\TaxEngine\BaseTaxType $instance */ $instance = new $class; if (!$instance instanceof BaseTaxType) { throw new TaxEngineException('Recorded type `' . $class . '` does not extends BaseTaxType', TaxEngineException::BAD_RECORDED_TYPE); } - - $instance->loadRequirements($this->getRequirements()); + + $instance->loadRequirements($this->getRequirements()); return $instance; }