Overwrites setting parameters with given name.

@param string      $name
@param array       $data

@return Setting
330456
public function update($name, $data = [])
    {
        $setting = $this->get($name);

        if (!$setting) {
            throw new \LogicException(sprintf('Setting %s not exist.', $name));
        }

        $this->eventDispatcher->dispatch(Events::PRE_UPDATE, new SettingActionEvent($name, $data, $setting));

        #TODO Add populate function to document class
        foreach ($data as $key => $value) {
            $setting->{'set'.ucfirst($key)}($value);
        }

        $this->manager->persist($setting);
        $this->manager->commit();
        $this->cache->delete($name);

        if ($setting->getType() == 'experiment' || $setting->getName() == 'ongr_active_experiments') {
            $this->getActiveExperimentProfilesCookie()->setClear(true);
        }

        $this->eventDispatcher->dispatch(Events::PRE_UPDATE, new SettingActionEvent($name, $data, $setting));

        return $setting;
    }
890774
public function createFromImportedData($name, $data)
    {
        if (!is_array($data)) {
            return new GroupParameter($name, [$data]);
        } elseif (!$this->isAssociativeArray($data)) {
            return new GroupParameter($name, $data);
        }
        $parameter = new GroupParameter($name);
        foreach ($data as $childName => $childData) {
            $parameter->addChild($this->createFromImportedData($childName, $childData));
        }
        return $parameter;
    }
90297
public function setData(array $data)
    {
        $data['TASK'] = $this->task;
        $data['RETRY'] = $this->retry;
        $data['APPLICATION'] = $this->application;

        $this->message = $data;
        return $this;
    }
823438
public static function createFromArray($name, array $data = [])
    {
        $class = new static($name);

        $class->setType($data['type']);
        if (isset($data['usage'])) {
            \assert($class instanceof TraitDefinition);
            $class->setUsage($data['usage']);
        }
        if (isset($data['required'])) {
            $class->setRequired($data['required']);
        }
        if (isset($data['enum'])) {
            $class->setEnum($data['enum']);
        }
        if (\substr($name, -1) === '?') {
            $class->setRequired(false);
            $class->setName(\substr($name, 0, -1));
        }
        $class->setDefinition($data);

        return $class;
    }
620836
public function createFromImportedData($name, $data)
    {
        $class = new GroupClass($name);
        foreach ($data as $parameterName => $parameterData) {
            $class->addParameter($this->getGroupParameterFactory()->createFromImportedData($parameterName, $parameterData));
        }
        return $class;
    }
691261
public static function createFromArray($name, array $data = [])
    {
        $type = parent::createFromArray($name, $data);
        \assert($type instanceof self);

        $type->json = $data;

        return $type;
    }
647447
public static function createFromArray($name, array $data = [])
    {
        $proxy = new static($name);
        $proxy->setDefinition($data);
        if (!isset($data['type'])) {
            throw new \InvalidArgumentException('Missing "type" key in $data param to determine datatype!');
        }
        if (isset($data['properties'])) {
            $proxy->properties = $data['properties'];
        }

        $proxy->setType($data['type']);
        if ($name !== $data['type']) {
            $proxy->setParent($data['type']);
        }

        return $proxy;
    }
1125495
protected function create($name, $data)
    {
        return $this->getManager()->getFactory()->make(
            $name,
            [$data, $this->getManager(), $this]
        );
    }
476043
public function overWritePostData ($name, $data) {
		Request::OverWritePostData($name, $data);
		$this->request->data->$name = $data;
		return true;
	}
1015834
public function make(string $name, array $data = [], \Closure $callback = null)
    {
        $this->setWidgetName($name);
        $this->data = $data;
        /*
         | If second param given as closure then we will
         | return callback
         */
        if (!is_null($callback) && $callback instanceof \Closure) {
            return $callback($this);
        }

        /*
         | return object
         */
        return $this->render();
    }
524013
private function reloadConfig($name, $data = null, $json = false)
    {
        // get from DB
        if (empty($data)) {
            $this->config[$name] = $this->getConfigObjectFromDatabase($name);

            // set data from input
        } else {
            $this->config[$name] = $this->createConfigObject($name, $data, $json);
        }
    }
1147534
public static function createFromArray($name, array $data = [])
    {
        $type = parent::createFromArray($name, $data);
        \assert($type instanceof self);

        foreach ($data as $key => $value) {
            switch ($key) {
                case 'pattern':
                    $type->setPattern($value);

                    break;
                case 'minLength':
                    $type->setMinLength($value);

                    break;
                case 'maxLength':
                    $type->setMaxLength($value);

                    break;
            }
        }

        return $type;
    }
67158
public function write_setting($data) {
        global $CFG, $DB;

        $oldvalue  = $this->config_read($this->name);
        $return    = parent::write_setting($data);
        $newvalue  = $this->config_read($this->name);

        if ($oldvalue !== $newvalue) {
        // force full regrading
            $DB->set_field('grade_items', 'needsupdate', 1, array('needsupdate'=>0));
        }

        return $return;
    }
922440
public function set($name, $value = null)
    {
        if (!is_array($name)) {
            $this->data[$name] = $value;
        } else {
            foreach ($name as $key => $value) {
                $this->data[$key] = $value;
            }
        }
        return $this;
    }
196824
public function format($name, array $data) {
        $name = $this->_getTemplateName($name, $data);
        return parent::format($name, $data);
    }
1218684
public function setCustomer($data = [])
    {
        if (array_key_exists('name', $data)) {
            $this->setCustomerName($data['name']);
        }

        if (array_key_exists('email', $data)) {
            $this->setCustomerEmail($data['email']);
        }

        if (array_key_exists('number', $data)) {
            $this->setCustomerMsisdn($data['number']);
        }

        if (array_key_exists('phone', $data)) {
            $this->setCustomerMsisdn($data['phone']);
        }

        if (array_key_exists('msisdn', $data)) {
            $this->setCustomerMsisdn($data['msisdn']);
        }

        return $this;
    }
437672
protected function createRoute($name, array $data)
    {
        $route = $this->map->route($name, $data['path']);
        $allows = array_key_exists('allows', $data)
            ? $data['allows']
            : [];
        $method = ['GET'];
        if (array_key_exists('method', $data)) {
            $method = [$data['method']];
        }
        $route->allows(array_merge($allows, $method));
        return $this->setRouteProperties($route, $data);
    }