Encodes model data to create custom JWT with model.id set in it
@return string encoded JWT
424094
public function getJWT()
    {
        // Collect all the data
        $secret      = static::getSecretKey();
        $currentTime = time();
        $request     = Yii::$app->request;
        $hostInfo    = '';

        // There is also a \yii\console\Request that doesn't have this property
        if ($request instanceof WebRequest) {
            $hostInfo = $request->hostInfo;
        }

        // Merge token with presets not to miss any params in custom
        // configuration
        $token = array_merge([
            'iss' => $hostInfo,
            'aud' => $hostInfo,
            'iat' => $currentTime,
            'nbf' => $currentTime
        ], static::getHeaderToken());

        // Set up id
        $token['jti'] = $this->getJTI();

        return JWT::encode($token, $secret, static::getAlgo());
    }
557874
public function getDecoded()
    {
      if (is_null($this->token)) return null;
      if (is_null($this->decoded)) {
        try {
          $this->decoded = JWT::decode($this->token, $this->key, ['HS512']);
        }
        catch (\Exception $e) {}
        catch (\DomainException $e) {}
      }
      return  $this->decoded;
    }
145714
public function _encode()
    {
        if ($this->isAssociativeArray)
        {
            $object = new \stdClass();
            foreach ($this->value as $key => $value)
            {
                $object->$key = AVClient::_encode($value, true);
            }

            return AVClient::_encode($object, true);
        }

        return AVClient::_encode($this->value, true);
    }
724979
public function getDataModel()
	{
		if (!$this->model)
		{
			$name = $this->getOption('model');
			$this->model = new $name;
		}

		return $this->model;
	}
856796
public function generateRawData()
    {
        $rawData = ['id' => $this->getId()];
        if ($this->getCreatedAt()) {
            $rawData['created_at'] = $this->getCreatedAt();
        }
        if ($this->getStatusDescription() || $this->getStatusCode()) {
            $rawData['status'] = $this->getStatus();
        }

        return $rawData;
    }
360126
public function generateSigninInput()
    {
        $base64payload = $this->encoder->encode(json_encode($this->getPayload(), JSON_UNESCAPED_SLASHES));
        $base64header = $this->encoder->encode(json_encode($this->getHeader(), JSON_UNESCAPED_SLASHES));

        return sprintf('%s.%s', $base64header, $base64payload);
    }
1109595
public function asJavascript()
    {
        return implode("\n    ", array_map(function ($push) {
            return '_paq.push([' . implode(', ', array_map(function ($item) {
                    if ($item instanceof RawExpression) {
                        return $item->value;
                    }

                    // JSON encoding is used to escape data injected into javascript
                    return json_encode($item);
                }, $push)) . ']);';
        }, $this->pushs));
    }
637132
public function wrapAndRender()
    {
        // Check if the model has encodings
        if (($item = $this->getModel()) && method_exists($item, 'encodings')) {

            // If so, get it's encoding model instance
            $this->encoding = $item->encodings()
                ->where('encodable_attribute', $this->model_attribute)
                ->first();

            // Add the data attributes for JS view
            if ($this->encoding) {
                $this->group->data_encode($this->encoding->id);
            }
        }

        // Continue rendering
        return parent::wrapAndRender();
    }
568516
def encode_id_token(payload, client):
    
    keys = get_client_alg_keys(client)
    _jws = JWS(payload, alg=client.jwt_alg)
    return _jws.sign_compact(keys)
175677
function _makeUid() {
    $date   = date('Ymd\THisT');
    $unique = substr(microtime(), 2, 4);
    $base   = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPrRsStTuUvVxXuUvVwWzZ1234567890';
    $start  = 0;
    $end    = strlen( $base ) - 1;
    $length = 6;
    $str    = null;
    for( $p = 0; $p < $length; $p++ )
      $unique .= $base{mt_rand( $start, $end )};
    $this->uid['value']  = $date.'-'.$unique.'@'.$this->getConfig( 'unique_id' );
    $this->uid['params'] = null;
  }
