Example #1
0
 public function getMessage()
 {
     if (is_null($this->m_errorCode)) {
         return null;
     }
     $errorMessage = getGS(SyntaxError::ErrorMessage($this->m_errorCode), $this->m_what);
     if (is_null($errorMessage)) {
         return null;
     }
     if (isset($this->m_templateName)) {
         $message .= getGS('template') . ' ' . $this->m_templateName;
         if (isset($this->m_line)) {
             $message .= ', ' . getGS('line') . ' ' . $this->m_line;
         }
         $message .= ': ';
     }
     $message .= $errorMessage;
     return $message;
 }
Example #2
0
 public function getMessage()
 {
     $translator = \Zend_Registry::get('container')->getService('translator');
     if (is_null($this->m_errorCode)) {
         return null;
     }
     $errorMessage = $translator->trans(SyntaxError::ErrorMessage($this->m_errorCode), array('$1' => $this->m_what), 'preview');
     if (is_null($errorMessage)) {
         return null;
     }
     if (isset($this->m_templateName)) {
         $message .= $translator->trans('template', array(), 'preview') . ' ' . $this->m_templateName;
         if (isset($this->m_line)) {
             $message .= ', ' . $translator->trans('line', array(), 'preview') . ' ' . $this->m_line;
         }
         $message .= ': ';
     }
     $message .= $errorMessage;
     return $message;
 }
Example #3
0
$global = Object::$global;
$undefined = null;
$Infinity = INF;
$NaN = NAN;
$Object = Object::getGlobalConstructor();
$Function = Func::getGlobalConstructor();
$Array = Arr::getGlobalConstructor();
$Boolean = Bln::getGlobalConstructor();
$Number = Number::getGlobalConstructor();
$String = Str::getGlobalConstructor();
$Date = Date::getGlobalConstructor();
$Error = Error::getGlobalConstructor();
$RangeError = RangeError::getGlobalConstructor();
$ReferenceError = ReferenceError::getGlobalConstructor();
$SyntaxError = SyntaxError::getGlobalConstructor();
$TypeError = TypeError::getGlobalConstructor();
$RegExp = RegExp::getGlobalConstructor();
$Buffer = Buffer::getGlobalConstructor();
call_user_func(function () use(&$escape, &$unescape, &$encodeURI, &$decodeURI, &$encodeURIComponent, &$decodeURIComponent) {
    $ord = function ($ch) {
        $i = ord($ch[0]);
        if ($i <= 0x7f) {
            return $i;
        } else {
            if ($i < 0xc2) {
                return $i;
                //invalid byte sequence
            } else {
                if ($i <= 0xdf) {
                    return ($i & 0x1f) << 6 | ord($ch[1]) & 0x3f;
Example #4
0
         }
         if ($opts->gap === null) {
             $result = '{' . join(',', $parts) . '}';
         } else {
             $result = count($parts) === 0 ? "{}" : "{\n" . $opts->gap . join(",\n" . $opts->gap, $parts) . "\n" . $prevGap . "}";
         }
     }
     $opts->level -= 1;
     $opts->gap = $prevGap;
     return $result;
 };
 $methods = array('parse' => function ($string, $reviver = null) use(&$decode) {
     $string = '{"_":' . $string . '}';
     $value = json_decode($string);
     if ($value === null) {
         throw new Ex(SyntaxError::create('Unexpected end of input'));
     }
     return $decode($value->_);
 }, 'stringify' => function ($value, $replacer = null, $space = null) use(&$encode) {
     $opts = new stdClass();
     $opts->indent = null;
     $opts->gap = null;
     if (is_int_or_float($space)) {
         $space = floor($space);
         if ($space > 0) {
             $space = str_repeat(' ', $space);
         }
     }
     if (is_string($space)) {
         $length = strlen($space);
         if ($length > 10) {