@param string $state

@return string
974358
protected function getAuthUrl($state)
    {
        // 网页授权登录
        if (!empty($this->scopes)) {
            return $this->getOAuthUrl($state);
        }

        // 第三方网页应用登录（扫码登录）
        return $this->getQrConnectUrl($state);
    }
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();
        }
    }
1170200
public function generateRedirectUri($state = null, $queryDelimeter = '?')
    {
        $uri = $this->getRedirectUri();
        $uri .= (strstr($this->getRedirectUri(), $queryDelimeter) === false) ? $queryDelimeter : '&';

        return $uri.http_build_query([
            'code'  =>  $this->getId(),
            'state' =>  $state,
        ]);
    }
1283924
protected function getQrConnectUrl($state)
    {
        $queries = [
            'appid' => $this->clientId,
            'agentid' => $this->agentId,
            'redirect_uri' => $this->redirectUrl,
            'state' => $state,
        ];

        return 'https://open.work.weixin.qq.com/wwopen/sso/qrConnect?'.http_build_query($queries);
    }
714249
public function getState($state = null)
	{
		if ($state === null) {
			$state = $this->getValue();
		}

		if (!isset($this->states[$state])) {
			return 'default';
		}

		return $this->states[$state];
	}
324705
public function getStateElement($state = null) {
		if (is_bool($state) && ($state === true)) {
			$state = 2;
		}

		switch ((int)$state) {
			case 2:
				$stateText = $this->Html->tag('span', '', ['class' => 'fas fa-check']);
				$titleText = __d('cake_installer', 'Ok');
				$labelClass = 'label-success';
				break;
			case 1:
				$stateText = $this->Html->tag('span', '', ['class' => 'fas fa-minus']);
				$titleText = __d('cake_installer', 'Ok');
				$labelClass = 'label-warning';
				break;
			default:
				$stateText = $this->Html->tag('span', '', ['class' => 'fas fa-times']);
				$titleText = __d('cake_installer', 'Bad');
				$labelClass = 'label-danger';
		}

		return $this->Html->tag('span', $stateText, [
			'class' => 'label' . ' ' . $labelClass,
			'title' => $titleText, 'data-toggle' => 'tooltip']);
	}
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);
    }
1265908
function restore($state=1) {
		$fw=Base::instance();
		if ($this->flag && is_file($file=($path=$fw->get('TEMP').
			$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'.
			$fw->hash($this->file).'-').$state.'.png')) {
			if (is_resource($this->data))
				imagedestroy($this->data);
			$this->data=imagecreatefromstring($fw->read($file));
			imagesavealpha($this->data,TRUE);
			foreach (glob($path.'*.png',GLOB_NOSORT) as $match)
				if (preg_match('/-(\d+)\.png/',$match,$parts) &&
					$parts[1]>$state)
					@unlink($match);
			$this->count=$state;
		}
		return $this;
	}
1128417
protected function determinePriority($state)
    {
        $priority = 0;

        if (array_key_exists($state, $this->stateToPriorityMap)) {
            $priority = $this->stateToPriorityMap[$state];
        }

        return $priority;
    }
1087120
public function setState($state)
    {
        if (!empty($state) && is_string($state) && ctype_print($state)) {
            $this->state = trim($state);
        }

        return $this;
    }
867195
public function setState(?string $state): Webhook
    {
        if (null !== $state) {
            Assert::oneOf($state, self::VALID_STATES);

            $this->state = $state;
        }

        return $this;
    }
904593
function renderingTitle($state = null) {
		if (!is_null($state)) {
			$this->_renderingTitle = $state;
		}
		return $this->_renderingTitle;
	}
1116114
private function treatState($defaultState)
    {

        if (strlen($defaultState) == 2) {
            foreach (self::$acronyms as $key => $val) {
                if ($val == strtoupper($defaultState)) {
                    return strtoupper($defaultState);
                }
            }
            return '';
        }

        $state = utf8_decode($defaultState);
        $state = strtolower($state);

        // Code ASCII of the vowel
        $ascii['a'] = range(224, 230);
        $ascii['e'] = range(232, 235);
        $ascii['i'] = range(236, 239);
        $ascii['o'] = array_merge(range(242, 246), array(240, 248));
        $ascii['u'] = range(249, 252);

        // Code ASCII of the others character
        $ascii['b'] = array(223);
        $ascii['c'] = array(231);
        $ascii['d'] = array(208);
        $ascii['n'] = array(241);
        $ascii['y'] = array(253, 255);

        foreach ($ascii as $key => $item) {
            $accents = '';
            foreach ($item as $code) {
                $accents .= chr($code);
            }
            $change[$key] = '/[' . $accents . ']/i';
        }

        $state = preg_replace(array_values($change), array_keys($change), $state);

        $state = preg_replace("/\s/", "", $state);

        foreach (self::$acronyms as $key => $val) {
            if ($key == $state) {
                $acronym = $val;
                return $acronym;
            }
        }

        return '';
    }
194042
protected function isRedirectState($state)
	{
		$state = (int) $state;

		return $state > 299 && $state < 400 && array_key_exists($state, $this->responseMap);
	}
794040
public function setState($state)
    {
        $oldState = $this->getState()->getUri();
        if ($oldState == $state) {
            common_Logger::w('Delivery execution ' . $this->getIdentifier() . ' already in state ' . $state);
            return false;
        }
        $this->setData(OntologyDeliveryExecution::PROPERTY_STATUS, $state);
        if ($state == DeliveryExecutionInterface::STATE_FINISHED) {
            $this->setData(OntologyDeliveryExecution::PROPERTY_TIME_END, microtime());
        }
        return $this->service->updateDeliveryExecutionStatus($this, $oldState, $state);
    }
1144166
public function getStepLabel(ModelState $state)
    {
        $step = $this->aggregator
            ->getProcess($state->getProcessName())
            ->getStep($state->getStepName());

        return $step instanceof Step ? $step->getLabel() : '';
    }
455971
public function getState($state)
    {
        if ($state instanceof StatableInterface) {
            $state = $state->getState();
        }

        return $this->options['state']['translation'].'.'.$state;
    }