~ubuntu-branches/ubuntu/saucy/php-codesniffer/saucy

« back to all changes in this revision

Viewing changes to PHP_CodeSniffer-1.0.1/CodeSniffer/CommentParser/MemberCommentParser.php

  • Committer: Bazaar Package Importer
  • Author(s): Jack Bates
  • Date: 2008-10-01 17:39:43 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20081001173943-2dy06n1e8zwyw1o8
Tags: 1.1.0-1
* New upstream release
* Acknowledge NMU, thanks Jan

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/**
3
 
 * Parses class member comments.
4
 
 *
5
 
 * PHP version 5
6
 
 *
7
 
 * @category  PHP
8
 
 * @package   PHP_CodeSniffer
9
 
 * @author    Greg Sherwood <gsherwood@squiz.net>
10
 
 * @author    Marc McIntyre <mmcintyre@squiz.net>
11
 
 * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
12
 
 * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
13
 
 * @version   CVS: $Id: MemberCommentParser.php,v 1.9 2008/02/01 03:19:53 squiz Exp $
14
 
 * @link      http://pear.php.net/package/PHP_CodeSniffer
15
 
 */
16
 
 
17
 
if (class_exists('PHP_CodeSniffer_CommentParser_ClassCommentParser', true) === false) {
18
 
    $error = 'Class PHP_CodeSniffer_CommentParser_ClassCommentParser not found';
19
 
    throw new PHP_CodeSniffer_Exception($error);
20
 
}
21
 
 
22
 
/**
23
 
 * Parses class member comments.
24
 
 *
25
 
 * @category  PHP
26
 
 * @package   PHP_CodeSniffer
27
 
 * @author    Greg Sherwood <gsherwood@squiz.net>
28
 
 * @author    Marc McIntyre <mmcintyre@squiz.net>
29
 
 * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
30
 
 * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
31
 
 * @version   Release: 1.0.1
32
 
 * @link      http://pear.php.net/package/PHP_CodeSniffer
33
 
 */
34
 
class PHP_CodeSniffer_CommentParser_MemberCommentParser extends PHP_CodeSniffer_CommentParser_ClassCommentParser
35
 
{
36
 
 
37
 
    /**
38
 
     * Represents a \@var tag in a member comment.
39
 
     *
40
 
     * @var PHP_CodeSniffer_CommentParser_SingleElement
41
 
     */
42
 
    private $_var = null;
43
 
 
44
 
 
45
 
    /**
46
 
     * Parses Var tags.
47
 
     *
48
 
     * @param array $tokens The tokens that represent this tag.
49
 
     *
50
 
     * @return PHP_CodeSniffer_CommentParser_SingleElement
51
 
     */
52
 
    protected function parseVar($tokens)
53
 
    {
54
 
        $this->_var = new PHP_CodeSniffer_CommentParser_SingleElement($this->previousElement, $tokens, 'var', $this->phpcsFile);
55
 
        return $this->_var;
56
 
 
57
 
    }//end parseVar()
58
 
 
59
 
 
60
 
    /**
61
 
     * Returns the var tag found in the member comment.
62
 
     *
63
 
     * @return PHP_CodeSniffer_CommentParser_PairElement
64
 
     */
65
 
    public function getVar()
66
 
    {
67
 
        return $this->_var;
68
 
 
69
 
    }//end getVar()
70
 
 
71
 
 
72
 
    /**
73
 
     * Returns the allowed tags for this parser.
74
 
     *
75
 
     * @return array
76
 
     */
77
 
    protected function getAllowedTags()
78
 
    {
79
 
        return array('var' => true);
80
 
 
81
 
    }//end getAllowedTags()
82
 
 
83
 
 
84
 
}//end class
85
 
 
86
 
?>