Source for file Expression.php
Documentation is available at Expression.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');
* @copyright Copyright (c) 2008 - 2009 PHPLinq (http://www.codeplex.com/PHPLinq)
* Internal function reference
* @param string $expression Expression to create
* @param string $defaultName Default name in expression
public function __construct($expression, $defaultName = '') {
// Split out variable name
if (strpos($expression, '=>') !== false && strpos($expression, '$') < strpos($expression, '=>')) {
list ($defaultName, $expression) = explode('=>', $expression, 2);
$defaultName = trim($defaultName);
$expression = trim($expression);
// Convert anonymous constructors
$expression = str_ireplace('new{', '(object)array(', $expression);
// Create PHPLinq_Function instance
* @param mixed $value Value to use as expression parameter
* @return mixed Expression result
* @return PHPLinq_Function
|