Source for file OrderByExpression.php
Documentation is available at OrderByExpression.php
* Copyright (c) 2008 - 2009 PHPLinq
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @copyright Copyright (c) 2008 - 2009 PHPLinq (http://www.codeplex.com/PHPLinq)
* @license http://www.gnu.org/licenses/lgpl.txt LGPL
* @version 0.4.0, 2009-01-27
require_once('PHPLinq/Function.php');
/** PHPLinq_OrderByExpression */
require_once('PHPLinq/Expression.php');
* PHPLinq_OrderByExpression
* @copyright Copyright (c) 2008 - 2009 PHPLinq (http://www.codeplex.com/PHPLinq)
* Internal function reference
* Internal expression reference
* @var PHPLinq_Expression
* @param string $expression Expression to create
* @param string $defaultName Default name in expression
* @param bool $descending Descending order?
* @param string $comparer Comparer function
public function __construct($expression, $defaultName = '', $descending = false, $comparer = null) {
// Comparer function set?
$comparer = '-1 * ' . $comparer;
// Compile comparer function
// Check http://www.php.net/manual/nl/function.create-function.php#14322 for this chr(0).'$f' approach...
$defaultName . 'A, ' . $defaultName . 'B',
call_user_func(chr(0).'$f', {$defaultName}A),
call_user_func(chr(0).'$f', {$defaultName}B)
* @param mixed $value Value to use as expression parameter
* @return mixed Expression result
* @return PHPLinq_Function
* @return PHPLinq_Expression
|