Get state of workers.
@return array - information.
967234
public static function getStateOfWorkers()
    {
        $offset = 0;

        $stat = [
            'idle' => 0,
            'busy' => 0,
            'alive' => 0,
            'shutdown' => 0,
            'preinit' => 0,
            'init' => 0,
            'reloading' => 0,
        ];
        $readed = 0;
        while (($buf = Daemon::$shm_wstate->read($readed, 1024)) !== false) {
            $buflen = mb_orig_strlen($buf);
            $readed += $buflen;
            for ($i = 0; $i < $buflen; ++$i) {
                $code = ord($buf[$i]);
                if ($code >= 100) {
                    // reloaded (shutdown)
                    $code -= 100;
                    if ($code !== Daemon::WSTATE_SHUTDOWN) {
                        ++$stat['alive'];
                        if (Daemon::$process instanceof Thread\Master) {
                            Daemon::$process->reloadWorker($offset + $i + 1);
                            ++$stat['reloading'];
                            continue;
                        }
                    }
                }
                if ($code === Daemon::WSTATE_IDLE) {
                    // idle
                    ++$stat['alive'];
                    ++$stat['idle'];
                } elseif ($code === Daemon::WSTATE_BUSY) {
                    // busy
                    ++$stat['alive'];
                    ++$stat['busy'];
                } elseif ($code === Daemon::WSTATE_SHUTDOWN) {
                    // shutdown
                    ++$stat['shutdown'];
                } elseif ($code === Daemon::WSTATE_PREINIT) {
                    // pre-init
                    ++$stat['alive'];
                    ++$stat['preinit'];
                    ++$stat['idle'];
                } elseif ($code === Daemon::WSTATE_INIT) { // init
                    ++$stat['alive'];
                    ++$stat['init'];
                    ++$stat['idle'];
                }
            }
        }
        return $stat;
    }
502680
public function getState()
    {
        $hash = array();

        foreach ($this->getProperties() as $property) {
            $hash[$property] = $this->$property;
        }

        return $hash;
    }
331446
public function status()
    {
        return array_key_exists($this->statusCode(), self::$statuses)
            ? self::$statuses[$this->statusCode()]
            : 'Unknown';
    }
534775
public function getStatus()
    {
        if ($this->_getField(self::STORAGE_ID)) {
            return ( $this->_getField(self::$PAYMENT_INFORMATION) ) ? self::STATE_NOT_EMPTY : self::STATE_EXISTING;
        } else {
            return ( $this->_getField(self::$ERRORS) ) ? self::STATE_FAILURE : self::STATE_NOT_EXISTING;
        }
    }
1282512
public function getState()
    {
        return [
            'items' => $this->items,
            'rules' => $this->rules,
            'nested' => $this->nested,
            'dynamic' => $this->dynamic,
            'filter' => $this->filter
        ];
    }
613179
public static function getManagersStats()
    {

        $managersStats = [];
        foreach (static::$producers as $appId => $producer) {

            /** @var $producer Producer */
            $redis = $producer->getRedis();
            $keys = [
                'stat' => $redis->keys(Manager::REDIS_NS_STATS . '*'),
                'live' => $redis->keys(Manager::REDIS_NS_LIVE . '*')
            ];

            foreach ($keys as $type => $statsKeys) {
                foreach ($statsKeys as $statsKey) {
                    $parse = Manager::parseManagerStatKey($statsKey);
                    if ($appId != $parse['appId']) {
                        continue;
                    }

                    $statsItemData = $redis->hgetall($statsKey);
                    $statsItemData['workerClass'] = $parse['workerClass'];
                    $statsItemData['appId'] = $parse['appId'];
                    $managersStats[$parse['appId']][$type][] = $statsItemData;
                }
            }

        }

        return $managersStats;
    }
