mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-02 14:57:37 +02:00
[ticket/16955] Clean up group related classes for psalm
PHPBB3-16955
This commit is contained in:
@@ -119,6 +119,7 @@ class helper
|
|||||||
public function get_name_string($mode, $group_id, $group_name, $group_colour = '', $custom_profile_url = false)
|
public function get_name_string($mode, $group_id, $group_name, $group_colour = '', $custom_profile_url = false)
|
||||||
{
|
{
|
||||||
$s_is_bots = ($group_name === 'BOTS');
|
$s_is_bots = ($group_name === 'BOTS');
|
||||||
|
$group_name_string = null;
|
||||||
|
|
||||||
// This switch makes sure we only run code required for the mode
|
// This switch makes sure we only run code required for the mode
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
|
@@ -47,8 +47,9 @@ class legend implements \phpbb\groupposition\groupposition_interface
|
|||||||
* Returns the group_legend for a given group, if the group exists.
|
* Returns the group_legend for a given group, if the group exists.
|
||||||
*
|
*
|
||||||
* @param int $group_id group_id of the group to be selected
|
* @param int $group_id group_id of the group to be selected
|
||||||
|
*
|
||||||
* @return int position of the group
|
* @return int position of the group
|
||||||
* @throws \phpbb\groupposition\exception
|
* @throws exception
|
||||||
*/
|
*/
|
||||||
public function get_group_value($group_id)
|
public function get_group_value($group_id)
|
||||||
{
|
{
|
||||||
@@ -62,7 +63,7 @@ class legend implements \phpbb\groupposition\groupposition_interface
|
|||||||
if ($current_value === false)
|
if ($current_value === false)
|
||||||
{
|
{
|
||||||
// Group not found.
|
// Group not found.
|
||||||
throw new \phpbb\groupposition\exception('NO_GROUP');
|
throw new exception('NO_GROUP');
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) $current_value;
|
return (int) $current_value;
|
||||||
@@ -212,11 +213,13 @@ class legend implements \phpbb\groupposition\groupposition_interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get group type language var
|
* Get group type language var
|
||||||
*
|
*
|
||||||
* @param int $group_type group_type from the groups-table
|
* @param int $group_type group_type from the groups-table
|
||||||
* @return string name of the language variable for the given group-type.
|
*
|
||||||
*/
|
* @return string name of the language variable for the given group-type.
|
||||||
|
* @throws exception If invalid group type is supplied
|
||||||
|
*/
|
||||||
public static function group_type_language($group_type)
|
public static function group_type_language($group_type)
|
||||||
{
|
{
|
||||||
switch ($group_type)
|
switch ($group_type)
|
||||||
@@ -231,6 +234,8 @@ class legend implements \phpbb\groupposition\groupposition_interface
|
|||||||
return 'GROUP_SPECIAL';
|
return 'GROUP_SPECIAL';
|
||||||
case GROUP_FREE:
|
case GROUP_FREE:
|
||||||
return 'GROUP_OPEN';
|
return 'GROUP_OPEN';
|
||||||
|
default:
|
||||||
|
throw new exception('NO_GROUP');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -58,8 +58,9 @@ class teampage implements \phpbb\groupposition\groupposition_interface
|
|||||||
* Returns the teampage position for a given group, if the group exists.
|
* Returns the teampage position for a given group, if the group exists.
|
||||||
*
|
*
|
||||||
* @param int $group_id group_id of the group to be selected
|
* @param int $group_id group_id of the group to be selected
|
||||||
|
*
|
||||||
* @return int position of the group
|
* @return int position of the group
|
||||||
* @throws \phpbb\groupposition\exception
|
* @throws exception
|
||||||
*/
|
*/
|
||||||
public function get_group_value($group_id)
|
public function get_group_value($group_id)
|
||||||
{
|
{
|
||||||
@@ -76,7 +77,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface
|
|||||||
if ($row === false)
|
if ($row === false)
|
||||||
{
|
{
|
||||||
// Group not found.
|
// Group not found.
|
||||||
throw new \phpbb\groupposition\exception('NO_GROUP');
|
throw new exception('NO_GROUP');
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) $row['teampage_position'];
|
return (int) $row['teampage_position'];
|
||||||
@@ -86,8 +87,9 @@ class teampage implements \phpbb\groupposition\groupposition_interface
|
|||||||
* Returns the row for a given group, if the group exists.
|
* Returns the row for a given group, if the group exists.
|
||||||
*
|
*
|
||||||
* @param int $group_id group_id of the group to be selected
|
* @param int $group_id group_id of the group to be selected
|
||||||
|
*
|
||||||
* @return array Data row of the group
|
* @return array Data row of the group
|
||||||
* @throws \phpbb\groupposition\exception
|
* @throws exception
|
||||||
*/
|
*/
|
||||||
public function get_group_values($group_id)
|
public function get_group_values($group_id)
|
||||||
{
|
{
|
||||||
@@ -104,7 +106,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface
|
|||||||
if ($row === false)
|
if ($row === false)
|
||||||
{
|
{
|
||||||
// Group not found.
|
// Group not found.
|
||||||
throw new \phpbb\groupposition\exception('NO_GROUP');
|
throw new exception('NO_GROUP');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
@@ -114,8 +116,9 @@ class teampage implements \phpbb\groupposition\groupposition_interface
|
|||||||
* Returns the teampage position for a given teampage item, if the item exists.
|
* Returns the teampage position for a given teampage item, if the item exists.
|
||||||
*
|
*
|
||||||
* @param int $teampage_id Teampage_id of the selected item
|
* @param int $teampage_id Teampage_id of the selected item
|
||||||
|
*
|
||||||
* @return int Teampage position of the item
|
* @return int Teampage position of the item
|
||||||
* @throws \phpbb\groupposition\exception
|
* @throws exception
|
||||||
*/
|
*/
|
||||||
public function get_teampage_value($teampage_id)
|
public function get_teampage_value($teampage_id)
|
||||||
{
|
{
|
||||||
@@ -129,7 +132,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface
|
|||||||
if ($current_value === false)
|
if ($current_value === false)
|
||||||
{
|
{
|
||||||
// Group not found.
|
// Group not found.
|
||||||
throw new \phpbb\groupposition\exception('NO_GROUP');
|
throw new exception('NO_GROUP');
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) $current_value;
|
return (int) $current_value;
|
||||||
@@ -139,8 +142,9 @@ class teampage implements \phpbb\groupposition\groupposition_interface
|
|||||||
* Returns the teampage row for a given teampage item, if the item exists.
|
* Returns the teampage row for a given teampage item, if the item exists.
|
||||||
*
|
*
|
||||||
* @param int $teampage_id Teampage_id of the selected item
|
* @param int $teampage_id Teampage_id of the selected item
|
||||||
|
*
|
||||||
* @return array Teampage row of the item
|
* @return array Teampage row of the item
|
||||||
* @throws \phpbb\groupposition\exception
|
* @throws exception
|
||||||
*/
|
*/
|
||||||
public function get_teampage_values($teampage_id)
|
public function get_teampage_values($teampage_id)
|
||||||
{
|
{
|
||||||
@@ -154,7 +158,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface
|
|||||||
if ($row === false)
|
if ($row === false)
|
||||||
{
|
{
|
||||||
// Group not found.
|
// Group not found.
|
||||||
throw new \phpbb\groupposition\exception('NO_GROUP');
|
throw new exception('NO_GROUP');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
@@ -565,11 +569,13 @@ class teampage implements \phpbb\groupposition\groupposition_interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get group type language var
|
* Get group type language var
|
||||||
*
|
*
|
||||||
* @param int $group_type group_type from the groups-table
|
* @param int $group_type group_type from the groups-table
|
||||||
* @return string name of the language variable for the given group-type.
|
*
|
||||||
*/
|
* @return string name of the language variable for the given group-type.
|
||||||
|
* @throws exception If invalid group type is supplied
|
||||||
|
*/
|
||||||
public static function group_type_language($group_type)
|
public static function group_type_language($group_type)
|
||||||
{
|
{
|
||||||
switch ($group_type)
|
switch ($group_type)
|
||||||
@@ -584,6 +590,8 @@ class teampage implements \phpbb\groupposition\groupposition_interface
|
|||||||
return 'GROUP_SPECIAL';
|
return 'GROUP_SPECIAL';
|
||||||
case GROUP_FREE:
|
case GROUP_FREE:
|
||||||
return 'GROUP_OPEN';
|
return 'GROUP_OPEN';
|
||||||
|
default:
|
||||||
|
throw new exception('NO_GROUP');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user