items, true ) ) { $this->items[] = $item; sort( $this->items ); } return true; } /** * Removes an item from the store. * * @param string $item Item to remove from the store. * * @return bool True if the item was removed, false if it failed. */ public function remove( $item ) { if ( ! is_string( $item ) ) { return false; } if ( ! in_array( $item, $this->items, true ) ) { return false; } $items = array_diff( $this->items, array( $item ) ); $this->items = array_values( $items ); sort( $this->items ); return true; } /** * Returns the list as array. * * @return array List of items in the store. */ public function to_array() { return $this->items; } }