id = $data['id']; $notification->active_from = $notification->get_formatted_date( $data['start'] ); $notification->active_until = $notification->get_formatted_date( $data['end'] ); $notification->is_remote = true; $notification->license_types = $data['type']; $notification->title = $data['title']; $notification->content = $data['content']; $notification->buttons = array_map( function ( $button ) { return array_merge( $button, array( 'is_external' => true, ) ); }, array_values( $data['btns'] ) ); return $notification; } public function should_display() { $now = $this->get_formatted_date( 'now' ); return ( $now >= $this->active_from && $now <= $this->active_until ) && $this->license_type_check(); } }