Find and return the Initial state if exists.

@return string

@throws Exception\StateException
960910
protected function findInitialState()
    {
        foreach ($this->states as $state) {
            if (State::TYPE_INITIAL === $state->getType()) {
                return $state->getName();
            }
        }

        throw new Exception\StateException(sprintf(
            'No initial state found on object "%s" with graph "%s".',
            get_class($this->getObject()),
            $this->getGraph()
        ));
    }
1339608
protected function restoreState()
    {
        // Restores state
        foreach ($this->getIniKeys() as $key) {
            ini_set($key, $this->getHistory($key));
        }

        // For chaining
        return $this;
    }
1084488
public function jumpToState($state)
    {
        if (!$state instanceof StateInterface) {
            $state = $this->getState($state);
        }

        if (!$this->canJumpToState($state)) {
            throw new StateException(sprintf('Can not jump from state "%s" to "%s".',$this->currentState->getName(), $state->getName()));
        }

        $this->object->setFiniteState($state->getName());
        $this->currentState = $state;
    }
263200
public function getInitialValue()
    {
        if ($this->hasDefaultValue) {
            return $this->defaultValue;
        }

        return $this->isNullable ? null : $this->dataType->getInitialValue();
    }
847780
public function getSqlState(): string
    {
        if (isset($this->errors[0]['sqlstate'])) {
            return $this->errors[0]['sqlstate']; // MySQL
        } elseif (isset($this->errors[0]['SQLSTATE'])) {
            return $this->errors[0]['SQLSTATE']; // SQL Server
        } else {
            return '';
        }
    }
455971
public function getState($state)
    {
        if ($state instanceof StatableInterface) {
            $state = $state->getState();
        }

        return $this->options['state']['translation'].'.'.$state;
    }
1370614
protected function getState()
    {
        $data = [];
        foreach ($this->serialisedProperties as $property) {
            $data[$property] = $this->$property;
        }
        return $data;
    }
280641
public function getState($type)
    {
        if (!isset($this->states[$type])) {
            return null;
        }

        return $this->states[$type];
    }
714249
public function getState($state = null)
	{
		if ($state === null) {
			$state = $this->getValue();
		}

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

		return $this->states[$state];
	}
828851
protected function onInit()
    {
        $host = Util::get($this->params, "host", "");//host\instanceName
        $username = Util::get($this->params, "username", "");
        $password = Util::get($this->params, "password", "");
        $dbname = Util::get($this->params, "dbname", "");
        $returnDatesAsStrings = Util::get($this->params, "returnDatesAsStrings", true);
        $charset = Util::get($this->params, "charset", 'utf-8');
        $connectionInfo = array(
            "Database"=>$dbname,
            "UID"=>$username,
            "PWD"=>$password, 
            "ReturnDatesAsStrings" => $returnDatesAsStrings, 
            "CharacterSet" => $charset
        );

        $key = md5($host.$username.$password.$dbname);
        if (isset(SQLSRVDataSource::$connections[$key])) {
            $this->connection = SQLSRVDataSource::$connections[$key];
        } else {
            $conn = sqlsrv_connect($host, $connectionInfo);
            if ($conn) {
                $this->connection = $conn;
            } else {
                throw new \Exception(
                    "Connection could not be established: "
                    .print_r(sqlsrv_errors(), true)
                );
            }    
            SQLSRVDataSource::$connections[$key] = $this->connection;
        }
    }
567316
protected function _getStateObject()
    {
        if (is_null($this->_oStateObject)) {
            $this->_oStateObject = oxNew(\OxidEsales\Eshop\Application\Model\State::class);
        }

        return $this->_oStateObject;
    }
1102900
protected function getListState()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            $list = $this->state->getList();
            $this->limitArray($list);
            return $list;
        }

        if ($this->getParam('country')) {
            $list = $this->state->getList(array('country' => $id));
            $this->limitArray($list);
            return $list;
        }

        if (!is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $result = $this->state->get($id);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($result);
    }
1238939
public function initializeState()
	{
		if (Session::has($this->session_key))
		{
			$this->setStateArray( Session::get($this->session_key) );
		}
		else
		{
			$this->resetState();
		}
		return $this->getStateArray();
	}
534866
private function determineState()
    {
        // If the state was provided via config, then just use it.
        if ($this->config['state'] instanceof UploadState) {
            return $this->config['state'];
        }

        // Otherwise, construct a new state from the provided identifiers.
        $required = $this->info['id'];
        $id = [$required['upload_id'] => null];
        unset($required['upload_id']);
        foreach ($required as $key => $param) {
            if (!$this->config[$key]) {
                throw new IAE('You must provide a value for "' . $key . '" in '
                    . 'your config for the MultipartUploader for '
                    . $this->client->getApi()->getServiceFullName() . '.');
            }
            $id[$param] = $this->config[$key];
        }
        $state = new UploadState($id);
        $state->setPartSize($this->determinePartSize());

        return $state;
    }
698983
public function getState()
    {
        return (isset($this->raw['state']) && ! empty($this->raw['state']))
            ? (string) $this->raw['state']
            : null;
    }
314034
protected int getState() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getState");
        int tempState;
        synchronized (stateLock) {
            tempState = state;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getState", state);
        return tempState;
    }
291730
public function state(){
        $currentState = $this->bridge->getBulbState($this->deviceId);
        $state = $currentState[0];
        return $state;
    }