Build HTML element with status icon from status value

@param int $state State for build HTML elemeth.
Integer value:
- `0` - Bad;
- `1` - Warning;
- `2` - Success.
@return string Result HTML element with status text
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']);
	}
1221936
protected function _validate($state)
    {
        // Unique values can't be null or empty string.
        if (empty($state->value) && !is_numeric($state->value)) {
            return false;
        }

        if (is_array($state->value)) {
            // The first element of the array can't be null or empty string.
            $first = array_slice($state->value, 0, 1);
            if (empty($first) && !is_numeric($first)) {
                return false;
            }
        }

        return true;
    }
217046
public function checkState($storeState, $state = null)
	{
		if(null === $state)
		{
			if(null === $this->state)
			{
				if(isset($_GET['state']))
				{
					$state = $_GET['state'];
				}
				else
				{
					$state = '';
				}
			}
			else
			{
				$state = $this->state;
			}
		}
		return $storeState === $state;
	}
929890
public function getState($state, $default = NULL)
    {
        $state = isset($this->states[$state]) ? $this->states[$state] : $default;
        return $state;
    }
299159
protected function getOAuthUrl($state)
    {
        $queries = [
            'appid' => $this->clientId,
            'redirect_uri' => $this->redirectUrl,
            'response_type' => 'code',
            'scope' => $this->formatScopes($this->scopes, $this->scopeSeparator),
            'agentid' => $this->agentId,
            'state' => $state,
        ];

        return sprintf('https://open.weixin.qq.com/connect/oauth2/authorize?%s#wechat_redirect', http_build_query($queries));
    }
968528
public function getLoginUrl($url, $state)
    {
        return sprintf(self::LOGIN_QR_CODE_URL, $this->appId, urlencode($url), trim($state));
    }
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;
	}
18406
private static function _debug($state=null)
	{
		static $_ = true;

		// set
		//
		if (isset($state))
		{
			$_ = (boolean) $state;
		}

		// get
		//
		return $_;
	}
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;
    }
891421
protected function setState(int $state) : bool
    {
        $this->workerState = $state;

        // report idle state to server:
        $this->replySocket->send(json_encode([
            'request' => 'change_state',
            'worker_id' => $this->workerId,
            'state' => $this->workerState
        ]));
        $response = $this->replySocket->recv();
        return ($response === 'ok');
    }
1005433
public static function get_StockState( &$state )
    {
        if( $state instanceof StockState or null === $state ) {
            $state = StockState::makeFromString( $state );
        }
        return $state;
    }
224311
public function getAction($state)
    {
        $type = self::getType('strtolower', false);
        $action = self::$defaultAction[$type];

        if (isset($this->states['action'])) {
            $action = $this->states['action'];
        }

        return ($state === 'uninstalled') ? '' : $action;
    }
529883
public function getStateColor($state)
    {
        if ($state instanceof StatableInterface) {
            $state = $state->getState();
        }

        return empty($this->colors['state'][$state])
            ? $this->options['state']['default_color']
            : $this->colors['state'][$state]
        ;
    }
1325308
public static function statusLabel($status = null)
    {
        switch ($status) {
            case User::STATUS_ACTIVE:
                $label = 'info';
                $name = ArrayHelper::getValue(User::getStatuses(), $status);
                break;
            case User::STATUS_BANNED:
                $label = 'warning';
                $name = ArrayHelper::getValue(User::getStatuses(), $status);
                break;
            default:
                $label = 'default';
                $name = ArrayHelper::getValue(User::getStatuses(), User::STATUS_REGISTERED);
        }

        return Html::tag('span', $name, ['class' => 'label label-' . $label]);
    }
833670
public static function label($status)
    {
        $statuses = [
            SeoChecker::STATUS_DANGER  => 'danger',
            SeoChecker::STATUS_GOOD    => 'success',
            SeoChecker::STATUS_WARNING => 'warning',
        ];

        return Arr::get($statuses, $status, 'default');
    }
1043810
public function get($state) : State
    {
        $this->addCallback('GET', $state);
        if (!isset($this->actions['POST'])) {
            $this->addCallback('POST', $state);
        }
        return $this;
    }
585527
protected function setState($state)
    {
        $serviceService = $this->getServiceLocator()->get(StateStorage::SERVICE_ID);
        $userUri = $this->getSession()->getUserUri();
        return is_null($userUri) ? false : $serviceService->set($userUri, $this->getServiceCallId(), $state);
    }