Extension   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 3
Bugs 2 Features 0
Metric Value
eloc 7
c 3
b 2
f 0
dl 0
loc 58
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 2 1
A shouldRenderIndex() 0 3 1
A shouldRenderElement() 0 3 1
A __construct() 0 4 1
A prepare() 0 2 1
1
<?php
2
/**
3
 * @copyright Copyright (c) 2017 Julius Härtl <[email protected]>
4
 * @author    Julius Härtl <[email protected]>
5
 * @license   GNU AGPL version 3 or any later version
6
 *
7
 *  This program is free software: you can redistribute it and/or modify
8
 *  it under the terms of the GNU Affero General Public License as
9
 *  published by the Free Software Foundation, either version 3 of the
10
 *  License, or (at your option) any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU Affero General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU Affero General Public License
18
 *  along with this program. If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
namespace JuliusHaertl\PHPDocToRst\Extension;
22
23
use JuliusHaertl\PHPDocToRst\Builder\ExtensionBuilder;
24
use phpDocumentor\Reflection\Element;
25
use phpDocumentor\Reflection\Php\Project;
26
27
abstract class Extension
28
{
29
    /** @var Project */
30
    protected $project;
31
32
    /** @var array */
33
    protected $arguments;
34
35
    public function __construct(Project $project, $arguments = [])
36
    {
37
        $this->project = $project;
38
        $this->arguments = $arguments;
39
    }
40
41
    /**
42
     * Method that will be ran before generating any documentation files
43
     * This is useful for preparing own data structures
44
     * to be used in the output documentation.
45
     */
46
    public function prepare()
47
    {
48
    }
49
50
    /**
51
     * Implement custom rendering functionality here.
52
     * It will be executed by Builder classes depending on the given type.
53
     *
54
     * Currently supported types:
55
     *
56
     *  - PhpDomainBuilder::SECTION_BEFORE_DESCRIPTION
57
     *  - PhpDomainBuilder::SECTION_AFTER_DESCRIPTION
58
     *
59
     * @param string           $type
60
     * @param ExtensionBuilder $builder
61
     * @param Element          $element context for the render type
62
     */
63
    public function render($type, &$builder, $element)
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

63
    public function render(/** @scrutinizer ignore-unused */ $type, &$builder, $element)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $element is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

63
    public function render($type, &$builder, /** @scrutinizer ignore-unused */ $element)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $builder is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

63
    public function render($type, /** @scrutinizer ignore-unused */ &$builder, $element)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
64
    {
65
    }
66
67
    /**
68
     * This method will be called to check if a certain element should
69
     * be rendered in the documentation.
70
     *
71
     * An example extension that makes use of it is PublicOnlyExtension
72
     *
73
     * @param Element $element
74
     *
75
     * @return bool
76
     */
77
    public function shouldRenderElement(Element $element)
0 ignored issues
show
Unused Code introduced by
The parameter $element is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

77
    public function shouldRenderElement(/** @scrutinizer ignore-unused */ Element $element)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
78
    {
79
        return true;
80
    }
81
82
    public function shouldRenderIndex($type, $element)
0 ignored issues
show
Unused Code introduced by
The parameter $element is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

82
    public function shouldRenderIndex($type, /** @scrutinizer ignore-unused */ $element)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

82
    public function shouldRenderIndex(/** @scrutinizer ignore-unused */ $type, $element)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
83
    {
84
        return true;
85
    }
86
}
87