Completed
Push — master ( 26109a...6e7ebd )
by T
02:01
created

ClassMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 62.5 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 10
loc 16
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFullyQualifiedName() 3 8 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace PHPSemVerChecker\Node\Statement;
4
5
use PhpParser\Node\Stmt;
6
use PhpParser\Node\Stmt\ClassMethod as BaseClassMethod;
7
8 View Code Duplication
class ClassMethod
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
	/**
11
	 * @param \PhpParser\Node\Stmt             $context
12
	 * @param \PhpParser\Node\Stmt\ClassMethod $classMethod
13
	 * @return string
14
	 */
15 76
	public static function getFullyQualifiedName(Stmt $context, BaseClassMethod $classMethod)
16
	{
17 76
		$namespace = $context->name;
0 ignored issues
show
Bug introduced by
The property name does not seem to exist in PhpParser\Node\Stmt.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
18 76
		if (isset($context->namespacedName)) {
19
			$namespace = $context->namespacedName->toString();
0 ignored issues
show
Bug introduced by
The property namespacedName does not seem to exist in PhpParser\Node\Stmt.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
20
		}
21 76
		return $namespace . '::' . $classMethod->name;
22
	}
23
}
24