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

Image   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A processNode() 0 8 1
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