Completed
Push — master ( a22bfe...2e3ab0 )
by Mike
02:35
created

Image::processNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 4
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace phpDocumentor\Guides\RestructuredText\Directives;
6
7
use phpDocumentor\Guides\Nodes\ImageNode;
8
use phpDocumentor\Guides\Nodes\Node;
9
use phpDocumentor\Guides\RestructuredText\Parser;
10
11
/**
12
 * Renders an image, example :
13
 *
14
 * .. image:: image.jpg
15
 *      :width: 100
16
 *      :title: An image
17
 */
18
class Image extends Directive
19
{
20
    public function getName() : string
21
    {
22
        return 'image';
23
    }
24
25
    /**
26
     * @param string[] $options
27
     */
28
    public function processNode(
29
        Parser $parser,
30
        string $variable,
31
        string $data,
32
        array $options
33
    ) : Node {
34
        return new ImageNode($parser->getEnvironment()->relativeUrl($data));
35
    }
36
}
37