From dd5969147dd1ec392d3edba4fb03b0c55af8ede1 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Tue, 7 May 2013 07:39:24 -0400 Subject: [PATCH] move JsExpression to web. --- framework/helpers/JsExpression.php | 45 ---------------------- framework/helpers/base/Json.php | 2 +- framework/validators/EmailValidator.php | 2 +- framework/validators/NumberValidator.php | 2 +- .../validators/RegularExpressionValidator.php | 2 +- framework/validators/UrlValidator.php | 2 +- framework/web/JsExpression.php | 45 ++++++++++++++++++++++ framework/widgets/ActiveField.php | 2 +- tests/unit/framework/helpers/JsonTest.php | 2 +- 9 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 framework/helpers/JsExpression.php create mode 100644 framework/web/JsExpression.php diff --git a/framework/helpers/JsExpression.php b/framework/helpers/JsExpression.php deleted file mode 100644 index 5a1f9bd..0000000 --- a/framework/helpers/JsExpression.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @since 2.0 - */ -class JsExpression extends Object -{ - /** - * @var string the JavaScript expression represented by this object - */ - public $expression; - - /** - * Constructor. - * @param string $expression the JavaScript expression represented by this object - * @param array $config additional configurations for this object - */ - public function __construct($expression, $config = array()) - { - $this->expression = $expression; - parent::__construct($config); - } - - /** - * The PHP magic function converting an object into a string. - * @return string the JavaScript expression. - */ - public function __toString() - { - return $this->expression; - } -} diff --git a/framework/helpers/base/Json.php b/framework/helpers/base/Json.php index c92e208..262dd81 100644 --- a/framework/helpers/base/Json.php +++ b/framework/helpers/base/Json.php @@ -8,7 +8,7 @@ namespace yii\helpers\base; use yii\base\InvalidParamException; -use yii\helpers\JsExpression; +use yii\web\JsExpression; /** * Json is a helper class providing JSON data encoding and decoding. diff --git a/framework/validators/EmailValidator.php b/framework/validators/EmailValidator.php index ad74dd6..949b3f9 100644 --- a/framework/validators/EmailValidator.php +++ b/framework/validators/EmailValidator.php @@ -9,7 +9,7 @@ namespace yii\validators; use Yii; use yii\helpers\Html; -use yii\helpers\JsExpression; +use yii\web\JsExpression; use yii\helpers\Json; /** diff --git a/framework/validators/NumberValidator.php b/framework/validators/NumberValidator.php index c0f81cd..10f0e52 100644 --- a/framework/validators/NumberValidator.php +++ b/framework/validators/NumberValidator.php @@ -9,7 +9,7 @@ namespace yii\validators; use Yii; use yii\helpers\Html; -use yii\helpers\JsExpression; +use yii\web\JsExpression; use yii\helpers\Json; /** diff --git a/framework/validators/RegularExpressionValidator.php b/framework/validators/RegularExpressionValidator.php index 79a1a3c..23419b9 100644 --- a/framework/validators/RegularExpressionValidator.php +++ b/framework/validators/RegularExpressionValidator.php @@ -10,7 +10,7 @@ namespace yii\validators; use Yii; use yii\base\InvalidConfigException; use yii\helpers\Html; -use yii\helpers\JsExpression; +use yii\web\JsExpression; use yii\helpers\Json; /** diff --git a/framework/validators/UrlValidator.php b/framework/validators/UrlValidator.php index 0ed59bd..c418353 100644 --- a/framework/validators/UrlValidator.php +++ b/framework/validators/UrlValidator.php @@ -9,7 +9,7 @@ namespace yii\validators; use Yii; use yii\helpers\Html; -use yii\helpers\JsExpression; +use yii\web\JsExpression; use yii\helpers\Json; /** diff --git a/framework/web/JsExpression.php b/framework/web/JsExpression.php new file mode 100644 index 0000000..027c065 --- /dev/null +++ b/framework/web/JsExpression.php @@ -0,0 +1,45 @@ + + * @since 2.0 + */ +class JsExpression extends Object +{ + /** + * @var string the JavaScript expression represented by this object + */ + public $expression; + + /** + * Constructor. + * @param string $expression the JavaScript expression represented by this object + * @param array $config additional configurations for this object + */ + public function __construct($expression, $config = array()) + { + $this->expression = $expression; + parent::__construct($config); + } + + /** + * The PHP magic function converting an object into a string. + * @return string the JavaScript expression. + */ + public function __toString() + { + return $this->expression; + } +} diff --git a/framework/widgets/ActiveField.php b/framework/widgets/ActiveField.php index 336966f..0e0381f 100644 --- a/framework/widgets/ActiveField.php +++ b/framework/widgets/ActiveField.php @@ -10,7 +10,7 @@ use yii\base\Component; use yii\db\ActiveRecord; use yii\helpers\Html; use yii\base\Model; -use yii\helpers\JsExpression; +use yii\web\JsExpression; /** * @author Qiang Xue diff --git a/tests/unit/framework/helpers/JsonTest.php b/tests/unit/framework/helpers/JsonTest.php index 6a78cd1..1795ce6 100644 --- a/tests/unit/framework/helpers/JsonTest.php +++ b/tests/unit/framework/helpers/JsonTest.php @@ -4,7 +4,7 @@ namespace yiiunit\framework\helpers; use yii\helpers\Json; -use yii\helpers\JsExpression; +use yii\web\JsExpression; class JsonTest extends \yii\test\TestCase {