1 | <?php |
||
23 | class PHPMD |
||
24 | { |
||
25 | /** |
||
26 | * The current PHPMD version. |
||
27 | */ |
||
28 | const VERSION = '@project.version@'; |
||
29 | |||
30 | /** |
||
31 | * List of valid file extensions for analyzed files. |
||
32 | * |
||
33 | * @var array(string) |
||
34 | */ |
||
35 | private $fileExtensions = array('php', 'php3', 'php4', 'php5', 'inc'); |
||
36 | |||
37 | /** |
||
38 | * List of exclude directory patterns. |
||
39 | * |
||
40 | * @var array(string) |
||
41 | */ |
||
42 | private $ignorePatterns = array('.git', '.svn', 'CVS', '.bzr', '.hg', 'SCCS'); |
||
43 | |||
44 | /** |
||
45 | * The input source file or directory. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | private $input; |
||
50 | |||
51 | /** |
||
52 | * This property will be set to <b>true</b> when an error or a violation |
||
53 | * was found in the processed source code. |
||
54 | * |
||
55 | * @var boolean |
||
56 | * @since 0.2.5 |
||
57 | */ |
||
58 | private $violations = false; |
||
59 | |||
60 | /** |
||
61 | * Additional options for PHPMD or one of it's parser backends. |
||
62 | * |
||
63 | * @var array |
||
64 | * @since 1.2.0 |
||
65 | */ |
||
66 | private $options = array(); |
||
67 | |||
68 | /** |
||
69 | * This method will return <b>true</b> when the processed source code |
||
70 | * contains violations. |
||
71 | * |
||
72 | * @return boolean |
||
73 | * @since 0.2.5 |
||
74 | */ |
||
75 | 7 | public function hasViolations() |
|
79 | |||
80 | /** |
||
81 | * Returns the input source file or directory path. |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | 11 | public function getInput() |
|
89 | |||
90 | /** |
||
91 | * Returns an array with valid php source file extensions. |
||
92 | * |
||
93 | * @return string[] |
||
94 | * @since 0.2.0 |
||
95 | */ |
||
96 | 11 | public function getFileExtensions() |
|
100 | |||
101 | /** |
||
102 | * Sets a list of filename extensions for valid php source code files. |
||
103 | * |
||
104 | * @param array(string) $fileExtensions Extensions without leading dot. |
||
|
|||
105 | * @return void |
||
106 | */ |
||
107 | public function setFileExtensions(array $fileExtensions) |
||
108 | { |
||
109 | $this->fileExtensions = $fileExtensions; |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * Returns an array with string patterns that mark a file path as invalid. |
||
114 | * |
||
115 | * @return string[] |
||
116 | * @since 0.2.0 |
||
117 | */ |
||
118 | 11 | public function getIgnorePattern() |
|
122 | |||
123 | /** |
||
124 | * Sets a list of ignore patterns that is used to exclude directories from |
||
125 | * the source analysis. |
||
126 | * |
||
127 | * @param array(string) $ignorePatterns List of ignore patterns. |
||
128 | * @return void |
||
129 | */ |
||
130 | public function setIgnorePattern(array $ignorePatterns) |
||
131 | { |
||
132 | $this->ignorePatterns = array_merge( |
||
133 | $this->ignorePatterns, |
||
134 | $ignorePatterns |
||
135 | ); |
||
136 | } |
||
137 | |||
138 | /** |
||
139 | * Returns additional options for PHPMD or one of it's parser backends. |
||
140 | * |
||
141 | * @return array |
||
142 | */ |
||
143 | 11 | public function getOptions() |
|
147 | |||
148 | /** |
||
149 | * Sets additional options for PHPMD or one of it's parser backends. |
||
150 | * |
||
151 | * @param array $options Additional backend or PHPMD options. |
||
152 | * @return void |
||
153 | */ |
||
154 | 4 | public function setOptions(array $options) |
|
158 | |||
159 | /** |
||
160 | * This method will process all files that can be found in the given input |
||
161 | * path. It will apply rules defined in the comma-separated <b>$ruleSets</b> |
||
162 | * argument. The result will be passed to all given renderer instances. |
||
163 | * |
||
164 | * @param string $inputPath |
||
165 | * @param string $ruleSets |
||
166 | * @param \PHPMD\AbstractRenderer[] $renderers |
||
167 | * @param \PHPMD\RuleSetFactory $ruleSetFactory |
||
168 | * @return void |
||
169 | */ |
||
170 | 11 | public function processFiles( |
|
209 | } |
||
210 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.