Load an object or array into the application configuration object.

@param   mixed  $data  Either an array or object to be loaded into the configuration object.

@return  $this

@since   1.0
178197
public function loadConfiguration($data)
	{
		/*
		 * Setup some application metadata options.  This is useful if we ever want to write out startup scripts
		 * or just have some sort of information available to share about things.
		 */

		// The application author name.  This string is used in generating startup scripts and has
		// a maximum of 50 characters.
		$tmp = (string) $this->get('author_name', 'Joomla Framework');
		$this->set('author_name', (strlen($tmp) > 50) ? substr($tmp, 0, 50) : $tmp);

		// The application author email.  This string is used in generating startup scripts.
		$tmp = (string) $this->get('author_email', 'admin@joomla.org');
		$this->set('author_email', filter_var($tmp, FILTER_VALIDATE_EMAIL));

		// The application name.  This string is used in generating startup scripts.
		$tmp = (string) $this->get('application_name', 'JApplicationDaemon');
		$this->set('application_name', (string) preg_replace('/[^A-Z0-9_-]/i', '', $tmp));

		// The application description.  This string is used in generating startup scripts.
		$tmp = (string) $this->get('application_description', 'A generic Joomla Framework application.');
		$this->set('application_description', filter_var($tmp, FILTER_SANITIZE_STRING));

		/*
		 * Setup the application path options.  This defines the default executable name, executable directory,
		 * and also the path to the daemon process id file.
		 */

		// The application executable daemon.  This string is used in generating startup scripts.
		$tmp = (string) $this->get('application_executable', basename($this->input->executable));
		$this->set('application_executable', $tmp);

		// The home directory of the daemon.
		$tmp = (string) $this->get('application_directory', dirname($this->input->executable));
		$this->set('application_directory', $tmp);

		// The pid file location.  This defaults to a path inside the /tmp directory.
		$name = $this->get('application_name');
		$tmp  = (string) $this->get('application_pid_file', strtolower('/tmp/' . $name . '/' . $name . '.pid'));
		$this->set('application_pid_file', $tmp);

		/*
		 * Setup the application identity options.  It is important to remember if the default of 0 is set for
		 * either UID or GID then changing that setting will not be attempted as there is no real way to "change"
		 * the identity of a process from some user to root.
		 */

		// The user id under which to run the daemon.
		$tmp     = (int) $this->get('application_uid', 0);
		$options = ['options' => ['min_range' => 0, 'max_range' => 65000]];
		$this->set('application_uid', filter_var($tmp, FILTER_VALIDATE_INT, $options));

		// The group id under which to run the daemon.
		$tmp     = (int) $this->get('application_gid', 0);
		$options = ['options' => ['min_range' => 0, 'max_range' => 65000]];
		$this->set('application_gid', filter_var($tmp, FILTER_VALIDATE_INT, $options));

		// Option to kill the daemon if it cannot switch to the chosen identity.
		$tmp = (bool) $this->get('application_require_identity', 1);
		$this->set('application_require_identity', $tmp);

		/*
		 * Setup the application runtime options.  By default our execution time limit is infinite obviously
		 * because a daemon should be constantly running unless told otherwise.  The default limit for memory
		 * usage is 128M, which admittedly is a little high, but remember it is a "limit" and PHP's memory
		 * management leaves a bit to be desired :-)
		 */

		// The maximum execution time of the application in seconds.  Zero is infinite.
		$tmp = $this->get('max_execution_time');

		if ($tmp !== null)
		{
			$this->set('max_execution_time', (int) $tmp);
		}

		// The maximum amount of memory the application can use.
		$tmp = $this->get('max_memory_limit', '256M');

		if ($tmp !== null)
		{
			$this->set('max_memory_limit', (string) $tmp);
		}

		return $this;
	}
568823
final public function importData($data)
    {
        foreach ($data as $property => $value) {
            if ($this[$property] instanceof ModelState){
                $this[$property]->importData($value);
            } else {
                $this[$property] = $value;
            }
        }
    }
1205007
protected function createObjectFromData(array $data) {
    // determine if we are loading or creating
    $createFromLoadedData = (sizeof($data) > 0) ? true : false;

    // initialize data and oid
    $oid = null;
    $initialData = $data;
    if ($createFromLoadedData) {
      $oid = $this->constructOID($initialData);
      // cleanup data
      foreach($initialData as $name => $value) {
        if ($this->hasAttribute($name) || strpos($name, self::INTERNAL_VALUE_PREFIX) === 0) {
          $value = $this->convertValueFromStorage($name, $value);
          $initialData[$name] = $value;
        }
        else {
          unset($initialData[$name]);
        }
      }
    }

    // construct object
    $object = $this->createObject($oid, $initialData);
    return $object;
  }
