GetNewNonce   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
dl 0
loc 12
ccs 0
cts 5
cp 0
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A _isValid() 0 2 1
A getNonce() 0 4 1
1
<?php
2
3
namespace LE_ACME2\Response;
4
5
class GetNewNonce extends AbstractResponse {
6
7
    protected $_pattern = '/^Replay\-Nonce: (\S+)$/i';
8
9
    protected function _isValid() : bool {
10
        return $this->_preg_match_headerLine($this->_pattern) !== null;
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->_preg_match_headerLine($this->_pattern) targeting LE_ACME2\Response\Abstra...preg_match_headerLine() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
11
    }
12
13
    public function getNonce() : string {
14
15
        $matches = $this->_preg_match_headerLine($this->_pattern);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $matches is correct as $this->_preg_match_headerLine($this->_pattern) targeting LE_ACME2\Response\Abstra...preg_match_headerLine() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
16
        return trim($matches[1]);
17
    }
18
}