Skip to content

Commit

Permalink
Фикс некоторых встроенных supported types
Browse files Browse the repository at this point in the history
  • Loading branch information
NolikTop committed Jun 3, 2020
1 parent 9c0de24 commit c0202be
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions controller/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,21 @@ private function __construct(){}
*/
public static function initSupportedTypes(){
self::addSupportedTypeClosure('int', static function(string $var, &$readyData, array $extraData): bool{
if(is_int($var) || preg_match_all('/[^0-9]/', $var) === 0){
if(is_numeric($var)){
$readyData = intval($var);
return true;
}
return false;
}, true);

self::addSupportedTypeClosure('string', static function(string $var, &$readyData, array $extraData): bool{
if(is_string($var)) {
if (isset($extraData[0])) {
if (!preg_match_all(implode(' ', $extraData[0]), $var)) {
return false;
}
/*if (isset($extraData[0])) {
if (!preg_match_all(implode(' ', $extraData[0]), $var)) {
return false;
}
$readyData = $var;
return true;
}else return false;
}*/
$readyData = $var;
return true;
}, true);

self::addSupportedTypeClosure('array', static function(string $var, &$readyData, array $extraData): bool{
Expand Down

0 comments on commit c0202be

Please sign in to comment.