mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 09:19:08 +00:00 
			
		
		
		
	Refactored menu events
This commit is contained in:
		
							
								
								
									
										61
									
								
								application/src/Event/Menu/AbstractMenuEvent.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								application/src/Event/Menu/AbstractMenuEvent.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| <?php | ||||
| namespace App\Event\Menu; | ||||
|  | ||||
| use Knp\Menu\FactoryInterface; | ||||
| use Knp\Menu\ItemInterface; | ||||
| use Symfony\Component\EventDispatcher\Event; | ||||
| use Symfony\Component\HttpFoundation\RequestStack; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  *         | ||||
|  */ | ||||
| abstract class AbstractMenuEvent extends Event | ||||
| { | ||||
|     /** | ||||
|      * @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; | ||||
|     } | ||||
| } | ||||
| @@ -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; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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; | ||||
|     } | ||||
| } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user