3
* Parses Class doc comments.
8
* @package PHP_CodeSniffer
9
* @author Greg Sherwood <gsherwood@squiz.net>
10
* @author Marc McIntyre <mmcintyre@squiz.net>
11
* @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
12
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
13
* @link http://pear.php.net/package/PHP_CodeSniffer
16
if (class_exists('PHP_CodeSniffer_CommentParser_AbstractParser', true) === false) {
17
$error = 'Class PHP_CodeSniffer_CommentParser_AbstractParser not found';
18
throw new PHP_CodeSniffer_Exception($error);
22
* Parses Class doc comments.
25
* @package PHP_CodeSniffer
26
* @author Greg Sherwood <gsherwood@squiz.net>
27
* @author Marc McIntyre <mmcintyre@squiz.net>
28
* @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
29
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
30
* @version Release: 1.3.4
31
* @link http://pear.php.net/package/PHP_CodeSniffer
33
class PHP_CodeSniffer_CommentParser_ClassCommentParser extends PHP_CodeSniffer_CommentParser_AbstractParser
37
* The package element of this class.
41
private $_package = null;
44
* The subpackage element of this class.
48
private $_subpackage = null;
51
* The version element of this class.
55
private $_version = null;
58
* The category element of this class.
62
private $_category = null;
65
* The copyright elements of this class.
67
* @var array(SingleElement)
69
private $_copyrights = array();
72
* The licence element of this class.
76
private $_license = null;
79
* The author elements of this class.
81
* @var array(SingleElement)
83
private $_authors = array();
87
* Returns the allowed tags withing a class comment.
89
* @return array(string => int)
91
protected function getAllowedTags()
103
}//end getAllowedTags()
107
* Parses the license tag of this class comment.
109
* @param array $tokens The tokens that comprise this tag.
111
* @return PHP_CodeSniffer_CommentParser_PairElement
113
protected function parseLicense($tokens)
115
$this->_license = new PHP_CodeSniffer_CommentParser_PairElement(
116
$this->previousElement,
122
return $this->_license;
124
}//end parseLicense()
128
* Parses the copyright tags of this class comment.
130
* @param array $tokens The tokens that comprise this tag.
132
* @return PHP_CodeSniffer_CommentParser_SingleElement
134
protected function parseCopyright($tokens)
136
$copyright = new PHP_CodeSniffer_CommentParser_SingleElement(
137
$this->previousElement,
143
$this->_copyrights[] = $copyright;
146
}//end parseCopyright()
150
* Parses the category tag of this class comment.
152
* @param array $tokens The tokens that comprise this tag.
154
* @return PHP_CodeSniffer_CommentParser_SingleElement
156
protected function parseCategory($tokens)
158
$this->_category = new PHP_CodeSniffer_CommentParser_SingleElement(
159
$this->previousElement,
165
return $this->_category;
167
}//end parseCategory()
171
* Parses the author tag of this class comment.
173
* @param array $tokens The tokens that comprise this tag.
175
* @return array(PHP_CodeSniffer_CommentParser_SingleElement)
177
protected function parseAuthor($tokens)
179
$author = new PHP_CodeSniffer_CommentParser_SingleElement(
180
$this->previousElement,
186
$this->_authors[] = $author;
193
* Parses the version tag of this class comment.
195
* @param array $tokens The tokens that comprise this tag.
197
* @return PHP_CodeSniffer_CommentParser_SingleElement
199
protected function parseVersion($tokens)
201
$this->_version = new PHP_CodeSniffer_CommentParser_SingleElement(
202
$this->previousElement,
208
return $this->_version;
210
}//end parseVersion()
214
* Parses the package tag found in this test.
216
* @param array $tokens The tokens that comprise this var.
218
* @return PHP_CodeSniffer_CommentParser_SingleElement
220
protected function parsePackage($tokens)
222
$this->_package = new PHP_CodeSniffer_CommentParser_SingleElement(
223
$this->previousElement,
229
return $this->_package;
231
}//end parsePackage()
235
* Parses the package tag found in this test.
237
* @param array $tokens The tokens that comprise this var.
239
* @return PHP_CodeSniffer_CommentParser_SingleElement
241
protected function parseSubpackage($tokens)
243
$this->_subpackage = new PHP_CodeSniffer_CommentParser_SingleElement(
244
$this->previousElement,
250
return $this->_subpackage;
252
}//end parseSubpackage()
256
* Returns the authors of this class comment.
258
* @return array(PHP_CodeSniffer_CommentParser_SingleElement)
260
public function getAuthors()
262
return $this->_authors;
268
* Returns the version of this class comment.
270
* @return PHP_CodeSniffer_CommentParser_SingleElement
272
public function getVersion()
274
return $this->_version;
280
* Returns the license of this class comment.
282
* @return PHP_CodeSniffer_CommentParser_PairElement
284
public function getLicense()
286
return $this->_license;
292
* Returns the copyrights of this class comment.
294
* @return PHP_CodeSniffer_CommentParser_SingleElement
296
public function getCopyrights()
298
return $this->_copyrights;
300
}//end getCopyrights()
304
* Returns the category of this class comment.
306
* @return PHP_CodeSniffer_CommentParser_SingleElement
308
public function getCategory()
310
return $this->_category;
316
* Returns the package that this class belongs to.
318
* @return PHP_CodeSniffer_CommentParser_SingleElement
320
public function getPackage()
322
return $this->_package;
328
* Returns the subpackage that this class belongs to.
330
* @return PHP_CodeSniffer_CommentParser_SingleElement
332
public function getSubpackage()
334
return $this->_subpackage;
336
}//end getSubpackage()