jsonpCallback = $callback; return $this; } /** * Serialize to JSON * * @return string */ public function serialize() { $variables = $this->getVariables(); if ($variables instanceof Traversable) { $variables = ArrayUtils::iteratorToArray($variables); } $options = array( 'prettyPrint' => $this->getOption('prettyPrint'), ); if (null !== $this->jsonpCallback) { return $this->jsonpCallback.'('.Json::encode($variables, false, $options).');'; } return Json::encode($variables, false, $options); } }