@param null  $data
@param array $options

@return mixed
@throws \HpsAuthenticationException
@throws \HpsGatewayException
552062
protected function doRequest($data = null, $options = array())
    {
        $endpoint = isset($options['endpoint']) ? $options['endpoint'] : '';
        $verb = isset($options['verb']) ? $options['verb'] : 'GET';
        $url = $this->_gatewayUrlForKey() . '/' . $endpoint;

        if (isset($this->limit) && isset($this->offset)) {
            $paging = array(
                'limit'  => $this->limit,
                'offset' => $this->offset,
            );
            $url .= '?' . http_build_query($paging);
        }

        if ($this->searchFields != null) {
            $data = $this->searchFields;
        }

        $encodedData = json_encode($data);

        $identity = array();
        if (isset($this->_config->siteId)) {
            $identity[0] = 'SiteID='.$this->_config->siteId;
        }
        if (isset($this->_config->deviceId)) {
            $identity[1] = 'DeviceID='.$this->_config->deviceId;
        }
        if (isset($this->_config->licenseId)) {
            $identity[2] = 'LicenseID='.$this->_config->licenseId;
        }

        $auth = isset($this->_config->username)
            ? $this->_config->username.':'.$this->_config->password
            : $this->_config->secretApiKey;
        $header = array(
            'Authorization: Basic '.base64_encode($auth),
            'Content-Type: application/json; charset=utf-8',
            'Content-Length: '.strlen($encodedData),
        );

        if (isset($this->_config->username)) {
            $header[] = 'HPS-Identity: '.implode(',', $identity);
        }
        $keyType = HpsServicesConfig::KEY_TYPE_SECRET;
        // print "\n" . $encodedData;
        return $this->submitRequest($url, $header, $encodedData, $verb, $keyType);
    }
1161189
public function provide($data = null, array $options = [])
    {
        $relatedProperties = $this->_getRelatedProperties($options['fieldDefinitions']->getLimit(), (string)$data);

        $table = $this->config->getTable();
        $entity = $options['entity'];
        $association = $options['association'];
        $contactsData = TableRegistry::getTableLocator()->get($entity->getSource())->get($entity->get('id'), ['contain' => $association->getName()]);
        $associationData = $contactsData[$association->getProperty()];
        $associationList = [];
        if (!empty($associationData)) {
            foreach ($associationData as $associationRow) {
                $associationList[$associationRow->get('id')] = $associationRow->get($relatedProperties['displayField']);
            }
        }

        if (empty($associationList)) {
            return $data;
        }

        $elementName = 'CsvMigrations.FieldHandlers/BelongsToManyFieldHandler/view';
        $params = [
            'relatedProperties' => $relatedProperties,
            'options' => $options,
            'associationList' => $associationList
        ];

        return $this->renderElement($elementName, $params);
    }
480596
public static final function gzipEncode($data, array $options = null): array
    {
        $encoder = new GzipEncoder($options);

        return [$encoder->encode($data), $encoder->hasError()
            ? new EncoderException('GZip Error: '. $encoder->getError()) : null];
    }
760312
public function deserialize($data, ClozeQuestion $clozeQuestion = null, array $options = [])
    {
        if (empty($clozeQuestion)) {
            $clozeQuestion = new ClozeQuestion();
        }
        $this->sipe('text', 'setText', $data, $clozeQuestion);

        $this->deserializeHoles($clozeQuestion, $data['holes'], $data['solutions'], $options);

        return $clozeQuestion;
    }
1133208
public function provide($data = null, array $options = [])
    {
        $result = null;

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

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

        if (!empty($relatedProperties[0]['config']['parent']['module'])) {
            array_unshift(
                $relatedProperties,
                $this->_getRelatedParentProperties($relatedProperties[0])
            );
        }

        $elementName = 'CsvMigrations.FieldHandlers/RelatedFieldHandler/view';
        $params = [
            'relatedProperties' => $relatedProperties,
            'options' => $options,
        ];

        return $this->renderElement($elementName, $params);
    }
788664
protected function parseData($data, array $options, $key = null)
    {
        $architect = new Architect();

        return $architect->parseData($data, $options['modes'], $key);
    }
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;
    }
