Generates key for email template.

@return string
761197
protected function generateKey()
    {
        return Json::encode([
            'model' => \get_class($this->owner),
            'id'    => $this->owner->getPrimaryKey(),
            'key'   => $this->_key,
        ]);
    }
736676
public function toString(): string
    {
        return 'has the key ' . $this->exporter->export($this->key) .
                ' with the value ' . $this->exporter->export($this->value);
    }
326165
public function generate()
    {
        $str     = '';
        $keysize = strlen($this->_alphabet);

        for ($i = 0; $i < $this->_length; ++$i) {
            $str .= $this->_alphabet[\Sodium\randombytes_uniform($keysize)];
        }

        return $str;
    }
320477
protected function buildDataGetterCacheKey()
    {
        $keys = array();

        foreach ($this->columns as $column) {
            if ($column->isPrimaryKey()) {
                $keys[] = '$this->' . $column->getMethodNameGet() . '()';
            }
        }

        $key = "'" . $this->config->getCachePrefix() . "_data_' . " . implode(" . '_' . ", $keys);

        $this->vars['cache_key'] = '
    /**
     * Get cache key
     *
     * @return string
     */
    public function getCacheKey()
    {
        return ' . $key . ';
    }';
    }
119611
public function getCacheKey(): string
    {
        return $this->getTypePrefix() . $this->getFlexType() . '.' . sha1(json_encode($this->call('getKey')));
    }
667798
public function generateUsername()
    {
        // try to use username part of email
        $this->username = explode('@', $this->email)[0];
        if ($this->validate(['username'])) {
            return $this->username;
        }

        // generate name like "user1", "user2", etc...
        while (!$this->validate(['username'])) {
            $row = (new Query())->from('{{%user}}')->select('MAX(id) as id')->one();
            $this->username = 'user' . ++$row['id'];
        }
        return $this->username;
    }
250235
public function key(): string
    {
        if ($this->cacheEntriesIterator === null) {
            $this->rewind();
        }
        return substr($this->cacheEntriesIterator->key(), strlen($this->identifierPrefix . 'entry_'));
    }
412866
protected function getTemplateRegexPattern()
    {
        $template = str_replace('.', '\.', $this->template);
        $template = str_replace('*', '[a-zA-Z0-9]*', $template);

        return sprintf('/^%s$/', $template);
    }
1291074
public function toString()
    {
        $credentials = array();
        $credentials['E-mail'] = $this->email;
        $credentials['Token'] = $this->token;
        return implode(' - ', $credentials);
    }
441940
public function getKeyPrefix()
    {
        if (!$this->keyPrefix) {
            return '';
        }

        $clean = Inflector::slug($this->keyPrefix);
        return substr($clean, 0, 8);
    }
153047
public function formatMailChimp()
    {
        $options = $this->options;
        if (!empty($this->getMergeFields())) {
            $options = array_merge([
                'merge_fields' => $this->getMergeFields()
            ], $options);
        }

        return array_merge([
            'email_address' => $this->getEmail()
        ], $options);
    }
781488
public function generate()
    {
        return sprintf(
            '<input type="hidden" id="ctrl_%s" name="%s" value="%s" /><div%s>%s</div>',
            $this->strId,
            $this->strName,
            StringUtil::specialchars($this->label ?: $this->varValue),
            $this->style ? ' style="' . $this->style . '"' : '',
            $this->label
        );
    }
39852
public function generateListKey() : string
    {
        $filter = [
            $this->getClient()->getNamespace(),
            'queue',
            \str_replace(':', '.', $this->getName())
        ];
        $parts = \array_filter($filter, 'strlen');
        return \implode(':', $parts);
    }
716090
private function generateRoutingKey()
    {
        $routeParts = explode('.', $this->request->get('_route'));
        $action = array_pop($routeParts);
        $baseRoute = implode('.', $routeParts);

        // find our route in the map
        $routingKey = null;

        foreach ($this->eventMap as $mapElement) {
            if ($mapElement['baseRoute'] == $baseRoute &&
                isset($mapElement['events'][$action])
            ) {
                $routingKey = $mapElement['events'][$action];
                break;
            }
        }

        return $routingKey;
    }
1226165
private function generateFromGeneric()
    {
        $ctypes = $this->app['config']->get('contenttypes');

        $translatables = array_filter(
            array_keys($this->translatables),
            function ($key) {
                return substr($key, 0, 21) === 'contenttypes.generic.' && substr($key, 21, 6) !== 'group.';
            }
        );

        foreach ($translatables as $key) {
            foreach ($ctypes as $ctname => $ctype) {
                $setkey = 'contenttypes.' . $ctname . '.text.' . substr($key, 21);
                $this->translation[$setkey] = isset($this->saved[$setkey]) ? $this->saved[$setkey] : '';
                if ($this->translation[$setkey] === '') {
                    $generic = Trans::__($key);
                    // If not translated, add hint
                    if ($generic !== $key) {
                        $replacement = [];
                        if (strpos($generic, '%contenttypes%') !== false) {
                            $replacement['%contenttypes%'] = $ctname;
                        } elseif (strpos($generic, '%contenttype%') !== false) {
                            $replacement['%contenttype%'] = $ctname;
                        }
                        $this->hints[$setkey] = Trans::__($key, $replacement);
                    }
                }
            }
        }
    }
1093914
protected function getTemplateStrings()
    {
        $default = 'Expected {{actual}} to have a{{deep}}property {{key}}';
        $negated = 'Expected {{actual}} to not have a{{deep}}property {{key}}';

        if ($this->getValue() && $this->isActualValueSet()) {
            $default = 'Expected {{actual}} to have a{{deep}}property {{key}} of {{value}}, but got {{actualValue}}';
            $negated = 'Expected {{actual}} to not have a{{deep}}property {{key}} of {{value}}';
        }

        $deep = ' ';
        if ($this->isDeep()) {
            $deep = ' deep ';
        }

        return str_replace('{{deep}}', $deep, [$default, $negated]);
    }
1217461
public function templateName()
    {
        $key = substr(strrchr('\\'.get_class($this), '\\'), 1);

        if (!isset(static::$templateNameCache[$key])) {
            $value = $key;

            if (!ctype_lower($value)) {
                $value = preg_replace('/\s+/u', '', $value);
                $value = mb_strtolower(preg_replace('/(.)(?=[A-Z])/u', '$1-', $value), 'UTF-8');
            }

            $value = str_replace(
                [ 'abstract', 'trait', 'interface', 'template', '\\' ],
                '',
                $value
            );

            static::$templateNameCache[$key] = trim($value, '-');
        }

        return static::$templateNameCache[$key];
    }