src/phpDocumentor/Compiler/Pass/ExampleTagsEnricher.php
protected function replaceInlineExamples(DescriptorAbstract $element)
    {
        $description = $element->getDescription();
        $matches     = array();

        if (! $description
            || ! preg_match_all('/\{@example\s(.+?)\}/', $description, $matches)
            || count($matches[0]) < 1
        ) {
            return $description;
        }

        $matched = array();
        foreach ($matches[0] as $index => $match) {
            if (isset($matched[$match])) {
                continue;
            }

            $matched[$match] = true;
            $exampleReflector = new ExampleTag('example', $matches[1][$index]);

            $example = $this->exampleAssembler->create($exampleReflector);

            $replacement = '`'.$example->getExample().'`';
            if ($example->getDescription()) {
                $replacement = '*' . $example->getDescription() . '*' . $replacement;
            }

            $description = str_replace($match, $replacement, $description);
        }

        return $description;
    }
protected function replaceInlineExamples(DescriptorAbstract $element)
    {
        $description = $element->getDescription();
        $matches     = array();

        if (! $description
            || ! preg_match_all('/\{@example\s(.+?)\}/', $description, $matches)
            || count($matches[0]) < 1
        ) {
            return $description;
        }

        $matched = array();
        foreach ($matches[0] as $index => $match) {
            if (isset($matched[$match])) {
                continue;
            }

            $matched[$match] = true;
            $exampleReflector = new ExampleTag('example', $matches[1][$index]);

            $example = $this->exampleAssembler->create($exampleReflector);

            $replacement = '`'.$example->getExample().'`';
            if ($example->getDescription()) {
                $replacement = '*' . $example->getDescription() . '*' . $replacement;
            }

            $description = str_replace($match, $replacement, $description);
        }

        return $description;
    }
protected function replaceInlineExamples ( DescriptorAbstract $ element ) { $ description = $ element -> getDescription ( ) ; $ matches = array ( ) ; if ( ! $ description || ! preg_match_all ( '/\{@example\s(.+?)\}/' , $ description , $ matches ) || count ( $ matches [ 0 ] ) < 1 ) { return $ description ; } $ matched = array ( ) ; foreach ( $ matches [ 0 ] as $ index => $ match ) { if ( isset ( $ matched [ $ match ] ) ) { continue ; } $ matched [ $ match ] = true ; $ exampleReflector = new ExampleTag ( 'example' , $ matches [ 1 ] [ $ index ] ) ; $ example = $ this -> exampleAssembler -> create ( $ exampleReflector ) ; $ replacement = '`' . $ example -> getExample ( ) . '`' ; if ( $ example -> getDescription ( ) ) { $ replacement = '*' . $ example -> getDescription ( ) . '*' . $ replacement ; } $ description = str_replace ( $ match , $ replacement , $ description ) ; } return $ description ; }
Replaces the example tags in the description with the contents of the found example.

@param DescriptorAbstract $element

@return string
Replaces the example tags in the description with the contents of the found example .