1022216
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;

        $className = $this->config->getProvider('selectOptions');
        $provider = new $className($this->config);
        $selectOptions = [];
        foreach ($provider->provide($options['fieldDefinitions']->getLimit()) as $k => $v) {
            $selectOptions[$k] = sprintf(CountryValueRenderer::ICON_HTML, strtolower($k), $v);
        }

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

        $attributes = [
            'class' => 'form-control',
            'label' => false,
            'data-class' => 'select2',
        ];

        $content = $view->Form->select('{{name}}', $selectOptions, $attributes);

        foreach ($selectOptions as $key => $value) {
            $result[$field]['options'][] = ['value' => $key, 'label' => $value];
        }

        $result[$field]['source'] = $options['fieldDefinitions']->getLimit();
        $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' => 'css',
                    'content' => [
                        'AdminLTE./bower_components/select2/dist/css/select2.min',
                        'Qobo/Utils.select2-bootstrap.min',
                        'Qobo/Utils.select2-style',
                        'Qobo/Utils./img/icons/flags/css/flag-icon.css'
                    ],
                    'block' => 'css'
                ]
            ]
        ];

        return $result;
    }
304452
public function deserialize($data, WorkspaceTeamParameters $parameters, array $options = [])
    {
        if (!in_array(Options::REFRESH_UUID, $options)) {
            $parameters->setUuid($data['id']);
        }

        $this->sipe('selfRegistration', 'setSelfRegistration', $data, $parameters);
        $this->sipe('selfUnregistration', 'setSelfUnregistration', $data, $parameters);
        $this->sipe('publicDirectory', 'setIsPublic', $data, $parameters);
        $this->sipe('deletableDirectory', 'setDirDeletable', $data, $parameters);
        $this->sipe('allowedTeams', 'setMaxTeams', $data, $parameters);

        if (isset($data['workspace']['uuid'])) {
            $workspace = $this->workspaceRepo->findOneBy(['uuid' => $data['workspace']['uuid']]);

            if ($workspace) {
                $parameters->setWorkspace($workspace);
            }
        }

        return $parameters;
    }
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];
    }
720814
public function create(Array $data, Array $options = null) {

		$json 			= json_encode($data);
		$jsonError 		= (function_exists("json_last_error") && $errno = json_last_error());
		$jsonInvalid	= ($json === 'null');

		// Handle Errors
		if ($jsonError) static::error($errno); elseif ($jsonInvalid) static::error(JSON_ERROR_SYNTAX);

		// Build Claims
		$claims = (is_array($options)) ? $this->configure($options) : [];
		$claims += [
			'd'		=> $data,
			'v'		=> 0.1,
			'iat'	=> time()
		];

		// Return JWT
		return \JWT::encode($claims, $this->secret, 'HS256');

	}
869949
public function createForm($data = null, array $options = [])
    {
        return $this->formFactory->create(RegionFormType::class, $data, $options);
    }
351699
public function provide($data = null, array $options = [])
    {
        $template = $this->getBasicTemplate('number');
        $defaultOptions = $this->getDefaultOptions($data, $options);
        $defaultOptions['input'] = ['content' => $template];

        $view = $this->config->getView();
        $content = $view->Form->control('', [
            'name' => '{{name}}',
            'value' => '{{value}}',
            'type' => 'number',
            'step' => $options['step'] ?? Setting::DEFAULT_STEP_FOR_NUMBER,
            'max' => $options['max'] ?? Setting::MAX_VALUE_FOR_NUMBER,
            'min' => $options['min'] ?? Setting::MIN_VALUE_FOR_NUMBER,
            'label' => false
        ]);

        $defaultOptions['input'] = [
            'content' => $content
        ];

        $result[$this->config->getField()] = $defaultOptions;

        return $result;
    }
281147
protected function mapData(array $data, array $options)
    {
        if (!isset($options['settings_field'])) {
            $field = $options['key_field'] ?? 'key';
            expect_type($field, 'string', \BadMethodCallException::class);

            unset($data[$field]);
        } else {
            $field = $options['settings_field'];

            if (!isset($data[$field]) && !(bool)($options['optional'] ?? false)) {
                throw new LoadException("DynamoDB item '{$options['key_value']}' doesn't have a '$field' field");
            }

            $data = $data[$field] ?? [];
        }

        return $data;
    }
1268853
public function createFromArrayWithContext($data, $options)
    {
        $_edgeClass = $this->_edgeClass;

        return $_edgeClass::createFromArray($data, $options);
    }
1301300
public function options($url, $data = [], array $options = [])
    {
        $options = $this->_mergeOptions($options);
        $url = $this->buildUrl($url, [], $options);

        return $this->_doRequest(Request::METHOD_OPTIONS, $url, $data, $options);
    }
1153203
public function deserialize(array $data, Item $item = null, array $options = [])
    {
        return $this->serializer->deserialize($data, $item, $options);
    }