Changeset 2963 for trunk/vendor/spikephpcoverage
- Timestamp:
- 10/21/07 07:23:59 (15 months ago)
- Location:
- trunk/vendor/spikephpcoverage
- Files:
-
- 19 modified
-
cli/driver.php (modified) (5 diffs)
-
cli/instrument.php (modified) (10 diffs)
-
CoverageRecorder.php (modified) (4 diffs)
-
parser/BasicXmlParser.php (modified) (1 diff)
-
parser/CoverageXmlParser.php (modified) (2 diffs)
-
parser/Parser.php (modified) (3 diffs)
-
parser/PHPParser.php (modified) (2 diffs)
-
PEAR.php (modified) (4 diffs)
-
phpcoverage.inc.php (modified) (1 diff)
-
phpcoverage.remote.bottom.inc.php (modified) (2 diffs)
-
phpcoverage.remote.top.inc.php (modified) (3 diffs)
-
remote/RemoteCoverageRecorder.php (modified) (7 diffs)
-
remote/XdebugTraceReader.php (modified) (3 diffs)
-
reporter/CoverageReporter.php (modified) (3 diffs)
-
reporter/HtmlCoverageReporter.php (modified) (6 diffs)
-
util/CoverageLogger.php (modified) (1 diff)
-
util/Utility.php (modified) (3 diffs)
-
XML/Parser.php (modified) (7 diffs)
-
XML/Parser/Simple.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/vendor/spikephpcoverage/cli/driver.php
r2847 r2963 19 19 */ 20 20 21 if( !defined("__PHPCOVERAGE_HOME")) {21 if( ! defined("__PHPCOVERAGE_HOME")) { 22 22 define("__PHPCOVERAGE_HOME", dirname(dirname(__FILE__))); 23 23 } … … 149 149 $excludePaths = array(); 150 150 151 if ( !$OPTION['cov-url']){152 if( !$OPTION['report'] && !$OPTION['cov-data-files']) {151 if ( ! $OPTION['cov-url']){ 152 if( ! $OPTION['report'] && !$OPTION['cov-data-files']) { 153 153 echo "ERROR: No --cov-url option specified.\n"; 154 154 exit(1); … … 157 157 158 158 if($OPTION['init']) { 159 if( !$OPTION['tmp-dir']) {159 if( ! $OPTION['tmp-dir']) { 160 160 $OPTION['tmp-dir'] = $util->getTmpDir(); 161 161 } 162 if( !$OPTION['cov-file-name']) {162 if( ! $OPTION['cov-file-name']) { 163 163 $OPTION['cov-file-name'] = "phpcoverage.data.xml"; 164 164 } … … 166 166 167 167 if($OPTION['report']) { 168 if ( !$OPTION['report-name']){168 if ( ! $OPTION['report-name']){ 169 169 echo "ERROR: No --report-name option specified.\n"; 170 170 exit(1); 171 171 } 172 172 173 if( !$OPTION['report-dir']) {174 if( !empty($PHPCOVERAGE_REPORT_DIR)) {173 if( ! $OPTION['report-dir']) { 174 if( ! empty($PHPCOVERAGE_REPORT_DIR)) { 175 175 $OPTION["report-dir"] = $PHPCOVERAGE_REPORT_DIR; 176 176 } … … 226 226 $OPTION['cov-data-fileset'] = explode(",", $OPTION['cov-data-files']); 227 227 foreach($OPTION['cov-data-fileset'] as $covDataFile) { 228 if( !is_readable($covDataFile)) {228 if( ! is_readable($covDataFile)) { 229 229 echo "Error: Cannot read cov-data-file: " . $covDataFile . "\n"; 230 230 exit(1); -
trunk/vendor/spikephpcoverage/cli/instrument.php
r2847 r2963 11 11 #!/bin/php 12 12 13 if( !defined("__PHPCOVERAGE_HOME")) {13 if( ! defined("__PHPCOVERAGE_HOME")) { 14 14 define("__PHPCOVERAGE_HOME", dirname(dirname(__FILE__))); 15 15 } … … 82 82 83 83 $fp = fopen($tmpfile, "w"); 84 if( !$fp) {84 if( ! $fp) { 85 85 error("Cannot write to file: $tmpfile"); 86 86 } … … 94 94 } 95 95 $ret = rename($tmpfile, $file); 96 if( !$ret) {96 if( ! $ret) { 97 97 error("Cannot save file: $file"); 98 98 } … … 119 119 $fr = fopen($file, "r"); 120 120 $fw = fopen($tmpfile, "w"); 121 if( !$fr) {121 if( ! $fr) { 122 122 error("Cannot read file: $file"); 123 123 } 124 if( !$fr) {124 if( ! $fr) { 125 125 error("Cannot write to file: $tmpfile"); 126 126 } 127 while( !feof($fr)) {127 while( ! feof($fr)) { 128 128 $line = fgets($fr); 129 129 if(strpos($line, $top) === false && strpos($line, $bottom) === false) { … … 139 139 } 140 140 $ret = rename($tmpfile, $file); 141 if( !$ret) {141 if( ! $ret) { 142 142 error("Cannot save file: $file"); 143 143 } … … 159 159 while(count($dirs) > 0) { 160 160 $currDir = realpath(array_pop($dirs)); 161 if( !is_readable($currDir)) {161 if( ! is_readable($currDir)) { 162 162 continue; 163 163 } … … 237 237 238 238 239 if( !is_dir($LOCAL_PHPCOVERAGE_LOCATION)) {239 if( ! is_dir($LOCAL_PHPCOVERAGE_LOCATION)) { 240 240 error("LOCAL_PHPCOVERAGE_LOCATION [$LOCAL_PHPCOVERAGE_LOCATION] not found."); 241 241 } … … 252 252 } 253 253 $ret = copy($PHPCOVERAGE_HOME . $top_file, $LOCAL_PHPCOVERAGE_LOCATION . $top_file); 254 if( !$ret) {254 if( ! $ret) { 255 255 error("Cannot copy to $LOCAL_PHPCOVERAGE_LOCATION"); 256 256 } … … 259 259 } 260 260 $ret = copy($PHPCOVERAGE_HOME . $bottom_file, $LOCAL_PHPCOVERAGE_LOCATION . $bottom_file); 261 if( !$ret) {261 if( ! $ret) { 262 262 error("Cannot copy to $LOCAL_PHPCOVERAGE_LOCATION"); 263 263 } … … 268 268 $paths[] = getcwd(); 269 269 } 270 if( !isset($EXCLUDE_FILES) || empty($EXCLUDE_FILES)) {270 if( ! isset($EXCLUDE_FILES) || empty($EXCLUDE_FILES)) { 271 271 $EXCLUDE_FILES = array(); 272 272 } 273 273 for($i = 0; $i < count($EXCLUDE_FILES); $i++) { 274 274 // Remove a file from the array if it does not exist 275 if( !file_exists($EXCLUDE_FILES[$i])) {275 if( ! file_exists($EXCLUDE_FILES[$i])) { 276 276 array_splice($EXCLUDE_FILES, $i, 1); 277 277 $i --; -
trunk/vendor/spikephpcoverage/CoverageRecorder.php
r2847 r2963 10 10 <?php 11 11 12 if( !defined("__PHPCOVERAGE_HOME")) {12 if( ! defined("__PHPCOVERAGE_HOME")) { 13 13 define("__PHPCOVERAGE_HOME", dirname(__FILE__)); 14 14 } … … 169 169 protected function removeAbsentPaths(&$dirs) { 170 170 for($i = 0; $i < count($dirs); $i++) { 171 if( !file_exists($dirs[$i])) {171 if( ! file_exists($dirs[$i])) { 172 172 // echo "Not found: " . $dirs[$i] . "\n"; 173 173 $this->errors[] = "Not found: " . $dirs[$i] … … 212 212 while(count($dirs) > 0) { 213 213 $currDir = realpath(array_pop($dirs)); 214 if( !is_readable($currDir)) {214 if( ! is_readable($currDir)) { 215 215 continue; 216 216 } … … 272 272 } 273 273 } 274 if( !array_key_exists($files[$i], $this->coverageData)) {274 if( ! array_key_exists($files[$i], $this->coverageData)) { 275 275 $this->coverageData[$files[$i]] = array(); 276 276 } -
trunk/vendor/spikephpcoverage/parser/BasicXmlParser.php
r2847 r2963 12 12 require_once("XML/Parser.php"); 13 13 14 if( !defined("ATTRIBUTES")) {14 if( ! defined("ATTRIBUTES")) { 15 15 define("ATTRIBUTES", "__ATTRIBUTES__"); 16 16 } -
trunk/vendor/spikephpcoverage/parser/CoverageXmlParser.php
r2847 r2963 43 43 $fileAttributes = $this->handleAttrTag($name, $attrs); 44 44 $this->_lastFilePath = $fileAttributes["PATH"]; 45 if( !isset($this->_data[$this->_lastFilePath])) {45 if( ! isset($this->_data[$this->_lastFilePath])) { 46 46 $this->_data[$this->_lastFilePath] = array(); 47 47 } … … 51 51 $lineAttributes = $this->handleAttrTag($name, $attrs); 52 52 $lineNumber = (int)$lineAttributes["LINE-NUMBER"]; 53 if( !isset($this->_data[$this->_lastFilePath][$lineNumber])) {53 if( ! isset($this->_data[$this->_lastFilePath][$lineNumber])) { 54 54 $this->_data[$this->_lastFilePath][$lineNumber] = (int)$lineAttributes["FREQUENCY"]; 55 55 } -
trunk/vendor/spikephpcoverage/parser/Parser.php
r2847 r2963 10 10 <?php 11 11 12 if( !defined("__PHPCOVERAGE_HOME")) {12 if( ! defined("__PHPCOVERAGE_HOME")) { 13 13 define("__PHPCOVERAGE_HOME", dirname(dirname(__FILE__))); 14 14 } … … 74 74 $this->filename = $filename; 75 75 $ret = $this->openFileReadOnly(); 76 if( !$ret) {76 if( ! $ret) { 77 77 die("Error: Cannot open file: $this->filename \n"); 78 78 } … … 102 102 */ 103 103 public function getLine() { 104 if( !feof($this->fileRef)) {104 if( ! feof($this->fileRef)) { 105 105 $this->line = fgets($this->fileRef); 106 106 $this->processLine($this->line); -
trunk/vendor/spikephpcoverage/parser/PHPParser.php
r2847 r2963 10 10 <?php 11 11 12 if( !defined("__PHPCOVERAGE_HOME")) {12 if( ! defined("__PHPCOVERAGE_HOME")) { 13 13 define("__PHPCOVERAGE_HOME", dirname(dirname(__FILE__))); 14 14 } … … 84 84 85 85 // If we are not inside PHP opening tag 86 if( !$this->inPHP) {86 if( ! $this->inPHP) { 87 87 $pos = -1; 88 88 -
trunk/vendor/spikephpcoverage/PEAR.php
r2847 r2963 46 46 47 47 // instant backwards compatibility 48 if ( !defined('PATH_SEPARATOR')) {48 if ( ! defined('PATH_SEPARATOR')) { 49 49 if (OS_WINDOWS) { 50 50 define('PATH_SEPARATOR', ';'); … … 165 165 global $_PEAR_destructor_object_list; 166 166 $_PEAR_destructor_object_list[] = &$this; 167 if ( !isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {167 if ( ! isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { 168 168 register_shutdown_function("_PEAR_call_destructors"); 169 169 $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; … … 440 440 } 441 441 return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME 442 } elseif ( !empty($error_code)) {442 } elseif ( ! empty($error_code)) { 443 443 // $error_code comes alone, trying to unset it 444 444 if ($this->_checkDelExpect($error_code)) { … … 708 708 function loadExtension($ext) 709 709 { 710 if ( !extension_loaded($ext)) {710 if ( ! extension_loaded($ext)) { 711 711 // if either returns true dl() will produce a FATAL error, stop that 712 712 if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) { -
trunk/vendor/spikephpcoverage/phpcoverage.inc.php
r2847 r2963 44 44 45 45 // Fallback 46 if( !defined("PHPCOVERAGE_HOME")) {46 if( ! defined("PHPCOVERAGE_HOME")) { 47 47 $include_path = get_include_path(); 48 48 set_include_path($PHPCOVERAGE_HOME. PATH_SEPARATOR . $include_path); -
trunk/vendor/spikephpcoverage/phpcoverage.remote.bottom.inc.php
r2847 r2963 20 20 __FILE__, __LINE__); 21 21 22 if( !isset($cov)) {22 if( ! isset($cov)) { 23 23 if(file_exists($tmpFile)) { 24 24 $object = file_get_contents($tmpFile); … … 30 30 if(isset($cov)) { 31 31 // PHPCoverage bottom half 32 if( !isset($called_script)) {32 if( ! isset($called_script)) { 33 33 $called_script = ""; 34 34 } -
trunk/vendor/spikephpcoverage/phpcoverage.remote.top.inc.php
r2847 r2963 29 29 $called_script = basename($_SERVER["SCRIPT_FILENAME"]); 30 30 31 if( !empty($_REQUEST["PHPCOVERAGE_HOME"])) {31 if( ! empty($_REQUEST["PHPCOVERAGE_HOME"])) { 32 32 $PHPCOVERAGE_HOME = $_REQUEST["PHPCOVERAGE_HOME"]; 33 33 } … … 52 52 53 53 // Fallback 54 if( !defined("PHPCOVERAGE_HOME")) {54 if( ! defined("PHPCOVERAGE_HOME")) { 55 55 $include_path = get_include_path(); 56 56 set_include_path($PHPCOVERAGE_HOME. ":" . $include_path); … … 95 95 } 96 96 97 if( !empty($_REQUEST["phpcoverage-action"])) {97 if( ! empty($_REQUEST["phpcoverage-action"])) { 98 98 $logger->info("[phpcoverage.remote.top.inc.php] phpcoverage-action=" . strtolower($_REQUEST["phpcoverage-action"]), 99 99 __FILE__, __LINE__); 100 100 switch(strtolower($_REQUEST["phpcoverage-action"])) { 101 101 case "init": 102 if( !empty($_REQUEST["tmp-dir"])) {102 if( ! empty($_REQUEST["tmp-dir"])) { 103 103 $cov->setTmpDir($_REQUEST["tmp-dir"]); 104 104 } 105 105 $cov->setCoverageFileName($_REQUEST["cov-file-name"]); 106 if( !$cov->cleanCoverageFile()) {106 if( ! $cov->cleanCoverageFile()) { 107 107 die("Cannot delete existing coverage data."); 108 108 } -
trunk/vendor/spikephpcoverage/remote/RemoteCoverageRecorder.php
r2847 r2963 10 10 <?php 11 11 12 if( !defined("__PHPCOVERAGE_HOME")) {12 if( ! defined("__PHPCOVERAGE_HOME")) { 13 13 define("__PHPCOVERAGE_HOME", dirname(dirname(__FILE__))); 14 14 } … … 125 125 $xmlString = ""; 126 126 $xmlBody = ""; 127 if( !empty($this->coverageData)) {127 if( ! empty($this->coverageData)) { 128 128 foreach($this->coverageData as $file => &$lines) { 129 129 $xmlBody .= "<file path=\"". $util->replaceBackslashes($file) . "\">"; … … 158 158 protected function parseCoverageXml(&$xml, $stream=false) { 159 159 // Need to handle multiple xml files. 160 if( !is_array($xml)) {160 if( ! is_array($xml)) { 161 161 $xml = array($xml); 162 162 } … … 195 195 $fp = fopen($filepath, "r"); 196 196 if($fp) { 197 while( !feof($fp)) {197 while( ! feof($fp)) { 198 198 $xml = fread($fp, 4096); 199 199 echo $xml; … … 226 226 protected function appendDataToFile($newXml) { 227 227 $filepath = $this->tmpDir . "/" . $this->coverageFileName; 228 if( !file_exists($filepath)) {228 if( ! file_exists($filepath)) { 229 229 // If new file, write the xml start and end tags 230 230 $bytes = file_put_contents($filepath, $this->xmlStart . "\n" . $this->xmlEnd); 231 if( !$bytes) {231 if( ! $bytes) { 232 232 $this->logger->critical("[RemoteCoverageRecorder::appendDataToFile()] Could not create file: " . $filepath, __FILE__, __LINE__); 233 233 return false; … … 239 239 fseek($res, -1 * strlen($this->xmlEnd), SEEK_END); 240 240 $ret = fwrite($res, $newXml); 241 if( !$ret) {241 if( ! $ret) { 242 242 $this->logger->error("[RemoteCoverageRecorder::appendDataToFile()] Could not append data to file.", 243 243 __FILE__, __LINE__); … … 271 271 $xml = $this->prepareCoverageXml(); 272 272 $ret = $this->appendDataToFile($xml); 273 if( !$ret) {273 if( ! $ret) { 274 274 $this->logger->warn("[RemoteCoverageRecorder::saveCoverageXml()] " 275 275 . "ERROR: Nothing was written to " . $filepath, -
trunk/vendor/spikephpcoverage/remote/XdebugTraceReader.php
r2847 r2963 61 61 */ 62 62 public function parseTraceFile() { 63 if( !$this->openTraceFile()) {63 if( ! $this->openTraceFile()) { 64 64 error_log("[XdebugTraceReader::parseTraceFile()] Unable to read trace file."); 65 65 return false; 66 66 } 67 while( !feof($this->handle)) {67 while( ! feof($this->handle)) { 68 68 $line = fgets($this->handle); 69 69 // echo "Line: " . $line . "\n"; … … 91 91 return false; 92 92 } 93 if( !file_exists($dataparts[$cnt-2])) {93 if( ! file_exists($dataparts[$cnt-2])) { 94 94 // echo "No file: " . $dataparts[$cnt-2] . "\n"; 95 95 return false; … … 99 99 $dataparts[$cnt-1] = trim($dataparts[$cnt-1]); 100 100 101 if( !isset($this->coverage[$dataparts[$cnt-2]][$dataparts[$cnt-1]])) {101 if( ! isset($this->coverage[$dataparts[$cnt-2]][$dataparts[$cnt-1]])) { 102 102 $this->coverage[$dataparts[$cnt-2]][$dataparts[$cnt-1]] = 1; 103 103 } -
trunk/vendor/spikephpcoverage/reporter/CoverageReporter.php
r2847 r2963 10 10 <?php 11 11 12 if( !defined("__PHPCOVERAGE_HOME")) {12 if( ! defined("__PHPCOVERAGE_HOME")) { 13 13 define("__PHPCOVERAGE_HOME", dirname(dirname(__FILE__))); 14 14 } … … 101 101 protected function createReportDir() { 102 102 global $util; 103 if( !file_exists($this->outputDir)) {103 if( ! file_exists($this->outputDir)) { 104 104 $util->makeDirRecursive($this->outputDir, 0755); 105 105 } … … 201 201 else { 202 202 $filename = $util->replaceBackslashes($filename); 203 if( !file_exists(dirname($filename))) {203 if( ! file_exists(dirname($filename))) { 204 204 $ret = $util->makeDirRecursive(dirname($filename), 0755); 205 if( !$ret) {205 if( ! $ret) { 206 206 die ("Cannot create directory " . dirname($filename) . "\n"); 207 207 } -
trunk/vendor/spikephpcoverage/reporter/HtmlCoverageReporter.php
r2847 r2963 10 10 <?php 11 11 12 if( !defined("__PHPCOVERAGE_HOME")) {12 if( ! defined("__PHPCOVERAGE_HOME")) { 13 13 define("__PHPCOVERAGE_HOME", dirname(dirname(__FILE__))); 14 14 } … … 67 67 */ 68 68 public function generateReport(&$data) { 69 if( !file_exists($this->outputDir)) {69 if( ! file_exists($this->outputDir)) { 70 70 mkdir($this->outputDir); 71 71 } … … 155 155 } 156 156 $imagesSpikeDir = $imagesDir . "/spikesource"; 157 if( !file_exists($imagesSpikeDir)) {157 if( ! file_exists($imagesSpikeDir)) { 158 158 mkdir($imagesSpikeDir); 159 159 } … … 342 342 $str .= $this->writeIndexFileTableHead(); 343 343 $str .= '<tbody>'; 344 if( !empty($this->coverageData)) {344 if( ! empty($this->coverageData)) { 345 345 foreach($this->coverageData as $filename => &$lines) { 346 346 $realFile = realpath($filename); … … 440 440 $fileLink = $util->replaceBackslashes($fileLink); 441 441 $parentDir = $util->replaceBackslashes(dirname($fileLink)); 442 if( !file_exists($parentDir)) {442 if( ! file_exists($parentDir)) { 443 443 //echo "\nCreating dir: $parentDir\n"; 444 444 &nb