@@ 143-156 (lines=14) @@ | ||
140 | * |
|
141 | * @return bool Whether the type was added successfully. |
|
142 | */ |
|
143 | public function add_type( $type ) { |
|
144 | ||
145 | if ( ! WordPoints_Rank_Types::is_type_registered( $type ) ) { |
|
146 | return false; |
|
147 | } |
|
148 | ||
149 | if ( isset( $this->types[ $type ] ) ) { |
|
150 | return false; |
|
151 | } |
|
152 | ||
153 | $this->types[ $type ] = $type; |
|
154 | ||
155 | return true; |
|
156 | } |
|
157 | ||
158 | /** |
|
159 | * Remove a rank type from the list allowed in this group. |
|
@@ 169-186 (lines=18) @@ | ||
166 | * |
|
167 | * @return bool Whether the type was removed successfully. |
|
168 | */ |
|
169 | public function remove_type( $type ) { |
|
170 | ||
171 | if ( 'base' === $type ) { |
|
172 | return false; |
|
173 | } |
|
174 | ||
175 | if ( ! WordPoints_Rank_Types::is_type_registered( $type ) ) { |
|
176 | return false; |
|
177 | } |
|
178 | ||
179 | if ( ! isset( $this->types[ $type ] ) ) { |
|
180 | return false; |
|
181 | } |
|
182 | ||
183 | unset( $this->types[ $type ] ); |
|
184 | ||
185 | return true; |
|
186 | } |
|
187 | ||
188 | /** |
|
189 | * Add a rank to the group. |