src/Hal/Metric/Class_/Text/HalsteadVisitor.php 1 location
|
@@ 49-55 (lines=7) @@
|
| 46 |
|
{ |
| 47 |
|
if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) { |
| 48 |
|
|
| 49 |
|
if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) { |
| 50 |
|
$name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node)); |
| 51 |
|
$classOrFunction = $this->metrics->get($name); |
| 52 |
|
} else { |
| 53 |
|
$classOrFunction = new FunctionMetric((string) $node->name); |
| 54 |
|
$this->metrics->attach($classOrFunction); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
// search for operands and operators |
| 58 |
|
$operands = []; |
src/Hal/Metric/Class_/Text/LengthVisitor.php 1 location
|
@@ 39-45 (lines=7) @@
|
| 36 |
|
{ |
| 37 |
|
if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) { |
| 38 |
|
|
| 39 |
|
if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) { |
| 40 |
|
$name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node)); |
| 41 |
|
$classOrFunction = $this->metrics->get($name); |
| 42 |
|
} else { |
| 43 |
|
$classOrFunction = new FunctionMetric((string) $node->name); |
| 44 |
|
$this->metrics->attach($classOrFunction); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
$prettyPrinter = new PrettyPrinter\Standard(); |