diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2015-01-22 09:14:12 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2015-01-22 09:14:12 +0100 |
commit | 5230f8f8a86fc1ae5d90f8c74ae65c93e197502b (patch) | |
tree | e870d29e21c14d5b1683d638dff978afe0a104fa /framework/Util | |
parent | 53e4cd65205ac33d7dbc61a767f467c1b896dfc6 (diff) |
Apply namespaces to class inheritances (pt1)
Diffstat (limited to 'framework/Util')
-rw-r--r-- | framework/Util/IBaseBehavior.php | 37 | ||||
-rw-r--r-- | framework/Util/IBehavior.php | 39 | ||||
-rw-r--r-- | framework/Util/IClassBehavior.php | 49 | ||||
-rw-r--r-- | framework/Util/TBehavior.php | 2 | ||||
-rw-r--r-- | framework/Util/TClassBehavior.php | 2 | ||||
-rw-r--r-- | framework/Util/TDataFieldAccessor.php | 2 | ||||
-rw-r--r-- | framework/Util/TLogRoute.php | 2 | ||||
-rw-r--r-- | framework/Util/TLogRouter.php | 2 | ||||
-rw-r--r-- | framework/Util/TLogger.php | 2 | ||||
-rw-r--r-- | framework/Util/TParameterModule.php | 2 | ||||
-rw-r--r-- | framework/Util/TRpcClient.php | 2 |
11 files changed, 133 insertions, 8 deletions
diff --git a/framework/Util/IBaseBehavior.php b/framework/Util/IBaseBehavior.php new file mode 100644 index 00000000..2f2ca858 --- /dev/null +++ b/framework/Util/IBaseBehavior.php @@ -0,0 +1,37 @@ +<?php +/** + * TComponent, TPropertyValue classes + * + * @author Qiang Xue <qiang.xue@gmail.com> + * + * Global Events, intra-object events, Class behaviors, expanded behaviors + * @author Brad Anderson <javalizard@mac.com> + * + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Util + */ + +namespace Prado\Util; + +/** + * IBaseBehavior interface is the base behavior class from which all other + * behaviors types are derived + * + * @author Brad Anderson <javalizard@mac.com> + * @package Prado\Util + * @since 3.2.3 + */ +interface IBaseBehavior { + /** + * Attaches the behavior object to the component. + * @param CComponent the component that this behavior is to be attached to. + */ + public function attach($component); + /** + * Detaches the behavior object from the component. + * @param CComponent the component that this behavior is to be detached from. + */ + public function detach($component); +}
\ No newline at end of file diff --git a/framework/Util/IBehavior.php b/framework/Util/IBehavior.php new file mode 100644 index 00000000..6b5e92d1 --- /dev/null +++ b/framework/Util/IBehavior.php @@ -0,0 +1,39 @@ +<?php +/** + * TComponent, TPropertyValue classes + * + * @author Qiang Xue <qiang.xue@gmail.com> + * + * Global Events, intra-object events, Class behaviors, expanded behaviors + * @author Brad Anderson <javalizard@mac.com> + * + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Util + */ + +namespace Prado\Util; + +/** + * IBehavior interfaces is implemented by instance behavior classes. + * + * A behavior is a way to enhance a component with additional methods and + * events that are defined in the behavior class and not available in the + * class. Objects may signal behaviors through dynamic events. + * + * @author Brad Anderson <javalizard@mac.com> + * @package Prado\Util + * @since 3.2.3 + */ +interface IBehavior extends IBaseBehavior +{ + /** + * @return boolean whether this behavior is enabled + */ + public function getEnabled(); + /** + * @param boolean whether this behavior is enabled + */ + public function setEnabled($value); +}
\ No newline at end of file diff --git a/framework/Util/IClassBehavior.php b/framework/Util/IClassBehavior.php new file mode 100644 index 00000000..ee708c06 --- /dev/null +++ b/framework/Util/IClassBehavior.php @@ -0,0 +1,49 @@ +<?php +/** + * TComponent, TPropertyValue classes + * + * @author Qiang Xue <qiang.xue@gmail.com> + * + * Global Events, intra-object events, Class behaviors, expanded behaviors + * @author Brad Anderson <javalizard@mac.com> + * + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Util + */ + +namespace Prado\Util; + +/** + * IClassBehavior interface is implements behaviors across all instances of + * a particular class + * + * Any calls to functions not present in the original object but to behaviors + * derived from this class, will have inserted as the first argument parameter + * the object containing the behavior. + * + * For example: + * <code> + * $objWithClassBehavior->MethodOfClassBehavior(1, 20); + * </code> + * will be acted within the class behavior like this: + * <code> + * public function MethodOfClassBehavior($object, $firstParam, $secondParam){ + * // $object === $objWithClassBehavior, $firstParam === 1, $secondParam === 20 + * } + * </code> + * + * This also holds for 'dy' events as well. For dynamic events, method arguments would be: + * <code> + * public function dyMethodOfClassBehavior($object, $firstParam, $secondParam, $callchain){ + * // $object === $objWithClassBehavior, $firstParam === 1, $secondParam === 20, $callchain instanceof {@link TCallChain} + * } + * </code> + * + * @author Brad Anderson <javalizard@mac.com> + * @package Prado\Util + * @since 3.2.3 + */ +interface IClassBehavior extends IBaseBehavior { +}
\ No newline at end of file diff --git a/framework/Util/TBehavior.php b/framework/Util/TBehavior.php index 83a24b75..c95f7cc3 100644 --- a/framework/Util/TBehavior.php +++ b/framework/Util/TBehavior.php @@ -16,7 +16,7 @@ namespace Prado\Util; * @package Prado\Util * @since 3.2.3 */ -class TBehavior extends TComponent implements IBehavior +class TBehavior extends \Prado\TComponent implements IBehavior { private $_enabled; private $_owner; diff --git a/framework/Util/TClassBehavior.php b/framework/Util/TClassBehavior.php index 113c9c68..183e8ec7 100644 --- a/framework/Util/TClassBehavior.php +++ b/framework/Util/TClassBehavior.php @@ -16,7 +16,7 @@ namespace Prado\Util; * @package Prado\Util * @since 3.2.3 */ -class TClassBehavior extends TComponent implements IClassBehavior +class TClassBehavior extends \Prado\TComponent implements IClassBehavior { /** diff --git a/framework/Util/TDataFieldAccessor.php b/framework/Util/TDataFieldAccessor.php index 35ae5228..10bb678e 100644 --- a/framework/Util/TDataFieldAccessor.php +++ b/framework/Util/TDataFieldAccessor.php @@ -54,7 +54,7 @@ class TDataFieldAccessor { try { - if(is_array($data) || ($data instanceof ArrayAccess)) + if(is_array($data) || ($data instanceof \ArrayAccess)) { if(isset($data[$field])) return $data[$field]; diff --git a/framework/Util/TLogRoute.php b/framework/Util/TLogRoute.php index 9a2d5699..d905f553 100644 --- a/framework/Util/TLogRoute.php +++ b/framework/Util/TLogRoute.php @@ -32,7 +32,7 @@ namespace Prado\Util; * @package Prado\Util * @since 3.0 */ -abstract class TLogRoute extends TApplicationComponent +abstract class TLogRoute extends \Prado\TApplicationComponent { /** * @var array lookup table for level names diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php index cbbfc434..2b2106f1 100644 --- a/framework/Util/TLogRouter.php +++ b/framework/Util/TLogRouter.php @@ -40,7 +40,7 @@ Prado::using('System.Data.TDbConnection'); * @package Prado\Util * @since 3.0 */ -class TLogRouter extends TModule +class TLogRouter extends \Prado\TModule { /** * @var array list of routes available diff --git a/framework/Util/TLogger.php b/framework/Util/TLogger.php index 2397704f..556e8a73 100644 --- a/framework/Util/TLogger.php +++ b/framework/Util/TLogger.php @@ -22,7 +22,7 @@ namespace Prado\Util; * @package Prado\Util * @since 3.0 */ -class TLogger extends TComponent +class TLogger extends \Prado\TComponent { /** * Log levels. diff --git a/framework/Util/TParameterModule.php b/framework/Util/TParameterModule.php index 1ca1a5cf..4cb26c7d 100644 --- a/framework/Util/TParameterModule.php +++ b/framework/Util/TParameterModule.php @@ -45,7 +45,7 @@ namespace Prado\Util; * @package Prado\Util * @since 3.0 */ -class TParameterModule extends TModule +class TParameterModule extends \Prado\TModule { /** * @deprecated since 3.2 diff --git a/framework/Util/TRpcClient.php b/framework/Util/TRpcClient.php index f665dce6..15d29955 100644 --- a/framework/Util/TRpcClient.php +++ b/framework/Util/TRpcClient.php @@ -45,7 +45,7 @@ namespace Prado\Util; * @since 3.2 */ -class TRpcClient extends TApplicationComponent +class TRpcClient extends \Prado\TApplicationComponent { /** * @var string url of the RPC server |