From b1b1ec0c47a55adeea55fccecad8beb828b73314 Mon Sep 17 00:00:00 2001
From: Lucas Mascaro CRAP
-
-
+
+
@@ -87,15 +87,15 @@
- 48.42
+ 49.36
-
-
+
+
@@ -171,15 +171,15 @@
@@ -298,62 +298,64 @@
- 33.17
+ 34.05
-
-
+
+ =============================================================*/ $checker = true; // contiendra VRAI si la vérification s'avère correcte
- $matches = [];
- //si on a un type scalairexlongueur, on traite
- if(preg_match_all('/((?:[a-z][a-z]+))(\\d+)/is',$dbtype,$matches)){
- $dbtype = $matches[1][0];
- isset($matches[2][0])? $len = $matches[2][0] : $len = 8;
- }
-
- switch($dbtype){
- // [1] 'M' / 'F'
- case 'Civilite':
- $checker = $checker && is_string($variable) && in_array($variable, ['M','F']);
- break;
-
- // [2] Chaine de caractère (longueur variable)
- case 'String':
- $checker = $checker && is_string($variable) && strlen($variable)<$len;
- break;
-
- case 'Integer':
- $checker = $checker && is_int($variable) && $variable<pow(2,32);
- break;
-
- case 'SmallInteger':
- $checker = $checker && is_int($variable) && $variable<pow(2,16);
- break;
-
- case 'TinyInteger':
- $checker = $checker && is_int($variable) && $variable<pow(2,8);
- break;
-
- case 'BigInteger':
- $checker = $checker && is_int($variable) && $variable<pow(2,64);
- break;
-
- case 'Date':
- $checker = $checker && is_string($variable) && preg_match('/(\d+)\/(\d+)\/(\d+)/is',$variable);
- break;
-
- case 'Heure':
- $checker = $checker && is_string($variable) && preg_match('/(\d+):(\d+)/is',$variable);
- break;
-
- // [N] Type inconnu
- default: $checker = false; break;
- }
-
-
- /* [3] On retourne le résultat de la vérif
- =============================================================*/
- return $checker;
-
+ }
+ $len = 8;
+
+ //si on a un type scalairexlongueur, on traite
+ if(preg_match_all('/([A-Z][a-z]+)(\d+)/s', $dbtype,$matches)){
+ $dbtype = $matches[1][0];
+ $len = $matches[2][0];
+ }
+
+ switch($dbtype){
+ // [1] 'M' / 'F'
+ case 'Civilite':
+ $checker = $checker && is_string($variable) && in_array($variable, ['M','F']);
+ break;
+
+ // [2] Chaine de caractère (longueur variable)
+ case 'String':
+ $checker = $checker && is_string($variable) && strlen($variable) <= $len;
+ break;
+
+ case 'Integer':
+ $checker = $checker && is_int($variable) && $variable<pow(2, 32);
+ break;
+
+ case 'SmallInteger':
+ $checker = $checker && is_int($variable) && $variable<pow(2, 16);
+ break;
+
+ case 'TinyInteger':
+ $checker = $checker && is_int($variable) && $variable<pow(2, 8);
+ break;
+
+ case 'BigInteger':
+ $checker = $checker && is_int($variable) && $variable<pow(2, 64);
+ break;
+
+ case 'Date':
+ $checker = $checker && is_string($variable) && ( preg_match('/\d{2}\/\d{2}\/\d{4}/', $variable) || preg_match('/\d{4}-\d{2}-\d{2}/', $variable) || preg_match('/\d{4}\/\d{2}\/\d{2}/', $variable) );
+ break;
+
+ case 'Heure':
+ $checker = $checker && is_string($variable) && preg_match('/(\d+):(\d+)/is',$variable);
+ break;
+
+ // [N] Type inconnu
+ default: $checker = false; break;
+ }
+
+
+ /* [3] On retourne le résultat de la vérif
+ =============================================================*/ return $checker;
-
-
+ }
+ }
-
+ ?>
+ }
+
@@ -366,7 +368,7 @@
Dead Code
?>
- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Tue Dec 15 8:23:37 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Thu Dec 17 7:56:03 UTC 2015.
diff --git a/coverage/dashboard.html b/coverage/dashboard.html index 7d2b492..cfccc41 100755 --- a/coverage/dashboard.html +++ b/coverage/dashboard.html @@ -59,6 +59,7 @@- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Tue Dec 15 8:23:37 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Thu Dec 17 7:56:03 UTC 2015.
diff --git a/coverage/repos/RDVRepo.php.html b/coverage/repos/RDVRepo.php.html index 843a591..920d128 100755 --- a/coverage/repos/RDVRepo.php.html +++ b/coverage/repos/RDVRepo.php.html @@ -52,22 +52,22 @@