Skip to content

Commit

Permalink
fix: Add backward-compatibility to nc<30
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Sep 3, 2024
1 parent 855ddae commit eaa4ba9
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions lib/Events/AbstractFormEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,37 @@
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IWebhookCompatibleEvent;

abstract class AbstractFormEvent extends Event implements IWebhookCompatibleEvent {
protected Form $form;
if (interface_exists(\OCP\EventDispatcher\IWebhookCompatibleEvent::class)) {
abstract class AbstractFormEvent extends Event implements IWebhookCompatibleEvent {
protected Form $form;

public function __construct() {
parent::__construct();
}
public function __construct() {
parent::__construct();
}

public function getForm(): Form {
return $this->form;
}

public function getForm(): Form {
return $this->form;
/**
* @inheritDoc
*/
public function getWebhookSerializable(): array {
return $this->form->read();
}
}

/**
* @inheritDoc
*/
public function getWebhookSerializable(): array {
return $this->form->read();
} else {
// need this block as long as NC < 30 is supported
abstract class AbstractFormEvent extends Event {
protected Form $form;

public function __construct() {
parent::__construct();
}

public function getForm(): Form {
return $this->form;
}
}
}

0 comments on commit eaa4ba9

Please sign in to comment.