parser_file.php | ||||
|
||||
Coverage | ||||||||||
Classes | Functions / Methods | Lines | ||||||||
Total |
|
0.00% | 0 / 1 |
|
75.00% | 3 / 4 | CRAP |
|
96.97% | 32 / 33 |
ParserFile |
|
0.00% | 0 / 1 |
|
75.00% | 3 / 4 | 12 |
|
96.97% | 32 / 33 |
__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) |
|
0.00% | 0 / 1 | 5.01 |
|
92.86% | 13 / 14 | |||
dump() |
|
100.00% | 1 / 1 | 5 |
|
100.00% | 10 / 10 |
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 : * Contains the {@link ParserFile} class 23 : * 24 : * @package Parser model 25 : * @author Josh Heidenreich 26 : * @since 0.1 27 : **/ 28 : 29 : /** 30 : * Represents a file 31 : **/ 32 : class ParserFile extends CodeParserItem { 33 : public $name; 34 : public $description; 35 : public $namespace; 36 : public $functions; 37 : public $classes; 38 : public $constants; 39 : public $enumerations; 40 : public $source; 41 : 42 : public function __construct() 43 : { 44 103 : parent::__construct(); 45 : 46 103 : $this->functions = array(); 47 103 : $this->classes = array(); 48 103 : $this->constants = array(); 49 103 : $this->enumerations = array(); 50 103 : $this->namespace = null; 51 103 : } 52 : 53 : 54 : /** 55 : * Applies the contents of a doc-block to this element 56 : * 57 : * @param $text The content of the DocBlock 58 : **/ 59 : public function processSpecificDocblockTags($docblock_tags) 60 : { 61 103 : $this->description = htmlify_text(@$docblock_tags['@summary']); 62 103 : } 63 : 64 : 65 : /** 66 : * Cascades Docblock tags into the children that do not have any tags, and then 67 : * runs processTags() for all of the children items. 68 : **/ 69 : public function treeWalk($function_name, ParserItem $parent_item = null) 70 : { 71 103 : call_user_func($function_name, $this, $parent_item); 72 : 73 103 : foreach ($this->classes as $item) { 74 53 : $item->treeWalk($function_name, $this); 75 103 : } 76 : 77 103 : foreach ($this->functions as $item) { 78 50 : $item->treeWalk($function_name, $this); 79 103 : } 80 : 81 103 : foreach ($this->constants as $item) { 82 4 : $item->treeWalk($function_name, $this); 83 103 : } 84 : 85 103 : foreach ($this->enumerations as $item) { 86 0 : $item->treeWalk($function_name, $this); 87 103 : } 88 103 : } 89 : 90 : 91 : /** 92 : * Debugging use only 93 : **/ 94 : public function dump() 95 : { 96 2 : echo '<div style="border: 1px black solid;">'; 97 2 : echo $this->name; 98 2 : echo "<pre>{$this->description}</pre>"; 99 2 : foreach ($this->functions as $a) $a->dump(); 100 2 : foreach ($this->classes as $a) $a->dump(); 101 2 : foreach ($this->constants as $a) $a->dump(); 102 2 : foreach ($this->enumerations as $a) $a->dump(); 103 : 104 2 : parent::dump(); 105 2 : echo '</div>'; 106 2 : } 107 : 108 : 109 : } 110 : 111 : 112 : ?> |
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. |