public function __construct($data = array())
 {
     if ($data == null) {
         $data = array();
     }
     parent::__construct($data, \ArrayObject::STD_PROP_LIST | \ArrayObject::ARRAY_AS_PROPS);
 }
Example #2
0
File: Data.php Project: kimai/kimai
 /**
  * Create a translation object:
  * pre-fill with english and replace by $language specific data.
  *
  * @param array|null|object $language
  */
 public function __construct($language)
 {
     $default = Kimai_Config::getDefault(Kimai_Config::DEFAULT_LANGUAGE);
     $data = (include WEBROOT . 'language/' . $default . '.php');
     parent::__construct($data, \ArrayObject::ARRAY_AS_PROPS);
     $this->addTranslations($language);
 }
Example #3
0
 public function __construct(IDataContainer $container)
 {
     parent::__construct();
     if ($container) {
         $this->offsetSet(0, $container);
     }
 }
Example #4
0
 public function __construct($name, $_parent = null)
 {
     parent::__construct();
     $this->name = $name;
     $this->parentNode = $_parent;
     $this->isroot = $this->parentNode === null ? true : false;
 }
Example #5
0
 /**
  * Constructs this collection with a default set of formats if none are given.
  *
  * @param Format[]|null $input
  */
 public function __construct(array $input = null)
 {
     if ($input === null) {
         $input = array(Format::HTML => new Format(Format::HTML, 'text/html', array('html', 'htm')), Format::JSON => new Format(Format::JSON, 'application/json', 'json'), Format::LATEX => new Format(Format::LATEX, 'application/x-latex', 'tex'), Format::MARKDOWN => new Format(Format::MARKDOWN, 'text/x-markdown', 'md'), Format::PDF => new Format(Format::PDF, 'application/pdf', 'pdf'), Format::RST => new Format(Format::RST, 'text-x-rst', array('rst', 'txt', 'rest', 'restx')));
     }
     parent::__construct($input, 0, 'ArrayIterator');
 }
Example #6
0
 function __construct($results, $pagination = null)
 {
     parent::__construct($results);
     if ($pagination instanceof \WP_Clanwars\Pagination) {
         $this->_pagination = $pagination;
     }
 }
Example #7
0
 public function get($data = null)
 {
     parent::__construct(array(), ArrayObject::ARRAY_AS_PROPS);
     if (is_array($data)) {
         foreach ($data as $key => $value) {
             if (is_array($value)) {
                 $value = new self($value);
             }
             $this->offsetSet($key, $value);
         }
     } else {
         if ($data instanceof self) {
             $data = $this->toArray($data);
             $this->get($data);
         } else {
             if (is_string($data)) {
                 $db = MySQL::getInstance();
                 $db->query($data);
                 if ($db->numRows() > 0) {
                     $this->get($db->fetchRow());
                 }
             }
         }
     }
     return $this;
 }
 public function __construct(array $data)
 {
     $defaults = array_fill_keys(['name' => NULL, 'firstname' => NULL, 'name_thirdparty' => NULL, 'ref_ext' => NULL, 'client' => NULL, 'fournisseur' => NULL, 'address' => NULL, 'zip' => NULL, 'town' => NULL, 'country_id' => NULL, 'country_code' => NULL, 'phone' => NULL, 'phone_mobile' => NULL, 'fax' => NULL, 'email' => NULL, 'url' => NULL, 'profid1' => NULL, 'profid2' => NULL, 'profid3' => NULL, 'profid4' => NULL, 'profid5' => NULL, 'profid6' => NULL, 'capital' => NULL, 'tva_assuj' => NULL, 'tva_intra' => NULL, 'login' => NULL, 'password' => NULL, 'group_id' => NULL], NULL);
     // Merge defaults.
     $data += $defaults;
     parent::__construct($data, \ArrayObject::ARRAY_AS_PROPS);
 }
Example #9
0
 function __construct(\Pyrus\PackageFile\v2\Files $parent, \Pyrus\PackageFile\v2 $ultraparent, array $info)
 {
     $this->parent = $parent;
     $this->pkg = $ultraparent;
     $this->tasksNs = $ultraparent->getTasksNs() . ':';
     parent::__construct($info);
 }
Example #10
0
 public function __construct(array $input = array(), $flags = 0, $iterator_class = "ArrayIterator")
 {
     if (is_array($input) && !empty($input)) {
         $this->checkInstanceOf(current($input));
     }
     parent::__construct($input, $flags, $iterator_class);
 }
 public function __construct(array $data)
 {
     $defaults = array_fill_keys(['id' => NULL, 'ref' => NULL, 'ref_ext' => NULL, 'fk_user_author' => NULL, 'status' => NULL, 'client' => NULL, 'supplier' => NULL, 'customer_code' => NULL, 'supplier_code' => NULL, 'customer_code_accountancy' => NULL, 'supplier_code_accountancy' => NULL, 'date_creation' => NULL, 'date_modification' => NULL, 'note_private' => NULL, 'note_public' => NULL, 'address' => NULL, 'zip' => NULL, 'town' => NULL, 'province_id' => NULL, 'country_id' => NULL, 'country_code' => NULL, 'country' => NULL, 'phone' => NULL, 'fax' => NULL, 'email' => NULL, 'url' => NULL, 'profid1' => NULL, 'profid2' => NULL, 'profid3' => NULL, 'profid4' => NULL, 'profid5' => NULL, 'profid6' => NULL, 'capital' => NULL, 'vat_used' => NULL, 'vat_number' => NULL], NULL);
     // Merge defaults.
     $data += $defaults;
     parent::__construct($data, \ArrayObject::ARRAY_AS_PROPS);
 }
