| 1 |
1060
|
mapi |
<?php |
|
| 2 |
↓
|
mapi |
/** |
|
| 3 |
↓
|
mapi |
* This file is part of PHP_Depend. |
|
| 4 |
↓
|
mapi |
* |
|
| 5 |
↓
|
mapi |
* PHP Version 5 |
|
| 6 |
↓
|
mapi |
* |
|
| 7 |
↓
|
mapi |
* Copyright (c) 2008-2010, Manuel Pichler <mapi@pdepend.org>. |
|
| 8 |
↓
|
mapi |
* All rights reserved. |
|
| 9 |
↓
|
mapi |
* |
|
| 10 |
↓
|
mapi |
* Redistribution and use in source and binary forms, with or without |
|
| 11 |
↓
|
mapi |
* modification, are permitted provided that the following conditions |
|
| 12 |
↓
|
mapi |
* are met: |
|
| 13 |
↓
|
mapi |
* |
|
| 14 |
↓
|
mapi |
* * Redistributions of source code must retain the above copyright |
|
| 15 |
↓
|
mapi |
* notice, this list of conditions and the following disclaimer. |
|
| 16 |
↓
|
mapi |
* |
|
| 17 |
↓
|
mapi |
* * Redistributions in binary form must reproduce the above copyright |
|
| 18 |
↓
|
mapi |
* notice, this list of conditions and the following disclaimer in |
|
| 19 |
↓
|
mapi |
* the documentation and/or other materials provided with the |
|
| 20 |
↓
|
mapi |
* distribution. |
|
| 21 |
↓
|
mapi |
* |
|
| 22 |
↓
|
mapi |
* * Neither the name of Manuel Pichler nor the names of his |
|
| 23 |
↓
|
mapi |
* contributors may be used to endorse or promote products derived |
|
| 24 |
↓
|
mapi |
* from this software without specific prior written permission. |
|
| 25 |
↓
|
mapi |
* |
|
| 26 |
↓
|
mapi |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
| 27 |
↓
|
mapi |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
| 28 |
↓
|
mapi |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
| 29 |
↓
|
mapi |
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
| 30 |
↓
|
mapi |
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
| 31 |
↓
|
mapi |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
| 32 |
↓
|
mapi |
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
| 33 |
↓
|
mapi |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
| 34 |
↓
|
mapi |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
| 35 |
↓
|
mapi |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
| 36 |
↓
|
mapi |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
| 37 |
↓
|
mapi |
* POSSIBILITY OF SUCH DAMAGE. |
|
| 38 |
↓
|
mapi |
* |
|
| 39 |
↓
|
mapi |
* @category QualityAssurance |
|
| 40 |
↓
|
mapi |
* @package PHP_Depend |
|
| 41 |
↓
|
mapi |
* @subpackage Log |
|
| 42 |
↓
|
mapi |
* @author Manuel Pichler <mapi@pdepend.org> |
|
| 43 |
↓
|
mapi |
* @copyright 2008-2010 Manuel Pichler. All rights reserved. |
|
| 44 |
↓
|
mapi |
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 45 |
↓
|
mapi |
* @version SVN: $Id$ |
|
| 46 |
↓
|
mapi |
* @link http://pdepend.org/ |
|
| 47 |
↓
|
mapi |
*/ |
|
| 48 |
↓
|
mapi |
|
|
| 49 |
↓
|
mapi |
require_once 'PHP/Depend/Metrics/AnalyzerI.php'; |
|
| 50 |
↓
|
mapi |
require_once 'PHP/Depend/Metrics/NodeAwareI.php'; |
|
| 51 |
↓
|
mapi |
require_once 'PHP/Depend/Metrics/ProjectAwareI.php'; |
|
| 52 |
↓
|
mapi |
|
|
| 53 |
↓
|
mapi |
/** |
|
| 54 |
↓
|
mapi |
* Dummy implementation of an analyzer. |
|
| 55 |
↓
|
mapi |
* |
|
| 56 |
↓
|
mapi |
* @category QualityAssurance |
|
| 57 |
↓
|
mapi |
* @package PHP_Depend |
|
| 58 |
↓
|
mapi |
* @subpackage Log |
|
| 59 |
↓
|
mapi |
* @author Manuel Pichler <mapi@pdepend.org> |
|
| 60 |
↓
|
mapi |
* @copyright 2008-2010 Manuel Pichler. All rights reserved. |
|
| 61 |
↓
|
mapi |
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 62 |
↓
|
mapi |
* @version Release: @package_version@ |
|
| 63 |
↓
|
mapi |
* @link http://pdepend.org/ |
|
| 64 |
↓
|
mapi |
*/ |
|
| 65 |
↓
|
mapi |
class PHP_Depend_Log_Summary_AnalyzerNodeAndProjectAwareDummy |
|
| 66 |
↓
|
mapi |
implements PHP_Depend_Metrics_AnalyzerI, |
|
| 67 |
↓
|
mapi |
PHP_Depend_Metrics_NodeAwareI, |
|
| 68 |
↓
|
mapi |
PHP_Depend_Metrics_ProjectAwareI |
|
| 69 |
↓
|
mapi |
{ |
|
| 70 |
↓
|
mapi |
/** |
|
| 71 |
↓
|
mapi |
* Dummy project metrics. |
|
| 72 |
↓
|
mapi |
* |
|
| 73 |
↓
|
mapi |
* @var array(string=>mixed) $projectMetrics |
|
| 74 |
↓
|
mapi |
*/ |
|
| 75 |
↓
|
mapi |
protected $projectMetrics = null; |
|
| 76 |
↓
|
mapi |
|
|
| 77 |
↓
|
mapi |
/** |
|
| 78 |
↓
|
mapi |
* Dummy node metrics. |
|
| 79 |
↓
|
mapi |
* |
|
| 80 |
↓
|
mapi |
* @var array(string=>array) $nodeMetrics |
|
| 81 |
↓
|
mapi |
*/ |
|
| 82 |
↓
|
mapi |
protected $nodeMetrics = null; |
|
| 83 |
↓
|
mapi |
|
|
| 84 |
↓
|
mapi |
/** |
|
| 85 |
↓
|
mapi |
* Constructs a new analyzer dummy instance. |
|
| 86 |
↓
|
mapi |
* |
|
| 87 |
↓
|
mapi |
* @param array(string=>mixed) $projectMetrics Dummy project metrics. |
|
| 88 |
↓
|
mapi |
* @param array(string=>array) $nodeMetrics Dummy node metrics. |
|
| 89 |
↓
|
mapi |
*/ |
|
| 90 |
↓
|
mapi |
public function __construct(array $projectMetrics = array(), array $nodeMetrics = array()) |
|
| 91 |
↓
|
mapi |
{ |
|
| 92 |
↓
|
mapi |
$this->projectMetrics = $projectMetrics; |
|
| 93 |
↓
|
mapi |
$this->nodeMetrics = $nodeMetrics; |
|
| 94 |
↓
|
mapi |
} |
|
| 95 |
↓
|
mapi |
|
|
| 96 |
↓
|
mapi |
/** |
|
| 97 |
↓
|
mapi |
* Adds a listener to this analyzer. |
|
| 98 |
↓
|
mapi |
* |
|
| 99 |
↓
|
mapi |
* @param PHP_Depend_Metrics_ListenerI $listener The listener instance. |
|
| 100 |
↓
|
mapi |
* |
|
| 101 |
↓
|
mapi |
* @return void |
|
| 102 |
↓
|
mapi |
*/ |
|
| 103 |
↓
|
mapi |
public function addAnalyzeListener(PHP_Depend_Metrics_ListenerI $listener) { |
|
| 104 |
↓
|
mapi |
} |
|
| 105 |
↓
|
mapi |
|
|
| 106 |
↓
|
mapi |
/** |
|
| 107 |
↓
|
mapi |
* Removes the listener from this analyzer. |
|
| 108 |
↓
|
mapi |
* |
|
| 109 |
↓
|
mapi |
* @param PHP_Depend_Metrics_ListenerI $listener The listener instance. |
|
| 110 |
↓
|
mapi |
* |
|
| 111 |
↓
|
mapi |
* @return void |
|
| 112 |
↓
|
mapi |
*/ |
|
| 113 |
↓
|
mapi |
public function removeAnalyzeListener(PHP_Depend_Metrics_ListenerI $listener) { |
|
| 114 |
↓
|
mapi |
} |
|
| 115 |
↓
|
mapi |
|
|
| 116 |
↓
|
mapi |
/** |
|
| 117 |
↓
|
mapi |
* Processes all {@link PHP_Depend_Code_Package} code nodes. |
|
| 118 |
↓
|
mapi |
* |
|
| 119 |
↓
|
mapi |
* @param PHP_Depend_Code_NodeIterator $packages All code packages. |
|
| 120 |
↓
|
mapi |
* |
|
| 121 |
↓
|
mapi |
* @return void |
|
| 122 |
↓
|
mapi |
*/ |
|
| 123 |
↓
|
mapi |
public function analyze(PHP_Depend_Code_NodeIterator $packages) |
|
| 124 |
↓
|
mapi |
{ |
|
| 125 |
↓
|
mapi |
} |
|
| 126 |
↓
|
mapi |
|
|
| 127 |
↓
|
mapi |
/** |
|
| 128 |
↓
|
mapi |
* By default all analyzers are enabled. Overwrite this method to provide |
|
| 129 |
↓
|
mapi |
* state based disabling/enabling. |
|
| 130 |
↓
|
mapi |
* |
|
| 131 |
↓
|
mapi |
* @return boolean |
|
| 132 |
↓
|
mapi |
* @since 0.9.10 |
|
| 133 |
↓
|
mapi |
*/ |
|
| 134 |
↓
|
mapi |
public function isEnabled() |
|
| 135 |
↓
|
mapi |
{ |
|
| 136 |
↓
|
mapi |
return true; |
|
| 137 |
↓
|
mapi |
} |
|
| 138 |
↓
|
mapi |
|
|
| 139 |
↓
|
mapi |
/** |
|
| 140 |
↓
|
mapi |
* Returns the project metrics. |
|
| 141 |
↓
|
mapi |
* |
|
| 142 |
↓
|
mapi |
* @return array(string=>mixed) |
|
| 143 |
↓
|
mapi |
* @see PHP_Depend_Metrics_ProjectAwareI::getProjectMetrics() |
|
| 144 |
↓
|
mapi |
*/ |
|
| 145 |
↓
|
mapi |
public function getProjectMetrics() |
|
| 146 |
↓
|
mapi |
{ |
|
| 147 |
↓
|
mapi |
return $this->projectMetrics; |
|
| 148 |
↓
|
mapi |
} |
|
| 149 |
↓
|
mapi |
|
|
| 150 |
↓
|
mapi |
/** |
|
| 151 |
↓
|
mapi |
* Returns an array with metrics for the requested node. |
|
| 152 |
↓
|
mapi |
* |
|
| 153 |
↓
|
mapi |
* @param PHP_Depend_Code_NodeI $node The context node instance. |
|
| 154 |
↓
|
mapi |
* |
|
| 155 |
↓
|
mapi |
* @return array(string=>mixed) |
|
| 156 |
↓
|
mapi |
* @see PHP_Depend_Metrics_NodeAwareI::getNodeMetrics() |
|
| 157 |
↓
|
mapi |
*/ |
|
| 158 |
↓
|
mapi |
public function getNodeMetrics(PHP_Depend_Code_NodeI $node) |
|
| 159 |
↓
|
mapi |
{ |
|
| 160 |
↓
|
mapi |
return $this->nodeMetrics; |
|
| 161 |
↓
|
mapi |
} |
|
| 162 |
↓
|
mapi |
} |
|