mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/16955] Clean up variable names and docblocks in notifications
PHPBB3-16955
This commit is contained in:
@@ -873,9 +873,9 @@ class manager
|
||||
/**
|
||||
* Helper to get the list of methods enabled by default
|
||||
*
|
||||
* @return method\method_interface[]
|
||||
* @return string[] Default method types
|
||||
*/
|
||||
public function get_default_methods()
|
||||
public function get_default_methods(): array
|
||||
{
|
||||
$default_methods = array();
|
||||
|
||||
@@ -894,13 +894,20 @@ class manager
|
||||
* Helper to get the notifications item type class and set it up
|
||||
*
|
||||
* @param string $notification_type_name
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
*
|
||||
* @return type\type_interface
|
||||
* @throws \Exception When type name is not o notification type
|
||||
*/
|
||||
public function get_item_type_class($notification_type_name, $data = array())
|
||||
{
|
||||
$item = $this->load_object($notification_type_name);
|
||||
|
||||
if (!$item instanceof type\type_interface)
|
||||
{
|
||||
throw new \Exception('Supplied type name returned invalid service: ' . $notification_type_name);
|
||||
}
|
||||
|
||||
$item->set_initial_data($data);
|
||||
|
||||
return $item;
|
||||
@@ -910,18 +917,30 @@ class manager
|
||||
* Helper to get the notifications method class and set it up
|
||||
*
|
||||
* @param string $method_name
|
||||
*
|
||||
* @return method\method_interface
|
||||
* @throws \Exception When object name is not o notification method
|
||||
*/
|
||||
public function get_method_class($method_name)
|
||||
{
|
||||
return $this->load_object($method_name);
|
||||
$object = $this->load_object($method_name);
|
||||
|
||||
if (!$object instanceof method\method_interface)
|
||||
{
|
||||
throw new \Exception('Supplied method name returned invalid service: ' . $method_name);
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to load objects (notification types/methods)
|
||||
*
|
||||
* @param string $object_name
|
||||
*
|
||||
* @return method\method_interface|type\type_interface
|
||||
* @psalm-suppress NullableReturnStatement Invalid service will result in exception
|
||||
* @throws \Exception When object name is not o notification method or type
|
||||
*/
|
||||
protected function load_object($object_name)
|
||||
{
|
||||
@@ -932,6 +951,11 @@ class manager
|
||||
$object->set_notification_manager($this);
|
||||
}
|
||||
|
||||
if (!$object instanceof method\method_interface && !$object instanceof type\type_interface)
|
||||
{
|
||||
throw new \Exception('Supplied object name returned invalid service: ' . $object_name);
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user