Example #12
0
 /**
  * @param array|\ArrayObject $data
  */
 public function __construct($data)
 {
     if (!$data instanceof self) {
         $data = $this->buildConfig($data);
     }
     parent::__construct($data);
 }
Example #13
0
 function __construct(array $config, TreeBuilder $tree = null)
 {
     $processor = new Processor();
     $tree = $tree ?: ConfigTree::get();
     $config = ['bureaupieper_storee' => $config];
     parent::__construct($processor->process($tree->buildTree(), $config));
 }
Example #14
0
 /**
  * Конструктор
  *
  * @param array $values
  * @internal param array|mixed $data
  * @return AbstractEntity
  */
 public function __construct($values = array())
 {
     if ($values instanceof EntityInterface) {
         /** @var $values AbstractEntity */
         parent::__construct($values, \ArrayObject::ARRAY_AS_PROPS);
         $this->autoAssignedData = $values->autoAssignedData;
         $this->isEmpty = $values->isEmpty;
         $this->dataTypes = $values->dataTypes;
         $this->_convertedFields = $values->_convertedFields;
         return;
     }
     $this->setupDataTypes();
     if (is_array($values) && !empty($values)) {
         foreach ($values as $name => $value) {
             if (!isset($this->dataTypes[$name])) {
                 //continue;
             }
             $this[$name] = $value;
             $this->isEmpty = false;
         }
     }
     if (is_array($this->dataTypes)) {
         foreach (array_keys($this->dataTypes) as $name) {
             if (!isset($this[$name])) {
                 $this->autoAssignedData[$name] = 1;
             }
         }
     }
 }
Example #15
0
 /**
  * __construct
  *
  * @param array $attributes array of attribute name => value pairs
  */
 public function __construct($attributes = array())
 {
     parent::__construct([]);
     if (!empty($attributes)) {
         $this->setAll($attributes);
     }
 }
 /**
  * Create ArrayObject instance according to the native constructor 
  * optionally adding the object from the previous action.
  * 
  * @param mixed $input An array or object (with externally iterable properties)
  * @param integer $flags Flags to control the behaviour of the ArrayObject object.
  * @param string $iterator_class Specify the class that will be used for iteration of the ArrayObject object.
  * @param ArrayObject $previous ArrayObject of the operation that created this object.
  * @return self
  * @throws InvalidArgumentException $input is not an array or object
  * @throws InvalidArgumentException $flags is not an integer
  * @throws InvalidArgumentException $iterator_class is not an object that implements Iterator
  */
 public function __construct($input = [], $flags = 0, $iterator_class = 'ArrayIterator', \ArrayObject $previous = null)
 {
     parent::__construct($input, $flags, $iterator_class);
     if ($previous) {
         $this->previous = $previous;
     }
 }
Example #17
0
 public function __construct(array $connectors = array())
 {
     parent::__construct(array(self::TAG_MASTER => array(), self::TAG_SLAVE => array(), self::TAG_ANONYMOUS => array()));
     foreach ($connectors as $connector) {
         $this->add($connector);
     }
 }
Example #18
0
 /**
  * @param array $params
  */
 public function __construct(array $params = null)
 {
     parent::__construct();
     if ($params) {
         $this->setOptions($params);
     }
 }
