protected function processStatistics($query = null)
    {
        $this->unchangedCount = 0;
        $this->changedCount = 0;
        $this->failedCount = 0;
        $this->nodesCountByOS = [];
        $this->nodesPercentageByOS = [];
        $this->recentlyRebootedNodes = [];
        $nodes = $this->getNodeService()->getAll($query);
        $this->nodesCount = count($nodes);
        foreach ($nodes as $node) {
            /** @var Model\Node $node */
            if ($node->getStatus() == Model\NodeInterface::UNCHANGED) {
                $this->unchangedCount++;
            } elseif ($node->getStatus() == Model\NodeInterface::CHANGED) {
                $this->changedCount++;
            } elseif ($node->getStatus() == Model\NodeInterface::FAILED) {
                $this->failedCount++;
            }
            if ($node->getFact('uptime_days') < 1) {
                $this->recentlyRebootedNodes[$node->getName()] = $node->getFact('uptime');
            }
            $osName = $node->hasFact('lsbdistdescription') ? $node->getFact('lsbdistdescription') : $node->getFact('operatingsystem');
            if (!array_key_exists($osName, $this->nodesCountByOS)) {
                $this->nodesCountByOS[$osName] = 0;
            }
            $this->nodesCountByOS[$osName]++;
            $this->nodesPercentageByOS[$osName] = round($this->nodesCountByOS[$osName] / $this->nodesCount, 2);
        }
        arsort($this->nodesCountByOS);
        arsort($this->nodesPercentageByOS);
        $this->osCount = count($this->nodesCountByOS);
    }
protected function processStatistics($query = null)
    {
        $this->unchangedCount = 0;
        $this->changedCount = 0;
        $this->failedCount = 0;
        $this->nodesCountByOS = [];
        $this->nodesPercentageByOS = [];
        $this->recentlyRebootedNodes = [];
        $nodes = $this->getNodeService()->getAll($query);
        $this->nodesCount = count($nodes);
        foreach ($nodes as $node) {
            /** @var Model\Node $node */
            if ($node->getStatus() == Model\NodeInterface::UNCHANGED) {
                $this->unchangedCount++;
            } elseif ($node->getStatus() == Model\NodeInterface::CHANGED) {
                $this->changedCount++;
            } elseif ($node->getStatus() == Model\NodeInterface::FAILED) {
                $this->failedCount++;
            }
            if ($node->getFact('uptime_days') < 1) {
                $this->recentlyRebootedNodes[$node->getName()] = $node->getFact('uptime');
            }
            $osName = $node->hasFact('lsbdistdescription') ? $node->getFact('lsbdistdescription') : $node->getFact('operatingsystem');
            if (!array_key_exists($osName, $this->nodesCountByOS)) {
                $this->nodesCountByOS[$osName] = 0;
            }
            $this->nodesCountByOS[$osName]++;
            $this->nodesPercentageByOS[$osName] = round($this->nodesCountByOS[$osName] / $this->nodesCount, 2);
        }
        arsort($this->nodesCountByOS);
        arsort($this->nodesPercentageByOS);
        $this->osCount = count($this->nodesCountByOS);
    }
protected function processStatistics ( $ query = null ) { $ this -> unchangedCount = 0 ; $ this -> changedCount = 0 ; $ this -> failedCount = 0 ; $ this -> nodesCountByOS = [ ] ; $ this -> nodesPercentageByOS = [ ] ; $ this -> recentlyRebootedNodes = [ ] ; $ nodes = $ this -> getNodeService ( ) -> getAll ( $ query ) ; $ this -> nodesCount = count ( $ nodes ) ; foreach ( $ nodes as $ node ) { /** @var Model\Node $node */ if ( $ node -> getStatus ( ) == Model \ NodeInterface :: UNCHANGED ) { $ this -> unchangedCount ++ ; } elseif ( $ node -> getStatus ( ) == Model \ NodeInterface :: CHANGED ) { $ this -> changedCount ++ ; } elseif ( $ node -> getStatus ( ) == Model \ NodeInterface :: FAILED ) { $ this -> failedCount ++ ; } if ( $ node -> getFact ( 'uptime_days' ) < 1 ) { $ this -> recentlyRebootedNodes [ $ node -> getName ( ) ] = $ node -> getFact ( 'uptime' ) ; } $ osName = $ node -> hasFact ( 'lsbdistdescription' ) ? $ node -> getFact ( 'lsbdistdescription' ) : $ node -> getFact ( 'operatingsystem' ) ; if ( ! array_key_exists ( $ osName , $ this -> nodesCountByOS ) ) { $ this -> nodesCountByOS [ $ osName ] = 0 ; } $ this -> nodesCountByOS [ $ osName ] ++ ; $ this -> nodesPercentageByOS [ $ osName ] = round ( $ this -> nodesCountByOS [ $ osName ] / $ this -> nodesCount , 2 ) ; } arsort ( $ this -> nodesCountByOS ) ; arsort ( $ this -> nodesPercentageByOS ) ; $ this -> osCount = count ( $ this -> nodesCountByOS ) ; }
Browse all nodes and process all the statistics

@param \KmbPuppetDb\Query\Query|array $query
Browse all nodes and process all the statistics