Populate the server bag.

@since 1.0.0

@param array $contents Kept for compatibility.
436953
protected function set_data(array $contents = [])
    {
        $definition = [
            'REQUEST_METHOD' => [
                'filter' => FILTER_CALLBACK,
                'options' => function ($method) {
                    return \strtoupper(\filter_var($method, FILTER_SANITIZE_STRING));
                },
            ],
            'QUERY_STRING' => FILTER_UNSAFE_RAW,
            'REMOTE_ADDR' => FILTER_VALIDATE_IP,
            'SERVER_PORT' => FILTER_SANITIZE_NUMBER_INT,
            'SERVER_NAME' => FILTER_SANITIZE_STRING,
            'HTTP_HOST' => FILTER_SANITIZE_URL,
            'HTTP_REFERER' => FILTER_SANITIZE_URL,
            'HTTP_USER_AGENT' => FILTER_SANITIZE_STRING,
        ];

        $server = \filter_input_array(INPUT_SERVER, $definition);

        if ('' !== \preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $server['HTTP_HOST'])) {
            \wp_die('This site has been temporarily disabled due to suspicious activity');
        }

        $this->data = $server;
    }
1374919
public function populate($data = array())
    {
        if (isset($data['name']) && $data['name'] !== null) {
            $this->name = $data['name'];
        }

        if (isset($data['type']) && $data['type'] !== null) {
            $this->type = $data['type'];
        }
    }
568757
public function setContent($content)
    {
        if (is_array($content)) {
            $this->setContentType('json');
            $this->_content = json_encode($content, JSON_PRETTY_PRINT);
        } else {
            $this->_content = (string) $content;
        }
    }
1193946
public function set_contents($contents) {
        if (empty($contents)) {
            throw new progressive_parser_exception('invalid_contents_to_parse');
        }
        $this->contents = $contents;
        $this->file = null;
    }
1236079
public function save($contents)
	{
		// prep the contents
		$this->prep_vars($contents);
		$contents = serialize($contents);

		// update the config in the database
		$result = \DB::update($this->table)->set(array('config' => $contents, 'hash' => uniqid()))->where('identifier', '=', $this->identifier)->execute();

		// if there wasn't an update, do an insert
		if ($result === 0)
		{
			list($notused, $result) = \DB::insert($this->table)->set(array('identifier' => $this->identifier, 'config' => $contents, 'hash' => uniqid()))->execute();
		}

		return $result === 1;
	}
412637
public function populate($data = array())
    {
        if (isset($data['name']) && $data['name'] !== null) {
            $this->name = $data['name'];
        }
        if (isset($data['code']) && $data['code'] !== null) {
            $this->code = $data['code'];
        }
        if (isset($data['phase']) && $data['phase'] !== null) {
            $this->phase = $data['phase'];
        }
        if (isset($data['active']) && $data['active'] !== null) {
            $this->active = $data['active'];
        }
    }
1249626
protected function initialize(array $fields)
    {
        $this->content = new Content;
        $this->revision = new Revision;

        foreach ($fields as $field => $settings) {
            $this->data[$field] = $this->initializeField($field, $settings);
        }
    }
1359807
public function load(array $files) : void
    {
        $this->appConfig = $this->getCache()->getOrSet($this->env, function() use ($files){
            $config = $this->loadBaseConfig($files);
            return $this->loadInstalledComponentsConfig($config);
        });
    }
426437
public function load(array $data)
    {
        foreach ($data as $index => $value) {
            $this->set($index, $value);
        }
    }
330015
public function setHeaders(array $values)
    {
        foreach ($values as $key => $value) {
            $this->setHeader($key, $value);
        }
    }
1249673
public function setContents($contents)
    {
        $contents_exist = file_exists($contents);

        if ($contents_exist) {
            $this->contents = file_get_contents($contents);

            $this->updateLog("info", "Page contents set from {$contents}");
        } else {
            $this->contents = false;
            
            $this->updateLog("alert", "File {$contents} not found");
        }

        return $contents_exist;
    }
323563
protected function addConfig(array $content, $resource)
    {
        foreach ($content as $key => $value) {
            $parameterBag = self::$parameters[$resource];

            $value = $parameterBag->unescapeValue($parameterBag->resolveValue($value));

            if (is_array($value) && !is_numeric($key)) {
                $key = array($key => $value);
                $value = true;
            }

            self::$slim->config($key, $value);
        }
    }
379086
public function write(string $contents) : void
    {
        file_put_contents($this->filename, $contents);
        $this->timestamp = time();
    }
1253938
private function save(MutableBag $contents)
    {
        try {
            $this->filesystem->dumpFile(static::FILENAME, Yaml::dump($contents->toArray()));
            $this->io->success('Added the site bundle to .bolt.yml');
        } catch (IOException $e) {
            $this->io->error('Unable to add the site bundle to .bolt.yml');
        }
    }
1063229
public function addContentAsLast(Content $content)
    {
        if(null === $this->contents)
        {
            $this->contents = array();
        }
        $this->contents[] = $content;
    }
495101
private function loadFromExtensions($content)
    {
        foreach ($content as $namespace => $values) {
            if (in_array($namespace, ['imports', 'parameters'])) {
                continue;
            }

            if (!is_array($values)) {
                $values = [];
            }

            $this->configCollection->add($namespace, $values);
        }
    }
306610
public function populate($data = array())
    {
        $this->title = (isset($data['title'])) ? $data['title'] : null;
        if (isset($data['is_active']) && $data['is_active'] != null) {
            $this->is_active = $data['is_active'];
        }
        if (isset($data['content']) && $data['content'] != null) {
            $this->content = $data['content'];
        }
        $this->identifier = (isset($data['identifier'])) ? $data['identifier'] : null;
    }