for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Spatie\Honeypot;
use Carbon\Carbon;
class EncryptedTime
{
/** @var string */
protected $encryptedTime;
public static function create(Carbon $carbon)
$encryptedTime = app('encrypter')->encrypt($carbon->timestamp);
return new static($encryptedTime);
}
public function __construct(string $encryptedTime)
$this->encryptedTime = $encryptedTime;
$timestamp = app('encrypter')->decrypt($encryptedTime);
$this->carbon = Carbon::createFromTimestamp($timestamp);
carbon
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;
public function isFuture(): bool
return $this->carbon->isFuture();
public function __toString()
return $this->encryptedTime;
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: