@param string $data
@param string $method
@param string $password
@param int    $options
@param string $initializationVector

@return string
550275
protected function openSslEncrypt(
        string $data,
        string $method,
        string $password,
        int $options,
        string $initializationVector
    ): string {
        $encrypted = $this->openSslEncryptImpl($data, $method, $password, $options, $initializationVector);

        $message = $this->getErrorMessage();
        $encrypted !== false ?: $this->throwException(new CryptException($message));

        return $encrypted;
    }
1194471
protected static function createBody($options, $method)
    {
        return ('GET' !== $method) ? is_array($options) ? http_build_query($options) : ltrim($options, '&') : null;
    }
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);
    }
1354459
protected function _doRequest($method, $url, $data, $options)
    {
        $request = $this->_createRequest(
            $method,
            $url,
            $data,
            $options
        );

        return $this->send($request, $options);
    }
460353
public function generate(int $algo = PASSWORD_DEFAULT, array $options = null): string
    {
        if ($this->checkPassword() ===false) {
            Throw new PasswordException('The set password does not meet the requirements of the set regular expression');
        }

        if (isset($options)) {
            $this->hash = password_hash($this->password . $this->salt, $options);
        }
        else {
            $this->hash = password_hash($this->password . $this->salt, $algo);
        }

        return $this->hash;
    }
575811
def init_string(data, options)
      @type, @data = File.exist?(data) ? [:datafile, "'#{data}'"] : [:math_function, data.clone]
      @options = Hamster.hash(options)
    end
1079633
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options)
    {
        //Prevents that a blank password is saved
        if ($options['validate'] === 'EmptyPassword' && isset($data['password']) && $data['password'] === '') {
            unset($data['password'], $data['password_repeat']);
        }
    }
361103
private function _curl($url, $data = '', $method = 'get')
    {
        $parStr = '';
        if (is_array($data)) {
            $parStr = http_build_query($data);
        } else {
            $parStr = $data;
        }

        if (strtolower($method) == 'get') {
            $json = file_get_contents(rtrim($url, '?').'?'.$parStr);
        } else {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_TIMEOUT, 30);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $parStr);
            $json = curl_exec($ch);
            curl_close($ch);
        }

        $result = json_decode($json, true);

        if (isset($result['errcode']) and $result['errcode'] != 0) {
            $this->_log("Error-{$method}-{$url}", $json, $data);
            return false;
        }

        return $result;
    }
166665
public static function generate(string $data, string $method='SHA256'): string
  {
    $hash = '';
    $hash = openssl_digest($data,$method);

    return $hash;
  }
1370181
protected static function _arrayToString($data, $options)
    {
        if (empty($data)) {
            return '[]';
        }

        extract($options['array']);
        /**
         * @var string $char
         * @var int $indent
         * @var int $multiplier
         */
        $comma = false;

        $tab = str_repeat($char, $indent * $multiplier);

        $string = "[\n";

        foreach ($data as $key => $value) {
            if ($comma) {
                $string .= ",\n";
            }
            $comma = true;
            $key = filter_var($key, FILTER_VALIDATE_INT) ? $key : static::dump($key, $options['quote']);
            $string .= $tab . $key . ' => ';
            if (is_array($value)) {
                $options['array']['indent'] = $indent + 1;
                $string .= static::_arrayToString($value, $options);
            } else {
                $string .= static::toString($value, $options);
            }
        }
        $tab = str_repeat($char, ($indent - 1) * $multiplier);
        return $string . "\n" . $tab . "]";
    }
822206
public function getAuthenticatedRequest($method, $url, $token, array $options = [])
	{
		$options['headers']['Accept'] = 'application/vnd.api+json, application/vnd.api+json; net.youthweb.api.version=0.9';
		$options['headers']['Content-Type'] = 'application/vnd.api+json';

		return parent::getAuthenticatedRequest($method, $url, $token, $options);
	}
725671
static public function instance($method = null, $url = null, $data = false, $options = false)
    {
        return new static($method, $url, $data, $options);
    }
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;
    }
188697
private function processSerializeTypeMethod(Type\Method $method, $object, array $data, string $attribute): array
    {
        $value = $object->{$method->getter()}();

        if ($this->checkNullForAttribute($value, $attribute) === false) {
            $data[$attribute] = $value;
        }

        return $data;
    }
793112
public function execute($method, $url, array $data = [])
    {
        $client = new Client(['handler' => $this->handler]);

        return json_decode($client->request($method, $url, array_merge($data, self::$OPTIONS))->getBody());
    }
1088143
static function MethodData(RequestMethod $method, $name, $filter = FILTER_DEFAULT, $options = null)
    {
        switch ($method)
        {
            case RequestMethod::Get():
                return self::GetData($name, $filter, $options);
            
            case RequestMethod::Post():
                return self::PostData($name, $filter, $options);
            
            default:
                throw new \InvalidArgumentException('Request::MethodData is available for request methods POST and GET, only');
        }
    }
610981
public function initialize(array $data, array $options = []): NodeInterface
    {
        if (!isset($data['id']) || !is_string($data['id']) || $data['id'] === '') {
            throw ValidationException::create('Field "id" must be a non-empty string.');
        }

        if (!preg_match('/^[0-9a-z\_]+$/i', $data['id'])) {
            throw ValidationException::create(
                'Field "id" must have only characters 0-9, a-z, A-Z or "_". Received: '.$data['id']
            );
        }

        $this->setId($data['id']);

        $this->addSubscriber($this);

        if (isset($data['name'])) {
            if (!is_string($data['name']) || $data['name'] === '') {
                throw ValidationException::create('Field "name" must be a non-empty string.');
            }

            $this->setName($data['name']);
        }

        if (isset($data['type'])) {
            if (!is_string($data['type']) || $data['type'] === '') {
                throw ValidationException::create('Field "type" must be a non-empty string.');
            }

            if (!preg_match('/^[0-9a-z\_]+$/i', $data['type'])) {
                throw ValidationException::create(
                    'Field "type" must have only characters 0-9, a-z, A-Z or "_". Received: '.$data['type']
                );
            }

            $this->setType($data['type']);
        }


        if (isset($data['metadata'])) {
            if (!is_array($data['metadata'])) {
                throw ValidationException::create('Field "metadata" must be an array.');
            }

            $this->setMetadata($data['metadata']);
        }

        if (isset($data['parent'])) {
            if (!is_object($data['parent'])
                || !($data['parent'] instanceof NodeInterface)
            ) {
                throw ValidationException::create(
                    'Field "parent" must be an instance of NodeInterface.'
                );
            }

            $this->addParent($data['parent']);
        }

        if (isset($data['children'])) {
            if (!is_array($data['children'])) {
                throw ValidationException::create('Field "children" must be an array.');
            }

            foreach ($data['children'] as $node) {
                if (!is_object($node) || !($node instanceof NodeInterface)) {
                    throw ValidationException::create(
                        'Field "children" must be an array of NodeInterface instances.'
                    );
                }

                $node->addParent($this);

                $this->addChild($node);
            }
        }

        return $this;
    }