Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Db / TableGateway / Feature / FeatureSet.php
blobfaa0f62cfec1c0b85fc7a490b1af6b8c597e0ba5
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Db\TableGateway\Feature;
12 use Zend\Db\TableGateway\AbstractTableGateway;
14 class FeatureSet
16 const APPLY_HALT = 'halt';
18 protected $tableGateway = null;
20 /**
21 * @var AbstractFeature[]
23 protected $features = array();
25 /**
26 * @var array
28 protected $magicSpecifications = array();
30 public function __construct(array $features = array())
32 if ($features) {
33 $this->addFeatures($features);
37 public function setTableGateway(AbstractTableGateway $tableGateway)
39 $this->tableGateway = $tableGateway;
40 foreach ($this->features as $feature) {
41 $feature->setTableGateway($this->tableGateway);
43 return $this;
46 public function getFeatureByClassName($featureClassName)
48 $feature = false;
49 foreach ($this->features as $potentialFeature) {
50 if ($potentialFeature instanceof $featureClassName) {
51 $feature = $potentialFeature;
52 break;
55 return $feature;
58 public function addFeatures(array $features)
60 foreach ($features as $feature) {
61 $this->addFeature($feature);
63 return $this;
66 public function addFeature(AbstractFeature $feature)
68 $this->features[] = $feature;
69 $feature->setTableGateway($feature);
70 return $this;
73 public function apply($method, $args)
75 foreach ($this->features as $feature) {
76 if (method_exists($feature, $method)) {
77 $return = call_user_func_array(array($feature, $method), $args);
78 if ($return === self::APPLY_HALT) {
79 break;
85 /**
86 * @param string $property
87 * @return bool
89 public function canCallMagicGet($property)
91 return false;
94 /**
95 * @param string $property
96 * @return mixed
98 public function callMagicGet($property)
100 $return = null;
101 return $return;
105 * @param string $property
106 * @return bool
108 public function canCallMagicSet($property)
110 return false;
114 * @param $property
115 * @param $value
116 * @return mixed
118 public function callMagicSet($property, $value)
120 $return = null;
121 return $return;
125 * @param string $method
126 * @return bool
128 public function canCallMagicCall($method)
130 return false;
134 * @param string $method
135 * @param array $arguments
136 * @return mixed
138 public function callMagicCall($method, $arguments)
140 $return = null;
141 return $return;