@param string $data

@throws SessionException

@return string|bool
978757
public function decrypt(string $data)
    {
        $this->throwExceptionIfKeyEmpty();

        if ($data === '') {
            return '';
        }

        list($encrypted_data, $iv) = \explode('::', \base64_decode($data, true), 2);

        return \openssl_decrypt($encrypted_data, $this->method, $this->key, 0, $iv);
    }
1161052
protected function returnData($data)
    {
        if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false) {
            $this->returnJson([
                'success' => true,
                'data' => $data,
            ]);
        } else {
            $this->setData('breadcrumbs', $data);
            $this->setView('blocks/breadcrumbs.tpl', 'tao');
        }
    }
458888
public function xml($data)
    {
        if (isset($data['url']) && ! empty($data['url'])) {
            $result = @file_get_contents($data['url']);
            $result = XmlFormatter::encode($result);
        }
        return isset($result) ? $result : null;
    }
1367679
protected function &loadFilterData(&$data) {

        if ( empty($this->filterMap) ) {
            return $data;
        }
        $error = null;
        $data = Filter::loadFromModel($data, $this->filterMap, $error);

        if ( $data == false ) {
            WebApplication::getInstance()->getAppError()->setCode(1);
            WebApplication::getInstance()->getAppError()->setMessage($error);
        }
        return $data;
    }
1205135
public function write($data)
    {

        if (is_resource($data)) {
            return (bool)stream_copy_to_stream($data, $this->resource());
        }

        $isStream = $data instanceof Stream;

        if (!$isStream && Type::isStringable($data)) {
            return (bool)fwrite($this->resource(), $data);
        }

        if (!$isStream) {
            throw new TypeException('Unsupported data type in write(): ' . Type::of($data));
        }

        $dataResource = $data->resource();

        if (is_resource($dataResource)) {
            return $this->write($dataResource);
        }

        $resource = $this->resource();

        $bytes = 0;

        foreach ($data as $chunk) {
            $bytes += fwrite($resource, $chunk);
        }

        return (bool)$bytes;

    }
970750
public function return_data($data){

        if (isset($data['errcode']) && $data['errcode'] > 0){
            $this->error = $data['errmsg'];
            return false;
        }else{
            return $data;
        }
    }
874694
private function deserializeData($data)
    {
        $result = $this->get('jms_serializer')->deserialize(
            $data,
            $this->getTargetGroupRepository()->getClassName(),
            'json',
            DeserializationContext::create()
                ->setSerializeNull(true)
        );

        return $result;
    }
594328
public function sendData($data)
    {
        $httpResponse = $this->httpClient->post(
            $this->getEndpoint(),
            ['Content-Type' => 'text/xml; charset=utf-8'],
            $this->xmlSerialize($data)
        )->send();

        return $this->response = $this->newResponse( $httpResponse->xml() );
    }
1110478
public static function parse(string $data): self
    {
        $separator = strpos($data, "\r\n\r\n");

        if ($separator === false) {
            throw new FormatException('Invalid article format');
        }

        $headers = HeaderBag::parse(substr($data, 0, $separator + 2));
        $body = substr($data, $separator + 4);

        return new self($body, $headers);
    }
642193
protected function request($data) {
    try {
      if ($this->method == 'delete') {
        $response = $this->client->{$this->method}($this->path(), [], $data);
      }
      else {
        $response = $this->client->{$this->method}($this->path(), $data);
      }
      $this->client->close();
    }
    catch (\Exception $e) {
      // Throw an expection if something goes wrong.
      $this->triggerError($e->getMessage());
    }
    return $this->response($response);
  }
1277808
public function decrypt(string $data)
  {
    $iv_strlen = 2  * $this->iv_bytes();
    if(preg_match("/^(.{" . $iv_strlen . "})(.+)$/", $data, $regs)) {
      list(, $iv, $crypted_string) = $regs;
      $decrypted_string = openssl_decrypt($crypted_string, $this->method, $this->key, 0, hex2bin($iv));
      return $decrypted_string;
    } else {
      return false;
    }
  }
1093598
public function transform($data)
    {
        if (is_null($data)) {
            return false;
        }

        if (! is_string($data)) {
            throw new DataTransformerException('A string value is expected.');
        }

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

        if (in_array($data, ['off', 'no'], true)) {
            return false;
        }

        return true;
    }
532611
protected function doRequest($data)
    {
        $this->send(self::MAGIC_HEADER.pack('N', strlen($data)));
        $this->send($data);

        $data = $this->receive();

        $this->checkReceivedDataMagic($data);

        $status = unpack('Nstatus', substr($data, 4, 4))['status'];
        $data = substr($data, 12);

        if ($status != 200) {
            throw new TransportException($data ?: 'Http request failed, status: '.$status,
                TransportException::REMOTE);
        }

        return $data;
    }
1135080
public static function sessionParamterSetSearchParams($data = [])
    {
        if (Request::input('search_params'))
        {
            session(['search_params' => Request::all()]);
            $data['search_params'] = Request::all();
            session(['cadena' => null]);
        }
        elseif (session('search_params') && Request::input('accion') != 'query')
        {
            //comprobamos que al recoger la variable de la session no se está realizando una busqueda rápida, si es así se estará lanzando la variable Request::input('accion') == 'query
            //y pasaremos de largo.
            $data['search_params'] = session('search_params');
        }
        else
        {
            $data['search_params'] = null;
        }

        return $data;
    }
768184
protected static function dataToString($data)
    {
        if (!is_string($data))
        {
            try
            {
                $data = \GuzzleHttp\json_encode($data);
            }
            catch (\InvalidArgumentException $e)
            {

            }
        }

        return $data;
    }
160374
public function encode($data)
    {
        if ($data !== null) {
            $data = gzencode((string) $data, $this->options['level'], $this->options['mode']);
            if ($data === false) {
                $data = null;
                $this->error = error_get_last()['message'] ?? 'Unknown';
            }
        }

        return $data;
    }
397719
public function decode(string $data)
    {
        if (serialize(false) == $data) {
            return false;
        } elseif (false !== ($ret = @unserialize($data))) {
            return $ret;
        } else {
            throw new DecodeException('unserialize() error');
        }
    }