/var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/View
NameSizeModeActions
Exception/-0755rm
Form/-0755rm
Helper/-0755rm
Widget/-0755rm
AjaxView.php10980644editdlrm
Cell.php89360644editdlrm
CellTrait.php45240644editdlrm
Helper.php71820644editdlrm
HelperRegistry.php48530644editdlrm
JsonView.php58580644editdlrm
SerializedView.php35580644editdlrm
StringTemplate.php112470644editdlrm
StringTemplateTrait.php28390644editdlrm
View.php504330644editdlrm
ViewBlock.php64450644editdlrm
ViewBuilder.php161570644editdlrm
ViewVarsTrait.php30010644editdlrm
XmlView.php49410644editdlrm
Edit: /var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/View/XmlView.php (4941B)
set(['posts' => $posts]); * $this->viewBuilder()->setOption('serialize', true); * ``` * * When the view is rendered, the `$posts` view variable will be serialized * into XML. * * **Note** The view variable you specify must be compatible with Xml::fromArray(). * * You can also set `'serialize'` as an array. This will create an additional * top level element named `` containing all the named view variables: * * ``` * $this->set(compact('posts', 'users', 'stuff')); * $this->viewBuilder()->setOption('serialize', true); * ``` * * The above would generate a XML object that looks like: * * `......` * * You can also set `'serialize'` to a string or array to serialize only the * specified view variables. * * If you don't set the `serialize` option, you will need a view. You can use extended * views to provide layout like functionality. */ class XmlView extends SerializedView { /** * XML layouts are located in the xml sub directory of `Layouts/` * * @var string */ protected $layoutPath = 'xml'; /** * XML views are located in the 'xml' sub directory for controllers' views. * * @var string */ protected $subDir = 'xml'; /** * Response type. * * @var string */ protected $_responseType = 'xml'; /** * Option to allow setting an array of custom options for Xml::fromArray() * * For e.g. 'format' as 'attributes' instead of 'tags'. * * @var array|null */ protected $xmlOptions; /** * Default config options. * * Use ViewBuilder::setOption()/setOptions() in your controller to set these options. * * - `serialize`: Option to convert a set of view variables into a serialized response. * Its value can be a string for single variable name or array for multiple * names. If true all view variables will be serialized. If null or false * normal view template will be rendered. * - `xmlOptions`: Option to allow setting an array of custom options for Xml::fromArray(). * For e.g. 'format' as 'attributes' instead of 'tags'. * - `rootNode`: Root node name. Defaults to "response". * * @var array * @psalm-var array{serialize:string|bool|null, xmlOptions: int|null, rootNode: string|null} */ protected $_defaultConfig = [ 'serialize' => null, 'xmlOptions' => null, 'rootNode' => null, ]; /** * @inheritDoc */ protected function _serialize($serialize): string { $rootNode = $this->getConfig('rootNode', 'response'); if (is_array($serialize)) { if (empty($serialize)) { $serialize = ''; } elseif (count($serialize) === 1) { $serialize = current($serialize); } } if (is_array($serialize)) { $data = [$rootNode => []]; foreach ($serialize as $alias => $key) { if (is_numeric($alias)) { $alias = $key; } if (array_key_exists($key, $this->viewVars)) { $data[$rootNode][$alias] = $this->viewVars[$key]; } } } else { $data = $this->viewVars[$serialize] ?? []; if ( $data && (!is_array($data) || Hash::numeric(array_keys($data))) ) { $data = [$rootNode => [$serialize => $data]]; } } $options = $this->getConfig('xmlOptions', []); if (Configure::read('debug')) { $options['pretty'] = true; } return Xml::fromArray($data, $options)->saveXML(); } }