| 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 object creation 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 AbstractProvider implements IProvider |
| 26 |
|
{ |
| 27 |
|
protected $_name; |
| 28 |
|
/** |
| 29 |
|
* @var \Xyster\Type\Type |
| 30 |
|
*/ |
| 31 |
|
protected $_type; |
| 32 |
|
protected $_initMethod; |
| 33 |
|
protected $_constructorArguments = array(); |
| 34 |
|
protected $_properties = array(); |
| 35 |
|
protected $_dependsOn = array(); |
| 36 |
|
|
| 37 |
|
/** |
| 38 |
|
* Creates a new provider |
| 39 |
|
* |
| 40 |
|
* @param \Xyster\Container\Definition $def The component definintion |
| 41 |
|
*/ |
| 42 |
|
public function __construct(\Xyster\Container\Definition $def) |
| 43 |
|
{ |
| 44 |
51 |
$this->_type = $def->getType(); |
| 45 |
51 |
$this->_name = $def->getName(); |
| 46 |
51 |
$this->_initMethod = $def->getInitMethod(); |
| 47 |
51 |
$this->_constructorArguments = $def->getConstructorArgs(); |
| 48 |
51 |
$this->_properties = $def->getProperties(); |
| 49 |
51 |
$this->_dependsOn = $def->getDependsOn(); |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
/** |
| 53 |
|
* Gets the name of the component. |
| 54 |
|
* |
| 55 |
|
* @return string The component name |
| 56 |
|
*/ |
| 57 |
|
public function getName() |
| 58 |
|
{ |
| 59 |
28 |
return $this->_name; |
| 60 |
|
} |
| 61 |
|
|
| 62 |
|
/** |
| 63 |
|
* Gets the type of component. |
| 64 |
|
* |
| 65 |
|
* @return \Xyster\Type\Type The component type |
| 66 |
|
*/ |
| 67 |
|
public function getType() |
| 68 |
|
{ |
| 69 |
51 |
return $this->_type; |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
/** |
| 73 |
|
* Converts the object into a string value |
| 74 |
|
* |
| 75 |
|
* @magic |
| 76 |
|
* @return string |
| 77 |
|
*/ |
| 78 |
|
public function __toString() |
| 79 |
|
{ |
| 80 |
3 |
return $this->getLabel() . ':' . $this->_name; |
| 81 |
|
} |
| 82 |
1 |
} |