Overview

Namespaces

  • TokenReflection
    • Broker
      • Backend
    • Dummy
    • Exception
    • Invalid
    • Php
    • Stream

Interfaces

  • Backend
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
  1: <?php
  2: /**
  3:  * PHP Token Reflection
  4:  *
  5:  * Version 1.3.1
  6:  *
  7:  * LICENSE
  8:  *
  9:  * This source file is subject to the new BSD license that is bundled
 10:  * with this library in the file LICENSE.
 11:  *
 12:  * @author Ondřej Nešpor
 13:  * @author Jaroslav Hanslík
 14:  */
 15: 
 16: namespace TokenReflection\Broker;
 17: 
 18: use TokenReflection;
 19: 
 20: /**
 21:  * Broker backend interface.
 22:  *
 23:  * Defines methods for storing and retrieving reflection objects.
 24:  */
 25: interface Backend
 26: {
 27:     /**
 28:      * Identifier of the tokenized classes list.
 29:      *
 30:      * @var integer
 31:      */
 32:     const TOKENIZED_CLASSES = 1;
 33: 
 34:     /**
 35:      * Identifier of the internal classes list.
 36:      *
 37:      * @var integer
 38:      */
 39:     const INTERNAL_CLASSES = 2;
 40: 
 41:     /**
 42:      * Identifier of the nonexisten classes list.
 43:      *
 44:      * @var integer
 45:      */
 46:     const NONEXISTENT_CLASSES = 4;
 47: 
 48:     /**
 49:      * Returns if there was such namespace processed (FQN expected).
 50:      *
 51:      * @param string $namespaceName Namespace name
 52:      * @return boolean
 53:      */
 54:     public function hasNamespace($namespaceName);
 55: 
 56:     /**
 57:      * Returns a reflection object of the given namespace.
 58:      *
 59:      * @param string $namespaceName Namespace name
 60:      * @return \TokenReflection\IReflectionNamespace|null
 61:      */
 62:     public function getNamespace($namespaceName);
 63: 
 64:     /**
 65:      * Returns if there was such class processed (FQN expected).
 66:      *
 67:      * @param string $className Class name
 68:      * @return boolean
 69:      */
 70:     public function hasClass($className);
 71: 
 72:     /**
 73:      * Returns a reflection object of the given class (FQN expected).
 74:      *
 75:      * @param string $className CLass bame
 76:      * @return \TokenReflection\IReflectionClass|null
 77:      */
 78:     public function getClass($className);
 79: 
 80:     /**
 81:      * Returns all classes from all namespaces.
 82:      *
 83:      * @param integer $type Returned class types (multiple values may be OR-ed)
 84:      * @return array
 85:      */
 86:     public function getClasses($type = Backend::TOKENIZED_CLASSES);
 87: 
 88:     /**
 89:      * Returns if there was such constant processed (FQN expected).
 90:      *
 91:      * @param string $constantName Constant name
 92:      * @return boolean
 93:      */
 94:     public function hasConstant($constantName);
 95: 
 96:     /**
 97:      * Returns a reflection object of a constant (FQN expected).
 98:      *
 99:      * @param string $constantName Constant name
100:      * @return \TokenReflection\IReflectionConstant|null
101:      */
102:     public function getConstant($constantName);
103: 
104:     /**
105:      * Returns all constants from all namespaces.
106:      *
107:      * @return array
108:      */
109:     public function getConstants();
110: 
111:     /**
112:      * Returns if there was such function processed (FQN expected).
113:      *
114:      * @param string $functionName Function name
115:      * @return boolean
116:      */
117:     public function hasFunction($functionName);
118: 
119:     /**
120:      * Returns a reflection object of a function (FQN expected).
121:      *
122:      * @param string $functionName Function name
123:      * @return \TokenReflection\IReflectionFunction|null
124:      */
125:     public function getFunction($functionName);
126: 
127:     /**
128:      * Returns all functions from all namespaces.
129:      *
130:      * @return array
131:      */
132:     public function getFunctions();
133: 
134:     /**
135:      * Returns if the given file was already processed.
136:      *
137:      * @param string $fileName File name
138:      * @return boolean
139:      */
140:     public function isFileProcessed($fileName);
141: 
142:     /**
143:      * Returns if a file with the given filename has been processed.
144:      *
145:      * @param string $fileName File name
146:      * @return boolean
147:      */
148:     public function hasFile($fileName);
149: 
150:     /**
151:      * Returns a file reflection.
152:      *
153:      * @param string $fileName File name
154:      * @return \TokenReflection\ReflectionFile
155:      * @throws \TokenReflection\Exception\RuntimeException If the requested file has not been processed
156:      */
157:     public function getFile($fileName);
158: 
159:     /**
160:      * Returns file reflections.
161:      *
162:      * @return array
163:      */
164:     public function getFiles();
165: 
166:     /**
167:      * Returns an array of tokens for a particular file.
168:      *
169:      * @param string $fileName File name
170:      * @return \TokenReflection\Stream\StreamBase
171:      */
172:     public function getFileTokens($fileName);
173: 
174:     /**
175:      * Adds a file to the backend storage.
176:      *
177:      * @param \TokenReflection\Stream\StreamBase $tokenStream Token stream
178:      * @param \TokenReflection\ReflectionFile $file File reflection object
179:      * @return \TokenReflection\Broker\Backend
180:      */
181:     public function addFile(TokenReflection\Stream\StreamBase $tokenStream, TokenReflection\ReflectionFile $file);
182: 
183:     /**
184:      * Sets the reflection broker instance.
185:      *
186:      * @param \TokenReflection\Broker $broker Reflection broker
187:      * @return \TokenReflection\Broker\Backend
188:      */
189:     public function setBroker(TokenReflection\Broker $broker);
190: 
191:     /**
192:      * Returns the reflection broker instance.
193:      *
194:      * @return \TokenReflection\Broker $broker Reflection broker
195:      */
196:     public function getBroker();
197: 
198:     /**
199:      * Sets if token streams are stored in the backend.
200:      *
201:      * @param boolean $store
202:      * @return \TokenReflection\Broker\Backend
203:      */
204:     public function setStoringTokenStreams($store);
205: 
206:     /**
207:      * Returns if token streams are stored in the backend.
208:      *
209:      * @return boolean
210:      */
211:     public function getStoringTokenStreams();
212: }
213: 
PHP Token Reflection API documentation generated by ApiGen 2.8.0