Registers a default.

@param array $config Options
768744
public static function registerDefault($config)
    {
        if (!isset($config['identifier'])) {
            throw new AnException('identifier [AnServiceIdentifier] options is requied');
        }

        $strIdentifier = (string) $config['identifier'];

        if (isset($config['default'])) {
            $config['default'] = (array) $config['default'];
        } else {
            if (is_object($config['prefix'])) {
                $config['prefix'] = get_class(($config['prefix']));
            }

            if (empty($config['name'])) {
                $path = AnInflector::implode($config['identifier']->path);
                $config['name'] = array($path.ucfirst($config['identifier']->name), $path.'Default');
            }

            unset($config['default']);
        }

        self::$_identifiers[$strIdentifier] = $config;

        if (isset(self::$_defaults[$strIdentifier])) {
            unset(self::$_defaults[$strIdentifier]);
        }
    }
27928
protected function registerConfig()
    {
        // Config options
        $configIndex = FileConfig::FILE_NAME;
        $configFileName = FileConfig::FILE_NAME.'.php';
        $configPath = __DIR__.'/../../config/'.$configFileName;

        // Publish the config
        $this->publishes([
            $configPath => config_path($configFileName),
        ]);

        // Merge the default config to prevent any crash or unfilled configs
        $this->mergeConfigFrom(
            $configPath,
            $configIndex
        );

        return $this;
    }
197528
public function initialize(array $config)
    {
        parent::initialize($config);

        $this->dir     = Configure::read('Cms.docDir');
        $this->locale  = Configure::read('App.defaultLocale');
        $this->charset = Str::low(Configure::read('App.encoding'));
        $this->eol     = (Configure::read('debug')) ? PHP_EOL : '';
        $this->tab     = (Configure::read('debug')) ? Configure::read('Cms.lineTab') : '';
    }
894330
public function initialize(array $config)
    {
        $defaultConfig = [
            'authenticate' => [
                'Form' => [
                    'finder' => 'auth',
                    'userModel' => 'MeCms.Users',
                ],
            ],
            'authError' => __d('me_cms', 'You are not authorized for this action'),
            'authorize' => 'Controller',
            'flash' => [
                'element' => 'MeTools.flash',
                'params' => ['class' => 'alert-danger'],
            ],
            'loginAction' => ['_name' => 'login'],
            'loginRedirect' => ['_name' => 'dashboard'],
            'logoutRedirect' => ['_name' => 'homepage'],
            'unauthorizedRedirect' => ['_name' => 'dashboard'],
        ];

        //The authorization error is shown only if the user is already logged
        //  in and he is trying to do something not allowed
        if (!$this->user('id')) {
            $defaultConfig['authError'] = false;
        }

        $config = array_merge($defaultConfig, $config);

        $this->setConfig($config);

        parent::initialize($config);
    }
1339251
public function initialize(array $config)
    {
        $table = Configure::read('Muffin/Tokenize.table', self::DEFAULT_TABLE);

        $this->setTable($table);
        $this->setPrimaryKey('id');
        $this->setDisplayField('token');

        $this->addBehavior('Timestamp');
    }
510153
public function initialize(array $config)
    {
        $this->_controller = $this->_registry->getController();
        $this->_request    = $this->_controller->request;

        parent::initialize($config);
    }
469559
public function initialize(array $config) {
		$controller = $this->_registry->getController();
		$this->setEventManager($controller->getEventManager());

		$this->Captchas = $controller->Captchas;
	}
742189
protected function configure(array $config)
    {
        $this->width = $config['width'] ?? null;
        $this->height = $config['height'] ?? null;
        $this->position = $config['position'] ?? 'center';
        $this->interlace = $config['interlace'] ?? true;
    }
842661
public function initialize(array $config)
    {
        $config += $this->_defaultConfig;
        $this->config('fields', $this->_resolveFields($config['fields']));
        $this->config('strategy', $this->_resolveStrategy($config['strategy']));
    }
769882
public function initialize(array $config): void
    {
        $this->table('model_history');
        $this->displayField('id');
        $this->primaryKey('id');
        $this->addBehavior('Timestamp');
        $this->belongsTo('Users', [
            'foreignKey' => 'user_id'
        ]);
        $this->schema()->columnType('data', 'json');
        $this->schema()->columnType('context', 'json');
    }
359187
public function initialize(array $config)
    {
        $this->setTable('tags_tags');
        $this->setDisplayField('label');
        $this->addBehavior('Timestamp');
        if (Plugin::loaded('Muffin/Slug')) {
            $this->addBehavior('Muffin/Slug.Slug');
        }
    }
577135
protected function setParsedConfig(array $config)
    {
        foreach ($config as $key => $value) {
            $setter = 'set'.ucfirst($key);
            $this->$setter($value);
        }
    }
106371
public function addFromConfig(array $config)
    {
        foreach ($config as $name => $data) {
            $params     = isset($data['params']) ? $data['params'] : array();
            $parameters = array();
            foreach ($params as $nameParam => $param) {
                if (empty($params['type'])) {
                    $params['type'] = 'string';
                }

                switch ($param['type']) {

                    case 'int':
                        $param['type'] = Parameter::TYPE_INTEGER;
                        break;

                    case 'mixed':
                        $param['type'] = Parameter::TYPE_MIXED;
                        break;

                    case 'string':
                        $param['type'] = Parameter::TYPE_STRING;
                        break;

                    default:
                        // Consider  current value as regexp
                }
                $parameters[$nameParam] = new Parameter($nameParam, $param['type'], (bool) $param['mandatory']);
            }
            $this->add(new Route($name, $data['route'], $data['controller'], $parameters));
        }

        return $this;
    }
1365715
private function ritaInitialize(array $config)
    {
        if ($this->hasField('created') || $this->hasField('modified')) {
			$this->addBehavior('Timestamp');
		}
        $this->addBehavior('Rita/Tools.Persian');
    }
1228151
public function initialize(array $config = [])
    {
        $this->setConfig($config);
        $this->_registry->getController()->viewBuilder()->setHelpers(['Recaptcha.Recaptcha' => $this->_config]);
    }
204933
public function initialize(array $config)
    {
        $this->table('users');
        $this->displayField('email');
        $this->primaryKey('id');
        $this->addBehavior('Timestamp');

        $this->belongsTo('Roles', [
            'className' => 'CakeManager.Roles',
            'foreignKey' => 'role_id',
            'propertyName' => 'role',
        ]);
    }
208352
public function initiate(array $config): void
    {
        foreach ($config as $key => $value) {
            if (\property_exists($this, $key)) {
                $this->{$key} = $value;
            }
        }

        $this->header(function () {
            return [];
        });
    }