protected function apply(DomainEvent $event): void {
        $eventName = explode('\\', get_class($event));

        $method = 'apply' . $eventName[count($eventName) - 1];

        if (method_exists($this, $method)) {
            $this->$method($event);
        }

        $this->version = $this->version->next();
    }
protected function apply(DomainEvent $event): void {
        $eventName = explode('\\', get_class($event));

        $method = 'apply' . $eventName[count($eventName) - 1];

        if (method_exists($this, $method)) {
            $this->$method($event);
        }

        $this->version = $this->version->next();
    }
protected function apply ( DomainEvent $ event ) : void { $ eventName = explode ( '\\' , get_class ( $ event ) ) ; $ method = 'apply' . $ eventName [ count ( $ eventName ) - 1 ] ; if ( method_exists ( $ this , $ method ) ) { $ this -> $ method ( $ event ) ; } $ this -> version = $ this -> version -> next ( ) ; }
apply domain events to aggregate state by mapping the class
name to method name using strings

@param DomainEvent $event
apply domain events to aggregate state by mapping the class name to method name using strings