} private function is_legal($text) { foreach ($this->_rules->states->inputs as $a) { if ($text == $a) { return true; } } return false; } public function get_error() { switch (json_last_error()) { case JSON_ERROR_DEPTH: return 'Maximum stack depth exceeded'; break; case JSON_ERROR_CTRL_CHAR: return 'Unexpected control character found'; break; case JSON_ERROR_SYNTAX: return 'Syntax error, malformed JSON'; break; case JSON_ERROR_NONE: return 'No errors'; break; } } } $compiler = new Compiler(); $compiler->process();