Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/View/BakeView.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,21 @@ class BakeView extends View
*
* This config is read when evaluating a template file.
*
* phpTagReplacements are applied to the contents of a bake template, to allow php tags
* to be treated as plain text
*
* replacements are applied in order on the template contents before the template is evaluated
* In order these:
* swallow leading whitespace for <%- tags
* swallow trailing whitespace for -%> tags
* Add an extra newline to <%=, to counteract php automatically removing a newline
* Replace remaining <=% with php short echo tags
* Replace <% with php open tags
* Replace %> with php close tags
* - `phpTagReplacements` are applied to the contents of a bake template, to allow php tags
* to be treated as plain text
* - `replacements` are applied in order on the template contents before the template is evaluated.
*
* The default replacements are (in the following order):
*
* - swallow leading whitespace for <%- tags
* - swallow trailing whitespace for -%> tags
* - Add an extra newline to <%=, to counteract php automatically removing a newline
* - Replace remaining <=% with php short echo tags
* - Replace <% with php open tags
* - Replace %> with php close tags
*
* Replacements that start with `/` will be treated as regex replacements.
* All other values will be treated used with str_replace()
*
* @var array
*/
Expand Down Expand Up @@ -244,10 +248,6 @@ protected function _paths($plugin = null, $cached = true)
*/
protected function _isRegex($maybeRegex)
{
// @codingStandardsIgnoreStart
$isRegex = @preg_match($maybeRegex, '');
// @codingStandardsIgnoreEnd

return $isRegex !== false;
return substr($maybeRegex, 0, 1) === '/';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @method \App\Model\Entity\CategoriesProduct|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\CategoriesProduct patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\CategoriesProduct[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\CategoriesProduct findOrCreate($search, callable $callback = null)
* @method \App\Model\Entity\CategoriesProduct findOrCreate($search, callable $callback = null, $options = [])
*/
class CategoriesProductsTable extends Table
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @method \App\Model\Entity\Category|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Category patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Category[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Category findOrCreate($search, callable $callback = null)
* @method \App\Model\Entity\Category findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @method \App\Model\Entity\OldProduct|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\OldProduct patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\OldProduct[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\OldProduct findOrCreate($search, callable $callback = null)
* @method \App\Model\Entity\OldProduct findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @method \App\Model\Entity\ProductVersion|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\ProductVersion patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\ProductVersion[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\ProductVersion findOrCreate($search, callable $callback = null)
* @method \App\Model\Entity\ProductVersion findOrCreate($search, callable $callback = null, $options = [])
*/
class ProductVersionsTable extends Table
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @method \App\Model\Entity\Product|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Product patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Product[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Product findOrCreate($search, callable $callback = null)
* @method \App\Model\Entity\Product findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Model/testBakeTableConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @method \App\Model\Entity\BakeArticle|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\BakeArticle patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\BakeArticle[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\BakeArticle findOrCreate($search, callable $callback = null)
* @method \App\Model\Entity\BakeArticle findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Model/testBakeTableRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @method \App\Model\Entity\BakeArticle|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\BakeArticle patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\BakeArticle[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\BakeArticle findOrCreate($search, callable $callback = null)
* @method \App\Model\Entity\BakeArticle findOrCreate($search, callable $callback = null, $options = [])
*/
class BakeArticlesTable extends Table
{
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Model/testBakeTableValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @method \App\Model\Entity\BakeArticle|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\BakeArticle patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\BakeArticle[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\BakeArticle findOrCreate($search, callable $callback = null)
* @method \App\Model\Entity\BakeArticle findOrCreate($search, callable $callback = null, $options = [])
*/
class BakeArticlesTable extends Table
{
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Model/testBakeTableWithPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @method \ModelTest\Model\Entity\BakeArticle|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \ModelTest\Model\Entity\BakeArticle patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \ModelTest\Model\Entity\BakeArticle[] patchEntities($entities, array $data, array $options = [])
* @method \ModelTest\Model\Entity\BakeArticle findOrCreate($search, callable $callback = null)
* @method \ModelTest\Model\Entity\BakeArticle findOrCreate($search, callable $callback = null, $options = [])
*/
class BakeArticlesTable extends Table
{
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Model/testBakeWithRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @method \App\Model\Entity\User|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\User patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\User[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\User findOrCreate($search, callable $callback = null)
* @method \App\Model\Entity\User findOrCreate($search, callable $callback = null, $options = [])
*/
class UsersTable extends Table
{
Expand Down