Completed
Push — master ( 77ed7b...43fa8f )
by Dmitry
04:25
created

Job::confirm()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
ccs 0
cts 8
cp 0
rs 9.4285
cc 3
eloc 7
nc 2
nop 1
crap 12
1
<?php
2
3
namespace Basis;
4
5
use Exception;
6
7
abstract class Job
8
{
9
    use Toolkit;
10
11
    protected function confirm($message)
12
    {
13
        $hash = md5($message);
14
        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...
15
            throw new Exception(json_encode([
16
                'type' => 'confirm',
17
                'message' => $message,
18
                'hash' => $hash
19
            ]));
20
        }
21
    }
22
}
23