| @@ 43-54 (lines=12) @@ | ||
| 40 | * @param string $name |
|
| 41 | * @return bool |
|
| 42 | */ |
|
| 43 | public function addGroup($name) { |
|
| 44 | $name = trim($name); |
|
| 45 | if($this->hasGroup($name)) { |
|
| 46 | return false; |
|
| 47 | } |
|
| 48 | $groups = $this->getParts(); |
|
| 49 | // Remove empty elements |
|
| 50 | $groups = array_filter($groups, 'strlen'); |
|
| 51 | $groups[] = $name; |
|
| 52 | $this->setParts($groups); |
|
| 53 | return true; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * Remove an existing group. |
|
| @@ 62-72 (lines=11) @@ | ||
| 59 | * @param string $name |
|
| 60 | * @return bool |
|
| 61 | */ |
|
| 62 | public function removeGroup($name) { |
|
| 63 | $name = trim($name); |
|
| 64 | if(!$this->hasGroup($name)) { |
|
| 65 | return false; |
|
| 66 | } |
|
| 67 | $groups = $this->getParts(); |
|
| 68 | $groups = array_map('trim', $groups); |
|
| 69 | array_splice($groups, $this->array_searchi($name, $groups), 1); |
|
| 70 | $this->setParts($groups); |
|
| 71 | return true; |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * Test it a group by that name exists. |
|