Configures the phpCAS object for the USF CAS environments.

@param string $environment

@throws Exception
508300
private function setCasEnvironment($environment)
    {
        switch ($environment) {
            case 'development':
                $this->setCasHost('authtest.it.usf.edu');
                $this->setCasPort(443);
                $this->setCasContext('/');
                $this->configureCasClient();
                $this->setCasCaCertPath('/etc/USF-CA-chain.pem');
                phpCAS::handleLogoutRequests(false);
                break;

            case 'production':
                $this->setCasHost('webauth.usf.edu');
                $this->setCasPort(443);
                $this->setCasContext('/');
                $this->configureCasClient();
                $this->setCasCaCertPath('/etc/USF-CA-chain.pem');
                phpCAS::handleLogoutRequests(false);
                break;

            case 'impersonate':
                $this->setCasHost('authtest.it.usf.edu');
                $this->setCasPort(444);
                $this->setCasContext('/');
                $this->configureCasClient();
                $this->setCasCaCertPath('/etc/USF-CA-chain.pem');
                phpCAS::handleLogoutRequests(false);
                break;

            default:
                throw new Exception("Unknown auth environment: " . $environment, 500);
                break;
        }
    }
1070491
public function setEnvironment(string $environment): Bootstrap
    {
        Environment::validateEnvironment($environment);
        $this->environment = $environment;

        return $this;
    }
422826
public function inherits(string ...$roles)
    {
        foreach ($roles as $role)
        {
            if (!$this->roleRegistry->exists($role)) {
                throw new \Exception(
                    sprintf(
                        "The role: %s doesnt exist",
                        (string)$role
                    )
                );
            }

            $this->roleRegistry->setRegistryValue($this->session["role"], $role);
        }

        $this->initSession();
    }
486559
public function set($name, $value)
    {
        if (!is_string($name)) {
            throw new \Exception("Invalid configuration key.");
        }

        $this->config[$name] = $value; //$this->prepare($value, $name);
    }
822086
protected function processConfigurationTraitCRUD(&$configuration)
    {
        if(!isset($configuration['subjects'][$this->name]['CRUD'])) {
            throw new \Exception(sprintf('missing CRUD configuration for subject %s', $this->name));
        }
        if(!isset($configuration['subjects'][$this->name]['CRUD']['actions'])) {
            throw new \Exception(sprintf('missing CRUD actions configuration for subject %s', $this->name));
        }
        if(!isset($configuration['subjects'][$this->name]['CRUD']['inputFields'])) {
            throw new \Exception(sprintf('missing CRUD inputFields configuration for subject %s', $this->name));
        }
    }
1199382
public function execute(): void
    {
        self::configure();
        if (false === $this->io->isVerbose()) {
            return;
        }

        $this->io->write('<info>Configured phpcs to use Hostnet standard</info>');
    }
1023417
protected function setOptions()
    {
        $this->ssoServerUrl = null;
        $this->brokerName = null;
        $this->brokerSecret = null;

        if (!$this->ssoServerUrl || !$this->brokerName || !$this->brokerSecret) {
            throw new Exception('Missing configuration values.');
        }
    }
129616
public function setConfigArray($config)
    {
        if (is_null($config) || !is_array($config)) {
            throw new \Exception(Lang::get('missing_phpci_yml'));
        }

        $this->config = $config;
    }
905746
public static function setLang($lang)
    {
        phpCAS::_validateClientExists();

        try {
            self::$_PHPCAS_CLIENT->setLang($lang);
        } catch (Exception $e) {
            phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
        }
    }
328271
public function deleteEnvironmentConfiguration(string $name)
    {
        if (array_key_exists($name, $this->environmentConfigurations)) {
            unset($this->environmentConfigurations[$name]);
        } else {
            throw new DomainException('There is no environment configuration with name' . $name);
        }
    }
