Skip to content

Commit 082f402

Browse files
committed
Method hasGroup for server group checking
1 parent e523a58 commit 082f402

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/Dplr/Dplr.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function getServers()
113113
* Return servers list of group
114114
*
115115
* @access public
116-
* @param mixed $group
116+
* @param string $group
117117
* @return array
118118
*/
119119
public function getServersByGroup($group)
@@ -128,6 +128,23 @@ public function getServersByGroup($group)
128128
return $servers;
129129
}
130130

131+
/**
132+
* Check server group existing
133+
*
134+
* @param string $group
135+
* @return bool
136+
*/
137+
public function hasGroup($group)
138+
{
139+
foreach ($this->servers as $serverName => $groups) {
140+
if (in_array($group, $groups)) {
141+
return true;
142+
}
143+
}
144+
145+
return false;
146+
}
147+
131148
/**
132149
* Creating new thread
133150
*

0 commit comments

Comments
 (0)