Normalize configuration entry

@return array
195520
protected function conf($confpath, $dependencies = []) {

		$conf = $this->confs->read($confpath);

		if (isset($conf['require'])) {
			throw new Panic("The paradox configuration $confpath must not contain a require key. Only the main paradox configuration should specify dependencies.");
		}

		return array_merge($conf, [ 'require' => $dependencies ]);
	}
1111913
public function getGeneralSettings()
    {
        return [
            'guard' => [
                'path' => '/config/auth.php',
                'search' => "'guards' => [",
                'stub' => __DIR__ . '/../stubs/config/guards.stub',
                'prefix' => false,
            ],
            'provider' => [
                'path' => '/config/auth.php',
                'search' => "'providers' => [",
                'stub' => __DIR__ . '/../stubs/config/providers.stub',
                'prefix' => false,
            ],
            'passwords' => [
                'path' => '/config/auth.php',
                'search' => "'passwords' => [",
                'stub' => __DIR__ . '/../stubs/config/passwords.stub',
                'prefix' => false,
            ],
            'kernel' => [
                'path' => '/app/Http/Kernel.php',
                'search' => 'protected $routeMiddleware = [',
                'stub' => __DIR__ . '/../stubs/Middleware/Kernel.stub',
                'prefix' => false,
            ],
            'map_register' => [
                'path' => '/app/Providers/RouteServiceProvider.php',
                'search' => '$this->mapWebRoutes();',
                'stub' => __DIR__ . '/../stubs/routes/map-register.stub',
                'prefix' => false,
            ],
            'map_method' => [
                'path' => '/app/Providers/RouteServiceProvider.php',
                'search' => "    /**\n" . '     * Define the "web" routes for the application.',
                'stub' => __DIR__ . '/../stubs/routes/map-method.stub',
                'prefix' => true,
            ],
        ];
    }
344761
function normalize()
    {
        $normalized = array();
        $paths      = $this->getPath();

        if (empty($paths))
            return $normalized;

        // Replace "~" with user's home directory.
        if ('~' === $paths[0]) {
            $home  = explode($this->getSeparator(), str_replace('\\', '/', $this->_getHomeDir()));
            $paths = $paths + $home;
        }

        $isRoot = $this->_isRoot($paths[0]);
        $paths  = array_filter($paths, function($p, $i) use (&$isRoot, $paths) {
            if ( ($isRoot && $i > 0) || $i+1 == count($paths) /* keep last slash remain */) {
                // keep last slash /go/to/path/
                // keep first slash after root if exists
                //   phar://path/to/res
                $isRoot = false;
                return true;
            }

            // Remove all ['',] from path
            // on appended path we don't want any absolute sign in
            // array list
            return ($p !== '' && $p !== '.');
        }, ARRAY_FILTER_USE_BOTH);

        // Collapse ".." with the previous part, if one exists
        // Don't collapse ".." if the previous part is also ".."
        foreach ($paths as $path) {
            if (   '..' === $path && count($normalized) > 0      // keep first segment
                && '..' !== $normalized[count($normalized) - 1]
            ) {
                if (! $this->_isRoot($normalized[count($normalized) - 1]) )
                    array_pop($normalized);

                continue;
            }

            $normalized[] = $path;
        }

        $this->setPath($normalized);
        return $this;
    }
479774
protected function makeConfiguration()
    {
        if ($this->on == 'create' || $this->on == 'update') {
            return $this->fieldName;
        }

        return [
            'field'        => $this->fieldName,
            'trackedField' => $this->trackedFields,
            'value'        => $this->value,
        ];
    }
955803
public static function GetDefaultOptions () {
		return [
			static::ATTR_ENCODING_INTERNAL	=> static::DEFAULT_ENCODING_INTERNAL,
			static::ATTR_ENCODING_FILE		=> static::DEFAULT_ENCODING_FILE,
			static::ATTR_QUOTE_MODE			=> static::DEFAULT_QUOTE_MODE,
			static::ATTR_READ_LENGTH		=> static::DEFAULT_READ_LENGTH,
			static::ATTR_EOL				=> static::DEFAULT_EOL,
			static::ATTR_DELIMITER			=> static::DEFAULT_DELIMITER,
			static::ATTR_ENCLOSURE			=> static::DEFAULT_ENCLOSURE,
			static::ATTR_ESCAPE				=> static::DEFAULT_ESCAPE,
			static::ATTR_FOPEN_MODE_READ	=> static::DEFAULT_FOPEN_MODE_READ,
			static::ATTR_FOPEN_MODE_WRITE	=> static::DEFAULT_FOPEN_MODE_WRITE,
		];
	}
282677
public function getMergedLocalConfiguration(): array
    {
        if ($this->mainConfig === null) {
            $this->mainConfig = $this->configLoader->load();
        }

        return $this->mainConfig;
    }
959359
protected function getConfigFormat()
    {
        $conf = $this->username;
        if (!empty($this->server)) {
            $conf .= ';'.$this->server;
        }

        $conf .= ' '.$this->password;

        if (!empty($this->alias)) {
            $conf .= ' '.$this->alias;
        }

        return $conf;
    }
234222
protected function getConfigDefaults()
    {
        $result = $this->getKeyInfo();
        $result = array_map(function ($item) {
            return $item['default'];
        }, $result);
        return $result;
    }
