protected function getReferenceValue(
        ReferenceAbstract $reference,
        /*# int */ $level = 0
    ) {
        $name = $reference->getName();

        // loop found
        if ($level > 2) {
            throw new NotFoundException(
                Message::get(Message::PARAMETER_LOOP_FOUND, $name),
                Message::PARAMETER_LOOP_FOUND
            );
        }

        // get service reference value
        if ($reference instanceof ServiceReference) {
            return $this->delegatedGet($name);

        // get parameter value, if value is another reference, go deeper
        } else {
            $val = $this->getParameter($name);
            if (is_string($val) && ($ref = $this->isReference($val))) {
                return $this->getReferenceValue($ref, ++$level);
            }
            return $val;
        }
    }