773594
protected function loadData(array $data = [])
    {
        foreach ($data as $key => $value) {
            if (property_exists($this, $key)) {
                $this->$key = $value;
            }
        }
    }
652650
final public function setData($data) {
        if ((is_object($data) && !is_a($data, 'Object')) || (!is_object($data) && !is_array($data)))
            throw new \Exception('Data must be either an array or an object that extends Object: ' . gettype($data));
        $data = is_array($data) ? $data : $data->toArray();
        foreach ($data as $attr => $value) {
            if ($this->elements[$attr]) {
                $this->elements[$attr]->setData($value);
            } else
                $this->data[$attr] = $value;
        }
        $this->valid = null;
        return $this;
    }
921049
public function toObject(array $data)
    {
        $data = json_decode(json_encode($data));

        if ($data === []) {
            $data = new \StdClass();
        }

        return $data;
    }
566555
public function payload(array $data)
    {
        foreach ($data as $key => $value) {
            $this->data->{$key} = $value;
        }

        return $this;
    }
1166295
public function setAllData($data)
    {
        array_walk(
            $data,
            function ($value, $key) {
                $this->{$key} = $value;
            }
        );

        return $this;
    }
520893
public function setData(array $data)
    {
        foreach ($this->getData()->toArray() as $key => $value) {
            $this->getData()->offsetUnset($key);
        }

        $this->addData($data);

        return $this;
    }
850989
public function load(array $data)
    {
        switch($data['Event']) {
            case WxReceiveEvent::EVENT_TYPE_LOCATION:
                return $this->createLocationEvent($data);
                break;
            case WxReceiveEvent::EVENT_TYPE_VIEW:
                return $this->createViewEvent($data);
                break;
            case WxReceiveEvent::EVENT_TYPE_CLICK:
                return $this->createClickEvent($data);
                break;
            case WxReceiveEvent::EVENT_TYPE_SCAN:
                return $this->createScanEvent($data);
                break;
            case WxReceiveEvent::EVENT_TYPE_SUBSCRIBE:
            case WxReceiveEvent::EVENT_TYPE_UN_SUBSCRIBE:
                return $this->createSubscribeEvent($data);
                break;
            default:
                break;
        }

        throw new RuntimeException("unknown Event({$data['Event']})");
    }
307014
public function setData(array $data)
    {
        $this->data = $this->parseData($data);

        $this->setRules($this->initialRules);

        return $this;
    }
165523
protected function normalizeData( $data )
	{
		// If an object was provided, get its public properties
		if( is_object( $data )) {
			$this->data = get_object_vars( $data );
		}
		else {
			$this->data = $data;
		}

		return $this;
	}
894450
public function setData($data)
    {
        if (!is_array($data) && !is_object($data)) {
            throw new \InvalidArgumentException(sprintf(
                'Expected argument of type array or object, "%s" given',
                is_object($data) ? get_class($data) : gettype($data)
            ));
        }
        $this->data = $data;
        return $this;
    }
303475
public function fill(array $data)
    {
        /* @var Field $field */
        foreach ($this->fields() as $field) {
            $field->fill($data);
        }

        return $this;
    }
1193824
public function import($data) {
		
		if (! is_array($data)) {
			$data = is_callable(array($data, 'toArray')) ? $data->toArray() : (array)$data;
		}
		
		foreach($data as $key => $value) {
			$this[$key] = $value;
		}
		
		return $this;
	}
280903
public function loadConfig($data)
    {
        $model = $this->getConfigModel(false);

        $newData = $model->loadFirst(array('grcfg_id_organization' => $data['gor_id_organization']));
        if (empty($newData)) {
            $newData = $model->loadNew();
        }
        $newData['grcfg_id_organization'] = $data['gor_id_organization'];

        return $newData;
    }
30238
public function initFromArray(array $data) {

        $unknownFields = [];

        foreach ($data as $k => $v) {

            if (empty($v)) {
                continue;
            }

            $setter = 'set' . ucfirst(str_replace('_', '', ucwords($k, '_')));

            if (method_exists($this, $setter)) {
                $this->{$setter}($v);
                continue;
            }

            $unknownFields[$k] = $v;

        }

        if (!empty($unknownFields)) {
            trigger_error('Encountered unknown fields in response: ' . json_encode($unknownFields));
        }

        return $this;

    }