Inventory: added removeAllListeners()

this isn't strictly necessary because it could be done by removeListeners(...getListeners()), but I think developers will appreciate not needing so much boilerplate code.
This commit is contained in:
Dylan K. Taylor 2020-05-03 21:44:45 +01:00
parent 8682ea35f7
commit 6e6fffa461
2 changed files with 6 additions and 0 deletions

View File

@ -384,6 +384,10 @@ abstract class BaseInventory implements Inventory{
} }
} }
public function removeAllListeners() : void{
$this->listeners = [];
}
public function getListeners() : array{ public function getListeners() : array{
return $this->listeners; return $this->listeners;
} }

View File

@ -164,6 +164,8 @@ interface Inventory{
*/ */
public function removeListeners(InventoryListener ...$listeners) : void; public function removeListeners(InventoryListener ...$listeners) : void;
public function removeAllListeners() : void;
/** /**
* @return InventoryListener[] * @return InventoryListener[]
*/ */