Repository navigation
Expand file tree
/
Copy pathAnnotations.php
More file actions
81 lines (70 loc) · 1.99 KB
/
Copy pathAnnotations.php
File metadata and controls
81 lines (70 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/*
* This file is part of the php-annotation framework.
*
* (c) Rasmus Schultz <[email protected]>
*
* This software is licensed under the GNU LGPL license
* for more information, please see:
*
* <http://code.google.com/p/php-annotations>
*/
namespace Mindplay\Annotation;
/**
* Thin, static class with shortcut methods for inspection of Annotations
*/
abstract class Annotations
{
/**
* @var array Configuration for any public property of AnnotationManager.
*/
public static $config;
/**
* @var AnnotationManager Singleton AnnotationManager instance
*/
private static $manager;
/**
* @return AnnotationManager a singleton instance
*/
public static function getManager()
{
if (!isset(self::$manager))
self::$manager = new AnnotationManager;
if (is_array(self::$config))
foreach (self::$config as $key => $value)
self::$manager->$key = $value;
return self::$manager;
}
/**
* Returns the UsageAnnotation for the annotation with the given class-name.
* @see AnnotationManager::getUsage()
*/
public static function getUsage($class)
{
return self::getManager()->getUsage($class);
}
/**
* Inspects class Annotations
* @see AnnotationManager::getClassAnnotations()
*/
public static function ofClass($class, $type=null)
{
return self::getManager()->getClassAnnotations($class, $type);
}
/**
* Inspects method Annotations
* @see AnnotationManager::getMethodAnnotations()
*/
public static function ofMethod($class, $method=null, $type=null)
{
return self::getManager()->getMethodAnnotations($class, $method, $type);
}
/**
* Inspects property Annotations
* @see AnnotationManager::getPropertyAnnotations()
*/
public static function ofProperty($class, $property=null, $type=null)
{
return self::getManager()->getPropertyAnnotations($class, $property, $type);
}
}