src/PhpProxyBuilder/Aop/Advice/CircuitBreakerAdvice.php
public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) {

        if ($this->breaker->isAvailable($this->serviceName)) {
            try {
                $result = $jointPoint->proceed();
                $this->breaker->reportSuccess($this->serviceName);
                return $result;
            } catch (Exception $e) {
                if ($this->isServiceFailureException($e)) {
                    $this->breaker->reportFailure($this->serviceName);
                }else{
                    $this->breaker->reportSuccess($this->serviceName);
                }
                throw $e;
            }
        } else {
            throw $this->throwOnFailure;
        }
    }
public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) {

        if ($this->breaker->isAvailable($this->serviceName)) {
            try {
                $result = $jointPoint->proceed();
                $this->breaker->reportSuccess($this->serviceName);
                return $result;
            } catch (Exception $e) {
                if ($this->isServiceFailureException($e)) {
                    $this->breaker->reportFailure($this->serviceName);
                }else{
                    $this->breaker->reportSuccess($this->serviceName);
                }
                throw $e;
            }
        } else {
            throw $this->throwOnFailure;
        }
    }
public function interceptMethodCall ( ProceedingJoinPointInterface $ jointPoint ) { if ( $ this -> breaker -> isAvailable ( $ this -> serviceName ) ) { try { $ result = $ jointPoint -> proceed ( ) ; $ this -> breaker -> reportSuccess ( $ this -> serviceName ) ; return $ result ; } catch ( Exception $ e ) { if ( $ this -> isServiceFailureException ( $ e ) ) { $ this -> breaker -> reportFailure ( $ this -> serviceName ) ; } else { $ this -> breaker -> reportSuccess ( $ this -> serviceName ) ; } throw $ e ; } } else { throw $ this -> throwOnFailure ; } }
In this implementation we ask CircuitBreaker implementation if it is safe to proceed with the service call.

@param ProceedingJoinPointInterface $jointPoint
@throws ServiceUnavailableException|Exception
@return mixed
In this implementation we ask CircuitBreaker implementation if it is safe to proceed with the service call .