Default claims (can be overriden)

@return array
968060
protected function getDefaultClaims()
    {
        $default = [];
        $default['nbf'] = time() + $this->config['nbfOffset'];
        $default['exp'] = time() + $this->config['expOffset'];
        if (!empty($this->config['issuer'])) {
            $default['iss'] = $this->config['issuer'];
        }
        if (!empty($this->config['audience'])) {
            $default['aud'] = $this->config['audience'];
        }
        return $default;
    }
899196
public function getOverrides()
    {
        $result = [];
        if (isset($this->payload->operations)) {
            foreach ($this->payload->operations as $id => $operation) {
                if (isset($operation->request)) {
                    // API Payloads can optionally have their URLs overriden per request.
                    if (isset($operation->request->overridableUrl) && true === $operation->request->overridableUrl) {
                        $result['payload.operation.'.$id.'.request.url'] = [
                            'key'   => 'payload.operation.'.$id.'.request.url',
                            'value' => !empty($operation->request->url) ? $operation->request->url : '',
                        ];
                    }
                    foreach (['headers', 'body'] as $type) {
                        if (isset($operation->request->{$type})) {
                            foreach ($operation->request->{$type} as $field) {
                                if (isset($field->overridable) && true === $field->overridable) {
                                    // Remove irrelevant data, since this result will need to be light-weight.
                                    unset($field->default_value);
                                    unset($field->test_value);
                                    unset($field->test_only);
                                    unset($field->overridable);
                                    unset($field->required);
                                    $result[(string) $field->key] = $field;
                                }
                            }
                        }
                    }
                }
            }
        }
        ksort($result);

        return array_values($result);
    }
1047122
public function applyOverrides(): array
    {
        $filesUpdated = [];
        $filesSame    = [];
        $errors       = [];
        foreach ($this->getOverridesIterator() as $pathToFileInOverrides) {
            $relativePathToFileInProject = $this->getRelativePathInProjectFromOverridePath($pathToFileInOverrides);
            if ($this->overrideFileHashIsCorrect($pathToFileInOverrides)) {
                if (false === is_file($pathToFileInOverrides)) {
                    throw new \RuntimeException('path ' . $pathToFileInOverrides . ' is not a file');
                }
                copy($pathToFileInOverrides, $this->pathToProjectRoot . $relativePathToFileInProject);
                $filesUpdated[] = $relativePathToFileInProject;
                continue;
            }
            if ($this->projectFileIsSameAsOverride($pathToFileInOverrides)) {
                $filesSame[] = $relativePathToFileInProject;
                continue;
            }
            $errors[$pathToFileInOverrides] = $this->getProjectFileHash($relativePathToFileInProject);
        }
        if ([] !== $errors) {
            throw new \RuntimeException('These file hashes were not up to date:' . print_r($errors, true));
        }

        return [$this->sortFiles($filesUpdated), $this->sortFiles($filesSame)];
    }
31236
public function getDefaultResourceAdapterConfig(): array
    {
        if ($this->_defaultResourceAdapterConfig !== null) {
            return $this->_defaultResourceAdapterConfig;
        }

        return $this->_defaultResourceAdapterConfig = $this->getSettings()->defaults;
    }
234222
protected function getConfigDefaults()
    {
        $result = $this->getKeyInfo();
        $result = array_map(function ($item) {
            return $item['default'];
        }, $result);
        return $result;
    }
246084
private function buildClaims(array $claims): array
    {
        $newClaims = [];

        foreach ($claims as $key => $claim) {
            if (in_array($key, [Claims::ISSUED_AT, Claims::EXPIRATION_TIME])) {
                $newClaims[$key] = $claim->format('U');
            } else {
                $newClaims[$key] = $claim;
            }
        }

        return $newClaims;
    }
1180565
public function getRoundDefaults()
    {
        $defaults = parent::getRoundDefaults();

        // Now check if the valid for depends on the same round
        if (count($defaults) > 1) {
            $lastRound = end($this->_rounds);   // We need the ID to compare
            if ($defaults['gro_valid_for_source']     == 'tok' &&
                    $defaults['gro_valid_for_field']  == 'gto_valid_from' &&
                    $defaults['gro_valid_for_id']     == $lastRound['gro_id_round']) {
                $defaults['gro_valid_for_id'] = 0;  // Will be updated on save
            }
        } else {
            $defaults['gro_valid_after_source'] = 'rtr';
        }

        return $defaults;
    }
1030290
protected function getCachePolicy()
    {
        $defaults = [
            'insert' => false,
            'update' => false,
            'not_found' => false,
        ];

        if (!$this->hasOption('cache_policy')) {
            return $defaults;
        }

        $policy = $this->getOption('cache_policy');

        if (is_array($policy)) {
            return array_merge($defaults, $policy);
        }

        if (DEBUG) {
            throw new \Exception('Invalid cache policy setting');
        }

        return $defaults;
    }
160376
protected function getDefaultInstall()
    {
        $data = array();
        $data['database']['port'] = 3306;
        $data['database']['user'] = 'root';
        $data['database']['type'] = 'mysql';
        $data['database']['host'] = 'localhost';
        $data['database']['password'] = '';
        $data['store']['basepath'] = '';
        $data['store']['title'] = 'GPL Cart';
        $data['store']['host'] = 'localhost';
        $data['store']['timezone'] = date_default_timezone_get();

        return $data;
    }
