src/Common/Endpoint/Manager.php
public function getActiveEndpoint()
    {
        // try to get endpoint with status active
        $active = $this->getEndpoints()->filter(function (Endpoint $endpoint) {
            return $endpoint->isActive();
        });

        // when empty, try other endpoints
        if ($active->isEmpty() === true) {
            $active = $this->getEndpoints()->filter(function (Endpoint $endpoint) {
                return $this->canBeActivated($endpoint);
            });
        }

        if ($active->isEmpty() === true) {
            throw new NoServerAvailableException('No active server available');
        }

        /** @var Endpoint $endpoint */
        $endpoint = $active->first();
        $endpoint->setStatus(Endpoint::STATUS_ACTIVE);

        return $endpoint;
    }
public function getActiveEndpoint()
    {
        // try to get endpoint with status active
        $active = $this->getEndpoints()->filter(function (Endpoint $endpoint) {
            return $endpoint->isActive();
        });

        // when empty, try other endpoints
        if ($active->isEmpty() === true) {
            $active = $this->getEndpoints()->filter(function (Endpoint $endpoint) {
                return $this->canBeActivated($endpoint);
            });
        }

        if ($active->isEmpty() === true) {
            throw new NoServerAvailableException('No active server available');
        }

        /** @var Endpoint $endpoint */
        $endpoint = $active->first();
        $endpoint->setStatus(Endpoint::STATUS_ACTIVE);

        return $endpoint;
    }
public function getActiveEndpoint ( ) { // try to get endpoint with status active $ active = $ this -> getEndpoints ( ) -> filter ( function ( Endpoint $ endpoint ) { return $ endpoint -> isActive ( ) ; } ) ; // when empty, try other endpoints if ( $ active -> isEmpty ( ) === true ) { $ active = $ this -> getEndpoints ( ) -> filter ( function ( Endpoint $ endpoint ) { return $ this -> canBeActivated ( $ endpoint ) ; } ) ; } if ( $ active -> isEmpty ( ) === true ) { throw new NoServerAvailableException ( 'No active server available' ) ; } /** @var Endpoint $endpoint */ $ endpoint = $ active -> first ( ) ; $ endpoint -> setStatus ( Endpoint :: STATUS_ACTIVE ) ; return $ endpoint ; }
Returns a active endpoint.
Tries to find the current active endpoint, or enable one.

@return Endpoint

@throws NoServerAvailableException
Returns a active endpoint . Tries to find the current active endpoint or enable one .