1078036
public static function getStatusList()
    {
        return [
            self::STATUS_OK => 'ok',
            self::STATUS_SENDING => 'sending',
            self::STATUS_PENDING => 'pending',
            self::STATUS_ERROR => 'error',
            self::STATUS_ENCODING => 'encoding',
        ];
    }
33169
public function getState()
     {
         return array(
             'id' => $this->id,
             'expirytime' => $this->expirytime,
             'client_id' => $this->client_id,
             'user_id' => $this->user_id,
             'scope' => $this->scope,
         );
     }
911717
public WorkingState getWorkingState() {
    return WorkingState
        .valueOf(getProp(ConfigurationKeys.WORK_UNIT_WORKING_STATE_KEY, WorkingState.PENDING.toString()));
  }
886858
public function toState()
    {
        $state = [];
        foreach ($this->getErrors() as $error) {
            $state[$error->getName()] = [];
            foreach ($error->getErrors() as $violation) {
                $state[$error->getName()][] = [
                    'path' => $violation->getPropertyPath(),
                    'message' => $violation->getMessage(),
                    'code' => $violation->getCode(),
                ];
            }
        }

        return $state;
    }
152257
protected function getRealTimeStatistics() {
        if (!$this->_realTimeStatistics) {
            $this->_realTimeStatistics = new WorkersRealTimeStatisticsList(
                $this->version,
                $this->solution['workspaceSid']
            );
        }

        return $this->_realTimeStatistics;
    }
81343
protected function getStatusData() : array
    {
        $statusData = [
            'version' => self::VERSION,
            'starttime' => '',
            'uptime' => '',
            'active_worker' => [],
            'job_info' => [],
        ];

        $starttime = date('Y-m-d H:i:s', $this->startTime);
        $start = new \DateTime($starttime);
        $now = new \DateTime('now');
        $uptime = $start->diff($now)->format('%ad %Hh %Im %Ss');
        $statusData['starttime'] = $starttime;
        $statusData['uptime'] = $uptime;

        foreach (array_keys($this->processes) as $poolName) {
            if (!isset($statusData['active_worker'][$poolName])) {
                $statusData['active_worker'][$poolName] = 0;
            }
            /** @var Process $process */
            foreach ($this->processes[$poolName] as $process) {
                $processIsRunning = $process->isRunning();
                if ($processIsRunning === true) {
                    $statusData['active_worker'][$poolName]++;
                }
            }
        }
        $statusData['job_info']['job_requests_total'] = $this->totalJobRequests;
        $statusData['job_info']['queue_length'] = $this->jobsInQueue;
        $statusData['job_info']['worker_stats'] = $this->workerStats;
        return $statusData;
    }
369233
public function toArray()
    {
        $workersDumped = array();

        foreach ($this->workerClasses as $worker) {
            $workersDumped[] = $worker->toArray();
        }

        return $workersDumped;
    }
1178011
public function getState()
    {
        if (empty($this->sortedQueue)) {
            return;
        }
        $current = current($this->sortedQueue)
                 ? current($this->sortedQueue)
                 : end($this->sortedQueue);

        return $current->getState();
    }
233907
private function progressedWorkers(): array
    {
        $result = [];
        foreach ($this->modified as $modifiedStream) {
            $found = null;
            foreach ($this->streams as $index => $stream) {
                if ($modifiedStream === $stream) {
                    $found = $index;
                    break;
                }
            }
            $result[$found] = $this->workers[$found];
        }
        $this->modified = [];

        return $result;
    }
199414
public static function getStatusesArray() : array
    {
        return [
            self::STATUS_BLOCKED => Yii::t('setrun/user', 'Blocked'),
            self::STATUS_ACTIVE  => Yii::t('setrun/user', 'Active'),
            self::STATUS_WAIT    => Yii::t('setrun/user', 'Wait')
        ];
    }
1248584
public function getStatus() {
        $rest = $this->getService( self::API_SWITCH_STATUS);
        $rest->GET();

        return $rest->getResult( models\SwitchPort\Status::class);
    }