Process a plugin-config restore
@param object $data The data in object form
@return void
167465
protected function process_assign_plugin_config($data) {
        global $DB;

        $data = (object)$data;
        $oldid = $data->id;

        $data->assignment = $this->get_new_parentid('assign');

        $newitemid = $DB->insert_record('assign_plugin_config', $data);
    }
704452
protected function onInput($data)
    {
        if (is_array($this->params)) {
            foreach ($this->params as $columnName => $columnInfo) {
                if (isset($columnInfo["name"])) {
                    $columnValue = $data[$columnName];
                    unset($data[$columnName]);
                    $data[$columnInfo["name"]] = $columnValue;
                }
            }
        } else {
            foreach ($this->nameMap as $oldName => $newName) {
                $value = $data[$oldName];
                unset($data[$oldName]);
                $data[$newName] = $value;
            }
        }
        $this->next($data);
    }
465045
public function data_postprocessing($data) {
        parent::data_postprocessing($data);
        if (!empty($data->completionunlocked)) {
            $autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
            if (empty($data->completionentriesenabled) || !$autocompletion) {
                $data->completionentries = 0;
            }
        }
    }
231609
public function onInput($data)
    {
        //Process data here
        foreach ($this->params as $copy => $original) {
            $data[$copy] = $data[$original];
        }
        $this->next($data);
    }
1020438
public function unserialize($data)
    {
        list(
            $this->messageKey,
            $this->batchEnabled,
            $this->metadataProvider,
            $this->debugOutput,
            $this->clientConfig,
            $this->batchMethod,
            $this->logName,
            $debugOutputResource
        ) = unserialize($data);

        if (is_array($debugOutputResource)) {
            $this->debugOutputResource = fopen(
                $debugOutputResource['uri'],
                $debugOutputResource['mode']
            );
        }
    }
266530
public function unserialize($data)
	{
		$this->__construct();

		$data = unserialize($data);

		if (isset($data['guest']))
		{
			$this->guest = $data['guest'];
			unset($data['guest']);
		}

		$this->set($data);
	}
647792
public function processUpdate(array $data)
	{
		$set = $this->formatCmd('set');

		$data[$set] = isset($data[$set]) ? $data[$set] : [];

		foreach ($data as $index => $value) {

			if (substr($index, 0, 1) !== $this->cmd) {
				$data[$set][$index] = $value;
				unset($data[$index]);
				continue;
			}

			$ckey = substr($index, 1);

			if ($ckey === 'unset') {
				$data[$index] = array_fill_keys(array_values((array) $value), '');
			} elseif (in_array($ckey, ['setOnInsert', 'addToSet', 'push'])) {
				$data[$index] = $this->processData($value);
			}
		}

		if (empty($data[$set])) {
			unset($data[$set]);
		} else {
			$data[$set] = $this->processData($data[$set]);
		}

		return $data;
	}
654132
public function unserialize($data)
    {
        $value = @json_decode($data, true);
        
        if (!$value) {
            $value = array();
        }

        $this->append($value);
    }
33000
public function process()
    {
        /** @var ConfigDataCollection $collection */
        $collection = $this->configDataCollectionFactory->create();
        $collection->setOrder('path', SortOrder::SORT_ASC);
        $collection->setOrder('scope', SortOrder::SORT_ASC);
        $collection->setOrder('scope_id', SortOrder::SORT_ASC);

        // Filter collection by includes
        if (null !== $this->include) {
            $includes = explode(',', $this->include);
            $orWhere = array();
            foreach ($includes as $singlePath) {
                $singlePath = trim($singlePath);
                if (!empty($singlePath)) {
                    $orWhere[] = $collection->getConnection()->quoteInto('`path` LIKE ?', $singlePath . '%');
                }
            }
            if (count($orWhere) > 0) {
                $collection->getSelect()->where(implode(' OR ', $orWhere));
            }
        }

        // Filter collection by scope
        if (null !== $this->includeScope) {
            $includeScopes = explode(',', $this->includeScope);
            $orWhere = array();
            foreach ($includeScopes as $singlePath) {
                $singlePath = trim($singlePath);
                if (!empty($singlePath)) {
                    $orWhere[] = $collection->getConnection()->quoteInto('`scope` like ?', $singlePath);
                }
            }
            if (count($orWhere) > 0) {
                $collection->getSelect()->where(implode(' OR ', $orWhere));
            }
        }

        // Filter collection by excludes
        if (null !== $this->exclude) {
            $excludes = explode(',', $this->exclude);
            foreach ($excludes as $singleExclude) {
                $singleExclude = trim($singleExclude);
                if (!empty($singleExclude)) {
                    $collection->getSelect()->where('`path` NOT LIKE ?', $singleExclude . '%');
                }
            }
        }


        $exportData = [];
        foreach ($collection as $item) {
            $data = $item->getData();
            unset($data['config_id']);
            ksort($data);
            $exportData[] = $data;
        }


        if (count($exportData) == 0) {
            $this->getOutput()->writeln('<error>No export data found.</error>');

            return;
        }

        $this->writer->write($exportData);
    }
