mirror of
https://github.com/YunoHost-Apps/limesurvey_ynh.git
synced 2024-09-03 19:36:32 +02:00
55 lines
1.8 KiB
PHP
55 lines
1.8 KiB
PHP
<?php
|
|
/**
|
|
* CExpressionDependency class file.
|
|
*
|
|
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
* @link http://www.yiiframework.com/
|
|
* @copyright 2008-2013 Yii Software LLC
|
|
* @license http://www.yiiframework.com/license/
|
|
*/
|
|
|
|
/**
|
|
* CExpressionDependency represents a dependency based on the result of a PHP expression.
|
|
*
|
|
* CExpressionDependency performs dependency checking based on the
|
|
* result of a PHP {@link expression}.
|
|
* The dependency is reported as unchanged if and only if the result is
|
|
* the same as the one evaluated when storing the data to cache.
|
|
*
|
|
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
* @package system.caching.dependencies
|
|
* @since 1.0
|
|
*/
|
|
class CExpressionDependency extends CCacheDependency
|
|
{
|
|
/**
|
|
* @var string the PHP expression whose result is used to determine the dependency.
|
|
* The expression can also be a valid serializable PHP callback.
|
|
* It will be passed with a parameter which is the dependency object itself.
|
|
*
|
|
* The PHP expression will be evaluated using {@link evaluateExpression}.
|
|
*
|
|
* A PHP expression can be any PHP code that has a value. To learn more about what an expression is,
|
|
* please refer to the {@link http://www.php.net/manual/en/language.expressions.php php manual}.
|
|
*/
|
|
public $expression;
|
|
|
|
/**
|
|
* Constructor.
|
|
* @param string $expression the PHP expression whose result is used to determine the dependency.
|
|
*/
|
|
public function __construct($expression='true')
|
|
{
|
|
$this->expression=$expression;
|
|
}
|
|
|
|
/**
|
|
* Generates the data needed to determine if dependency has been changed.
|
|
* This method returns the result of the PHP expression.
|
|
* @return mixed the data needed to determine if dependency has been changed.
|
|
*/
|
|
protected function generateDependentData()
|
|
{
|
|
return $this->evaluateExpression($this->expression);
|
|
}
|
|
}
|