-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #549 from FriendsOfCake/php-72
Rename "Object" to "BaseObject" for PHP 7.2 compatibility.
- Loading branch information
Showing
5 changed files
with
78 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
namespace Crud\Core; | ||
|
||
use Cake\Controller\Controller; | ||
use Cake\Core\InstanceConfigTrait; | ||
use Cake\Event\EventListenerInterface; | ||
|
||
/** | ||
* Crud Base Class | ||
* | ||
* Implement base methods used in CrudAction and CrudListener classes | ||
* | ||
* Licensed under The MIT License | ||
* For full copyright and license information, please see the LICENSE.txt | ||
*/ | ||
abstract class BaseObject implements EventListenerInterface | ||
{ | ||
|
||
use InstanceConfigTrait; | ||
use ProxyTrait; | ||
|
||
/** | ||
* Container with reference to all objects | ||
* needed within the CrudListener and CrudAction | ||
* | ||
* @var \Cake\Controller\Controller | ||
*/ | ||
protected $_controller; | ||
|
||
/** | ||
* Default configuration | ||
* | ||
* @var array | ||
*/ | ||
protected $_defaultConfig = []; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \Cake\Controller\Controller $Controller Controller instance | ||
* @param array $config Default settings | ||
*/ | ||
public function __construct(Controller $Controller, $config = []) | ||
{ | ||
$this->_controller = $Controller; | ||
$this->config($config); | ||
} | ||
|
||
/** | ||
* List of implemented events | ||
* | ||
* @return array | ||
*/ | ||
public function implementedEvents() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Convenient method for Request::is | ||
* | ||
* @param string|array $method Method(s) to check for | ||
* @return bool | ||
*/ | ||
protected function _checkRequestType($method) | ||
{ | ||
return $this->_request()->is($method); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,5 @@ | ||
<?php | ||
namespace Crud\Core; | ||
|
||
use Cake\Controller\Controller; | ||
use Cake\Core\InstanceConfigTrait; | ||
use Cake\Event\EventListenerInterface; | ||
|
||
/** | ||
* Crud Base Class | ||
* | ||
* Implement base methods used in CrudAction and CrudListener classes | ||
* | ||
* Licensed under The MIT License | ||
* For full copyright and license information, please see the LICENSE.txt | ||
*/ | ||
abstract class Object implements EventListenerInterface | ||
{ | ||
|
||
use InstanceConfigTrait; | ||
use ProxyTrait; | ||
|
||
/** | ||
* Container with reference to all objects | ||
* needed within the CrudListener and CrudAction | ||
* | ||
* @var \Cake\Controller\Controller | ||
*/ | ||
protected $_controller; | ||
|
||
/** | ||
* Default configuration | ||
* | ||
* @var array | ||
*/ | ||
protected $_defaultConfig = []; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \Cake\Controller\Controller $Controller Controller instance | ||
* @param array $config Default settings | ||
*/ | ||
public function __construct(Controller $Controller, $config = []) | ||
{ | ||
$this->_controller = $Controller; | ||
$this->config($config); | ||
} | ||
|
||
/** | ||
* List of implemented events | ||
* | ||
* @return array | ||
*/ | ||
public function implementedEvents() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Convenient method for Request::is | ||
* | ||
* @param string|array $method Method(s) to check for | ||
* @return bool | ||
*/ | ||
protected function _checkRequestType($method) | ||
{ | ||
return $this->_request()->is($method); | ||
} | ||
// @deprecated Add backwards compat alias. "Object" is protected keyword in PHP 7.2 | ||
if (PHP_VERSION_ID < 70200) { | ||
class_alias('Crud\Core\BaseObject', 'Crud\Core\Object'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters