Format a state name.

@param string $state

@return string
518514
public static function formatState($state)
    {
        return isset(self::$stateNames[$state]) ? self::$stateNames[$state] : $state;
    }
77544
public function recode_legacy_state_answer($state) {
        $answer = $state->answer;
        $resultarr = array();
        foreach (explode(',', $answer) as $pair) {
            $pairarr = explode('-', $pair);
            $questionid = $pairarr[0];
            $answerid = $pairarr[1];
            $newquestionid = $questionid ? $this->get_mappingid('question', $questionid) : 0;
            $newanswerid = $answerid ? $this->get_mappingid('question_answer', $answerid) : 0;
            $resultarr[] = implode('-', array($newquestionid, $newanswerid));
        }
        return implode(',', $resultarr);
    }
1297274
public function andStateIsNotIn($states)
    {
        if (false === is_array($states)) {
            $states = array($states);
        }

        $suffix = $this->getSuffix();

        return $this->andWhere($this->getAlias().'._state NOT IN (:states'.$suffix.')')
                        ->setParameter('states'.$suffix, $states);
    }
940144
public function states($states = null)
    {
        if ($states === null) {
            return $this->_states;
        } else {
            unset($states['id']);
            foreach ($states as $key => $value) {
                $this->_states[$key] = $value;
            }
            $this->save();
        }
    }
725015
public String stateName(
    int      state)
  {
    String name = "Unknown state = " + state;
    switch(state)
    {
      case NodeStack.VISIT_LEFT:
        name = "VISIT_LEFT";
        break;
      case NodeStack.PROCESS_CURRENT:
        name = "PROCESS_CURRENT";
        break;
      case NodeStack.VISIT_RIGHT:
        name = "VISIT_RIGHT";
        break;
      case NodeStack.DONE_VISITS:
        name = "DONE_VISITS";
        break;
    }
    return name;
  }
291884
protected function formatAction($action)
    {
        if (is_array($action)) {
            $action = '\\'.implode('@', $action);
        }

        if ($this->rootNamespace && strpos($action, '\\') !== 0) {
            return $this->rootNamespace.'\\'.$action;
        } else {
            return trim($action, '\\');
        }
    }
1043810
public function get($state) : State
    {
        $this->addCallback('GET', $state);
        if (!isset($this->actions['POST'])) {
            $this->addCallback('POST', $state);
        }
        return $this;
    }
191649
function getLoginUrl($state) {
        $loginUrl = "https://accounts.google.com/o/oauth2/auth?"
            . "client_id=" . $this->client_id
            . "&redirect_uri=" . $this->redirect
            . "&state=" . $state
            . "&response_type=code"
            . "&scope=email%20profile" 
            . "&include_granted_scopes=true";

        if ( $this->openid_realm ) {
            $loginUrl .= "&openid.realm=" . $this->openid_realm;
        }
        return $loginUrl;
    }
1333092
public function removeAuthContextClassRefWithPrefix(&$state)
    {
        $conf = Configuration::getConfig(self::CONFIG_FILE_NAME);
        $prefix = $conf->getString(self::PROPNAME_PREFIX, null);

        if (is_null($prefix)) {
            return;
        }
        unset($state['saml:RequestedAuthnContext']['AuthnContextClassRef']);
        $array = array();
        foreach ($this->authnContextClassRef as $value) {
            if (!(substr($value, 0, strlen($prefix)) === $prefix)) {
                array_push($array, $value);
            }
        }
        if (!empty($array)) {
            $state['saml:RequestedAuthnContext']['AuthnContextClassRef']
                = $array;
        }
    }
1038823
protected function getState($state = null)
	{
		if(null === $state)
		{
			if(null === $this->state)
			{
				$this->state = md5(\uniqid('', true));
			}
		}
		else
		{
			$this->state = $state;
		}
		return $this->state;
	}
469151
public function setOverwrite($state = false)
	{
		$tmp = $this->overwrite;

		if ($state)
		{
			$this->overwrite = true;
		}
		else
		{
			$this->overwrite = false;
		}

		return $tmp;
	}
251343
public static function setValidationState( $state = true)
	{
		$previousState = XBRL::$validating;
		XBRL::$validating = $state;
		return $previousState;
	}
268145
public static function formatName($role): string
    {
        if ($role instanceof RoleInterface) {
            return $role->getName();
        }

        return $role instanceof Role ? $role->getRole() : (string) $role;
    }
1310776
public function setState($state)
    {
        if (!is_numeric($state)) {
            $errMsg = sprintf('Аргумент должен быть числом. Актуальное значение %s', $state);
            throw new ArgumentNotNumericException($errMsg);
        }
        $this->state = (integer)$state;

        return $this;
    }
911946
protected function stateHasAfterCallback($state)
    {
        return isset($this->afterMaking[$this->class][$state]) ||
               isset($this->afterCreating[$this->class][$state]);
    }
1269902
public function tokenize($state)
    {
        $rules = $this->ruler->getRules('');
        $len = count($rules);
        $end = $state->posMax;
        $maxNesting = $state->md->options->maxNesting;
        $ok = false;

        $i = 0;
        while ($state->pos < $end) {
            // Try all possible rules.
            // On success, rule should:
            //
            // - update `state.pos`
            // - update `state.tokens`
            // - return true
            if($state->pos == 3){
                $test = 0;
            }else if($state->pos == 17){
                $test = 0;
            }

            if ($state->level < $maxNesting) {
                $i = 0;
                foreach ($rules as &$rule) {
                    $i++;
                    if( is_array($rule) )
                        $ok = $rule[0]->{$rule[1]}($state, false);
                    else
                        $ok = $rule($state, false);
                    if ($ok) { break; }
                }
            }

            if ($ok) {
                if ($state->pos >= $end) { break; }
                continue;
            }

            $state->pending .= $state->src[$state->pos++];
        }

        if ($state->pending) {
            $state->pushPending();
        }
    }
655254
public function recode_legacy_state_answer($state) {
        $answer = $state->answer;
        $result = '';
        if ($answer) {
            $result = $this->get_mappingid('question_answer', $answer);
        }
        return $result;
    }