One entry per callback * attached to the hook in the global filter table (Reflection). file: relative to ABSPATH when inside * is true, absolute otherwise; null for a PHP internal function or a file Reflection * could not give (silent, reported). Empty list = no code attached. * * @package Timaub\AfterHackChecklist */ namespace Timaub\AfterHackChecklist\Domain; final class CronEvent { /** @var string */ public $hook = ''; /** @var int */ public $timestamp = 0; /** @var string */ public $args = ''; /** @var array */ public $callbacks = array(); public static function fromArray( array $a ): self { $e = new self(); $e->hook = (string) $a['hook']; $e->timestamp = isset( $a['timestamp'] ) ? (int) $a['timestamp'] : 0; $e->args = isset( $a['args'] ) ? substr( (string) $a['args'], 0, Assumptions::CONTENT_MAX_BYTES ) : ''; foreach ( isset( $a['callbacks'] ) ? (array) $a['callbacks'] : array() as $cb ) { $e->callbacks[] = array( 'function' => isset( $cb['function'] ) ? (string) $cb['function'] : '', 'file' => isset( $cb['file'] ) ? str_replace( '\\', '/', (string) $cb['file'] ) : null, 'inside' => isset( $cb['inside'] ) ? (bool) $cb['inside'] : true, ); } return $e; } public function toArray(): array { return get_object_vars( $this ); } }