Evaluate

@param Environment $env
502179
public function evaluate(EnvironmentInterface $env)
    {
        $qb = $env->queryBuilder;
        
        $value = $env->newParamName();

        switch ($this->operator) {
            case 'equals':
                $qb->andWhere('a.'.$this->attribute.' = :'.$value);
                $qb->setParameter($value, $this->getRight()->getValue());
                break;
            case 'notequals':
                $qb->andWhere('a.'.$this->attribute.' <> :'.$value);
                $qb->setParameter($value, $this->getRight()->getValue());
                break;
            case 'contains':
                $qb->andWhere('a.'.$this->attribute.' LIKE :'.$value);
                $qb->setParameter($value, '%'. $this->getRight()->getValue().'%');
                break;
            case 'greaterthan':
                $qb->andWhere('a.'.$this->attribute.' > :'.$value);
                $qb->setParameter($value, $this->getRight()->getValue());
                break;
            case 'lessthan':
                $qb->andWhere('a.'.$this->attribute.' < :'.$value);
                $qb->setParameter($value, $this->getRight()->getValue());
                break;
        }
    }
1102700
private function getDefinition($env, $key)
	{
		return isset($this->definitions[$env][$key])
			? $this->definitions[$env][$key]
			: null;
	}
460751
private function deleteCache(string $env)
    {
        Output::displayAsSuccess("Hey, I delete cache from $env environment ", "none");
        $this->callDelCreaServer($env);
        if (in_array("--noexit", $this->options["options"])) {
            Output::displayAsEndSuccess("Cache delete for $env environment is successfull.", "none");
        } else {
            Output::displayAsNormal("Cache delete for $env environment is successfull.");
        }
    }
1084532
private function renderParentProperty(EnvironmentInterface $environment, $property, $value)
    {
        $evaluation = $property->getExtra();

        if (\is_array($value)) {
            return \implode(', ', $value);
        }

        $isRendered = false;

        $value = $this->renderForCheckbox($property, $value, $isRendered);
        $value = $this->renderForDateTime($environment, $property, $value, $isRendered);
        $value = $this->renderReference($value, $evaluation['reference'], $isRendered);

        $options = $property->getOptions();
        if ($evaluation['isAssociative'] || \array_is_assoc($options)) {
            $value = $options[$value];
        }

        return $value;
    }
401195
public function setEnvironments($env) {
    $envs = (explode('+', $env));
    while (!empty($envs)) {
      $_env = array_shift($envs);
      if (!$this->setEnvironment($_env)) {
        $msg = dt("Unable to locate an environment definition for '@env'.", ['@env' => $_env]);
        if (empty($envs)) {
          drush_log($msg, 'warning');
          return FALSE;
        }
        else {
          drush_log($msg, 'warning');
          if (!drush_confirm(dt("Do you want to process the other environments?"))) {
            return drush_user_abort(dt("Aborting."));
          }
        }
      }
    }

    return TRUE;
  }
539269
public function setEnv($env = null)
    {
        if (in_array($env, \WebServCo\Framework\Environment::getOptions())) {
            $this->env = $env;
        } else {
            $this->env = \WebServCo\Framework\Environment::ENV_DEV;
        }

        return true;
    }
727126
public function env($env, $value = null)
    {
        if (! is_array($env)) {
            $env = [$env => $value];
        }

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

        return $this;
    }
341903
public static function determineAuthorization($env): Collection
    {
        $authorization = $env->get('HTTP_AUTHORIZATION');

        if (null === $authorization && \is_callable('getallheaders')) {
            $headers = \getallheaders();
            $headers = \array_change_key_case($headers, CASE_LOWER);

            if (isset($headers['authorization'])) {
                $env->set('HTTP_AUTHORIZATION', $headers['authorization']);
            }
        }

        return $env;
    }
