/** * @param \ezcConsoleInput $input * * @return \TheSeer\Autoload\Config */ private function configure(\ezcConsoleInput $input) { $config = new Config($input->getArguments()); if ($input->getOption('quiet')->value) { $config->setQuietMode(TRUE); } if ($input->getOption('compat')->value) { $config->setCompatMode(TRUE); } if ($input->getOption('tolerant')->value) { $config->setTolerantMode(TRUE); } if ($output = $input->getOption('output')->value) { $config->setOutputFile($output); } if ($input->getOption('phar')->value) { $compression = \Phar::NONE; if ($input->getOption('bzip2')->value === TRUE) { $compression = \Phar::BZ2; } else { if ($input->getOption('gzip')->value === TRUE) { $compression = \Phar::GZ; } } $config->enablePharMode($compression, $input->getOption('all')->value, $input->getOption('key')->value, $input->getOption('alias')->value); $config->setVariable('PHAR', $input->getOption('alias')->value ? $input->getOption('alias')->value : basename($output)); if ($hashAlgorithm = $input->getOption('hash')->value) { $config->setPharHashAlgorithm($hashAlgorithm); } } if ($input->getOption('cache')->value) { $config->setCacheFile($input->getOption('cache')->value); } if ($basedir = $input->getOption('basedir')->value) { $config->setBaseDirectory($basedir); } $include = $input->getOption('include')->value; if (!is_array($include)) { $include = array($include); } $config->setInclude($include); if ($exclude = $input->getOption('exclude')->value) { if (!is_array($exclude)) { $exclude = array($exclude); } $config->setExclude($exclude); } $whitelist = $input->getOption('whitelist')->value; if (!is_array($whitelist)) { $whitelist = array($whitelist); } $config->setWhitelist($whitelist); if ($blacklist = $input->getOption('blacklist')->value) { if (!is_array($blacklist)) { $blacklist = array($blacklist); } $config->setBlacklist($blacklist); } if ($input->getOption('static')->value) { $config->setStaticMode(TRUE); } if ($input->getOption('once')->value) { $config->setOnceMode(TRUE); } if ($input->getOption('follow')->value) { $config->setFollowSymlinks(TRUE); } if ($input->getOption('prepend')->value) { $config->enablePrepend(); } if ($input->getOption('no-exception')->value) { $config->disableExceptions(); } $indent = $input->getOption('indent')->value; if ($indent !== FALSE) { $config->setIndent($indent); } if ($template = $input->getOption('template')->value) { $config->setTemplate($template); } if ($linebreak = $input->getOption('linebreak')->value) { $config->setLinebreak($linebreak); } if ($input->getOption('nolower')->value) { $config->setLowercaseMode(FALSE); } if ($variables = $input->getOption('var')->value) { foreach ($variables as $var) { if (strpos($var, '=') === FALSE) { throw new \RuntimeException("Variable defintion '{$var}' is invalid and cannot be processed."); } list($name, $value) = explode('=', $var, 2); $config->setVariable($name, $value); } } if ($input->getOption('paranoid')->value || !$input->getOption('trusting')->value) { $config->setTrusting(FALSE); } return $config; }