1141978
public function process($data, ...$initLoaderArgs): void
    {
        $flushCounter = $totalCounter = 0;
        $this->start();

        foreach ($this->extract($data) as $key => $item) {
            if ($this->shouldSkip) {
                $this->skip($item, $key);
                continue;
            }

            if ($this->shouldStop) {
                $this->stop($item, $key);
                break;
            }

            $transformed = $this->transform($item, $key);

            if ($this->shouldSkip) {
                $this->skip($item, $key);
                continue;
            }

            if ($this->shouldStop) {
                $this->stop($item, $key);
                break;
            }

            $flushCounter++;
            $totalCounter++;

            if (1 === $totalCounter) {
                $this->initLoader($item, $key, ...$initLoaderArgs);
            }

            $flush = (null === $this->flushEvery ? false : (0 === ($totalCounter % $this->flushEvery)));
            $this->load($transformed(), $item, $key, $flush, $flushCounter, $totalCounter);
        }

        $this->end($flushCounter, $totalCounter);
    }
185141
public function replace($data) {

		if (! is_array($data)) {
			$data = $this->makeArray($data);
		}
		
		$this->_data = array_replace($this->_data, $data);
	}
150489
public function process()
    {

        if ($this->plugin->request()->has('_flush')) {

            if ($this->flushCache($this->plugin->request()->get('_flush'))) {

                $this->attributes['alertClass'] = 'success';
                $this->attributes['messages'] = array(
                    '&#10004; ' . $this->plugin->config()->get('plugin.namespace') . ' ' . ucwords($this->plugin->request()->get('_flush')) . ' flushed successfully.'
                );
                //Refresh Data
            } else {

                $this->attributes['alertClass'] = 'error';
                $this->attributes['messages'] = array(
                    '&#9888; ' . $this->plugin->config()->get('plugin.namespace') . ' ' . ucwords($this->plugin->request()->get('_flush'))
                    .' could not be flushed.  The file(s) may not exist; If they exist, check directory structure, permissions and config paths.'
                );
            }

            $this->data();
        }

    }
52910
protected function convert($data)
    {
        foreach ($data[0] as $key => $value) {
            if (!$this->_kept && !$this->_stashed) {
                $this->$key = $value;
                $this->setKey($key, $value);
            } else {
                if ($this->_kept) {
                    $this->_keptData[$key] = $value;
                }
                if ($this->_stashed) {
                    $this->_stashedData[$key] = $value;
                }
            }

            $this->data[$key] = $value;
        }
    }
622110
protected function process_ltitoolsetting($data) {
        global $DB;

        $data = (object)$data;
        $data->toolproxyid = $this->get_new_parentid('ltitoolproxy');

        if (!$data->toolproxyid) {
            return;
        }

        $data->course = $this->get_courseid();
        $data->coursemoduleid = $this->task->get_moduleid();
        $DB->insert_record('lti_tool_settings', $data);
    }
1025663
public function data_postprocessing($data) {
        parent::data_postprocessing($data);
        // Convert completionstatusrequired to a proper integer, if any.
        $total = 0;
        if (isset($data->completionstatusrequired) && is_array($data->completionstatusrequired)) {
            foreach (array_keys($data->completionstatusrequired) as $state) {
                $total |= $state;
            }
            $data->completionstatusrequired = $total;
        }

        if (!empty($data->completionunlocked)) {
            // Turn off completion settings if the checkboxes aren't ticked.
            $autocompletion = isset($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;

            if (!(isset($data->completionstatusrequired) && $autocompletion)) {
                $data->completionstatusrequired = null;
            }
            // Else do nothing: completionstatusrequired has been already converted
            //             into a correct integer representation.

            if (!empty($data->completionscoredisabled) || !$autocompletion) {
                $data->completionscorerequired = null;
            }
        }
    }
88207
public function unserialize($data): void
    {
        $data = unserialize($data, ['allowed_classes' => [FlexObject::class]]);

        $this->doUnserialize($data);
    }
609848
public function setData($data)
    {
        if (!is_string($data)) {
            $data = json_encode($data);
        }

        $this->data = $data;
    }