Example #19
0
 public function __construct($options)
 {
     $opts = array();
     $longopts = array();
     $relations = array();
     foreach ($options as $k => $v) {
         if (is_numeric($k)) {
             if (strlen($v) == 1) {
                 $opts[] = $v;
             } else {
                 $longopts[] = $v;
             }
         } else {
             $opts[] = $k;
             $longopts[] = $v;
             $k = trim($k, ':');
             $v = trim($v, ':');
             $relations[$k] = $v;
             $relations[$v] = $k;
         }
     }
     $arguments = array();
     foreach (getopt(implode('', $opts), $longopts) as $k => $v) {
         if (isset($relations[$k]) && !isset($arguments[$relations[$k]])) {
             $arguments[$relations[$k]] = $v;
         }
         $arguments[$k] = $v;
     }
     parent::__construct($arguments, \ArrayObject::STD_PROP_LIST | \ArrayObject::ARRAY_AS_PROPS);
 }
 public function __construct(array $data)
 {
     $defaults = array_fill_keys(['id' => NULL, 'ref_ext' => NULL, 'lastname' => NULL, 'firstname' => NULL, 'address' => NULL, 'zip' => NULL, 'town' => NULL, 'state_id' => NULL, 'state_code' => NULL, 'state' => NULL, 'country_id' => NULL, 'country_code' => NULL, 'country' => NULL, 'socid' => NULL, 'status' => NULL, 'phone_pro' => NULL, 'fax' => NULL, 'phone_perso' => NULL, 'phone_mobile' => NULL, 'code' => NULL, 'email' => NULL, 'birthday' => NULL, 'default_lang' => NULL, 'note' => NULL, 'no_email' => NULL, 'ref_facturation' => NULL, 'ref_contrat' => NULL, 'ref_commande' => NULL, 'ref_propal' => NULL, 'user_id' => NULL, 'user_login' => NULL, 'civility_id' => NULL, 'poste' => NULL], NULL);
     // Merge defaults.
     $data += $defaults;
     parent::__construct($data, \ArrayObject::ARRAY_AS_PROPS);
 }
 /**
  * Public constructor
  *
  * @param mixed $list Array representing Public Suffix List or PHP Public Suffix List file
  */
 public function __construct($list)
 {
     if (!is_array($list)) {
         $list = (include $list);
     }
     parent::__construct($list);
 }
Example #22
0
 public function __construct($state = [], $data = [])
 {
     foreach ($state as $key => $value) {
         $this->{$key} = $value;
     }
     parent::__construct($data);
 }
Example #23
0
 public function __construct($posts = array(), $post_class = '\\Timber\\Post')
 {
     $returned_posts = array();
     if (is_null($posts)) {
         $posts = array();
     }
     foreach ($posts as $post_object) {
         $post_class_use = $post_class;
         if (is_array($post_class)) {
             $post_type = get_post_type($post_object);
             $post_class_use = '\\Timber\\Post';
             if (isset($post_class[$post_type])) {
                 $post_class_use = $post_class[$post_type];
             } else {
                 if (is_array($post_class)) {
                     Helper::error_log($post_type . ' of ' . $post_object->ID . ' not found in ' . print_r($post_class, true));
                 } else {
                     Helper::error_log($post_type . ' not found in ' . $post_class);
                 }
             }
         }
         // Don't create yet another object if $post_object is already of the right type
         if (is_a($post_object, $post_class_use)) {
             $post = $post_object;
         } else {
             $post = new $post_class_use($post_object);
         }
         if (isset($post->ID)) {
             $returned_posts[] = $post;
         }
     }
     $returned_posts = self::maybe_set_preview($returned_posts);
     parent::__construct($returned_posts, $flags = 0, 'Timber\\PostsIterator');
 }
Example #24
0
 public function __construct($template, $caller = false)
 {
     //makes this a property overloaded object
     parent::__construct(array(), \ArrayObject::ARRAY_AS_PROPS);
     $this->template = $template;
     $this->caller = $caller;
 }
Example #25
0
 public function __construct()
 {
     if ($this->isCli()) {
         $this->_params = $this->parseArgs($_SERVER['argv']);
     }
     parent::__construct();
 }
Example #26
0
 /**
  * Constructor
  * 
  * @param string $name Root section name
  * @param array $data Optional key values data
  */
 public function __construct($name = null, $data = null)
 {
     $this->_name = $name;
     if (is_array($data)) {
         parent::__construct($data);
     }
 }
Example #27
0
 function __construct($response)
 {
     parent::__construct(CloudinaryApi::parse_json_response($response));
     $this->rate_limit_reset_at = strtotime($response->headers["X-FeatureRateLimit-Reset"]);
     $this->rate_limit_allowed = intval($response->headers["X-FeatureRateLimit-Limit"]);
     $this->rate_limit_remaining = intval($response->headers["X-FeatureRateLimit-Remaining"]);
 }
Example #28
0
 /**
  * Create a new instance of URLSearchParams from string, array, or object
  * @param mixed $params Initial value for search paramaters
  */
 public function __construct($params = null)
 {
     if (is_string($params)) {
         parse_str(trim($params, '?'), $params);
     }
     parent::__construct(is_array($params) ? $params : [], self::ARRAY_AS_PROPS);
 }
Example #29
0
 /**
  * Constructor
  *
  * Enforces that we have an array, and enforces parameter access to array
  * elements.
  *
  * @param  array $values
  */
 public function __construct(array $values = null)
 {
     if (null === $values) {
         $values = array();
     }
     parent::__construct($values, ArrayObject::ARRAY_AS_PROPS);
 }
Example #30
0
 /**
  * @param AbstractUser $user
  */
 public function __construct(AbstractUser $user)
 {
     $this->userInstance = $user;
     $cnf = $user->offsetGet('config');
     $config = !empty($cnf) ? unserialize($cnf) : $this->defaults;
     parent::__construct($config, \ArrayObject::ARRAY_AS_PROPS);
 }