Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

Apps/Model/Admin/Application/FormTurn.php (1 issue)

1
<?php
2
3
namespace Apps\Model\Admin\Application;
4
5
use Apps\ActiveRecord\App;
6
use Ffcms\Core\Arch\Model;
7
8
/**
9
 * Class FormTurn. Turn on/off model for application object
10
 * @package Apps\Model\Admin\Application
11
 */
12
class FormTurn extends Model
13
{
14
    private $_record;
15
16
    /**
17
     * FormTurn constructor. Pass app object inside.
18
     * @param App $record
19
     */
20
    public function __construct(App $record)
21
    {
22
        $this->_record = $record;
23
        parent::__construct(true);
24
    }
25
26
    /**
27
     * Switch app status to inverse
28
     */
29
    public function update()
30
    {
31
        $status = $this->_record->disabled;
32
33
        $this->_record->disabled = (int)!$status; // magic inside: bool to int and reverse - 0 => 1, 1 => 0
0 ignored issues
show
Documentation Bug introduced by zenn
The property $disabled was declared of type boolean, but (int)! $status is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
34
        $this->_record->save();
35
    }
36
}
37