956151
static function fromEnvironment(array $env = null): self {
    if (!is_array($env)) $env = $_ENV ?: $_SERVER;
    $config = new static;

    // Standard.
    $serviceName = $env['CI_NAME'] ?? '';
    if (mb_strlen($serviceName)) $config['service_name'] = $serviceName;

    if (isset($env['CI_BRANCH'])) $config['service_branch'] = $env['CI_BRANCH'];
    if (isset($env['CI_BUILD_NUMBER'])) $config['service_number'] = $env['CI_BUILD_NUMBER'];
    if (isset($env['CI_BUILD_URL'])) $config['service_build_url'] = $env['CI_BUILD_URL'];
    if (isset($env['CI_COMMIT'])) $config['commit_sha'] = $env['CI_COMMIT'];
    if (isset($env['CI_JOB_ID'])) $config['service_job_id'] = $env['CI_JOB_ID'];

    if (isset($env['CI_PULL_REQUEST']) && preg_match('/(\d+)$/', $env['CI_PULL_REQUEST'], $matches)) {
      if (count($matches) >= 2) $config['service_pull_request'] = $matches[1];
    }

    // Coveralls.
    if (isset($env['COVERALLS_REPO_TOKEN']) || isset($env['COVERALLS_TOKEN']))
      $config['repo_token'] = $env['COVERALLS_REPO_TOKEN'] ?? $env['COVERALLS_TOKEN'];

    if (isset($env['COVERALLS_COMMIT_SHA'])) $config['commit_sha'] = $env['COVERALLS_COMMIT_SHA'];
    if (isset($env['COVERALLS_PARALLEL'])) $config['parallel'] = $env['COVERALLS_PARALLEL'];
    if (isset($env['COVERALLS_RUN_AT'])) $config['run_at'] = $env['COVERALLS_RUN_AT'];
    if (isset($env['COVERALLS_SERVICE_BRANCH'])) $config['service_branch'] = $env['COVERALLS_SERVICE_BRANCH'];
    if (isset($env['COVERALLS_SERVICE_JOB_ID'])) $config['service_job_id'] = $env['COVERALLS_SERVICE_JOB_ID'];
    if (isset($env['COVERALLS_SERVICE_NAME'])) $config['service_name'] = $env['COVERALLS_SERVICE_NAME'];

    // Git.
    if (isset($env['GIT_AUTHOR_EMAIL'])) $config['git_author_email'] = $env['GIT_AUTHOR_EMAIL'];
    if (isset($env['GIT_AUTHOR_NAME'])) $config['git_author_name'] = $env['GIT_AUTHOR_NAME'];
    if (isset($env['GIT_BRANCH'])) $config['service_branch'] = $env['GIT_BRANCH'];
    if (isset($env['GIT_COMMITTER_EMAIL'])) $config['git_committer_email'] = $env['GIT_COMMITTER_EMAIL'];
    if (isset($env['GIT_COMMITTER_NAME'])) $config['git_committer_name'] = $env['GIT_COMMITTER_NAME'];
    if (isset($env['GIT_ID'])) $config['commit_sha'] = $env['GIT_ID'];
    if (isset($env['GIT_MESSAGE'])) $config['git_message'] = $env['GIT_MESSAGE'];

    // CI services.
    if (isset($env['TRAVIS'])) {
      $config->merge(TravisCI::getConfiguration($env));
      if (mb_strlen($serviceName) && $serviceName != 'travis-ci') $config['service_name'] = $serviceName;
    }
    else if (isset($env['APPVEYOR'])) $config->merge(AppVeyor::getConfiguration($env));
    else if (isset($env['CIRCLECI'])) $config->merge(CircleCI::getConfiguration($env));
    else if ($serviceName == 'codeship') $config->merge(Codeship::getConfiguration($env));
    else if (isset($env['GITLAB_CI'])) $config->merge(GitLabCI::getConfiguration($env));
    else if (isset($env['JENKINS_URL'])) $config->merge(Jenkins::getConfiguration($env));
    else if (isset($env['SEMAPHORE'])) $config->merge(Semaphore::getConfiguration($env));
    else if (isset($env['SURF_SHA1'])) $config->merge(Surf::getConfiguration($env));
    else if (isset($env['TDDIUM'])) $config->merge(SolanoCI::getConfiguration($env));
    else if (isset($env['WERCKER'])) $config->merge(Wercker::getConfiguration($env));

    return $config;
  }
