/** * Constructor * * @param string $input - YAML string * @param array $config - possible configuration changes * * @returns Yaml * * @since 1.0 */ public function __construct($input, array $config = array()) { parent::__construct(); $config = array_merge($this->config, $config); $this->config = new ArrayObject($config, ArrayObject::ARRAY_AS_PROPS); $this->data = $input; }
/** * Constructor * * @param string $input - filename * * @returns Ini * * @since 1.0 */ public function __construct($input) { parent::__construct(); $this->data = $input; $this->parser = new \IniParser(); foreach ($this->config as $property => $value) { $this->parser->{$property} = $value; } }
/** * Constructor * * @param array $input - structure to be encoded * * @returns Ini * * @since 1.0 */ public function __construct(array $input) { parent::__construct(); $this->data = $input; }
/** * Constructor * * @param string $input - JSON string * @param array $config - possible configuration changes * * @returns Xml * * @throws InvalidArgumentException * * @since 1.0 */ public function __construct($input, array $config = array()) { if (!is_string($input)) { throw new InvalidArgumentException('XML serializer accepts only strings.'); } parent::__construct(); $config = array_merge($this->config, $config); $this->config = new ArrayObject($config, ArrayObject::ARRAY_AS_PROPS); $this->data = $input; }
/** * Constructor * * @param string $root - root element * @param mixed $input - structure to be encoded * @param array $config - additional configuration options * * @returns Xml * * @throws \InvalidArgumentException * * @since 1.0 */ public function __construct($root, array $input, array $config = array()) { if (!is_string($root) || empty($root)) { throw new InvalidArgumentException('Root element must be a valid string.'); } parent::__construct(); $this->root = $root; $this->data = $input; $config = array_merge($this->config, $config); $this->config = new ArrayObject($config, ArrayObject::ARRAY_AS_PROPS); }