1018159
public function create(Environment $environment)
    {
        $scheme = $environment->getRequestScheme();
        $host   = $environment->getHost();
        $port   = $environment->getPort();
        $query  = $environment->getQueryString();
        $user   = $environment->getAuthUser();
        $pass   = $environment->getAuthPassword();

        // parse_url() requires a full URL - but only URL path is need it here.
        $path = parse_url('http://example.com' . $environment->getRequestUri(), PHP_URL_PATH);
        if ($path === false) {
            throw new InvalidArgumentException('Uri path must be a string');
        }

        return new Uri($scheme, $host, $port, $path, $query, '', $user, $pass);
    }
132295
public static function Init(?string $host = null, ?int $port = null, ?string $dbname = null, ?string $user = null, ?string $pass = null, ?string $encoding = 'UTF8', ?bool $useCache = null) :void
        {
            if (!self::IsSupported()) {
                throw new \Exception('PostgreSQL is not supported!');
            }

            if (self::$inited) {
                return;
            }

            self::$inited = true;

            self::$host     = is_null($host) ? Cfg::Get('Vxn.storage.postgres.host', '127.0.0.1') : $host;
            self::$port     = is_null($port) ? Cfg::Get('Vxn.storage.postgres.port', '5432') : $port;
            self::$dbname   = is_null($dbname) ? Cfg::Get('Vxn.storage.postgres.dbname', '') : $dbname;
            self::$user     = is_null($user) ? Cfg::Get('Vxn.storage.postgres.user', '') : $user;
            self::$pass     = is_null($pass) ? Cfg::Get('Vxn.storage.postgres.pass', '') : $pass;
            self::$encoding = is_null($encoding) ? Cfg::Get('Vxn.storage.postgres.encoding', 'UTF8') : $encoding;
            self::$useCache = is_null($useCache) ? Cfg::Get('Vxn.storage.postgres.useCache', false) : $useCache;

            Engine::RegisterFinalShutdown(function () {
                self::CloseConnection();
            });
        }
1269575
public function setEnvironment($environment = 'test')
    {
        $environment = trim($environment);
        if ($environment === 'live') {
            //Live
            $this->_setEnvironment = 'https://sis.redsys.es/sis/realizarPago';
        } elseif ($environment === 'test') {
            //Test
            $this->_setEnvironment = 'https://sis-t.redsys.es:25443/sis/realizarPago';
        } else {
            throw new TpvException('Add test or live');
        }

        return $this;
    }
1232153
public function prepare(string $confKey)
    {
        $this->config = getInstance()->config['kafka'] ?? [];
        if (!isset($this->config[$confKey])) {
            throw new Exception('No such a kafka config ' . $confKey);
        }
        $this->setting = $this->config[$confKey];
        $this->kafkaConf = new Conf();
        foreach ($this->setting as $k => $value) {
            $this->kafkaConf->set($k, $value);
        }
    }
979625
private function setCasCaCertPath($ca_file)
    {
        if ($ca_file === 'none') {
            phpCAS::setNoCasServerValidation();
        } else {
            if (file_exists($ca_file) && is_readable($ca_file)) {
                phpCAS::setCasServerCACert($ca_file);
            } else {
                throw new Exception("Unable to read CAS CA-Cert file: " . $ca_file, 500);
            }
        }
    }
1288292
private function configureSslValidation()
    {
        // set SSL validation for the CAS server
        if ($this->config['cas_validation'] == 'ca' || $this->config['cas_validation'] == 'self')
        {
            phpCAS::setCasServerCACert($this->config['cas_cert']);
        }
        else
        {
            phpCAS::setNoCasServerValidation();
        }
    }
115585
public function setEnv($properties)
    {
        $envPath = app()->environmentFilePath();

        $contents = File::get($envPath);
        if(!$contents) {
            throw new \Exception('Could not read env file');
        }

        foreach($properties as $key => $value){
            // Env value must be set so the already loaded file reflect changes
            $this->setEnvValue($key, $value);

            // Change content
            $contents = preg_replace('/' . $key . '=(.*)/', $key . '=' . $value, $contents);
        }

        if (File::put($envPath, $contents) === false) {
            throw new \Exception('Could not write env file');
        }

        return true;
    }