Skip to content
Snippets Groups Projects
Commit 38d6553f authored by Damien's avatar Damien
Browse files

FEAT Create DatabaseModel + refactoring ValidatorModel

parent eae98974
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,8 @@ use Respect\Validation\Validator; ...@@ -19,7 +19,8 @@ use Respect\Validation\Validator;
class ValidatorModel class ValidatorModel
{ {
public static function notEmpty(array $aArgs, $aKeys) { public static function notEmpty(array $aArgs, $aKeys)
{
if (!Validator::arrayType()->notEmpty()->validate($aArgs)) { if (!Validator::arrayType()->notEmpty()->validate($aArgs)) {
throw new \Exception('First argument must be a non empty array'); throw new \Exception('First argument must be a non empty array');
} }
...@@ -30,7 +31,8 @@ class ValidatorModel ...@@ -30,7 +31,8 @@ class ValidatorModel
} }
} }
public static function intVal(array $aArgs, $aKeys) { public static function intVal(array $aArgs, $aKeys)
{
if (!Validator::arrayType()->notEmpty()->validate($aArgs)) { if (!Validator::arrayType()->notEmpty()->validate($aArgs)) {
throw new \Exception('First argument must be a non empty array'); throw new \Exception('First argument must be a non empty array');
} }
...@@ -44,7 +46,8 @@ class ValidatorModel ...@@ -44,7 +46,8 @@ class ValidatorModel
} }
} }
public static function intType(array $aArgs, $aKeys) { public static function intType(array $aArgs, $aKeys)
{
if (!Validator::arrayType()->notEmpty()->validate($aArgs)) { if (!Validator::arrayType()->notEmpty()->validate($aArgs)) {
throw new \Exception('First argument must be a non empty array'); throw new \Exception('First argument must be a non empty array');
} }
...@@ -58,7 +61,8 @@ class ValidatorModel ...@@ -58,7 +61,8 @@ class ValidatorModel
} }
} }
public static function stringType(array $aArgs, $aKeys) { public static function stringType(array $aArgs, $aKeys)
{
if (!Validator::arrayType()->notEmpty()->validate($aArgs)) { if (!Validator::arrayType()->notEmpty()->validate($aArgs)) {
throw new \Exception('First argument must be a non empty array'); throw new \Exception('First argument must be a non empty array');
} }
...@@ -72,7 +76,8 @@ class ValidatorModel ...@@ -72,7 +76,8 @@ class ValidatorModel
} }
} }
public static function arrayType(array $aArgs, $aKeys) { public static function arrayType(array $aArgs, $aKeys)
{
if (!Validator::arrayType()->notEmpty()->validate($aArgs)) { if (!Validator::arrayType()->notEmpty()->validate($aArgs)) {
throw new \Exception('First argument must be a non empty array'); throw new \Exception('First argument must be a non empty array');
} }
...@@ -86,7 +91,8 @@ class ValidatorModel ...@@ -86,7 +91,8 @@ class ValidatorModel
} }
} }
public static function boolType(array $aArgs, $aKeys) { public static function boolType(array $aArgs, $aKeys)
{
if (!Validator::arrayType()->notEmpty()->validate($aArgs)) { if (!Validator::arrayType()->notEmpty()->validate($aArgs)) {
throw new \Exception('First argument must be a non empty array'); throw new \Exception('First argument must be a non empty array');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment