for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Apps\Model\Admin\Application;
use Apps\ActiveRecord\App;
use Ffcms\Core\Arch\Model;
/**
* Class FormTurn. Turn on/off model for application object
* @package Apps\Model\Admin\Application
*/
class FormTurn extends Model
{
private $_record;
* FormTurn constructor. Pass app object inside.
* @param App $record
public function __construct(App $record)
$this->_record = $record;
parent::__construct(true);
}
* Switch app status to inverse
public function update()
$status = $this->_record->disabled;
$this->_record->disabled = (int)!$status; // magic inside: bool to int and reverse - 0 => 1, 1 => 0
$disabled
boolean
(int)! $status
integer
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;
$this->_record->save();
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.