public function _boolval($value) { if ($value instanceof SandboxedString) { return (bool) strval($value); } return is_bool($value) ? $value : (bool) $value; }