Get the default payload for the session.

@param  string $data
@return array
554881
protected function getDefaultPayload( $data )
	{
		$payload = ['payload' => base64_encode( $data ), 'last_activity' => time()];

		if ( Acct::check() )
			$payload['user_id'] = Acct::acct()->getId();

		if ( $request = Factory::i()->request() )
		{
			$payload['ip_address'] = $request->ip();
			$payload['user_agent'] = substr( (string) $request->header( 'User-Agent' ), 0, 500 );
		}

		return $payload;
	}
648376
public function setPayload($data)
    {
        if (!is_string($data)) {
            if (is_array($data)) {
                $data = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
            } else {
                $data = serialize($data);
            }
        }

        $maxLength = 255;
        if (mb_strlen($data) > $maxLength) {
            // Truncate too long payload
            $data = mb_substr($data, 0, $maxLength - 3) . '...';
        }

        $this->payload = $data ? $data : null;

        return $this;
    }
115254
public static function default_data_provider() 
	{
		return array(
			'last_active'	=> time(),
			'current_lang'	=> \CCLang::current(),
			'client_agent'	=> \CCServer::client( 'agent' ),
			'client_ip'		=> \CCServer::client( 'ip' ),
			'client_port'	=> \CCServer::client( 'port' ),
			'client_lang'	=> \CCServer::client( 'language' ),
		);
	}
861776
private function unpackData($data)
    {
        $arr = unserialize($data);

        if (time() > $arr['expires'] && $arr['expires'] !== 0) {
            return false;
        }

        return $arr['data'];
    }
163586
private function getSession(array &$data)
    {
        $session = array_shift($data['queue']);

        if ($session) {
            if ($session['expiration'] - self::DURATION_ONE_MINUTE < $this->time()) {
                return $this->getSession($data);
            }

            $data['inUse'][$session['name']] = $session + [
                'lastActive' => $this->time()
            ];

            if ($this->config['shouldAutoDownsize']) {
                $this->manageSessionsToDelete($data);
            }
        }

        return $session;
    }
1340235
public function get($data = [])
	{
		// Process data given.
		$processPayload = $this->process(__FUNCTION__, $data);

		if( ! $processPayload->isStatus(Payload::STATUS_VALID))
		{
			return $processPayload;
		}

		// Get a properly formatted Entity Class string.
		$entityContext = $this->formatEntityType($processPayload->getData()['entity_type']);

		return $this->aggregate[$entityContext]->get($processPayload->getData()['filter'], $processPayload->getData()['sort'], $processPayload->getData()['field'], $processPayload->getData()['embed']);
	}
757286
protected function generatePayload($data)
  {

    $payload = $data;

    // Ensures consistent message structure.
    $payload['requested'] = date('c');
    $payload['startTime'] = $this->startTime;

    return $payload;
  }
55814
protected function prepareForUnserialization(string $data = null) : string
    {
        if ($data === null) {
            return '';
        }

        if ($this->usesEncryption) {
            if ($this->encrypter === null) {
                throw new LogicException('Encrypter not set on session handler');
            }

            try {
                return $this->encrypter->decrypt($data);
            } catch (SessionEncryptionException $ex) {
                return serialize([]);
            }
        } else {
            return $data;
        }
    }
558983
protected final function getWhere($data) {
        $con = [];
        foreach ($this->primaryKeys as $f) {
            if (array_key_exists($f, $data)) {
                if (isset($data[ $f ])) {
                    $con [ $f ] = $data [ $f ];
                } else {
                    $con [ $f . ' $' ] = null;
                }
            }
        }

        return $con;
    }
770530
protected function payload()
    {
        $buffer = "";

        # Payload
        $buffer .= $this->message;
        Debug::Log(Debug::DEBUG, 'Message PUBLISH: Message='.$this->message);

        return  $buffer;
    }
249918
function payload()
    {
        if ( $this->IsFault )
        {
            $payload = xmlrpc_encode( array(
                "faultCode" => $this->FaultCode,
                "faultString" => $this->FaultString ) );
            return str_replace( array( '<fault>', '</fault>' ), array( '<methodResponse><fault>', '</fault></methodResponse>' ), $payload );
        }
        else
        {
            $payload = xmlrpc_encode( $this->Value );
            /// @todo verify if user gave us back an array with faultString / faultCode members,
            ///       as we will be sending back junk in that case...
            return str_replace( array( '<params>', '</params>' ), array( '<methodResponse><params>', '</params></methodResponse>' ), $payload );
        }
    }
741904
public function getPayloadData($key, $default = null)
    {
        if (is_null($this->payload)) {
            return null;
        }

        return $this->payload[$key] ?? $default;
    }
1218737
public function getValueFromData($data, $default = null)
    {
        $columnName = $this->valueFrom ?: $this->columnName;
        return $this->getColumnNameFromData($columnName, $data, $default);
    }
1113931
public static function config_get_configuration_array($data) {
        return array(
            'server' => $data->server,
            'prefix' => $data->prefix,
            'password' => $data->password,
            'serializer' => $data->serializer
        );
    }
226798
private function unserialize(string $data)
    {
        $value = unserialize($data);

        if ($this->packer !== null) {
            return $this->packer->unpack($value);
        }

        return $value;
    }
733586
protected function getData($data)
    {
        $method = "load" . strtoupper($this->mode);

        libxml_use_internal_errors(true);
        $this->dom->$method($data);
        $this->errors = libxml_get_errors();
        libxml_clear_errors();

        return $data;
    }
359564
protected function setData($data = [])
    {
        $defaults = [
            'content'  => '',
            'data'     => null,
        ];

        $this->data = array_merge($defaults, $data);

        return $this;
    }