Apply defaults.
@return void
192218
private function applyDefaults(): void
    {
        $timezone = $this->config->get('timezone');
        if ($timezone != null) {
            date_default_timezone_set($timezone);
        }

        $encoding = $this->config->get('encoding');
        if ($encoding != null) {
            mb_internal_encoding($encoding);
            ini_set('default_charset', $encoding);
        }

        $locales = $this->config->get('locales');
        if ($locales != null) {
            foreach ((array) $locales as $category => $locale) {
                setlocale($category, $locale);
            }
        }
    }
1028633
public function defaults()
	{
		// Reset filters.
        foreach ($this->getProfileConfig('filters') as $filter) {
        	$this->addFilter(new $filter);
        }

        // Reset hooks.
        foreach ($this->getProfileConfig('hooks') as $hook => $config) {
        	$this->addHook(new $hook($config));
        }

        // Reset black & white list.
        $this->whitelist($this->getProfileConfig('whitelist'));
        $this->blacklist($this->getProfileConfig('blacklist'));

        // Add configs dir as path.
        $this->addPath($this->_configs->get('bbcoder::cpath'));

        return $this;
	}
1249674
protected function initializeDefaultValues()
    {
        $defaults = [];

        $filters = $this->getFilterInformation();

        foreach (array_keys($filters) as $key) {
            $defaults[ $key ] = null;
        }

        $this->defaults = $defaults;

        return $this;
    }
853888
protected function setDefaultDataTypes()
    {
        foreach ($this->_params as $key => $value) {
            switch (gettype($value)) {
                case "boolean":
                    $this->_types[$key] = 'boolean';
                    break;
                case "integer":
                    $this->_types[$key] = 'integer';
                    break;
                case "double":
                    $this->_types[$key] = 'float';
                    break;
                case "string":
                    $this->_types[$key] = 'string';
                    break;
                case "array":
                    $this->_types[$key] = 'array';
                    break;
                default:
                    $this->_types[$key] = null;
                    break;
            }
        }
    }
142504
public function apply()
    {
        $input = $this->grid->getInputProcessor()->getInput();
        $sort = null;
        if (isset($input['sort'])) {
            foreach ($input['sort'] as $field => $direction) {
                $sort = [$field, $direction];
                break;
            }
        }
        foreach ($this->grid->getConfig()->getColumns() as $column) {
            if ($sort) {
                if ($column->getName() === $sort[0]) {
                    $column->setSorting($sort[1]);
                } else {
                    $column->setSorting(null);
                }
            } else {
                if ($direction = $column->getSorting()) {
                    $sort = [$column->getName(), $direction];
                }
            }
        }
        if ($sort) {
            $this
                ->grid
                ->getConfig()
                ->getDataProvider()
                ->orderBy($sort[0], $sort[1]);
        }
    }
1145429
protected function setDefaults()
    {
        $this->attributes['name']      = $this->name;
        $this->attributes['classname'] = get_called_class();
        $attributesAdapter             = new AttributesAdapter($this->name);
        $defaults                      = $attributesAdapter->defaults();
        if (!isset($this->attributes['width']) && isset($this->attributes['default_width'])) {
            $this->attributes['width'] = $this->attributes['default_width'];
        }
        if (!isset($this->attributes['height']) && isset($this->attributes['default_height'])) {
            $this->attributes['height'] = $this->attributes['default_height'];
        }
        $this->attributes = array_merge($defaults, $this->attributes);

        $attributes = app(Service::class)->findOne(array_merge($defaults, $this->attributes), uri());

        $this->attributes            = array_merge($this->attributes, $attributes);
        $this->attributes['desktop'] = array_only($this->attributes, ['x', 'y', 'width', 'height']);

        return $this->attributes;
    }
677820
private void applyDefaults() {
        for (String name : getOptionNames()) {
        	String val = _map.get(name);
        	if (val == null || val.length() == 0) {
                OptionDefinition opt = OptionDefinition.get(name, this);
                _map.put(name, opt.getDefaultValue());
            }
        }
    }
1346615
protected function defaults()
    {
        parent::defaults();

        if ($this->isMissingLeft()) {
            $this->left();
        }

        if ($this->isMissingRight()) {
            $this->right();
        }
    }
1200981
public function configDefault($key, $default = null)
    {
        $value = $this->config($key);
        if ($value === null) {
            $this->config($key, $default);
        }
    }
