Issues (17)

src/Extension/Extension.php (6 issues)

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

67
    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...
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

67
    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...
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

67
    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...
68
69
    }
70
71
    /**
72
     * This method will be called to check if a certain element should
73
     * be rendered in the documentation.
74
     *
75
     * An example extension that makes use of it is PublicOnlyExtension
76
     *
77
     * @param Element $element
78
     * @return bool
79
     */
80
    public function shouldRenderElement(Element $element) {
0 ignored issues
show
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

80
    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...
81
        return true;
82
    }
83
84
    public function shouldRenderIndex($type, $element) {
0 ignored issues
show
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

84
    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...
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

84
    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...
85
        return true;
86
    }
87
88
}