/** * forges AppBuilder. * * $options = array( * 'env' => 'env-name', // or array of env-names. * 'debug' => true, // or false. * 'env-file' => 'env-file-name', * ) * * @param string $app_dir * @param string|null $var_dir * @param array $options * @return AppBuilder */ public static function forge($app_dir, $var_dir = null, $options = []) { $builder = new self($app_dir, $var_dir); if (isset($options['debug'])) { $builder->debug = $options['debug']; } // set environment if (isset($options['env'])) { // directly specify using 'env'. $builder->envObj->setEnvironment((array) $options['env']); } elseif (isset($options['env-file'])) { // or, set from 'env-file'. $builder->loadEnvironment($options['env-file']); } $options['app-dir'] = $app_dir; $options['var-dir'] = $var_dir; $builder->setOptions($options); return $builder; }