Esempio n. 1
0
 public function stringToObject($data, $options = array('processSections' => false))
 {
     // Fix legacy API.
     if (is_bool($options)) {
         $options = array('processSections' => $options);
         // Deprecation warning.
         MLog::add('MRegistryFormatJSON::stringToObject() second argument should not be a boolean.', MLog::WARNING, 'deprecated');
     }
     $data = trim($data);
     if (substr($data, 0, 1) != '{' && substr($data, -1, 1) != '}') {
         $ini = MRegistryFormat::getInstance('INI');
         $obj = $ini->stringToObject($data, $options);
     } else {
         $obj = json_decode($data);
     }
     return $obj;
 }
Esempio n. 2
0
 public function toString($format = 'JSON', $options = array())
 {
     // Return a namespace in a given format
     $handler = MRegistryFormat::getInstance($format);
     return $handler->objectToString($this->data, $options);
 }