1033522
public function encoded()
    {
        $encoded = collect();

        $this->each(function ($model) use (&$encoded) {
            $pool = Mention::pool($model);
            $encoded->push("{$pool->key}:{$model->getKey()}");
        });

        return $encoded->implode(',');
    }
158103
public function encode()
    {
        $reserved = [
            '!%21!ui' => "!",
            '!%23!ui' => "#",
            '!%24!ui' => "$",
            '!%26!ui' => "&",
            '!%27!ui' => "'",
            '!%28!ui' => "(",
            '!%29!ui' => ")",
            '!%2A!ui' => "*",
            '!%2B!ui' => "+",
            '!%2C!ui' => ",",
            '!%2F!ui' => "/",
            '!%3A!ui' => ":",
            '!%3B!ui' => ";",
            '!%3D!ui' => "=",
            '!%3F!ui' => "?",
            '!%40!ui' => "@",
            '!%5B!ui' => "[",
            '!%5D!ui' => "]",
            '!%25!ui' => "%",
        ];
        // The % character must be the last in the $reserved array.
        // This makes sure that the already encoded values are not lost or encoded again.
        $this->uri = preg_replace(array_keys($reserved), array_values($reserved), rawurlencode($this->uri));
        return $this->baseToLowercase();
    }
44669
public function getSerialized()
    {
        if (\is_numeric($this->modelId)) {
            return \sprintf('%s::%s', $this->dataProviderName, $this->modelId);
        }

        return \sprintf('%s::%s', $this->dataProviderName, \base64_encode(\json_encode($this->modelId)));
    }
296842
public function hashCode()
    {
        $validPk = null !== $this->getUserId() &&
            null !== $this->getRoleId();

        $validPrimaryKeyFKs = 2;
        $primaryKeyFKs = [];

        //relation user_role_fk_29554a to table user
        if ($this->aUser && $hash = spl_object_hash($this->aUser)) {
            $primaryKeyFKs[] = $hash;
        } else {
            $validPrimaryKeyFKs = false;
        }

        //relation user_role_fk_1ff99e to table role
        if ($this->aRole && $hash = spl_object_hash($this->aRole)) {
            $primaryKeyFKs[] = $hash;
        } else {
            $validPrimaryKeyFKs = false;
        }

        if ($validPk) {
            return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
        } elseif ($validPrimaryKeyFKs) {
            return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
        }

        return spl_object_hash($this);
    }
966414
public function encode()
    {
    	foreach ($this->body as $key => $value) {
    		$result[] = $this->replaceText($value);
    	}

    	return implode('', $result);
    }
1003203
public function generate(): string
    {
        $uniqueId = uniqid((string) rand(), true);

        return (string) md5($uniqueId);
    }
525550
public function generateRawData()
    {
        $rawData = ['id' => $this->getId()];
        $rawData['output_info'] = [];
        $rawData['output_info']['data'] = [];
        if ($this->getName()) {
            $rawData['name'] = $this->getName();
        }
        if ($this->getAppId()) {
            $rawData['app_id'] = $this->getAppId();
        }
        if ($this->getCreatedAt()) {
            $rawData['created_at'] = $this->getCreatedAt();
        }
        if ($this->getConcepts()) {
            $rawData['output_info']['data']['concepts'] = [];
            foreach ($this->getConcepts() as $concept) {
                $rawData['output_info']['data']['concepts'][] = $concept->generateRawData();
            }
        }
        if ($this->isConceptsMutuallyExclusive() || $this->isClosedEnvironment()) {
            $rawData['output_info']['output_config'] = $this->getOutputConfig();
        }
        if ($this->getModelVersion()) {
            $rawData['model_version'] = $this->getModelVersion()->generateRawData();
        }

        return $rawData;
    }