Completed
Push — master ( d1ea0c...72efe0 )
by Dmitry
03:12
created

Job   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 27.27%

Importance

Changes 3
Bugs 0 Features 2
Metric Value
wmc 4
c 3
b 0
f 2
lcom 1
cbo 1
dl 0
loc 21
ccs 3
cts 11
cp 0.2727
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A confirm() 0 11 3
1
<?php
2
3
namespace Basis;
4
5
use Exception;
6
7
abstract class Job
8
{
9
    use Toolkit;
10
11 9
    public function __construct(Application $app)
12
    {
13 9
        $this->app = $app;
14 9
    }
15
16
    protected function confirm($message)
17
    {
18
        $hash = md5($message);
19
        if (!is_array($this->_confirmations) || !in_array($hash, $this->_confirmations)) {
0 ignored issues
show
Bug introduced by
The property _confirmations does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
20
            throw new Exception(json_encode([
21
                'type' => 'confirm',
22
                'message' => $message,
23
                'hash' => $hash
24
            ]));
25
        }
26
    }
27
}
28