예제 #1
0
 public function toJson()
 {
     static $options = null;
     if (null === $options) {
         $options = Utils::calculateBitmask(array('JSON_PRETTY_PRINT', 'JSON_NUMERIC_CHECK'));
     }
     return json_encode($this->toArray(), $options);
 }
예제 #2
0
 public function toJson()
 {
     static $options = null;
     if (null === $options) {
         $options = Utils::calculateBitmask(array('JSON_PRETTY_PRINT', 'JSON_NUMERIC_CHECK'));
     }
     $output = new \SplFixedArray(count($this));
     foreach ($this as $index => $token) {
         $output[$index] = $token->toArray();
     }
     $this->rewind();
     return json_encode($output, $options);
 }