src/Health/Service/HealthService.php
public function check($alias = null)
    {
        if (null === $alias) {
            $statuses = new Statuses;
            $statuses->setHealthy(true);

            foreach ($this->checkCollection as $check) {
                $status = $check->execute();
                $statuses->getCollection()->add($status);

                if (!$status->getHealthy()) {
                    $statuses->setHealthy(false);
                }
            }

            return $statuses;
        } else {
            $check = $this->checkCollection->filter(function($element) use($alias) {
                return $element->getAlias() === $alias;
            })->first();

            if (!$check) {
                throw new InvalidAliasException('Check alias does not exist.');
            }

            $status = $check->execute();

            return $status;
        }
    }
public function check($alias = null)
    {
        if (null === $alias) {
            $statuses = new Statuses;
            $statuses->setHealthy(true);

            foreach ($this->checkCollection as $check) {
                $status = $check->execute();
                $statuses->getCollection()->add($status);

                if (!$status->getHealthy()) {
                    $statuses->setHealthy(false);
                }
            }

            return $statuses;
        } else {
            $check = $this->checkCollection->filter(function($element) use($alias) {
                return $element->getAlias() === $alias;
            })->first();

            if (!$check) {
                throw new InvalidAliasException('Check alias does not exist.');
            }

            $status = $check->execute();

            return $status;
        }
    }
public function check ( $ alias = null ) { if ( null === $ alias ) { $ statuses = new Statuses ; $ statuses -> setHealthy ( true ) ; foreach ( $ this -> checkCollection as $ check ) { $ status = $ check -> execute ( ) ; $ statuses -> getCollection ( ) -> add ( $ status ) ; if ( ! $ status -> getHealthy ( ) ) { $ statuses -> setHealthy ( false ) ; } } return $ statuses ; } else { $ check = $ this -> checkCollection -> filter ( function ( $ element ) use ( $ alias ) { return $ element -> getAlias ( ) === $ alias ; } ) -> first ( ) ; if ( ! $ check ) { throw new InvalidAliasException ( 'Check alias does not exist.' ) ; } $ status = $ check -> execute ( ) ; return $ status ; } }
Run health checks

@param string $alias
@return \Ds\Component\Health\Model\Statuses|\Ds\Component\Health\Model\Status
@throws \Ds\Component\Health\Exception\InvalidAliasException
Run health checks