-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring of source code include comment
- Loading branch information
Paul PRIKAZSKY
committed
Mar 19, 2019
1 parent
760de1c
commit c11f989
Showing
31 changed files
with
1,011 additions
and
661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Form_Manager; | ||
|
||
use Form_Manager\Error_Manager; | ||
use Form_Manager\Field_Manager; | ||
|
||
class Checker_Manager | ||
{ | ||
/** | ||
* Ensemble de fonction permettant la gestion des erreur. | ||
*/ | ||
use Trait_Error; | ||
|
||
/** | ||
* @var Field_Manager | ||
*/ | ||
private $field; | ||
|
||
/** | ||
* @var boolean | ||
*/ | ||
private $result; | ||
|
||
public function __construct(Field_Manager $field, $result) | ||
{ | ||
$this->field = $field; | ||
$this->result = $result; | ||
} | ||
|
||
/** | ||
* Retourne le champs associé au validateur. | ||
* | ||
* @return Field_Manager | ||
*/ | ||
protected function get_field() | ||
{ | ||
return ($this->field); | ||
} | ||
|
||
/** | ||
* Retourn la valeur du résultat. | ||
* | ||
* @return boolean | ||
*/ | ||
public function is_valid() | ||
{ | ||
return ($this->result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Form_Manager; | ||
|
||
use Form_Manager\Field_Manager; | ||
|
||
class Control_Manager | ||
{ | ||
/** | ||
* Ensemble de fonction permettant la gestion des validateurs. | ||
*/ | ||
use Trait_Validator; | ||
|
||
public function __construct(Field_Manager $field, $control, $args = []) | ||
{ | ||
$control = ucfirst(strtolower($control)); | ||
if ($this->control_exist($control)) | ||
{ | ||
if (!strcmp($control, "Require")) | ||
$control = "LRequire"; | ||
$control = __NAMESPACE__ . "\\" . "Control" . "\\" . $control; | ||
$this->validator = new $control($field, $args); | ||
} | ||
else | ||
{ | ||
throw new \Exception(" | ||
Try to add $control but this regex doesent exist", 1 | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Vérifie si le nom du control existe dans la liste des control de la | ||
* librairie. | ||
* | ||
* @return boolean | ||
*/ | ||
private function control_exist($control_name) | ||
{ | ||
$control_list = ["Interval", "Max", "Min", "Require"]; | ||
|
||
return (in_array($control_name, $control_list)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Form_Manager; | ||
|
||
use Form_Manager\Field_Manager; | ||
use Form_Manager\Regex\Specific; | ||
|
||
class Caller_Regex | ||
{ | ||
/** | ||
* Ensemble de fonction permettant la gestion des validateurs. | ||
*/ | ||
use Trait_Validator; | ||
|
||
public function __construct(Field_Manager $field, $regex, $specific = FALSE) | ||
{ | ||
$regex = ucfirst(strtolower($regex)); | ||
|
||
if ($this->is_regex($regex) && $specific == FALSE) | ||
{ | ||
$regex = __NAMESPACE__ . "\\" . "Regex" . "\\" . $regex; | ||
$this->validator = new $regex($field); | ||
} | ||
else if ($specific == TRUE) | ||
$this->validator = new Specific($field, $specific); | ||
else | ||
{ | ||
throw new \Exception(" | ||
Try to add " . $regex . " but this regex type doesn't | ||
exist", 1 | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Vérifie si le nom de la regex existe dans la liste des regex de la | ||
* librairie. | ||
* | ||
* @return boolean | ||
*/ | ||
private function is_regex($regex) | ||
{ | ||
$regex_list = ["Alpha", "Mail"]; | ||
|
||
return (in_array($regex, $regex_list)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.