Skip to content

This package contains an interface used by objects to say they can sort data. The concept is very simple, the object implements a sort method that takes a key (the sort column) and a direction, and that's it!

License

Notifications You must be signed in to change notification settings

thecodingmachine/utils.common.sortable-interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this package

This package contains an interface used by many objects to declare they have the ability to sort the result set they represent.

If your objects represent a resultset (for instance your object is a resultset from a query to a database), and if you can sort this result set (on a column of the resultset), then your object should implement SortableInterface.

interface SortableInterface {
	const ASC = "ASC";
	const DESC = "DESC";
	
	/**
	 * Sorts the result set.
	 * 
	 * @param string $key The key to sort upon
	 * @param string $direction Either SortableInterface::ASC or SortableInterface::DESC
	 */
	public function sort($key, $direction = self::ASC);
}

Mouf package

This package is part of Mouf (http://mouf-php.com), an effort to ensure good developing practices by providing a graphical dependency injection framework.

About

This package contains an interface used by objects to say they can sort data. The concept is very simple, the object implements a sort method that takes a key (the sort column) and a direction, and that's it!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages