for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Basis;
use Exception;
abstract class Job
{
use Toolkit;
protected function require($name)
if (!$this->$name) {
throw new Exception("$name is not defined");
}
protected function confirm($message)
$hash = md5($message);
if (!property_exists($this, '_confirmations') || !is_array($this->_confirmations) || !in_array($hash, $this->_confirmations)) {
_confirmations
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;
throw new Exception(json_encode([
'type' => 'confirm',
'message' => $message,
'hash' => $hash
]));
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: