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 / Di / Definition / Builder / PhpClass.php
blob9cc669e81e5523e8a1b2870d13a1e8db3e96e7cb
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\Di\Definition\Builder;
12 /**
13 * Object containing definitions for a single class
15 class PhpClass
17 /**
18 * @var string
20 protected $defaultMethodBuilder = 'Zend\Di\Definition\Builder\InjectionMethod';
22 /**
23 * @var null|string
25 protected $name = null;
27 /**
28 * @var string|\Callable|array
30 protected $instantiator = '__construct';
32 /**
33 * @var InjectionMethod[]
35 protected $injectionMethods = array();
37 /**
38 * @var array
40 protected $superTypes = array();
42 /**
43 * Set name
45 * @param string $name
46 * @return PhpClass
48 public function setName($name)
50 $this->name = $name;
52 return $this;
55 /**
56 * Get name
58 * @return string
60 public function getName()
62 return $this->name;
65 /**
66 * @param string|\Callable|array $instantiator
67 * @return PhpClass
69 public function setInstantiator($instantiator)
71 $this->instantiator = $instantiator;
73 return $this;
76 /**
77 * @return array|\Callable|string
79 public function getInstantiator()
81 return $this->instantiator;
84 /**
85 * @param string $superType
86 * @return PhpClass
88 public function addSuperType($superType)
90 $this->superTypes[] = $superType;
92 return $this;
95 /**
96 * Get super types
98 * @return array
100 public function getSuperTypes()
102 return $this->superTypes;
106 * Add injection method
108 * @param InjectionMethod $injectionMethod
109 * @return PhpClass
111 public function addInjectionMethod(InjectionMethod $injectionMethod)
113 $this->injectionMethods[] = $injectionMethod;
115 return $this;
119 * Create and register an injection method
121 * Optionally takes the method name.
123 * This method may be used in lieu of addInjectionMethod() in
124 * order to provide a more fluent interface for building classes with
125 * injection methods.
127 * @param null|string $name
128 * @return InjectionMethod
130 public function createInjectionMethod($name = null)
132 $builder = $this->defaultMethodBuilder;
133 /* @var $method InjectionMethod */
134 $method = new $builder();
135 if (null !== $name) {
136 $method->setName($name);
138 $this->addInjectionMethod($method);
140 return $method;
144 * Override which class will be used by {@link createInjectionMethod()}
146 * @param string $class
147 * @return PhpClass
149 public function setMethodBuilder($class)
151 $this->defaultMethodBuilder = $class;
153 return $this;
157 * Determine what class will be used by {@link createInjectionMethod()}
159 * Mainly to provide the ability to temporarily override the class used.
161 * @return string
163 public function getMethodBuilder()
165 return $this->defaultMethodBuilder;
169 * @return InjectionMethod[]
171 public function getInjectionMethods()
173 return $this->injectionMethods;