From 26767735dc05df0c902935365d67c3ed621e8265 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 4 Dec 2013 14:26:47 +0100 Subject: [PATCH] Renamed byte methods, moved path methods back to StringHelper --- extensions/elasticsearch/ActiveRecord.php | 6 +-- .../gii/generators/crud/templates/controller.php | 12 ++--- .../gii/generators/crud/templates/search.php | 8 +-- .../gii/generators/crud/templates/views/_form.php | 4 +- .../generators/crud/templates/views/_search.php | 4 +- .../gii/generators/crud/templates/views/create.php | 6 +-- .../gii/generators/crud/templates/views/index.php | 8 +-- .../gii/generators/crud/templates/views/update.php | 6 +-- .../gii/generators/crud/templates/views/view.php | 6 +-- extensions/gii/generators/module/Generator.php | 6 +-- extensions/redis/ActiveRecord.php | 5 +- extensions/sphinx/ActiveRecord.php | 6 +-- framework/yii/caching/Cache.php | 2 +- framework/yii/db/ActiveRecord.php | 4 +- framework/yii/helpers/BaseFileHelper.php | 50 ++---------------- framework/yii/helpers/BaseSecurity.php | 10 ++-- framework/yii/helpers/BaseStringHelper.php | 46 +++++++++++++++- framework/yii/web/Response.php | 4 +- framework/yii/web/XmlResponseFormatter.php | 4 +- tests/unit/framework/helpers/StringHelperTest.php | 61 +++++++++++----------- tests/unit/framework/web/ResponseTest.php | 2 +- 21 files changed, 129 insertions(+), 131 deletions(-) diff --git a/extensions/elasticsearch/ActiveRecord.php b/extensions/elasticsearch/ActiveRecord.php index e6e28b7..3afadf6 100644 --- a/extensions/elasticsearch/ActiveRecord.php +++ b/extensions/elasticsearch/ActiveRecord.php @@ -10,9 +10,9 @@ namespace yii\elasticsearch; use yii\base\InvalidCallException; use yii\base\InvalidConfigException; use yii\db\BaseActiveRecord; -use yii\helpers\FileHelper; use yii\helpers\Inflector; use yii\helpers\Json; +use yii\helpers\StringHelper; /** * ActiveRecord is the base class for classes representing relational data in terms of objects. @@ -226,7 +226,7 @@ class ActiveRecord extends BaseActiveRecord */ public static function index() { - return Inflector::pluralize(Inflector::camel2id(FileHelper::basename(get_called_class()), '-')); + return Inflector::pluralize(Inflector::camel2id(StringHelper::basename(get_called_class()), '-')); } /** @@ -234,7 +234,7 @@ class ActiveRecord extends BaseActiveRecord */ public static function type() { - return Inflector::camel2id(FileHelper::basename(get_called_class()), '-'); + return Inflector::camel2id(StringHelper::basename(get_called_class()), '-'); } /** diff --git a/extensions/gii/generators/crud/templates/controller.php b/extensions/gii/generators/crud/templates/controller.php index c1ce71f..bb5d3f4 100644 --- a/extensions/gii/generators/crud/templates/controller.php +++ b/extensions/gii/generators/crud/templates/controller.php @@ -1,7 +1,7 @@ controllerClass); -$modelClass = FileHelper::basename($generator->modelClass); -$searchModelClass = FileHelper::basename($generator->searchModelClass); +$controllerClass = StringHelper::basename($generator->controllerClass); +$modelClass = StringHelper::basename($generator->modelClass); +$searchModelClass = StringHelper::basename($generator->searchModelClass); if ($modelClass === $searchModelClass) { $searchModelAlias = $searchModelClass.'Search'; } @@ -27,7 +27,7 @@ $actionParamComments = $generator->generateActionParamComments(); echo " -namespace controllerClass, '\\')) ?>; +namespace controllerClass, '\\')) ?>; use modelClass, '\\') ?>; use searchModelClass, '\\') ?> as ; @@ -38,7 +38,7 @@ use yii\web\VerbFilter; /** * implements the CRUD actions for model. */ -class extends baseControllerClass) . "\n" ?> +class extends baseControllerClass) . "\n" ?> { public function behaviors() { diff --git a/extensions/gii/generators/crud/templates/search.php b/extensions/gii/generators/crud/templates/search.php index 1a9da82..1411896 100644 --- a/extensions/gii/generators/crud/templates/search.php +++ b/extensions/gii/generators/crud/templates/search.php @@ -1,6 +1,6 @@ modelClass); -$searchModelClass = FileHelper::basename($generator->searchModelClass); +$modelClass = StringHelper::basename($generator->modelClass); +$searchModelClass = StringHelper::basename($generator->searchModelClass); $rules = $generator->generateSearchRules(); $labels = $generator->generateSearchLabels(); $searchAttributes = $generator->getSearchAttributes(); @@ -19,7 +19,7 @@ $searchConditions = $generator->generateSearchConditions(); echo " -namespace searchModelClass, '\\')) ?>; +namespace searchModelClass, '\\')) ?>; use yii\base\Model; use yii\data\ActiveDataProvider; diff --git a/extensions/gii/generators/crud/templates/views/_form.php b/extensions/gii/generators/crud/templates/views/_form.php index 4ac7971..52538d5 100644 --- a/extensions/gii/generators/crud/templates/views/_form.php +++ b/extensions/gii/generators/crud/templates/views/_form.php @@ -1,7 +1,7 @@ -
+
$form = ActiveForm::begin(); ?> diff --git a/extensions/gii/generators/crud/templates/views/_search.php b/extensions/gii/generators/crud/templates/views/_search.php index 6ba9ee0..af2f948 100644 --- a/extensions/gii/generators/crud/templates/views/_search.php +++ b/extensions/gii/generators/crud/templates/views/_search.php @@ -1,7 +1,7 @@ -