parser_class.php | ||||
|
||||
Coverage | ||||||||||
Classes | Functions / Methods | Lines | ||||||||
Total |
|
100.00% | 1 / 1 |
|
100.00% | 4 / 4 | CRAP |
|
100.00% | 30 / 30 |
ParserClass |
|
100.00% | 1 / 1 |
|
100.00% | 4 / 4 | 12 |
|
100.00% | 30 / 30 |
__construct() |
|
100.00% | 1 / 1 | 1 |
|
100.00% | 7 / 7 | |||
processSpecificDocblockTags($docblock_tags) |
|
100.00% | 1 / 1 | 1 |
|
100.00% | 2 / 2 | |||
treeWalk($function_name, ParserItem $parent_item = null) |
|
100.00% | 1 / 1 | 3 |
|
100.00% | 8 / 8 | |||
dump() |
|
100.00% | 1 / 1 | 7 |
|
100.00% | 13 / 13 |
1 : <?php 2 : /* 3 : Copyright 2008 Josh Heidenreich 4 : 5 : This file is part of Pelzini. 6 : 7 : Pelzini is free software: you can redistribute it and/or modify 8 : it under the terms of the GNU General Public License as published by 9 : the Free Software Foundation, either version 3 of the License, or 10 : (at your option) any later version. 11 : 12 : Pelzini 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 General Public License for more details. 16 : 17 : You should have received a copy of the GNU General Public License 18 : along with Pelzini. If not, see <http://www.gnu.org/licenses/>. 19 : */ 20 : 21 : 22 : /** 23 : * Contains the {@link ParserClass} class 24 : * 25 : * @package Parser model 26 : * @author Josh Heidenreich 27 : * @since 0.1 28 : **/ 29 : 30 : /** 31 : * Stores information about a specific class 32 : **/ 33 : class ParserClass extends CodeParserItem { 34 : public $name; 35 : public $functions; 36 : public $variables; 37 : public $visibility; 38 : public $extends; 39 : public $implements; 40 : public $abstract; 41 : public $description; 42 : public $final; 43 : 44 : /** 45 : * Creates this object 46 : **/ 47 : public function __construct() 48 : { 49 45 : parent::__construct(); 50 : 51 45 : $this->functions = array (); 52 45 : $this->variables = array (); 53 45 : $this->implements = array (); 54 45 : $this->visibility = 'public'; 55 45 : $this->final = false; 56 45 : } 57 : 58 : 59 : /** 60 : * Applies the contents of a doc-block to this element 61 : * 62 : * @param $text The content of the DocBlock 63 : **/ 64 : protected function processSpecificDocblockTags($docblock_tags) 65 : { 66 45 : $this->description = htmlify_text(@$docblock_tags['@summary']); 67 45 : } 68 : 69 : 70 : /** 71 : * Cascades Docblock tags into the children that do not have any tags, and then 72 : * runs processTags() for all of the children items. 73 : **/ 74 : public function treeWalk($function_name, ParserItem $parent_item = null) 75 : { 76 45 : call_user_func($function_name, $this, $parent_item); 77 : 78 45 : foreach ($this->functions as $item) { 79 20 : $item->treeWalk($function_name, $this); 80 45 : } 81 : 82 45 : foreach ($this->variables as $item) { 83 8 : $item->treeWalk($function_name, $this); 84 45 : } 85 45 : } 86 : 87 : 88 : /** 89 : * Debugging use only 90 : **/ 91 : public function dump() 92 : { 93 2 : echo '<div style="border: 1px blue solid;">'; 94 2 : echo $this->visibility . ' '; 95 2 : echo $this->name; 96 : 97 2 : if ($this->extends) echo '<br>extends ' . $this->extends; 98 2 : if ($this->implements) echo '<br>implements ' . implode(', ', $this->implements); 99 : 100 2 : if ($this->abstract) echo '<br>abstract'; 101 2 : if ($this->final) echo '<br>final'; 102 : 103 2 : echo '<br>' . $this->description; 104 : 105 2 : foreach ($this->variables as $a) $a->dump(); 106 2 : foreach ($this->functions as $a) $a->dump(); 107 : 108 2 : parent::dump(); 109 2 : echo '</div>'; 110 2 : } 111 : 112 : 113 : } 114 : 115 : 116 : ?> |
Generated by PHP_CodeCoverage 1.1.2 using PHP 5.4.39-0+deb7u2 and PHPUnit 3.6.10 at Fri Sep 11 11:35:19 WIT 2015. |