5063
protected function setDefaults()
    {
        $this->setBankLeftAttr(3, 8, 50, 4);
        $this->setBankRightAttr(66, 8, 50, 4);
        $this->setRecipientLeftAttr(3, 23, 50, 4);
        $this->setRecipientRightAttr(66, 23, 50, 4);
        $this->setAccountLeftAttr(27, 43, 30, 4);
        $this->setAccountRightAttr(90, 43, 30, 4);
        $this->setAmountFrancsLeftAttr(5, 50.5, 35, 4);
        $this->setAmountFrancsRightAttr(66, 50.5, 35, 4);
        $this->setAmountCentsLeftAttr(50, 50.5, 6, 4);
        $this->setAmountCentsRightAttr(111, 50.5, 6, 4);
        $this->setPayerLeftAttr(3, 65, 50, 4);
        $this->setPayerRightAttr(125, 48, 50, 4);

        return $this;
    }
11866
protected function setDefaultValue() : void
    {
        if (empty($this->defaultOptions['default'])) {
            return;
        }

        // If we have a default value from configuration, pass it through
        // processing for magic/dynamic values like dates and usernames.
        $eventName = (string)EventName::FIELD_HANDLER_DEFAULT_VALUE();
        $event = new Event($eventName, $this, [
            'default' => $this->defaultOptions['default']
        ]);

        $view = $this->config->getView();
        $view->getEventManager()->dispatch($event);

        // Only overwrite the default if any events were triggered
        $listeners = $view->getEventManager()->listeners($eventName);
        if (empty($listeners)) {
            return;
        }
        $this->defaultOptions['default'] = $event->result;
    }
829670
protected function _setDefaults()
    {
        $defaults = [
            'authenticate' => [
                'Form' => [
                    'finder'    => 'auth',
                    'userModel' => 'Community.Users',
                    'fields'    => [
                        'username' => 'login',
                        'password' => 'password'
                    ],
                ]
            ],
            'flash' => [
                'key'       => 'auth',
                'element'   => 'error',
                'params'    => ['class' => 'error']
            ],
            'loginAction' => [
                'controller' => 'Users',
                'action'     => 'login',
                'plugin'     => 'Community'
            ],
            'unauthorizedRedirect' => [
                'action'     => 'login',
                'controller' => 'Users',
                'plugin'     => 'Community'
            ],
            'authorize'      => ['Community.Base'],
            'loginRedirect'  => $this->_getLoginRedirect(),
            'logoutRedirect' => $this->_config['loginAction'],
            'authError'      => __d('community', 'You are not authorized to access that location.')
        ];

        $config = $this->getConfig();
        foreach ($config as $key => $value) {
            if ($value !== null) {
                unset($defaults[$key]);
            }
        }

        $this->setConfig($defaults);
    }
1205890
public void applyDefaults() {
		if (fillColor == null) {
			fillColor = "#ffffff"; // white
		}
		if (strokeColor == null) {
			strokeColor = "#000000"; // black
		}
		if (strokeOpacity == -1) {
			strokeOpacity = 1; // fully opaque by default
		}
		if (fillOpacity == -1) {
			fillOpacity = .5f; // 50% transparent by default
		}
		if (strokeWidth == -1) {
			strokeWidth = 1; // white
		}
	}
906297
protected function setDefaultAttributes()
    {
        if (!empty($this->attributes)) {
            foreach ($this->attributes as $attr => $val) {
                $this->realSetAttribute($attr, $val);
            }
        }
    }
894909
public function setDefault(): void
	{
		$repo = $this->getRepository();
		$locales = $repo->findAll();
		foreach ($locales as $locale) {
			/* @var $locale self */
			$locale->default = false;
			$repo->persist($locale);
		}
		$this->default = true;
		$repo->persist($this);
		$repo->flush();
	}
701420
protected function initDefaults()
    {
        if ($this->properties['header'] === null) {
            $this->setHeader($this->name);
        }
        if ($this->properties['type'] === null) {
            $this->setType(ColumnType::createType(ColumnType::TYPE_STRING));
        }
    }
230823
protected function defaults()
    {
        parent::defaults();

        if ($this->isMissingPath()) {
            $this->path();
        }

        if ($this->isMissingSource()) {
            $this->pathSource();
        }
    }