Converts raw data into a Hint entity.

@param array $data
@param Hint  $hint
@param array $options

@return Hint
431272
public function deserialize($data, Hint $hint = null, array $options = [])
    {
        $hint = $hint ?: new Hint();
        $this->sipe('id', 'setUuid', $data, $hint);
        $this->sipe('penalty', 'setPenalty', $data, $hint);
        $this->sipe('value', 'setData', $data, $hint);

        if (in_array(Transfer::REFRESH_UUID, $options)) {
            $hint->refreshUuid();
        }

        return $hint;
    }
1004390
public function amend($data = null, $options = [])
    {
        if ($data !== null) {
            $count = $this->count();
            foreach ($data as $i => $value) {
                if (!isset($this[$i])) {
                    $this->setAt($i, $value, $options);
                } else {
                    $this[$i]->amend($value, $options);
                }
            }
            for ($i = count($data); $i < $count; $i++) {
                unset($this[$i]);
            }
        }
        $this->_original = $this->_data;
        $this->_modified = false;
        return $this;
    }
207674
public static final function gzipDecode($data, array $options = null): array
    {
        $encoder = new GzipEncoder($options);

        return [$encoder->decode($data), $encoder->hasError()
            ? new EncoderException('GZip Error: '. $encoder->getError()) : null];
    }
880674
public function update($data,$options) {
        $this->model  =   $options['model'];
        $this->parseBind(!empty($options['bind'])?$options['bind']:array());
        $sql   = 'UPDATE '
            .$this->parseTable($options['table'])
            .$this->parseSet($data)
            .$this->parseWhere(!empty($options['where'])?$options['where']:'')
            .$this->parseLock(isset($options['lock'])?$options['lock']:false)
            .$this->parseComment(!empty($options['comment'])?$options['comment']:'');
        return $this->execute($sql,!empty($options['fetch_sql']) ? true : false);
    }
568482
public function deserialize($data, BookReferenceConfiguration $bookReferenceConfiguration = null, array $options = [])
    {
        if (empty($bookReferenceConfiguration)) {
            $bookReferenceConfiguration = new BookReferenceConfiguration();
        }

        $this->sipe('apiKey', 'setApiKey', $data, $bookReferenceConfiguration);

        return $bookReferenceConfiguration;
    }
1166615
public function provide($data = null, array $options = [])
    {
        $label = $options['label'];

        $combinedFields = $this->config->getProvider('combinedFields');
        $combinedFields = new $combinedFields($this->config);
        $combinedFields = $combinedFields->provide($data, $options);

        $view = $this->config->getView();

        $inputs = [];
        foreach ($combinedFields as $suffix => $preOptions) {
            // Skip individual inputs' label
            $options['label'] = false;
            $fieldName = $this->config->getField() . '_' . $suffix;

            $fieldData = $data;
            if (empty($fieldData) && !empty($options['entity'])) {
                $fieldData = $options['entity'];
            }

            $config = new $preOptions['config']($fieldName, $this->config->getTable(), $options);
            $config->setView($view);
            $handler = new FieldHandler($config);

            $inputs[$fieldName] = $handler->renderInput($fieldData, $options);
        }

        $params = [
            'field' => $this->config->getField(),
            'label' => $label,
            'required' => $options['fieldDefinitions']->getRequired(),
            'inputs' => $inputs
        ];

        $defaultElement = 'CsvMigrations.FieldHandlers/CombinedFieldHandler/input';
        $element = empty($options['element']) ? $defaultElement : $options['element'];

        return $this->renderElement($element, $params);
    }
330345
public function hint($hint)
    {
        if (null !== $hint && !is_array($hint)) {
            throw new \InvalidArgumentException(sprintf('The hint "%s" is not valid.', $hint));
        }

        $this->hint = $hint;

        return $this;
    }
1113258
public function body($data = null, $options = []) {
		$default = ['buffer' => null];
		$options += $default;
		$this->body = array_merge((array) $this->body, (array) $data);
		$body = join("\r\n", $this->body);
		return ($options['buffer']) ? str_split($body, $options['buffer']) : $body;
	}
517695
private function serializeHints(Item $question, array $options = [])
    {
        return array_map(function (Hint $hint) use ($options) {
            return $this->hintSerializer->serialize($hint, $options);
        }, $question->getHints()->toArray());
    }
1182003
public function setJsonBody(array $data, int $options=JSON_PRETTY_PRINT|JSON_NUMERIC_CHECK)
  {
    $this->setContentType('application/json')
         ->setBody( json_encode($data,$options) );

    return $this;
  }
1068383
public function save(array &$data, array $options = array())
    {
        $document = new Document($data, $this);
        $save = $document->save($options);
        $data = $document->data;

        return $save;
    }
