3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace schlaus\schimile; /** * * Schimile is a validation class * */ class schimile { private static $_ruleset = array(); private static $_errorHandler = null; private static $_latestErrors = null; private static $_currentInstance; private $_currentIndex = 0; private $_optional = array(); private $_nextIndex = 0; private $_inputType; private $_not; private $_queue = array(); private $_queueIndex = 0; private $_errors = array(); private $_haltOnError = false; private $_currentValue; private $_currentValidatorAccepts = array("boolean", "integer", "double", "string", "array", "object"); public function __construct($inputType, $index) { $this->_inputType = $inputType; $this->_updateIndex($index); } private function _accept() { $shortForms = array( "arr" => "array", "str" => "string", "bool" => "boolean", "obj" => "object", "int" => "integer", "float" => "double" ); $accepted = func_get_args(); if (empty($accepted)) $accepted = array("bool", "int", "float", "str", "arr", "obj"); if (count($accepted) == 1 && is_string($accepted)) { $accepted = preg_split('/(, |,|\|)/', $accepted, -1, PREG_SPLIT_NO_EMPTY); } elseif (is_array($accepted[0])) { $accepted = $accepted[0]; } foreach ($accepted as &$val) { if (array_key_exists($val, $shortForms)) $val = $shortForms[$val]; } $this->_currentValidatorAccepts = $accepted; } private function _isValidType($var, $accepted) { return in_array(gettype($var), $accepted); } private function _pushToQueue($validator, $nonNegatedMessage, $negatedMessage, $params = array()) { $message = ($this->_not) ? $negatedMessage : $nonNegatedMessage; $this->_queue[$this->_queueIndex][] = array( "validator" => $validator, "message" => $message, "negate" => $this->_not, "inputType" => $this->_inputType, "accepts" => $this->_currentValidatorAccepts, "useIndex" => $this->_currentIndex, "params" => $params ); $this->_accept(); } private function _reset() { $this->_currentIndex = 0; $this->_nextIndex = 0; $this->_queue = array(); $this->_queueIndex = 0; $this->_errors = array(); } public static function assert($ruleset, $input) { if (is_object($ruleset)) { $instance = $ruleset; } elseif (is_string($ruleset) && array_key_exists($ruleset, self::$_ruleset)) { $instance = clone self::$_ruleset[$ruleset]; } else { throw new InvalidArgumentException("Invalid argument provided for schimile::loadRuleset() (Ruleset object or name expected)"); } return $instance->execute($input); } public static function getErrors() { return self::$_latestErrors; } private function _handleErrors() { self::$_latestErrors = $this->_errors; return false; } private function _pushError($item, $message) { $this->_errors[$item][] = $message; } public function execute($input) { foreach ($this->_queue as $index => $testArrays) { foreach ($testArrays as $testNr => $testBlock) { switch ($testBlock['inputType']) { case "input": $value = &$input; break; case "val": if (is_object($input)) { $value =& $input->$testBlock['useIndex']; } else { $value =& $input[$testBlock['useIndex']]; } break; case "key": $value = key($input); break; } $matcher = !$testBlock['negate']; array_unshift($testBlock['params'], $value); if ($this->_isValidType($value, $testBlock['accepts'])) { try { $result = call_user_func_array($testBlock['validator'], $testBlock['params']); if (!is_bool($result)) { $value = $result; $result = true; } } catch (ValidationFailException $e) { $this->_haltOnError = true; $result = null; } } else { throw new InvalidInputTypeException($testBlock['accepts'], $value); } if ($result === $matcher) { //pass } else { //fail $this->_pushError($this->_currentIndex, $testBlock['message']); if ($this->_haltOnError) { break 2; } } } } if (!empty($this->_errors)) { if (is_null(self::$_errorHandler)) return $this->_handleErrors(); else return self::$_errorHandler($this->_errors); } return true; } private function _composite($params) { $not = $this->_not; foreach ($params as $test) { if (isset($test['negate']) && $test['negate']) { $this->isNot(); } else { $this->is(); } $params = (empty($test['params'])) ? array() : $test['params']; call_user_func_array(array($this, $test['test']), $params); } $this->_not = $not; return $this; } public static function registerErrorHandler($fn) { if (is_callable($fn)) { self::$_errorHandler = $fn; } else { throw new InvalidArgumentException("Invalid argument provided for schimile::registerErrorHandler() (Callable expetcer, " . gettype($fn) . " received)."); } } /** * Gets the currently loaded ruleset * @return Array */ public static function getRuleset() { return self::$_ruleset; } public static function loadRuleset($ruleset) { if (is_object($ruleset)) { self::$_ruleset[] = $ruleset; end(self::$_ruleset[]); return key(self::$_ruleset[]); } elseif (is_array($ruleset)) { self::$_ruleset = array_merge(self::$_ruleset, $ruleset); } else { throw new InvalidArgumentException("Invalid argument provided for schimile::loadRuleset() (Array or Object expected, " . gettype($ruleset) . " received)."); } } private static function _init($type, $index = false) { $self = __CLASS__; $self::$_currentInstance = new $self($type, $index); } private function _nextItem($type, $index = false) { $this->_inputType = $type; $this->_queueIndex++; $this->_updateIndex($index); } private function _updateIndex($index) { if ($index === false) { $this->_currentIndex = $this->_nextIndex++; } else { $this->_currentIndex = $index; } } public static function input() { self::_init("input"); return self::$_currentInstance; } public static function val($index = false) { self::_init("val", $index); return self::$_currentInstance; } public function next($index = false) { $this->_updateIndex($index); return $this; } public function arr() { $this->_pushToQueue(function($input) { return is_array($input); }, "{{name}} must be an array", "{{name}} can't be an array"); return $this; } public function top() { $this->_inputType = "input"; $this->_updateIndex(0); return $this; } public function validPer($ruleset) { $this->_pushToQueue(function($input, $ruleset) { $self = __CLASS__; return $self::assert($ruleset, $input); }, "null", "null", array($ruleset)); return $this; } public function is() { $this->_not = false; return $this; } public function isNot() { $this->_not = true; return $this; } public function noneOf() { $rulesets = func_get_args(); $this->_pushToQueue(function($input, $rulesets) { $self = __CLASS__; $status = false; foreach ($rulesets as $ruleset) { $status = ($status || $self::assert($ruleset, $input)); } return !$status; }, "null", "null", array($rulesets)); return $this; } public function allOf() { $rulesets = func_get_args(); $this->_pushToQueue(function($input, $rulesets) { $self = __CLASS__; $status = true; foreach ($rulesets as $ruleset) { $status = ($status && $self::assert($ruleset, $input)); } return $status; }, "null", "null", array($rulesets)); return $this; } public function oneOf() { $rulesets = func_get_args(); $this->_pushToQueue(function($input, $rulesets) { $self = __CLASS__; $status = false; foreach ($rulesets as $ruleset) { $status = ($status || $self::assert($ruleset, $input)); } return $status; }, "null", "null", array($rulesets)); return $this; } public function haltOnFail() { $this->_haltOnError = true; return $this; } public function continueOnFail() { $this->_haltOnError = false; return $this; } public function required() { if ($key = array_search($this->_currentIndex, $this->_optional) !== false) { unset($this->_optional[$key]); } return $this; } public function optional() { $this->_optional[] = $this->_currentIndex; return $this; } public function string() { //$this->_accept("string", $strict); $this->_pushToQueue(function($input) { return is_string($input); }, "{{name}} must be a string", "{{name}} can't be a string"); return $this; } public function int() { $this->_pushToQueue(function($input) { return is_int($input); }, "{{name}} must be an integer", "{{name}} can't be an integer"); return $this; } public function atStart($param) { $this->_pushToQueue(function($input, $param) { return strpos($input, $param) === 0; }, "{{name}} must start with $param", "{{name}} can't start with $param", array($param)); return $this; } public function atEnd($param) { $this->_pushToQueue(function($input, $param) { return substr($haystack, -strlen($needle)) === $needle; }, "{{name}} must end with $param", "{{name}} can't end with $param", array($param)); return $this; } public function contains($param) { $this->_pushToQueue(function($input, $param) { return strpos($input, $param) !== false; }, "{{name}} must start with $param", "{{name}} can't start with $param", array($param)); return $this; } public function like($type, $keepType = true) { $this->_pushToQueue(function($input, $type) { switch($type) { case "float": case "double": $pattern = '/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/'; break; case "int": case "integer": $pattern = '/^[-+]?[0-9]+$/'; break; default: throw new InvalidInputTypeException("Invalid comparison type provided for schimile->like() operator"); break; } if (preg_match($pattern, $input)) { if ($keepType) return true; if ($type === "float") return (float) $input; return (int) $input; } else { if ($keepType) return false; throw new ValidationFailException(); } }, "{{name}} must be a valid $type", "{{name}} can't be a $type", array($type)); return $this; } public function likeRegex($pattern) { $this->_pushToQueue(function($input, $pattern) { return (bool) preg_match($pattern, $input); }, "{{name}} must match regex $pattern", "{{name}} can't match regex $pattern", array($pattern)); return $this; } public function numeric() { $this->_pushToQueue(function($input) { return is_numeric($input); }, "{{name}} must be numeric", "{{name}} can't be numeric"); return $this; } public function alnum() { $this->_pushToQueue(function($input) { return ctype_alnum($input); }, "{{name}} must consist of only letters and numbers", "{{name}} can't consist of just letters or numbers"); return $this; } public function charList($characters) { $this->_pushToQueue(function($input, $characters) { $incl = array(); $pattern = preg_replace_callback('/([a-z]\-[a-z])|([0-9]\-[0-9])|([A-Z]\-[A-Z])/', function($matches) use (&$incl) { $incl = array_merge($incl, $matches); return ""; }, $characters); $pattern = preg_quote($pattern); $pattern = $pattern . implode("", array_unique($incl)); $pattern = '/^['.$pattern.']+$/'; return (bool) preg_match($pattern, $input); }, "{{name}} can only contain the characters $characters", "{{name}} can't consist entirely of the characters $characters", array($characters)); return $this; } public function lengthBetween($min = 0, $max = null) { $this->_pushToQueue(function($input, $min, $max) { $resultmin = false; $resultmax = false; if (strlen($input) >= $min) $resultmin = true; if ($max === null || strlen($input) <= $max) $resultmax = true; return $resultmin && $resultmax; }, "{{name}} must be between $min and $max characters", "{{name}} can't be between $min and $max characters", array($min, $max)); return $this; } public function email() { $this->_pushToQueue(function($input) { return (bool) preg_match('/^.+@.+\..+$/', $input); }, "{{name}} must be a valid e-mail address", "{{name}} can't be an e-mail address"); return $this; } public function equalTo($comparison, $strict = true) { $this->_pushToQueue(function($input, $comparison, $strict) { if ($strict) { return $input === $comparison; } else { return $input == $comparison; } }, "{{name}} must be equal to $comparison", "{{name}} can't be $comparison", array($comparison, $strict)); return $this; } public function entropyMin($value) { $this->_pushToQueue(function($input, $value) { $h=0; $size = strlen($string); foreach (count_chars($string, 1) as $v) { $p = $v/$size; $h -= $p*log($p)/log(2); } return $h >= $value; }, "{{name}} must be equal to $comparison", "{{name}} can't be $comparison", array($value)); return $this; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  602     0  E > > RETURN                                                   1

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A285%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  6
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  285     0  E >   RECV                                             !0      
  286     1        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cis_array'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  287     5*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A285%240

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A303%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  10
compiled vars:  !0 = $input, !1 = $ruleset, !2 = $self
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  303     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  304     2        ASSIGN                                                   !2, 'schlaus%5Cschimile%5Cschimile'
  306     3        FETCH_CLASS                                   0  $4      !2
          4        INIT_STATIC_METHOD_CALL                                  $4, 'assert'
          5        SEND_VAR_EX                                              !1
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $5      
          8      > RETURN                                                   $5
  308     9*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A303%241

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A331%242:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 13
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  19
compiled vars:  !0 = $input, !1 = $rulesets, !2 = $self, !3 = $status, !4 = $ruleset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  331     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  332     2        ASSIGN                                                   !2, 'schlaus%5Cschimile%5Cschimile'
  334     3        ASSIGN                                                   !3, <false>
  336     4      > FE_RESET_R                                       $7      !1, ->15
          5    > > FE_FETCH_R                                               $7, !4, ->15
  337     6    > > JMPNZ_EX                                         ~8      !3, ->13
          7    >   FETCH_CLASS                                   0  $9      !2
          8        INIT_STATIC_METHOD_CALL                                  $9, 'assert'
          9        SEND_VAR_EX                                              !4
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0  $10     
         12        BOOL                                             ~8      $10
         13    >   ASSIGN                                                   !3, ~8
  336    14      > JMP                                                      ->5
         15    >   FE_FREE                                                  $7
  340    16        BOOL_NOT                                         ~12     !3
         17      > RETURN                                                   ~12
  342    18*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A331%242

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A352%243:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 13
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  18
compiled vars:  !0 = $input, !1 = $rulesets, !2 = $self, !3 = $status, !4 = $ruleset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  352     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  353     2        ASSIGN                                                   !2, 'schlaus%5Cschimile%5Cschimile'
  355     3        ASSIGN                                                   !3, <true>
  357     4      > FE_RESET_R                                       $7      !1, ->15
          5    > > FE_FETCH_R                                               $7, !4, ->15
  358     6    > > JMPZ_EX                                          ~8      !3, ->13
          7    >   FETCH_CLASS                                   0  $9      !2
          8        INIT_STATIC_METHOD_CALL                                  $9, 'assert'
          9        SEND_VAR_EX                                              !4
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0  $10     
         12        BOOL                                             ~8      $10
         13    >   ASSIGN                                                   !3, ~8
  357    14      > JMP                                                      ->5
         15    >   FE_FREE                                                  $7
  361    16      > RETURN                                                   !3
  363    17*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A352%243

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A373%244:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 13
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  18
compiled vars:  !0 = $input, !1 = $rulesets, !2 = $self, !3 = $status, !4 = $ruleset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  373     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  374     2        ASSIGN                                                   !2, 'schlaus%5Cschimile%5Cschimile'
  376     3        ASSIGN                                                   !3, <false>
  378     4      > FE_RESET_R                                       $7      !1, ->15
          5    > > FE_FETCH_R                                               $7, !4, ->15
  379     6    > > JMPNZ_EX                                         ~8      !3, ->13
          7    >   FETCH_CLASS                                   0  $9      !2
          8        INIT_STATIC_METHOD_CALL                                  $9, 'assert'
          9        SEND_VAR_EX                                              !4
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0  $10     
         12        BOOL                                             ~8      $10
         13    >   ASSIGN                                                   !3, ~8
  378    14      > JMP                                                      ->5
         15    >   FE_FREE                                                  $7
  382    16      > RETURN                                                   !3
  384    17*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A373%244

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A425%245:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  6
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  425     0  E >   RECV                                             !0      
  426     1        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cis_string'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  427     5*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A425%245

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A434%246:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  6
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  434     0  E >   RECV                                             !0      
  435     1        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cis_int'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  436     5*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A434%246

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A443%247:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  9
compiled vars:  !0 = $input, !1 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  443     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  444     2        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cstrpos'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0  $2      
          6        IS_IDENTICAL                                     ~3      $2, 0
          7      > RETURN                                                   ~3
  445     8*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A443%247

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A452%248:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  13
compiled vars:  !0 = $input, !1 = $param, !2 = $haystack, !3 = $needle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  452     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  453     2        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Csubstr'
          3        SEND_VAR_EX                                              !2
          4        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cstrlen'
          5        SEND_VAR_EX                                              !3
          6        DO_FCALL                                      0  $4      
          7        MUL                                              ~5      $4, -1
          8        SEND_VAL_EX                                              ~5
          9        DO_FCALL                                      0  $6      
         10        IS_IDENTICAL                                     ~7      !3, $6
         11      > RETURN                                                   ~7
  454    12*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A452%248

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A461%249:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  9
compiled vars:  !0 = $input, !1 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  461     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  462     2        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cstrpos'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0  $2      
          6        TYPE_CHECK                                  1018  ~3      $2
          7      > RETURN                                                   ~3
  463     8*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A461%249

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A471%24a:
Finding entry points
Branch analysis from position: 0
6 jumps found. (Code = 188) Position 1 = 12, Position 2 = 12, Position 3 = 14, Position 4 = 14, Position 5 = 16, Position 6 = 3
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 35
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 28
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 37
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 14
Branch analysis from position: 16
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 14
Branch analysis from position: 14
Branch analysis from position: 12
Branch analysis from position: 12
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  41
compiled vars:  !0 = $input, !1 = $type, !2 = $pattern, !3 = $keepType
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  471     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  472     2      > SWITCH_STRING                                            !1, [ 'float':->12, 'double':->12, 'int':->14, 'integer':->14, ], ->16
  473     3    >   IS_EQUAL                                                 !1, 'float'
          4      > JMPNZ                                                    ~4, ->12
  474     5    >   IS_EQUAL                                                 !1, 'double'
          6      > JMPNZ                                                    ~4, ->12
  477     7    >   IS_EQUAL                                                 !1, 'int'
          8      > JMPNZ                                                    ~4, ->14
  478     9    >   IS_EQUAL                                                 !1, 'integer'
         10      > JMPNZ                                                    ~4, ->14
         11    > > JMP                                                      ->16
  475    12    >   ASSIGN                                                   !2, '%2F%5E%5B-%2B%5D%3F%5B0-9%5D%2A%5C.%3F%5B0-9%5D%2B%28%5BeE%5D%5B-%2B%5D%3F%5B0-9%5D%2B%29%3F%24%2F'
  476    13      > JMP                                                      ->21
  479    14    >   ASSIGN                                                   !2, '%2F%5E%5B-%2B%5D%3F%5B0-9%5D%2B%24%2F'
  480    15      > JMP                                                      ->21
  482    16    >   NEW                                              $7      'schlaus%5Cschimile%5CInvalidInputTypeException'
         17        SEND_VAL_EX                                              'Invalid+comparison+type+provided+for+schimile-%3Elike%28%29+operator'
         18        DO_FCALL                                      0          
         19      > THROW                                         0          $7
  483    20*       JMP                                                      ->21
  485    21    >   INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cpreg_match'
         22        SEND_VAR_EX                                              !2
         23        SEND_VAR_EX                                              !0
         24        DO_FCALL                                      0  $9      
         25      > JMPZ                                                     $9, ->35
  486    26    > > JMPZ                                                     !3, ->28
         27    > > RETURN                                                   <true>
  487    28    >   IS_IDENTICAL                                             !1, 'float'
         29      > JMPZ                                                     ~10, ->32
         30    >   CAST                                          5  ~11     !0
         31      > RETURN                                                   ~11
  488    32    >   CAST                                          4  ~12     !0
         33      > RETURN                                                   ~12
         34*       JMP                                                      ->40
  490    35    > > JMPZ                                                     !3, ->37
         36    > > RETURN                                                   <false>
  491    37    >   NEW                                              $13     'schlaus%5Cschimile%5CValidationFailException'
         38        DO_FCALL                                      0          
         39      > THROW                                         0          $13
  494    40*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A471%24a

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A501%24b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  9
compiled vars:  !0 = $input, !1 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  501     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  502     2        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cpreg_match'
          3        SEND_VAR_EX                                              !1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $2      
          6        BOOL                                             ~3      $2
          7      > RETURN                                                   ~3
  503     8*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A501%24b

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A510%24c:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  6
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  510     0  E >   RECV                                             !0      
  511     1        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cis_numeric'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  512     5*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A510%24c

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A519%24d:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  6
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  519     0  E >   RECV                                             !0      
  520     1        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cctype_alnum'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  521     5*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A519%24d

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A528%24e:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  34
compiled vars:  !0 = $input, !1 = $characters, !2 = $incl, !3 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  528     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  530     2        ASSIGN                                                   !2, <array>
  532     3        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cpreg_replace_callback'
          4        SEND_VAL_EX                                              '%2F%28%5Ba-z%5D%5C-%5Ba-z%5D%29%7C%28%5B0-9%5D%5C-%5B0-9%5D%29%7C%28%5BA-Z%5D%5C-%5BA-Z%5D%29%2F'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A532%24f'
          6        BIND_LEXICAL                                             ~5, !2
  535     7        SEND_VAL_EX                                              ~5
  532     8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $6      
         10        ASSIGN                                                   !3, $6
  537    11        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cpreg_quote'
         12        SEND_VAR_EX                                              !3
         13        DO_FCALL                                      0  $8      
         14        ASSIGN                                                   !3, $8
  538    15        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cimplode'
         16        SEND_VAL_EX                                              ''
         17        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Carray_unique'
         18        SEND_VAR_EX                                              !2
         19        DO_FCALL                                      0  $10     
         20        SEND_VAR_NO_REF_EX                                       $10
         21        DO_FCALL                                      0  $11     
         22        CONCAT                                           ~12     !3, $11
         23        ASSIGN                                                   !3, ~12
  539    24        CONCAT                                           ~14     '%2F%5E%5B', !3
         25        CONCAT                                           ~15     ~14, '%5D%2B%24%2F'
         26        ASSIGN                                                   !3, ~15
  541    27        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cpreg_match'
         28        SEND_VAR_EX                                              !3
         29        SEND_VAR_EX                                              !0
         30        DO_FCALL                                      0  $17     
         31        BOOL                                             ~18     $17
         32      > RETURN                                                   ~18
  542    33*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A528%24e

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A532%24f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  9
compiled vars:  !0 = $matches, !1 = $incl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  532     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
  533     2        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Carray_merge'
          3        SEND_VAR_EX                                              !1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $2      
          6        ASSIGN                                                   !1, $2
  534     7      > RETURN                                                   ''
  535     8*     > RETURN                                                   null

End of function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A532%24f

Function %00schlaus%5Cschimile%5C%7Bclosure%7D%2Fin%2FOrdHN%3A550%2410:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 20
Branch analysis from position: 18
Branch analysis from position: 11
filename:       /in/OrdHN
function name:  schlaus\schimile\{closure}
number of ops:  24
compiled vars:  !0 = $input, !1 = $min, !2 = $max, !3 = $resultmin, !4 = $resultmax
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  550     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  551     3        ASSIGN                                                   !3, <false>
  552     4        ASSIGN                                                   !4, <false>
  553     5        INIT_NS_FCALL_BY_NAME                                    'schlaus%5Cschimile%5Cstrlen'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $7      
          8 

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
360.1 ms | 1433 KiB | 43 Q