Skip to content

Commit

Permalink
Update docs to indicate lists not mutable as per 7673
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamish Friedlander committed Jul 20, 2012
1 parent 09067cc commit c9b3430
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
25 changes: 14 additions & 11 deletions model/Filterable.php
Expand Up @@ -2,7 +2,10 @@


/** /**
* Additional interface for {@link SS_List} classes that are filterable. * Additional interface for {@link SS_List} classes that are filterable.
* *
* All methods in this interface are immutable - they should return new instances with the filter
* applied, rather than applying the filter in place
*
* @see SS_List, SS_Sortable, SS_Limitable * @see SS_List, SS_Sortable, SS_Limitable
*/ */
interface SS_Filterable { interface SS_Filterable {
Expand All @@ -18,22 +21,22 @@ public function canFilterBy($by);
/** /**
* Filter the list to include items with these charactaristics * Filter the list to include items with these charactaristics
* *
* @example $list->filter('Name', 'bob'); // only bob in the list * @example $list = $list->filter('Name', 'bob'); // only bob in the list
* @example $list->filter('Name', array('aziz', 'bob'); // aziz and bob in list * @example $list = $list->filter('Name', array('aziz', 'bob'); // aziz and bob in list
* @example $list->filter(array('Name'=>'bob, 'Age'=>21)); // bob with the age 21 * @example $list = $list->filter(array('Name'=>'bob, 'Age'=>21)); // bob with the age 21
* @example $list->filter(array('Name'=>'bob, 'Age'=>array(21, 43))); // bob with the Age 21 or 43 * @example $list = $list->filter(array('Name'=>'bob, 'Age'=>array(21, 43))); // bob with the Age 21 or 43
* @example $list->filter(array('Name'=>array('aziz','bob'), 'Age'=>array(21, 43))); // aziz with the age 21 or 43 and bob with the Age 21 or 43 * @example $list = $list->filter(array('Name'=>array('aziz','bob'), 'Age'=>array(21, 43))); // aziz with the age 21 or 43 and bob with the Age 21 or 43
*/ */
public function filter(); public function filter();


/** /**
* Exclude the list to not contain items with these charactaristics * Exclude the list to not contain items with these charactaristics
* *
* @example $list->exclude('Name', 'bob'); // exclude bob from list * @example $list = $list->exclude('Name', 'bob'); // exclude bob from list
* @example $list->exclude('Name', array('aziz', 'bob'); // exclude aziz and bob from list * @example $list = $list->exclude('Name', array('aziz', 'bob'); // exclude aziz and bob from list
* @example $list->exclude(array('Name'=>'bob, 'Age'=>21)); // exclude bob that has Age 21 * @example $list = $list->exclude(array('Name'=>'bob, 'Age'=>21)); // exclude bob that has Age 21
* @example $list->exclude(array('Name'=>'bob, 'Age'=>array(21, 43))); // exclude bob with Age 21 or 43 * @example $list = $list->exclude(array('Name'=>'bob, 'Age'=>array(21, 43))); // exclude bob with Age 21 or 43
* @example $list->exclude(array('Name'=>array('bob','phil'), 'Age'=>array(21, 43))); // bob age 21 or 43, phil age 21 or 43 would be excluded * @example $list = $list->exclude(array('Name'=>array('bob','phil'), 'Age'=>array(21, 43))); // bob age 21 or 43, phil age 21 or 43 would be excluded
*/ */
public function exclude(); public function exclude();


Expand Down
5 changes: 4 additions & 1 deletion model/Limitable.php
Expand Up @@ -2,7 +2,10 @@


/** /**
* Additional interface for {@link SS_List} classes that are limitable - able to have a subset of the list extracted. * Additional interface for {@link SS_List} classes that are limitable - able to have a subset of the list extracted.
* *
* All methods in this interface are immutable - they should return new instances with the limit
* applied, rather than applying the limit in place
*
* @see SS_List, SS_Sortable, SS_Filterable * @see SS_List, SS_Sortable, SS_Filterable
*/ */
interface SS_Limitable { interface SS_Limitable {
Expand Down
15 changes: 9 additions & 6 deletions model/Sortable.php
Expand Up @@ -2,7 +2,10 @@


/** /**
* Additional interface for {@link SS_List} classes that are sortable. * Additional interface for {@link SS_List} classes that are sortable.
* *
* All methods in this interface are immutable - they should return new instances with the sort
* applied, rather than applying the sort in place
*
* @see SS_List, SS_Filterable, SS_Limitable * @see SS_List, SS_Filterable, SS_Limitable
*/ */
interface SS_Sortable { interface SS_Sortable {
Expand All @@ -19,18 +22,18 @@ public function canSortBy($by);
* Sorts this list by one or more fields. You can either pass in a single * Sorts this list by one or more fields. You can either pass in a single
* field name and direction, or a map of field names to sort directions. * field name and direction, or a map of field names to sort directions.
* *
* @example $list->sort('Name'); // default ASC sorting * @example $list = $list->sort('Name'); // default ASC sorting
* @example $list->sort('Name DESC'); // DESC sorting * @example $list = $list->sort('Name DESC'); // DESC sorting
* @example $list->sort('Name', 'ASC'); * @example $list = $list->sort('Name', 'ASC');
* @example $list->sort(array('Name'=>'ASC,'Age'=>'DESC')); * @example $list = $list->sort(array('Name'=>'ASC,'Age'=>'DESC'));
*/ */
public function sort(); public function sort();




/** /**
* Reverses the list based on reversing the current sort. * Reverses the list based on reversing the current sort.
* *
* @example $list->reverse(); * @example $list = $list->reverse();
* *
* @return array * @return array
*/ */
Expand Down

0 comments on commit c9b3430

Please sign in to comment.