Format module name.

Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.

@param array @vars

@return array
775840
public function inflectPackageVars($vars)
    {
        if ($vars['type'] == 'sydes-module') {
            return $this->inflectModuleVars($vars);
        }

        if ($vars['type'] === 'sydes-theme') {
            return $this->inflectThemeVars($vars);
        }

        return $vars;
    }
92021
public function getModulesAsArray()
    {

        // initialize the array for the modules
        $modules = array();

        // iterate over the module nodes and sort them into an array
        /** @var \AppserverIo\Appserver\Core\Api\Node\ModuleNode $module */
        foreach ($this->getModules() as $module) {
            $modules[$module->getUuid()] = $module->getType();
        }

        // return the array
        return $modules;
    }
213326
private function formatStructForApi(array $fields)
    {
        $fFields = [];

        foreach ($fields as $key => $value) {
            $fFields[$key] = $this->formatValueForApi($value);
        }

        return ['fields' => $fFields];
    }
1237005
private function formatTags(array $tags = [])
    {
        if (!$this->dataDog || count($tags) === 0) {
            return '';
        }

        $result = [];
        foreach ($tags as $key => $value) {
            if (is_numeric($key)) {
                $result[] = $value;
            } else {
                $result[] = sprintf('%s:%s', $key, $value);
            }
        }

        return sprintf('|#%s', implode(',', $result));
    }
653744
function getFormattedNamespaces() {
		$ns = $this->getNamespaces();
		foreach ( $ns as $k => $v ) {
			$ns[$k] = strtr( $v, '_', ' ' );
		}
		return $ns;
	}
888874
private static function getComposerNamespaces()
	{
		static $result = null;
		
		if ( !is_array($result) ) {
			$result = require self::$root . 'vendor/composer/autoload_namespaces.php';
			
			foreach ( $result as $ns => &$paths ) {
				$subpath = trim(str_replace('\\', DIRECTORY_SEPARATOR, $ns), DIRECTORY_SEPARATOR);
				foreach ( $paths as &$path ) {
					$path = rtrim($path, DIRECTORY_SEPARATOR);
					if ( is_dir("$path/$subpath") ) {
						$path = "$path/$subpath";
					}
				}
				unset($path);
			}
			unset($paths);
			
			$psr4 = require self::$root . 'vendor/composer/autoload_psr4.php';
			
			foreach ( $psr4 as $ns => $paths )
			{
				if ( isset($result[$ns]) ) {
					$result[$ns] = array_merge($result[$ns], $paths);
				}
				else {
					$result[$ns] = $paths;
				}
			}
		}
		
		return $result;
	}
1212831
public function formatRouteNameAndViewPathModifiers()
    {
        if ($this->alias) {
            $this->alias = str_finish($this->alias, '.');
        }

        if ($this->theme) {
            $this->theme = str_finish($this->theme, '.');
        }

        if ($this->prefix) {
            $this->prefix = str_finish($this->prefix, '.');
        }

        if ($this->module) {
            if (!ends_with($this->module, '::')) {
                $this->module .= '::';
            }
        }
    }
468686
public function inflectPackageVars($vars)
    {
        if ($vars['type'] === 'october-plugin') {
            return $this->inflectPluginVars($vars);
        }

        if ($vars['type'] === 'october-theme') {
            return $this->inflectThemeVars($vars);
        }

        return $vars;
    }
280320
private function getAppConfig($apps)
    {
        $pathinfo = trim($this->env->getPathinfo(), '/');
        $pathinfos = explode('/', $pathinfo);
        $group = isset($pathinfos[0]) ? $pathinfos[0] : '';
        $_apps = null;
        if (isset($apps[$group])) {
            $_apps = $apps[$group];
            array_shift($pathinfos);
            $this->env->setPathinfo(implode('/', $pathinfos));
        } elseif (isset($apps['vitex.default'])) {
            $_apps = $apps['vitex.default'];
        }
        return $_apps;
    }
1367721
def format_vars(args):
    """'"""
    variables = []
    for key, value in args.items():
        if value:
            variables += ['{0}={1}'.format(key, value)]
    return variables