359471
protected function _dataTooltip(array $options, $tooltip)
    {
        if (Arr::key('title', $options)) {
            $options['data-tooltip'] = $options['title'];
        }

        if (is_string($tooltip)) {
            $options['data-tooltip'] = $tooltip;
        }

        return $options;
    }
249125
public static final function jsonEncode($data, array $options = null): array
    {
        $encoder = new JsonEncoder($options);

        return [$encoder->encode($data), $encoder->hasError()
            ? new EncoderException('JSON Error: '. $encoder->getError()) : null];
    }
234758
public function deserialize($data, $content = null, array $options = [])
    {
        if ('text/html' === $data['type'] || 'text/plain' === $data['type']) {
            // HTML is directly stored in the choice entity
            $content->setData($data['data']);
            $content->setResourceNode(null);
        } else {
            // Other types require a ResourceNode
            $node = $this->resourceContentSerializer->deserialize($content);

            $content->setData('');
            $content->setResourceNode($node);
        }

        return $content;
    }
1323036
public function update($data, $options)
    {
        $set  = [];
        $data = $this->parseData($data, $options);
        if (empty($data)) {
            return '';
        }
        foreach ($data as $key => $val) {
            $set[] = $key . '=' . $val;
        }

        $sql = str_replace(
            ['%TABLE%', '%SET%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'],
            [
                $this->parseTable($options['table'], $options),
                implode(',', $set),
                $this->parseJoin($options['join'], $options),
                $this->parseWhere($options['where'], $options),
                $this->parseOrder($options['order'], $options),
                $this->parseLimit($options['limit']),
                $this->parseLock($options['lock']),
                $this->parseComment($options['comment']),
            ], $this->updateSql);

        return $sql;
    }
1366815
public function provide($data = null, array $options = [])
    {
        $field = $this->config->getField();

        $template = $this->getBasicTemplate('text');
        $defaultOptions = $this->getDefaultOptions($data, $options);
        $defaultOptions['input'] = ['content' => $template];

        $result[$field] = $defaultOptions;

        $relatedProperties = $this->_getRelatedProperties($options['fieldDefinitions']->getLimit(), '');

        $view = $this->config->getView();

        $content = sprintf(
            static::HTML_INPUT,
            $this->_getInputIcon($relatedProperties),
            $view->Form->control($field, [
                'label' => false,
                'name' => '{{name}}',
                'id' => $field,
                'type' => 'select',
                'data-type' => 'select2',
                'data-display-field' => $relatedProperties['displayField'],
                'data-magic-value' => isset($options['magic-value']) ?
                    (bool)$options['magic-value'] :
                    'Users' === $options['fieldDefinitions']->getLimit(),
                'escape' => false,
                'autocomplete' => 'off',
                'multiple' => isset($options['multiple']) ?
                    ((bool)$options['multiple'] ? 'multiple' : false) :
                    'multiple',
                'data-url' => $view->Url->build([
                    'prefix' => 'api',
                    'plugin' => $relatedProperties['plugin'],
                    'controller' => $relatedProperties['controller'],
                    'action' => 'lookup.json'
                ])
            ])
        );

        $result[$field]['display_field'] = $relatedProperties['displayField'];
        $result[$field]['source'] = Inflector::tableize($relatedProperties['controller']);
        $result[$field]['url'] = $view->Url->build([
            'prefix' => 'api',
            'plugin' => $relatedProperties['plugin'],
            'controller' => $relatedProperties['controller'],
            'action' => 'lookup.json'
        ]);
        $result[$field]['input'] = [
            'content' => $content,
            'post' => [
                [
                    'type' => 'script',
                    'content' => [
                        'CsvMigrations.dom-observer',
                        'AdminLTE./bower_components/select2/dist/js/select2.full.min',
                        'CsvMigrations.select2.init'
                    ],
                    'block' => 'scriptBottom'
                ],
                [
                    'type' => 'scriptBlock',
                    'content' => 'csv_migrations_select2.setup(' . json_encode(
                        array_merge(
                            Configure::read('CsvMigrations.select2'),
                            Configure::read('CsvMigrations.api')
                        )
                    ) . ');',
                    'block' => 'scriptBottom'
                ],
                [
                    'type' => 'css',
                    'content' => [
                        'AdminLTE./bower_components/select2/dist/css/select2.min',
                        'Qobo/Utils.select2-bootstrap.min',
                        'Qobo/Utils.select2-style'
                    ],
                    'block' => 'css'
                ]
            ]
        ];

        return $result;
    }
1190041
public function provide($data = null, array $options = [])
    {
        $result = parent::provide($data, $options);

        if (empty($result)) {
            return $result;
        }

        $config = [
            'html_input' => 'escape',
            'allow_unsafe_links' => false
        ];

        $converter = new CommonMarkConverter($config);

        return $converter->convertToHtml($result);
    }