Total Complexity | 4 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class DatasourceEvent extends Event |
||
13 | { |
||
14 | public const EVENT_ENTITY = 'OCA\Analytics\Datasource\ICommentsManager::registerEntity'; |
||
15 | |||
16 | /** @var string */ |
||
17 | protected $event; |
||
18 | /** @var \Closure[] */ |
||
19 | protected $collections; |
||
20 | |||
21 | /** |
||
22 | * DispatcherEvent constructor. |
||
23 | * |
||
24 | * @param string $event |
||
25 | * @since 9.1.0 |
||
26 | */ |
||
27 | public function __construct($event) |
||
28 | { |
||
29 | $this->event = $event; |
||
30 | $this->collections = []; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param string $name |
||
35 | * @param \Closure $entityExistsFunction The closure should take one |
||
36 | * argument, which is the id of the entity, that comments |
||
37 | * should be handled for. The return should then be bool, |
||
38 | * depending on whether comments are allowed (true) or not. |
||
39 | * @throws \OutOfBoundsException when the entity name is already taken |
||
40 | * @since 9.1.0 |
||
41 | */ |
||
42 | public function addEntityCollection($name, \Closure $entityExistsFunction) |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @return \Closure[] |
||
53 | * @since 9.1.0 |
||
54 | */ |
||
55 | public function getEntityCollections() |
||
58 | } |
||
59 | } |