Overview

Namespaces

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

Classes

  • Broker
  • ReflectionAnnotation
  • ReflectionBase
  • ReflectionClass
  • ReflectionConstant
  • ReflectionElement
  • ReflectionFile
  • ReflectionFileNamespace
  • ReflectionFunction
  • ReflectionFunctionBase
  • ReflectionMethod
  • ReflectionNamespace
  • ReflectionParameter
  • ReflectionProperty
  • Resolver

Interfaces

  • IReflection
  • IReflectionClass
  • IReflectionConstant
  • IReflectionExtension
  • IReflectionFunction
  • IReflectionFunctionBase
  • IReflectionMethod
  • IReflectionNamespace
  • IReflectionParameter
  • IReflectionProperty
  • 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;
 17: 
 18: /**
 19:  * Common reflection classes interface.
 20:  */
 21: interface IReflectionClass extends IReflection
 22: {
 23:     /**
 24:      * Returns the unqualified name (UQN).
 25:      *
 26:      * @return string
 27:      */
 28:     public function getShortName();
 29: 
 30:     /**
 31:      * Returns the namespace name.
 32:      *
 33:      * @return string
 34:      */
 35:     public function getNamespaceName();
 36: 
 37:     /**
 38:      * Returns if the class is defined within a namespace.
 39:      *
 40:      * @return boolean
 41:      */
 42:     public function inNamespace();
 43: 
 44:     /**
 45:      * Returns imported namespaces and aliases from the declaring namespace.
 46:      *
 47:      * @return array
 48:      */
 49:     public function getNamespaceAliases();
 50: 
 51:     /**
 52:      * Returns the PHP extension reflection.
 53:      *
 54:      * @return \TokenReflection\IReflectionExtension|null
 55:      */
 56:     public function getExtension();
 57: 
 58:     /**
 59:      * Returns the PHP extension name.
 60:      *
 61:      * @return string|null
 62:      */
 63:     public function getExtensionName();
 64: 
 65:     /**
 66:      * Returns the file name the reflection object is defined in.
 67:      *
 68:      * @return string
 69:      */
 70:     public function getFileName();
 71: 
 72:     /**
 73:      * Returns the definition start line number in the file.
 74:      *
 75:      * @return integer
 76:      */
 77:     public function getStartLine();
 78: 
 79:     /**
 80:      * Returns the definition end line number in the file.
 81:      *
 82:      * @return integer
 83:      */
 84:     public function getEndLine();
 85: 
 86:     /**
 87:      * Returns the appropriate docblock definition.
 88:      *
 89:      * @return string|boolean
 90:      */
 91:     public function getDocComment();
 92: 
 93:     /**
 94:      * Returns modifiers.
 95:      *
 96:      * @return array
 97:      */
 98:     public function getModifiers();
 99: 
100:     /**
101:      * Returns if the class is abstract.
102:      *
103:      * @return boolean
104:      */
105:     public function isAbstract();
106: 
107:     /**
108:      * Returns if the class is final.
109:      *
110:      * @return boolean
111:      */
112:     public function isFinal();
113: 
114:     /**
115:      * Returns if the class is an interface.
116:      *
117:      * @return boolean
118:      */
119:     public function isInterface();
120: 
121:     /**
122:      * Returns if the class is an exception or its descendant.
123:      *
124:      * @return boolean
125:      */
126:     public function isException();
127: 
128:     /**
129:      * Returns if objects of this class are cloneable.
130:      *
131:      * Introduced in PHP 5.4.
132:      *
133:      * @return boolean
134:      * @see http://svn.php.net/viewvc/php/php-src/trunk/ext/reflection/php_reflection.c?revision=307971&view=markup#l4059
135:      */
136:     public function isCloneable();
137: 
138:     /**
139:      * Returns if the class is iterateable.
140:      *
141:      * Returns true if the class implements the Traversable interface.
142:      *
143:      * @return boolean
144:      */
145:     public function isIterateable();
146: 
147:     /**
148:      * Returns if the current class is a subclass of the given class.
149:      *
150:      * @param string|object $class Class name or reflection object
151:      * @return boolean
152:      */
153:     public function isSubclassOf($class);
154: 
155:     /**
156:      * Returns the parent class reflection.
157:      *
158:      * @return \TokenReflection\IReflectionClass|null
159:      */
160:     public function getParentClass();
161: 
162:     /**
163:      * Returns the parent class name.
164:      *
165:      * @return string|null
166:      */
167:     public function getParentClassName();
168: 
169:     /**
170:      * Returns the parent classes reflections.
171:      *
172:      * @return array
173:      */
174:     public function getParentClasses();
175: 
176:     /**
177:      * Returns the parent classes names.
178:      *
179:      * @return array
180:      */
181:     public function getParentClassNameList();
182: 
183:     /**
184:      * Returns if the class implements the given interface.
185:      *
186:      * @param string|object $interface Interface name or reflection object
187:      * @return boolean
188:      * @throws \TokenReflection\Exception\RuntimeException If an invalid object was provided as interface.
189:      */
190:     public function implementsInterface($interface);
191: 
192:     /**
193:      * Returns interface reflections.
194:      *
195:      * @return array
196:      */
197:     public function getInterfaces();
198: 
199:     /**
200:      * Returns interface names.
201:      *
202:      * @return array
203:      */
204:     public function getInterfaceNames();
205: 
206:     /**
207:      * Returns interface reflections implemented by this class, not its parents.
208:      *
209:      * @return array
210:      */
211:     public function getOwnInterfaces();
212: 
213:     /**
214:      * Returns names of interfaces implemented by this class, not its parents.
215:      *
216:      * @return array
217:      */
218:     public function getOwnInterfaceNames();
219: 
220:     /**
221:      * Returns the class constructor reflection.
222:      *
223:      * @return \TokenReflection\IReflectionMethod|null
224:      */
225:     public function getConstructor();
226: 
227:     /**
228:      * Returns the class desctructor reflection.
229:      *
230:      * @return \TokenReflection\IReflectionMethod|null
231:      */
232:     public function getDestructor();
233: 
234:     /**
235:      * Returns if the class implements the given method.
236:      *
237:      * @param string $name Method name
238:      * @return boolean
239:      */
240:     public function hasMethod($name);
241: 
242:     /**
243:      * Returns a method reflection.
244:      *
245:      * @param string $name Method name
246:      * @return \TokenReflection\IReflectionMethod
247:      * @throws \TokenReflection\Exception\RuntimeException If the requested method does not exist.
248:      */
249:     public function getMethod($name);
250: 
251:     /**
252:      * Returns method reflections.
253:      *
254:      * @param integer $filter Methods filter
255:      * @return array
256:      */
257:     public function getMethods($filter = null);
258: 
259:     /**
260:      * Returns if the class implements (and not its parents) the given method.
261:      *
262:      * @param string $name Method name
263:      * @return boolean
264:      */
265:     public function hasOwnMethod($name);
266: 
267:     /**
268:      * Returns method reflections declared by this class, not its parents.
269:      *
270:      * @param integer $filter Methods filter
271:      * @return array
272:      */
273:     public function getOwnMethods($filter = null);
274: 
275:     /**
276:      * Returns if the class imports the given method from traits.
277:      *
278:      * @param string $name Method name
279:      * @return boolean
280:      */
281:     public function hasTraitMethod($name);
282: 
283:     /**
284:      * Returns method reflections imported from traits.
285:      *
286:      * @param integer $filter Methods filter
287:      * @return array
288:      */
289:     public function getTraitMethods($filter = null);
290: 
291:     /**
292:      * Returns if the class defines the given constant.
293:      *
294:      * @param string $name Constant name.
295:      * @return boolean
296:      */
297:     public function hasConstant($name);
298: 
299:     /**
300:      * Returns a constant value.
301:      *
302:      * @param string $name Constant name
303:      * @return mixed
304:      * @throws \TokenReflection\Exception\RuntimeException If the requested constant does not exist.
305:      */
306:     public function getConstant($name);
307: 
308:     /**
309:      * Returns a constant reflection.
310:      *
311:      * @param string $name Constant name
312:      * @return \TokenReflection\IReflectionConstant
313:      * @throws \TokenReflection\Exception\RuntimeException If the requested constant does not exist.
314:      */
315:     public function getConstantReflection($name);
316: 
317:     /**
318:      * Returns an array of constant values.
319:      *
320:      * @return array
321:      */
322:     public function getConstants();
323: 
324:     /**
325:      * Returns constant reflections.
326:      *
327:      * @return array
328:      */
329:     public function getConstantReflections();
330: 
331:     /**
332:      * Returns if the class (and not its parents) defines the given constant.
333:      *
334:      * @param string $name Constant name.
335:      * @return boolean
336:      */
337:     public function hasOwnConstant($name);
338: 
339:     /**
340:      * Returns values of constants declared by this class, not by its parents.
341:      *
342:      * @return array
343:      */
344:     public function getOwnConstants();
345: 
346:     /**
347:      * Returns constant reflections declared by this class, not by its parents.
348:      *
349:      * @return array
350:      */
351:     public function getOwnConstantReflections();
352: 
353:     /**
354:      * Returns if the class defines the given property.
355:      *
356:      * @param string $name Property name
357:      * @return boolean
358:      */
359:     public function hasProperty($name);
360: 
361:     /**
362:      * Return a property reflection.
363:      *
364:      * @param string $name Property name
365:      * @return \TokenReflection\ReflectionProperty
366:      * @throws \TokenReflection\Exception\RuntimeException If the requested property does not exist.
367:      */
368:     public function getProperty($name);
369: 
370:     /**
371:      * Returns property reflections.
372:      *
373:      * @param integer $filter Properties filter
374:      * @return array
375:      */
376:     public function getProperties($filter = null);
377: 
378:     /**
379:      * Returns if the class (and not its parents) defines the given property.
380:      *
381:      * @param string $name Property name
382:      * @return boolean
383:      */
384:     public function hasOwnProperty($name);
385: 
386:     /**
387:      * Returns property reflections declared by this class, not its parents.
388:      *
389:      * @param integer $filter Properties filter
390:      * @return array
391:      */
392:     public function getOwnProperties($filter = null);
393: 
394:     /**
395:      * Returns if the class imports the given property from traits.
396:      *
397:      * @param string $name Property name
398:      * @return boolean
399:      */
400:     public function hasTraitProperty($name);
401: 
402:     /**
403:      * Returns property reflections imported from traits.
404:      *
405:      * @param integer $filter Properties filter
406:      * @return array
407:      */
408:     public function getTraitProperties($filter = null);
409: 
410:     /**
411:      * Returns default properties.
412:      *
413:      * @return array
414:      */
415:     public function getDefaultProperties();
416: 
417:     /**
418:      * Returns static properties reflections.
419:      *
420:      * @return array
421:      */
422:     public function getStaticProperties();
423: 
424:     /**
425:      * Returns a value of a static property.
426:      *
427:      * @param string $name Property name
428:      * @param mixed $default Default value
429:      * @return mixed
430:      * @throws \TokenReflection\Exception\RuntimeException If the requested static property does not exist.
431:      * @throws \TokenReflection\Exception\RuntimeException If the requested static property is not accessible.
432:      */
433:     public function getStaticPropertyValue($name, $default = null);
434: 
435:     /**
436:      * Returns reflections of direct subclasses.
437:      *
438:      * @return array
439:      */
440:     public function getDirectSubclasses();
441: 
442:     /**
443:      * Returns names of direct subclasses.
444:      *
445:      * @return array
446:      */
447:     public function getDirectSubclassNames();
448: 
449:     /**
450:      * Returns reflections of indirect subclasses.
451:      *
452:      * @return array
453:      */
454:     public function getIndirectSubclasses();
455: 
456:     /**
457:      * Returns names of indirect subclasses.
458:      *
459:      * @return array
460:      */
461:     public function getIndirectSubclassNames();
462: 
463:     /**
464:      * Returns reflections of classes directly implementing this interface.
465:      *
466:      * @return array
467:      */
468:     public function getDirectImplementers();
469: 
470:     /**
471:      * Returns names of classes directly implementing this interface.
472:      *
473:      * @return array
474:      */
475:     public function getDirectImplementerNames();
476: 
477:     /**
478:      * Returns reflections of classes indirectly implementing this interface.
479:      *
480:      * @return array
481:      */
482:     public function getIndirectImplementers();
483: 
484:     /**
485:      * Returns names of classes indirectly implementing this interface.
486:      *
487:      * @return array
488:      */
489:     public function getIndirectImplementerNames();
490: 
491:     /**
492:      * Returns if it is possible to create an instance of this class.
493:      *
494:      * @return boolean
495:      */
496:     public function isInstantiable();
497: 
498:     /**
499:      * Returns traits used by this class.
500:      *
501:      * @return array
502:      */
503:     public function getTraits();
504: 
505:     /**
506:      * Returns traits used by this class and not its parents.
507:      *
508:      * @return array
509:      */
510:     public function getOwnTraits();
511: 
512:     /**
513:      * Returns names of used traits.
514:      *
515:      * @return array
516:      */
517:     public function getTraitNames();
518: 
519:     /**
520:      * Returns names of traits used by this class an not its parents.
521:      *
522:      * @return array
523:      */
524:     public function getOwnTraitNames();
525: 
526:     /**
527:      * Returns method aliases from traits.
528:      *
529:      * @return array
530:      */
531:     public function getTraitAliases();
532: 
533:     /**
534:      * Returns if the class uses a particular trait.
535:      *
536:      * @param \ReflectionClass|\TokenReflection\IReflectionClass|string $trait Trait reflection or name
537:      * @return bool
538:      */
539:     public function usesTrait($trait);
540: 
541:     /**
542:      * Returns if the class is a trait.
543:      *
544:      * @return boolean
545:      */
546:     public function isTrait();
547: 
548:     /**
549:      * Returns if the given object is an instance of this class.
550:      *
551:      * @param object $object Instance
552:      * @return boolean
553:      * @throws \TokenReflection\Exception\RuntimeException If the provided argument is not an object.
554:      */
555:     public function isInstance($object);
556: 
557:     /**
558:      * Creates a new class instance without using a constructor.
559:      *
560:      * @return object
561:      * @throws \TokenReflection\Exception\RuntimeException If the class inherits from an internal class.
562:      */
563:     public function newInstanceWithoutConstructor();
564: 
565:     /**
566:      * Creates a new instance using variable number of parameters.
567:      *
568:      * Use any number of constructor parameters as function parameters.
569:      *
570:      * @param mixed $args
571:      * @return object
572:      */
573:     public function newInstance($args);
574: 
575:     /**
576:      * Creates a new instance using an array of parameters.
577:      *
578:      * @param array $args Array of constructor parameters
579:      * @return object
580:      * @throws \TokenReflection\Exception\RuntimeException If the required class does not exist.
581:      */
582:     public function newInstanceArgs(array $args = array());
583: 
584:     /**
585:      * Sets a static property value.
586:      *
587:      * @param string $name Property name
588:      * @param mixed $value Property value
589:      * @throws \TokenReflection\Exception\RuntimeException If the requested static property does not exist.
590:      * @throws \TokenReflection\Exception\RuntimeException If the requested static property is not accessible.
591:      */
592:     public function setStaticPropertyValue($name, $value);
593: 
594:     /**
595:      * Returns the string representation of the reflection object.
596:      *
597:      * @return string
598:      */
599:     public function __toString();
600: 
601:     /**
602:      * Returns if the class definition is complete.
603:      *
604:      * That means if there are no dummy classes among parents and implemented interfaces.
605:      *
606:      * @return boolean
607:      */
608:     public function isComplete();
609:     /**
610:      * Returns if the class definition is valid.
611:      *
612:      * That means that the source code is valid and the class name is unique within parsed files.
613:      *
614:      * @return boolean
615:      */
616:     public function isValid();
617: 
618:     /**
619:      * Returns if the class is deprecated.
620:      *
621:      * @return boolean
622:      */
623:     public function isDeprecated();
624: }
PHP Token Reflection API documentation generated by ApiGen 2.8.0