name = $name; $this->title = $title; $this->description = $description; $this->option_buttons = $option_buttons; $this->props = $props; parent::__construct(); } public function get_name(): string { return $this->name; } public function get_title(): string { return $this->title; } public function get_description(): string { return $this->description; } public function get_option_buttons(): array { return $this->option_buttons; } /** * Check if notice is applicable * * Apply Logic: If start and end date is set and current time is between them, it'll be displayed * * @return boolean */ public function is_applicable(): bool { $start_date = isset( $this->props['start'] ) ? $this->props['start'] : null; $end_date = isset( $this->props['end'] ) ? $this->props['end'] : null; if ( is_null( $start_date ) || is_null( $end_date ) ) { return false; } if ( strtotime( $start_date ) >= time() || strtotime( $end_date ) <= time() ) { return false; } return true; } }