1<?php 2/** 3 * @copyright Copyright (c) 2016, ownCloud, Inc. 4 * 5 * @author Arthur Schiwon <blizzz@arthur-schiwon.de> 6 * @author Christoph Wurst <christoph@winzerhof-wurst.at> 7 * @author Lukas Reschke <lukas@statuscode.ch> 8 * 9 * @license AGPL-3.0 10 * 11 * This code is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Affero General Public License, version 3, 13 * as published by the Free Software Foundation. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Affero General Public License for more details. 19 * 20 * You should have received a copy of the GNU Affero General Public License, version 3, 21 * along with this program. If not, see <http://www.gnu.org/licenses/> 22 * 23 */ 24namespace OCP\App; 25 26use OCP\EventDispatcher\Event; 27 28/** 29 * Class ManagerEvent 30 * 31 * @since 9.0.0 32 */ 33class ManagerEvent extends Event { 34 /** 35 * @deprecated 22.0.0 36 */ 37 public const EVENT_APP_ENABLE = 'OCP\App\IAppManager::enableApp'; 38 39 /** 40 * @deprecated 22.0.0 41 */ 42 public const EVENT_APP_ENABLE_FOR_GROUPS = 'OCP\App\IAppManager::enableAppForGroups'; 43 44 /** 45 * @deprecated 22.0.0 46 */ 47 public const EVENT_APP_DISABLE = 'OCP\App\IAppManager::disableApp'; 48 49 /** 50 * @since 9.1.0 51 * @deprecated 22.0.0 52 */ 53 public const EVENT_APP_UPDATE = 'OCP\App\IAppManager::updateApp'; 54 55 /** @var string */ 56 protected $event; 57 /** @var string */ 58 protected $appID; 59 /** @var \OCP\IGroup[]|null */ 60 protected $groups; 61 62 /** 63 * DispatcherEvent constructor. 64 * 65 * @param string $event 66 * @param $appID 67 * @param \OCP\IGroup[]|null $groups 68 * @since 9.0.0 69 */ 70 public function __construct($event, $appID, array $groups = null) { 71 $this->event = $event; 72 $this->appID = $appID; 73 $this->groups = $groups; 74 } 75 76 /** 77 * @return string 78 * @since 9.0.0 79 */ 80 public function getEvent() { 81 return $this->event; 82 } 83 84 /** 85 * @return string 86 * @since 9.0.0 87 */ 88 public function getAppID() { 89 return $this->appID; 90 } 91 92 /** 93 * returns the group Ids 94 * @return string[] 95 * @since 9.0.0 96 */ 97 public function getGroups() { 98 return array_map(function ($group) { 99 /** @var \OCP\IGroup $group */ 100 return $group->getGID(); 101 }, $this->groups); 102 } 103} 104