public static function clearLastFail() { Structure::$lastFail = null; }
/** * Runs type and value set tests * * @api * * @param mixed $data * @param $failed * @return boolean */ public function check($data = null, &$failed = null) { // reset var if it is defined $failed = null; $valid = $this->checkType($data, $failed) && $this->checkValueSet($data, $failed); if (!$valid) { Structure::$lastFail = $failed; } return $valid; }
/** * @param mixed $data * @param $failed * @return bool */ public function check($data = null, &$failed = null) { $valid = parent::check($data, $failed) && $this->checkLength($data, $failed); if (!$valid) { Structure::$lastFail = $failed; } return $valid; }
/** * Runs an __is_array__ test on some $data. * A test format can be set (read Documentation) * * @param mixed $data * @param array $failed * @return bool */ public function check($data = null, &$failed = array()) { if (is_null($data)) { $data = $this->data; } if (!isset($this->format)) { $this->format = "array"; } // reset the reporting array $failed = array(); if ($this->getNull()) { $valid = (is_null($data) || $this->checkType($data, $failed)) && $this->checkFormat($data, $failed); } else { $valid = $this->checkType($data, $failed) && $this->checkFormat($data, $failed); } // save the failures for later checking if (!is_array($failed) || is_array($failed) && count($failed) > 0) { Structure::$lastFail = $failed; } return $valid; }