Return the current switch state based on the
GPIO digital output pin state.

@return SwitchState
559771
@Override
    public SwitchState getState() {
        if(pin.isState(onState))
            return SwitchState.ON;
        else
            return SwitchState.OFF;
    }
811450
private function switchNodeIfNeeded()
    {
        $sortedNodes = $this->priorityStrategy->sort(
            $this->nodes,
            $this->nodeId
        );

        $previous = null;

        // Try to connect by priority, continue on error, return on success
        foreach($sortedNodes as $nodeCandidate) {
            // If the first recommended node is our current node and it has
            // a working connection, return early.
            // If its connection is not working, let's try and reconnect further
            // below, or find the first best connected node.
            if ($nodeCandidate->getId() === $this->nodeId &&
                $nodeCandidate->isConnected()) {
                return;
            }

            try {
                if ($nodeCandidate->isConnected()) {
                    // Say a new HELLO to the node, the cluster might have changed
                    $nodeCandidate->sayHello();
                } else {
                    $nodeCandidate->connect();
                }
            } catch (ConnectionException $e) {
                $previous = $e;
                continue;
            }

            $this->switchToNode($nodeCandidate);
            return;
        }

        throw new ConnectionException('Could not switch to any node', 0, $previous);
    }
690480
public function getState() {
        if (!isset($this->state)) {
            $state = $this->getData(OntologyDeliveryExecution::PROPERTY_STATUS);
            if (!$state instanceof core_kernel_classes_Resource) {
                $state = $this->getResource((string)$state);
            }
            $this->state = $state;
        }
        return $this->state;
    }
759430
protected function getStatus()
    {
        if (!$this->getModuleSetting('status')) {
            return false;
        }

        if ($this->getModuleSetting('test')) {
            return $this->getModuleSetting('test_key') && $this->getModuleSetting('test_public_key');
        }

        return $this->getModuleSetting('live_key') && $this->getModuleSetting('live_public_key');
    }
766939
public static function current()
    {
        if (defined('PHPUNIT_RUNNING')) {
            return 'http://localhost';
        }

        $protocol = (!empty($_SERVER['HTTPS'])
            && $_SERVER['HTTPS'] !== 'off'
            || (int) $_SERVER['SERVER_PORT'] === 443) ? 'https://' : 'http://';

        return $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }
706219
public function setValue(int $state): bool
    {
        if ($this->type == GPIO::IN) {
            throw new GPIOException('Setting the value of a GPIO input pin is not supported!');
        }
        return $this->adapter->write($this->pin, $state);
    }
343374
public function dimState()
    {
        $currentState = $this->bridge->getBulbState($this->deviceId);
        $level = explode(':', $currentState[1])[0];
        $percent = round(($level*100)/255);

        return $percent;
    }
1079302
public static function current()
    {
        $protocol = (!empty($_SERVER['HTTPS'])
            && $_SERVER['HTTPS'] !== 'off'
            || $_SERVER['SERVER_PORT'] === 443) ? 'https://' : 'http://';

        if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
            $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
        } else {
            $host = $_SERVER['HTTP_HOST'];
        }

        return $protocol . $host . $_SERVER['REQUEST_URI'];
    }
4831
public function getCurrent()
	{
		if ( ! $this->iterationStarted || is_null( $this->current ) )
			throw new InvalidOperationException();
		return $this->current->Current;
	}
422949
private function getCircuitBreaker()
    {
        return $this->circuitBreakerFactory->get($this->getCommandKey(), $this->config, $this->getMetrics());
    }
662054
@Override
    public ButtonState getState() {
        if(pin.isState(pressedState))
            return ButtonState.PRESSED;
        else
            return ButtonState.RELEASED;
    }
1246201
public function getState() : ?int 
    {
        if ( ! $this->hasState()) {
            $this->setState($this->getDefaultState());
        }
        return $this->state;
    }
937240
private function doTransition() : self
    {
        switch ($this->getState()) {
            case self::STATE_G:
                $this->doTransitionFromG();
                break;

            case self::STATE_F:
                $this->doTransitionFromF();
                break;

            case self::STATE_E:
                $this->doTransitionFromE();
                break;

            case self::STATE_D:
                $this->doTransitionFromD();
                break;

            case self::STATE_C:
                $this->doTransitionFromC();
                break;

            case self::STATE_B:
                $this->doTransitionFromB();
                break;

            case self::STATE_A:
                $this->doTransitionFromA();
                break;

            case self::STATE_Y:
                $this->doTransitionFromY();
                break;
        }

        return $this;
    }
507759
public function getNextStates()
    {
        return array_map(
            function(Transition $transition) {
                return $this->states[$transition->getResultingStateName()];
            },
            $this->getNextTransitions()
        );
    }
562756
protected function getState()
    {
        $serviceService = $this->getServiceLocator()->get(StateStorage::SERVICE_ID);
        $userUri = $this->getSession()->getUserUri();
        return is_null($userUri) ? null : $serviceService->get($userUri, $this->getServiceCallId());
    }
931021
public function getCurrent()
    {
        if ($this->_current === null) {
            $this->_current = $this->resolveCurrent();
            $this->trigger(self::EVENT_AFTER_RESOLVE_CURRENT);
        }

        return $this->_current;
    }
1108280
public function getStatus() {
        if ($this->pid) {
            $waitPID = \pcntl_waitpid($this->pid, $status, WNOHANG);

            if ($waitPID == $this->pid) {
                return Thread::THREAD_EXITED;
            } else {
                return Thread::THREAD_RUNNING;
            }
        }
    }