343224
protected function getVates(){
        return [
            self::TAX_NONE,
            self::TAX_VAT0,
            self::TAX_VAT10,
            self::TAX_VAT110,
            self::TAX_VAT118,
            self::TAX_VAT18,
        ];
    }
794487
protected function getDefaultHandlers()
    {
        return array(
            '+' => new Handler\StatusResponse(),
            '-' => new Handler\ErrorResponse(),
            ':' => new Handler\IntegerResponse(),
            '$' => new Handler\BulkResponse(),
            '*' => new Handler\MultiBulkResponse(),
        );
    }
75026
public function defaultAttributeLabels()
    {
        return [
            'id' => Yii::t('hipanel', 'ID'),
            'remoteid' => Yii::t('hipanel', 'Remote ID'),
            'client' => Yii::t('hipanel', 'Client'),
            'client_id' => Yii::t('hipanel', 'Client'),
            'seller' => Yii::t('hipanel', 'Reseller'),
            'seller_id' => Yii::t('hipanel', 'Reseller'),
            'domain' => Yii::t('hipanel', 'Domain name'),
            'hdomain' => Yii::t('hipanel', 'Domain name'),
            'ns' => Yii::t('hipanel', 'Name Server'),
            'nss' => Yii::t('hipanel', 'Name Servers'),
            'server' => Yii::t('hipanel', 'Server'),
            'account' => Yii::t('hipanel', 'Account'),
            'service' => Yii::t('hipanel', 'Service'),
            'tariff' => Yii::t('hipanel', 'Tariff'),
            'contact' => Yii::t('hipanel', 'Contact'),
            'article' => Yii::t('hipanel', 'Article'),
            'host' => Yii::t('hipanel', 'Host'),
            'bill' => Yii::t('hipanel', 'Bill'),
            'backup' => Yii::t('hipanel', 'Backup'),
            'backuping' => Yii::t('hipanel', 'Backuping'),
            'crontab' => Yii::t('hipanel', 'Crontab'),
            'ip' => Yii::t('hipanel', 'IP'),
            'ips' => Yii::t('hipanel', 'IPs'),
            'mail' => Yii::t('hipanel', 'Mail'),
            'request' => Yii::t('hipanel', 'Request'),
            'db' => Yii::t('hipanel', 'Database'),
            'state' => Yii::t('hipanel', 'Status'),
            'status' => Yii::t('hipanel', 'Status'),
            'states' => Yii::t('hipanel', 'Statuses'),
            'type' => Yii::t('hipanel', 'Type'),
            'types' => Yii::t('hipanel', 'Types'),
            'note' => Yii::t('hipanel', 'Note'),
            'descr' => Yii::t('hipanel', 'Description'),
            'comment' => Yii::t('hipanel', 'Comment'),
            'created_date' => Yii::t('hipanel', 'Registered'),
            'updated_date' => Yii::t('hipanel', 'Last update'),
        ];
    }
21127
protected function buildClaims($options)
    {
        $claims = array();

        foreach ($this->requiredClaims as $claimKey) {
            list($key, $claim) = $this->buildClaim($claimKey);
            $claims[$key] = $claim;
        }

        foreach (array_intersect($this->availableClaims, array_keys($options)) as $claimKey) {
            list($key, $claim) = $this->buildClaim($claimKey, $options[$claimKey]);
            $claims[$key] = $claim;
        }

        return $claims;
    }
148662
protected function getDefault()
    {
        $current_url = $this->url->get();

        return array(
            'id' => uniqid(),
            'status' => true,
            'title' => '',
            'url' => '',
            'total' => 0,
            'errors' => 0,
            'done' => 0,
            'inserted' => 0,
            'updated' => 0,
            'context' => array(
                'offset' => 0,
                'line' => 1,
            ),
            'data' => array(),
            'message' => array(
                'start' => $this->translation->text('Starting...'),
                'finish' => $this->translation->text('Finished'),
                'process' => $this->translation->text('Processing...')
            ),
            'redirect' => array(
                'finish' => $current_url,
                'errors' => $current_url,
                'no_results' => $current_url
            ),
            'redirect_message' => array(
                'finish' => '',
                'errors' => '',
                'no_results' => ''
            ),
            'log' => array(
                'errors' => ''
            )
        );
    }
409227
public function defaults()
    {
        $baseDir = rtrim(realpath(__DIR__.'/../../../'), '/');
        $confDir = $baseDir.'/config';

        return $this->loadFile($confDir.'/admin.config.default.json');
    }
794222
public function getDefaultValuesForProperties()
    {
        $this->initialize();
        if (!isset($this->fullConfiguration['properties'])) {
            return [];
        }

        $defaultValues = [];
        foreach ($this->fullConfiguration['properties'] as $propertyName => $propertyConfiguration) {
            if (isset($propertyConfiguration['defaultValue'])) {
                $type = isset($propertyConfiguration['type']) ? $propertyConfiguration['type'] : '';
                switch ($type) {
                    case 'DateTime':
                        $defaultValues[$propertyName] = new \DateTime($propertyConfiguration['defaultValue']);
                    break;
                    default:
                        $defaultValues[$propertyName] = $propertyConfiguration['defaultValue'];
                }
            }
        }

        return $defaultValues;
    }
607358
public function defaults()
    {
        $defaults = array();

        foreach($this->_props as $key=>$prop)
            $defaults[$key] = $prop->defaultValue();

        return $defaults;
    }