Skip to content

Commit 91a7992

Browse files
author
Arikaim
committed
=
1 parent be0c1d8 commit 91a7992

4 files changed

Lines changed: 13 additions & 22 deletions

File tree

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
44
patreon: # Replace with a single Patreon username
5-
open_collective: # Replace with a single Open Collective username
5+
open_collective: arikaim-cms
66
ko_fi: arikaim
77
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
88
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry

EventsManager.php

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,14 @@ public function getEvents(array $filter = []): array
126126
/**
127127
* Get subscribers list
128128
*
129-
* @param array $filter
129+
* @param string|null $eventName
130+
* @param string|null $extensionName
131+
* @param integer|null $status
130132
* @return array
131133
*/
132-
public function getSubscribers(array $filter = []): array
134+
public function getSubscribers(?string $eventName = null, ?string $extensionName, ?int $status = null): array
133135
{
134-
return $this->subscriberRegistry->getSubscribers($filter);
136+
return $this->subscriberRegistry->getSubscribers($eventName,$extensionName,$status);
135137
}
136138

137139
/**
@@ -260,21 +262,10 @@ public function dispatch(string $eventName, $event = [], bool $callbackOnly = fa
260262
$result = [];
261263

262264
if ($callbackOnly != true) {
263-
// get all subscribers for event
264-
if (empty($extension) == false) {
265-
$subscribers = $this->getSubscribers([
266-
'extension_name' => $extension,
267-
'status' => 1,
268-
'name' => $eventName
269-
]);
270-
} else {
271-
$subscribers = $this->getSubscribers([
272-
'status' => 1,
273-
'name' => $eventName
274-
]);
275-
}
276-
277-
$this->log('Dispatch event '. $eventName,$event->toArray());
265+
// get all subscribers for event
266+
$subscribers = $this->getSubscribers($eventName,$extension,1);
267+
268+
$this->log('Dispatch event ' . $eventName,$event->toArray());
278269
$result = $this->executeEventHandlers($subscribers,$event);
279270
}
280271

@@ -321,7 +312,7 @@ private function executeEventHandlers(array $eventSubscribers, Event $event): ar
321312
$subscriber = Factory::createInstance($item['handler_class']);
322313
$handlerMethod = (empty($item['handler_method']) == true) ? 'execute' : $item['handler_method'];
323314

324-
if (\is_object($subscriber) == true && $subscriber instanceof EventSubscriberInterface) {
315+
if ($subscriber instanceof EventSubscriberInterface) {
325316

326317
// check for subscriber log
327318
if ($subscriber instanceof EventLogInterface) {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
#### Requirements
8-
* PHP 7.2, 7.3, 7.4
8+
* PHP 7.3, 7.4
99

1010

1111

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}],
1212
"homepage": "http://arikaim.com",
1313
"require": {
14-
"php": ">=7.1",
14+
"php": "^7.3|^8.0",
1515
"arikaim/utils": "^1.0.0",
1616
"arikaim/collection": "^1.0.0",
1717
"arikaim/interfaces": "^1.0.0"

0 commit comments

Comments
 (0)