diff --git a/application/src/Event/Menu/AbstractMenuEvent.php b/application/src/Event/Menu/AbstractMenuEvent.php new file mode 100644 index 0000000..8cee78a --- /dev/null +++ b/application/src/Event/Menu/AbstractMenuEvent.php @@ -0,0 +1,61 @@ +factory = $factory; + $this->item = $item; + $this->request = $request; + } + + /** + * @return FactoryInterface + */ + public function getFactory(): FactoryInterface + { + return $this->factory; + } + + /** + * @return ItemInterface + */ + public function getItem(): ItemInterface + { + return $this->item; + } + + /** + * @return RequestStack + */ + public function getRequest(): RequestStack + { + return $this->request; + } +} \ No newline at end of file diff --git a/application/src/Event/Menu/Subbar/SourceMenuEvent.php b/application/src/Event/Menu/Subbar/SourceMenuEvent.php index 675dc27..5a99ba0 100644 --- a/application/src/Event/Menu/Subbar/SourceMenuEvent.php +++ b/application/src/Event/Menu/Subbar/SourceMenuEvent.php @@ -2,58 +2,9 @@ namespace App\Event\Menu\Subbar; -use Knp\Menu\FactoryInterface; -use Knp\Menu\ItemInterface; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\HttpFoundation\RequestStack; +use App\Event\Menu\AbstractMenuEvent; -class SourceMenuEvent extends Event +class SourceMenuEvent extends AbstractMenuEvent { public const EVENT = 'app.menu.source.user'; - - /** - * @var FactoryInterface - */ - private $factory; - - /** - * @var ItemInterface - */ - private $item; - - /** - * @var RequestStack - */ - private $request; - - public function __construct(FactoryInterface $factory, ItemInterface $item, RequestStack $request) - { - $this->factory = $factory; - $this->item = $item; - $this->request = $request; - } - - /** - * @return FactoryInterface - */ - public function getFactory(): FactoryInterface - { - return $this->factory; - } - - /** - * @return ItemInterface - */ - public function getItem(): ItemInterface - { - return $this->item; - } - - /** - * @return RequestStack - */ - public function getRequest(): RequestStack - { - return $this->request; - } } diff --git a/application/src/Event/Menu/Topbar/UserMenuEvent.php b/application/src/Event/Menu/Topbar/UserMenuEvent.php index f22f893..72d0c14 100644 --- a/application/src/Event/Menu/Topbar/UserMenuEvent.php +++ b/application/src/Event/Menu/Topbar/UserMenuEvent.php @@ -2,58 +2,9 @@ namespace App\Event\Menu\Topbar; -use Knp\Menu\FactoryInterface; -use Knp\Menu\ItemInterface; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\HttpFoundation\RequestStack; +use App\Event\Menu\AbstractMenuEvent; -class UserMenuEvent extends Event +class UserMenuEvent extends AbstractMenuEvent { public const EVENT = 'app.menu.topbar.user'; - - /** - * @var FactoryInterface - */ - private $factory; - - /** - * @var ItemInterface - */ - private $item; - - /** - * @var RequestStack - */ - private $request; - - public function __construct(FactoryInterface $factory, ItemInterface $item, RequestStack $request) - { - $this->factory = $factory; - $this->item = $item; - $this->request = $request; - } - - /** - * @return FactoryInterface - */ - public function getFactory(): FactoryInterface - { - return $this->factory; - } - - /** - * @return ItemInterface - */ - public function getItem(): ItemInterface - { - return $this->item; - } - - /** - * @return RequestStack - */ - public function getRequest(): RequestStack - { - return $this->request; - } -} +} \ No newline at end of file