Core/Processors/Routing/ContentRouter.php
protected function doProcess(Exchange $exchange, SerializableArray $processingContext)
    {
        $evaluator = $this->getEvaluator();

        foreach ($this->clauses as $clause) {
            if ($evaluator->evaluateWithExchange($clause->getCondition(), $exchange)) {
                $exchange->getItinerary()->prepend($clause->getItinerary());
                $processingContext->set(self::CONDITION_MATCHED, $clause->getCondition());

                return true;
            }
        }

        if ($this->fallbackItinerary) {
            $exchange->getItinerary()->prepend($this->fallbackItinerary);
            $processingContext->set(self::CONDITION_MATCHED, 'fallback itinerary');

            return true;
        }

        return false;
    }
protected function doProcess(Exchange $exchange, SerializableArray $processingContext)
    {
        $evaluator = $this->getEvaluator();

        foreach ($this->clauses as $clause) {
            if ($evaluator->evaluateWithExchange($clause->getCondition(), $exchange)) {
                $exchange->getItinerary()->prepend($clause->getItinerary());
                $processingContext->set(self::CONDITION_MATCHED, $clause->getCondition());

                return true;
            }
        }

        if ($this->fallbackItinerary) {
            $exchange->getItinerary()->prepend($this->fallbackItinerary);
            $processingContext->set(self::CONDITION_MATCHED, 'fallback itinerary');

            return true;
        }

        return false;
    }
protected function doProcess ( Exchange $ exchange , SerializableArray $ processingContext ) { $ evaluator = $ this -> getEvaluator ( ) ; foreach ( $ this -> clauses as $ clause ) { if ( $ evaluator -> evaluateWithExchange ( $ clause -> getCondition ( ) , $ exchange ) ) { $ exchange -> getItinerary ( ) -> prepend ( $ clause -> getItinerary ( ) ) ; $ processingContext -> set ( self :: CONDITION_MATCHED , $ clause -> getCondition ( ) ) ; return true ; } } if ( $ this -> fallbackItinerary ) { $ exchange -> getItinerary ( ) -> prepend ( $ this -> fallbackItinerary ) ; $ processingContext -> set ( self :: CONDITION_MATCHED , 'fallback itinerary' ) ; return true ; } return false ; }
The content router will evaluate the list of when clauses for the given exchange until one of them returns true,
then the itinerary of the exchange will be updated with the one specified for the when clause.

In case that no when clause matches, if there is a fallbackItinerary defined, the exchange will be updated with it,
otherwise nothing will happen.

todo: Check what should be the behaviour when no when clause is matched and no fallbackItinerary is defined

@param Exchange $exchange

@return bool
The content router will evaluate the list of when clauses for the given exchange until one of them returns true then the itinerary of the exchange will be updated with the one specified for the when clause .