Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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;
     }
 }
Exemplo n.º 3
0
 /**
  * Constructor
  *
  * @param array $input - structure to be encoded
  *
  * @returns Ini
  *
  * @since 1.0
  */
 public function __construct(array $input)
 {
     parent::__construct();
     $this->data = $input;
 }
Exemplo n.º 4
0
 /**
  * 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;
 }
Exemplo n.º 5
0
 /**
  * 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);
 }