10 defined(
'JPATH_PLATFORM') or die;
32 public function objectToString($object, $params = array())
37 foreach (get_object_vars($object) as $k => $v)
41 $vars .=
"\tpublic $" . $k .
" = '" . addcslashes($v,
'\\\'') .
"';\n";
43 elseif (is_array($v) || is_object($v))
45 $vars .=
"\tpublic $" . $k .
" = " . $this->getArrayString((array) $v) .
";\n";
49 $str =
"<?php\nclass " . $params[
'class'] .
" {\n";
54 if (!isset($params[
'closingtag']) || $params[
'closingtag'] !==
false)
72 public function stringToObject($data, array $options = array())
86 protected function getArrayString($a)
91 foreach ($a as $k => $v)
93 $s .= ($i) ?
', ' :
'';
94 $s .=
'"' . $k .
'" => ';
96 if (is_array($v) || is_object($v))
98 $s .= $this->getArrayString((array) $v);
102 $s .=
'"' . addslashes($v) .
'"';