74 if ($key === (array)$key) {
77 $this->_data[$key] =
$value;
92 }
elseif (is_string($key)) {
93 if (isset($this->_data[$key]) || array_key_exists($key, $this->_data)) {
94 unset($this->_data[$key]);
96 }
elseif ($key === (array)$key) {
126 if (strpos($key,
'/') !==
false) {
157 $keys = explode(
'/',
$path);
160 foreach ($keys as $key) {
191 if (isset($this->_data[$key])) {
192 return $this->_data[$key];
206 $method =
'set' . str_replace(
' ',
'', ucwords(str_replace(
'_',
' ', $key)));
220 $method =
'get' . str_replace(
' ',
'', ucwords(str_replace(
'_',
' ', $key)));
221 return $this->{
$method}($args);
233 if (empty($key) || !is_string($key)) {
234 return !empty($this->_data);
236 return array_key_exists($key, $this->_data);
252 foreach ($keys as $key) {
253 if (isset($this->_data[$key])) {
254 $result[$key] = $this->_data[$key];
282 public function toXml(array $keys = [], $rootName =
'item', $addOpenTag =
false, $addCdata =
true)
286 foreach (
$data as $fieldName => $fieldValue) {
287 if ($addCdata ===
true) {
288 $fieldValue =
"<![CDATA[{$fieldValue}]]>";
290 $fieldValue = str_replace(
291 [
'&',
'"',
"'",
'<',
'>'],
292 [
'&',
'"',
''',
'<',
'>'],
296 $xml .=
"<{$fieldName}>{$fieldValue}</{$fieldName}>\n";
299 $xml =
"<{$rootName}>\n{$xml}</{$rootName}>\n";
302 $xml =
'<?xml version="1.0" encoding="UTF-8"?>' .
"\n" . $xml;
317 array $arrAttributes = [],
322 return $this->
toXml($arrAttributes, $rootName, $addOpenTag, $addCdata);
335 return \Magento\Framework\Serialize\JsonConverter::convert(
$data);
347 return $this->
toJson($keys);
363 preg_match_all(
'/\{\{([a-z0-9_]+)\}\}/is',
$format, $matches);
364 foreach ($matches[1] as $var) {
382 switch (substr(
$method, 0, 3)) {
385 $index = isset($args[0]) ? $args[0] :
null;
389 $value = isset($args[0]) ? $args[0] :
null;
396 return isset($this->_data[$key]);
398 throw new \Magento\Framework\Exception\LocalizedException(
410 if (empty($this->_data)) {
427 if (isset(self::$_underscoreCache[
$name])) {
428 return self::$_underscoreCache[
$name];
430 $result = strtolower(trim(preg_replace(
'/([A-Z]|[0-9]+)/',
"_$1",
$name),
'_'));
446 public function serialize($keys = [], $valueSeparator =
'=', $fieldSeparator =
' ',
$quote =
'"')
450 $keys = array_keys($this->_data);
453 foreach ($this->_data as $key =>
$value) {
454 if (in_array($key, $keys)) {
458 $res = implode($fieldSeparator,
$data);
471 if (
$data ===
null) {
472 $hash = spl_object_hash($this);
473 if (!empty($objects[$hash])) {
474 return '*** RECURSION ***';
476 $objects[$hash] =
true;
502 $this->_data[$offset] =
$value;
514 return isset($this->_data[$offset]) || array_key_exists($offset, $this->_data);
526 unset($this->_data[$offset]);
538 if (isset($this->_data[$offset])) {
539 return $this->_data[$offset];
convertToJson(array $keys=[])
getData($key='', $index=null)
elseif(isset( $params[ 'redirect_parent']))
getDataUsingMethod($key, $args=null)
offsetSet($offset, $value)
debug($data=null, &$objects=[])
serialize($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
convertToXml(array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
convertToArray(array $keys=[])
setData($key, $value=null)
__construct(array $data=[])
setDataUsingMethod($key, $args=[])
toXml(array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
if(!isset($_GET['name'])) $name