'edit', DOKU_CHANGE_TYPE_MINOR_EDIT => 'edit minor', DOKU_CHANGE_TYPE_CREATE => 'create', DOKU_CHANGE_TYPE_DELETE => 'delete', self::TYPE_RENAME => 'rename', ]; public function getEventType(): ?string { return self::EVENT_TYPE[$this->changeType] ?? null; } /** * Root namespace of the page. */ public function getNamespace(): string { // Handle special case of page being in root namespace $pos = strpos($this->id, ':'); if ($pos === false) { return ':'; } return explode(':', $this->id, 2)[0]; } public function isCreate(): bool { return $this->changeType === DOKU_CHANGE_TYPE_CREATE; } public function isDelete(): bool { return $this->changeType === DOKU_CHANGE_TYPE_DELETE; } public function convertToRename(PageSaveEvent $deleteEvent) { // Sanity check if ( !$this->isCreate() || !$deleteEvent->isDelete() || $this->summary !== $deleteEvent->summary ) { throw new InvalidArgumentException("Unexpected event"); } $this->changeType = self::TYPE_RENAME; $this->oldRevision = $deleteEvent->oldRevision; } }