Completed
Push — master ( 48abf8...8f7739 )
by C
13:50
created

DecrypterFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 30
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createDecryptor() 0 20 3
1
<?php
2
namespace Tartana\Component\Decrypter;
3
use Tartana\Mixins\LoggerAwareTrait;
4
5
class DecrypterFactory
6
{
7
	use LoggerAwareTrait;
8
9
	/**
10
	 *
11
	 * @param string $filename
0 ignored issues
show
Documentation introduced by
There is no parameter named $filename. Did you maybe mean $fileName?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
12
	 * @return \Tartana\Component\Decrypter\DecrypterInterface
13
	 */
14 5
	public function createDecryptor ($fileName)
15
	{
16 5
		$className = 'Tartana\\Component\\Decrypter\\' . ucfirst(strtolower(pathinfo($fileName, PATHINFO_EXTENSION)));
17
18
		// Check if the class exists for the host to download
19 5
		if (! class_exists($className))
20
		{
21 2
			return null;
22
		}
23
24 3
		$decrypter = new $className();
25 3
		if (! $decrypter instanceof DecrypterInterface)
26
		{
27 1
			return null;
28
		}
29
30 2
		$decrypter->setLogger($this->getLogger());
31
32 2
		return $decrypter;
33
	}
34
}