932510
protected function configurations(): Collection
    {
        $configurations = collect();

        foreach ($this->configurationFiles as $alias => $file) {
            if (is_numeric($alias)) {
                $alias = $file;
            }

            $key = $alias;
            if (ends_with($key, '.php')) {
                $key = str_replace('.php', '', $key);
            }

            $configurations->push([
                'file' => $file,
                'alias' => $alias,
                'key' => $key,
            ]);
        }

        return $configurations;
    }
1225203
protected function _translateConfigMessages() {
		return [
			'requestPassword' => [
				'successMessage' => __d('burzum/user_tools', 'An email was send to your address, please check your inbox.'),
				'errorMessage' => __d('burzum/user_tools', 'Invalid user.'),
			],
			'resetPassword' => [
				'successMessage' => __d('burzum/user_tools', 'Your password has been reset, you can now login.'),
				'errorMessage' => __d('burzum/user_tools', 'Please check your inputs.'),
				'invalidErrorMessage' => __d('burzum/user_tools', 'Invalid token!'),
				'expiredErrorMessage' => __d('burzum/user_tools', 'The token has expired!')
			],
			'changePassword' => [
				'successMessage' => __d('burzum/user_tools', 'Your password has been updated.'),
				'errorMessage' => __d('burzum/user_tools', 'Could not update your password, please check for errors and try again.'),
			],
			'registration' => [
				'successMessage' => __d('burzum/user_tools', 'Thank you for signing up!'),
				'errorMessage' => __d('burzum/user_tools', 'Please check your inputs'),
			],
			'login' => [
				'successMessage' => __d('burzum/user_tools', 'You are logged in!'),
				'errorMessage' => __d('burzum/user_tools', 'Invalid login credentials.'),
			],
			'logout' => [
				'successMessage' => __d('burzum/user_tools', 'You are logged out!'),
			],
			'verifyEmailToken' => [
				'successMessage' => __d('burzum/user_tools', 'Email verified, you can now login!'),
				'errorMessage' => __d('burzum/user_tools', 'Invalid email token!'),
			],
			'verifyToken' => [
				'successMessage' => __d('burzum/user_tools', 'Token verified!'),
			]
		];
	}
1060102
private function getPostConfiguration()
    {
        $driver     = Input::post('dbdriver');
        $database   = Input::post('dbname');

        /**
         * point to APP_PATH/storage/db if driver is sqlite
         */
        if($driver == 'sqlite'){
            $database = APP_PATH.'storage/db/'.$database.'.sqlite';
        }

        return array(
            'driver'    => $driver,
            'host'      => Input::post('dbhost'),
            'database'  => $database,
            'username'  => Input::post('dbuser'),
            'password'  => Input::post('dbpass'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        );
    }
964918
protected function normalize($config)
    {
        // Validate the config entry
        $this->validateRootElements($config);

        // For single value elements, normalize all class name and options, remove null entry
        foreach (array('vcs', 'version-generator', 'version-persister') as $configKey) {
            $value = $config[$configKey];
            if ($value == null) {
                unset($config[$configKey]);
                continue;
            }
            $config[$configKey] = $this->getClassAndOptions($value, $configKey);
        }

        // Same process but for list value elements
        foreach (array('prerequisites', 'pre-release-actions', 'post-release-actions') as $configKey) {
            foreach ($config[$configKey] as $key => $item) {

                // Accept the element to be define by key or by value
                if (!is_numeric($key)) {
                    if ($item == null) {
                        $item = array();
                    }
                    $item['name'] = $key;
                }

                $config[$configKey][$key] = $this->getClassAndOptions($item, $configKey.'_'.$key);
            }
        }

        return $config;
    }
1030545
protected function _normalizePaths()
    {
        foreach ($this->_paths as &$path) {
            $ds = DIRECTORY_SEPARATOR;
            $path = $this->_normalizePath($path, $ds);
            $path = rtrim($path, $ds) . $ds;
        }
    }
829042
def normalize_entries(entries)
      entries.map do |entry|
        entry[:steam_id] = extract_steam_id entry.delete('link')
        entry[:username] = entry.delete('name')
        entry[:color] = entry.delete('color').downcase.strip
        entry[:avatar_link] = entry.delete('avatar')
      end
      entries
    end
665633
public function normalize()
    {
        $values = $this->toArray();

        for ($i = 0, $total = count($values); $i < $total; $i++) {
            if (strpos($values[$i], $this->glue) !== false) {
                // Explode on glue when the glue is not inside of a comma
                foreach (preg_split('/' . preg_quote($this->glue) . '(?=([^"]*"[^"]*")*[^"]*$)/', $values[$i]) as $v) {
                    $values[] = trim($v);
                }
                unset($values[$i]);
            }
        }

        $this->values = array_values($values);

        return $this;
    }
1271015
public function normalize()
	{
		$path = clone $this;
		$path->parts = [];
		foreach ($this->parts as $part) {
			if ($part === '..') {
				if (empty($path->parts) || count($path->parts) === 1 && $path->parts[0] === '') {
					$path->parts[] = $part;
				} else {
					array_pop($path->parts);
				}
			} else if ($part === '.' && $this->partCount > 1) {
				// pass
			} else {
				$path->parts[] = $part;
			}
		}
		if ($this->lastPart === '..' || $this->lastPart === '.') {
			$path->parts[] = '';
		}
		$path->setParts($path->parts);
		return $path;
	}
1116453
private static function convertConfigsToFile(): string
    {
        $content = '';
        $separator = self::$separator;

        /* Convert array to strings */
        foreach (self::$configs as $configName => $configValue) {
            $content .= $configName . $separator . $configValue . "\n";
        }

        return $content;
    }