203507
public function getEnvBaseUrl($env)
    {
        switch ($env) {
            case self::ENV_PROD:
                return self::BASE_URL_PROD;
            case self::ENV_STAGE:
                return self::BASE_URL_STAGE;
            case self::ENV_MOCK:
                return null;
        }
    }
1364701
protected function multiplySelectors(Environment $env)
    {
        $envs            = $this->compactEnv($env);
        $selectors       = [];
        $parentSelectors = [[]];

        while ($env = array_pop($envs)) {
            if (empty($env->selectors)) {
                continue;
            }
            if ($env->block->type == Type::T_AT_ROOT) {
                break;
            }
            $selectors = [];
            if (!empty($env->block->parent->atrootParent) && !empty($env->block->parent->atrootParent->selectors)) {
                $parentSelectors = $env->block->parent->atrootParent->selectors;
            }
            if (!empty($env->parent->parent->block->atrootParentSelectors)) {
                $parentSelectors = $env->parent->parent->block->atrootParentSelectors;
            }

            foreach ($env->selectors as $selector) {
                foreach ($parentSelectors as $parent) {
                    $selectors[] = $this->joinSelectors($parent, $selector);
                }
            }

            $parentSelectors = $selectors;
        }

        return $selectors;
    }
1116096
public function onPeridotStart(Environment $env)
    {
        $definition = $env->getDefinition();
        $definition->option('concurrent', null, InputOption::VALUE_NONE, 'run specs concurrently');
        $definition->option('processes', 'p', InputOption::VALUE_REQUIRED, 'number of processes to use');
    }
635030
public static function setEnv(array $env = [])
    {
        self::$envIsSet = true;

        foreach ($env as $variable => $value) {
            self::setEnvironmentVariable($variable, $value);
        }
    }
198133
public function getoneConfigActivity(string $env):Renderer
    {
        if (!in_array($env, array("dev", "prod"))) {
            throw new Server500(new \ArrayObject(array("explain" => "Undefined environment $env", "solution" =>
            "Environment must be [dev or prod]")));
        }

        $file = (array) JL::open(FEnv::get("framework.config").'hosts/hosts.'.$env.'.json');
        if (!(isset($file['allowed'])) || !(isset($file['denied']))) {
            throw new Server500(new \ArrayObject(array("explain" => "Undefined key allowed or denied in host.dev.json",
                "solution" => "Add the correct tags [allowed, denied]")));
        }

        $allowed = ((array)$file['allowed']);
        $denied = ((array)$file['denied']);


        return ((new Renderer())->jsonRenderer(array("code" => 200,
            "results" => array("allowed" => implode(";", $allowed), "denied" => implode(";", $denied)))));
    }
1157284
private function convertEnvValue($value, $environmentVariable)
    {
        $value = trim(trim(trim($value, '\''), '"'));

        if ($this->isBoolean($value)) {
            $value = $this->convertBoolean($value);
        } elseif ($this->isInteger($value)) {
            $value = $this->convertInteger($value);
        } elseif ($this->isJson($value)) {
            $value = $this->convertJson($value, $environmentVariable);
        }

        return $value;
    }
1240096
def evaluate(self, env):
        
        if self.ident in env.functions:
            arg_vals = [expr.evaluate(env) for expr in self.args]
            try:
                out = env.functions[self.ident](*arg_vals)
            except Exception as exc:
                # Function raised exception! Maybe inlining the name of
                # the exception will help debug.
                return u'<%s>' % str(exc)
            return str(out)
        else:
            return self.original
462921
def evaluate(self, env):
        
        if self.ident in env.values:
            # Substitute for a value.
            return env.values[self.ident]
        else:
            # Keep original text.
            return self.original