| 1 |
|
<?php |
| 2 |
|
/** |
| 3 |
|
* Xyster Framework |
| 4 |
|
* |
| 5 |
|
* This source file is subject to the new BSD license that is bundled |
| 6 |
|
* with this package in the file LICENSE.txt. |
| 7 |
|
* It is also available through the world-wide-web at this URL: |
| 8 |
|
* http://www.opensource.org/licenses/bsd-license.php |
| 9 |
|
* |
| 10 |
|
* @category Xyster |
| 11 |
|
* @package Xyster_Container |
| 12 |
|
* @copyright Copyright LibreWorks, LLC (http://libreworks.net) |
| 13 |
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
| 14 |
|
* @version $Id$ |
| 15 |
|
*/ |
| 16 |
|
namespace Xyster\Container\Provider; |
| 17 |
|
/** |
| 18 |
|
* Abstract provider deletate class |
| 19 |
|
* |
| 20 |
|
* @category Xyster |
| 21 |
|
* @package Xyster_Container |
| 22 |
|
* @copyright Copyright LibreWorks, LLC (http://libreworks.net) |
| 23 |
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
| 24 |
|
*/ |
| 25 |
|
abstract class Delegate implements IProvider |
| 26 |
|
{ |
| 27 |
|
/** |
| 28 |
|
* @var IProvider |
| 29 |
|
*/ |
| 30 |
|
protected $_delegate; |
| 31 |
|
|
| 32 |
|
/** |
| 33 |
|
* Creates a new delegate |
| 34 |
|
* |
| 35 |
|
* @param IProvider $delegate The delegate provider |
| 36 |
|
*/ |
| 37 |
|
public function __construct(IProvider $delegate) |
| 38 |
|
{ |
| 39 |
6 |
$this->_delegate = $delegate; |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
/** |
| 43 |
|
* Gets the name of the component. |
| 44 |
|
* |
| 45 |
|
* @return string The component name |
| 46 |
|
*/ |
| 47 |
|
public function getName() |
| 48 |
|
{ |
| 49 |
1 |
return $this->_delegate->getName(); |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
/** |
| 53 |
|
* Gets the type of component. |
| 54 |
|
* |
| 55 |
|
* @return \Xyster\Type\Type The component type |
| 56 |
|
*/ |
| 57 |
|
public function getType() |
| 58 |
|
{ |
| 59 |
1 |
return $this->_delegate->getType(); |
| 60 |
|
} |
| 61 |
|
|
| 62 |
|
/** |
| 63 |
|
* Verify that all dependencies for this component can be satisifed. |
| 64 |
|
* |
| 65 |
|
* Normally, the details should verify this by checking that the associated |
| 66 |
|
* Container contains all the needed dependnecies. |
| 67 |
|
* |
| 68 |
|
* @param \Xyster\Container\IContainer $container The container |
| 69 |
|
* @throws \Xyster\Container\Exception if one or more required dependencies aren't met |
| 70 |
|
*/ |
| 71 |
|
public function validate(\Xyster\Container\IContainer $container) |
| 72 |
|
{ |
| 73 |
1 |
$this->_delegate->validate($container); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
/** |
| 77 |
|
* Converts the object into a string value |
| 78 |
|
* |
| 79 |
|
* @magic |
| 80 |
|
* @return string |
| 81 |
|
*/ |
| 82 |
|
public function __toString() |
| 83 |
|
{ |
| 84 |
1 |
return $this->getLabel() . ':' . $this->_delegate->__toString(); |
| 85 |
|
} |
| 86 |
|
} |