958430
function defineAppVars()
    {
        $vars   = [];
        $vars[] = '// App Constants';
        $vars[] = [
            'key'   => 'APP_NAME',
            'label' => 'App Name',
            'value' => defined('APP_NAME') ? APP_NAME : 'Untitled',
        ];

        $vars[] = [
            'key'      => 'APP_DEFAULT_TIMEZONE',
            'label'    => 'App Timezone',
            'value'    => defined('APP_DEFAULT_TIMEZONE') ? APP_DEFAULT_TIMEZONE : date_default_timezone_get(),
            'validate' => function ($sInput) {
                return in_array($sInput, timezone_identifiers_list());
            },
        ];

        $vars[] = [
            'key'   => 'APP__KEY',
            'label' => 'App  Key',
            'value' => defined('APP_PRIVATE_KEY') && !empty(APP_PRIVATE_KEY) ? APP_PRIVATE_KEY : md5(rand(0, 1000) . microtime(true)),
        ];

        $vars[] = [
            'key'   => 'APP_DEVELOPER_EMAIL',
            'label' => 'Developer Email',
            'value' => defined('APP_DEVELOPER_EMAIL') ? APP_DEVELOPER_EMAIL : '',
        ];

        $vars[] = [
            'key'   => 'APP_DB_PREFIX',
            'label' => 'Prefix for app database tables',
            'value' => defined('APP_DB_PREFIX') ? 'app_' : '',
        ];

        // --------------------------------------------------------------------------

        //  Any constants defined by the components?
        $componentVars = $this->getConstantsFromComponents('APP', $vars);
        $vars          = array_merge($vars, $componentVars);

        // --------------------------------------------------------------------------

        //  Any other constants defined in app.php?
        $appFile = $this->getConstantsFromFile('config/app.php', $vars);
        $vars    = array_merge($vars, $appFile);

        // --------------------------------------------------------------------------

        return $vars;
    }
1288465
private function formatGemfile(array $dependencies)
    {
        $lines = ["source 'https://rubygems.org'"];
        foreach ($dependencies as $package => $version) {
            if ($version != '*') {
                $lines[] = sprintf("gem '%s', '%s', :require => false", $package, $version);
            } else {
                $lines[] = sprintf("gem '%s', :require => false", $package);
            }
        }

        return implode("\n", $lines);
    }
599333
protected function formatTemplate($template, array $vars)
    {
        $output = $template;
        $token = $this->buildToken();

        foreach ($vars as $key => $value) {
            $replacement = sprintf($token, $key);

            if (!$this->isFlagEnabled(self::ALLOW_NEWLINES)) {
                $value = $this->sanitizeNewlines($value);
            }

            if (false !== strpos($output, $replacement)) {
                $output = str_replace($replacement, $value, $output);
            }
        }

        $output = $this->removeExtraTokens($token, $output);

        return $output;
    }
371220
protected function formatRequirements(array $packages)
    {
        $requires = [];
        $packages = $this->normalizeRequirements($packages);
        foreach ($packages as $package) {
            $requires[$package['name']] = $package['version'];
        }

        return $requires;
    }
615615
public function parseModuleChains($modules)
    {
        $moduleArray = [];

        if (is_array($modules)) {
            foreach ($modules as $class => $moduleChain) {
                if (strstr($moduleChain, '&')) {
                    $moduleChain = explode('&', $moduleChain);
                } else {
                    $moduleChain = [$moduleChain];
                }
                $moduleArray[$class] = $moduleChain;
            }
        }

        return $moduleArray;
    }
145860
protected function getPrefixGroups(array $strings)
	{
		$groups = [];
		foreach ($strings as $k => $string)
		{
			if ($this->hasOptionalSuffix($string))
			{
				$groups[serialize(end($string))][$k] = $string;
			}
		}

		return $groups;
	}
256971
protected function values($vars)
    {
        if (is_array($vars)) {
            return $vars;
        }
        $attributes = array();
        foreach (explode('|', $vars) as $value) {
            if (strpos($value, '=')) {
                list($key, $value) = explode('=', $value);
                $attributes[trim($key)] = trim($value);
            }
        }

        return $attributes;
    }