Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
CRAP
100.00% covered (success)
100.00%
1 / 1
Reflection
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
8
100.00% covered (success)
100.00%
1 / 1
 createClass
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 createTrait
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 createInterface
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 createNamespace
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 createDocblock
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 createFunction
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 createMethod
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 createProperty
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * Pop PHP Framework (http://www.popphp.org/)
4 *
5 * @link       https://github.com/popphp/popphp-framework
6 * @author     Nick Sagona, III <dev@nolainteractive.com>
7 * @copyright  Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)
8 * @license    http://www.popphp.org/license     New BSD License
9 */
10
11/**
12 * @namespace
13 */
14namespace Pop\Code;
15
16/**
17 * Reflection code class
18 *
19 * @category   Pop
20 * @package    Pop\Code
21 * @author     Nick Sagona, III <dev@nolainteractive.com>
22 * @copyright  Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)
23 * @license    http://www.popphp.org/license     New BSD License
24 * @version    4.1.0
25 */
26class Reflection
27{
28
29    /**
30     * Create class
31     *
32     * @param  mixed  $class
33     * @param  string $name
34     * @return Generator\ClassGenerator
35     */
36    public static function createClass($class, $name = null)
37    {
38        return Reflection\ClassReflection::parse($class, $name);
39    }
40
41    /**
42     * Create trait
43     *
44     * @param  mixed  $trait
45     * @param  string $name
46     * @return Generator\TraitGenerator
47     */
48    public static function createTrait($trait, $name = null)
49    {
50        return Reflection\TraitReflection::parse($trait, $name);
51    }
52
53    /**
54     * Create interface
55     *
56     * @param  mixed  $interface
57     * @param  string $name
58     * @return Generator\InterfaceGenerator
59     */
60    public static function createInterface($interface, $name = null)
61    {
62        return Reflection\InterfaceReflection::parse($interface, $name);
63    }
64
65    /**
66     * Create namespace
67     *
68     * @param  mixed  $namespace
69     * @param  string $name
70     * @return Generator\NamespaceGenerator
71     */
72    public static function createNamespace($namespace, $name = null)
73    {
74        return Reflection\NamespaceReflection::parse($namespace, $name);
75    }
76
77    /**
78     * Create docblock
79     *
80     * @param  mixed  $docblock
81     * @param  int    $forceIndent
82     * @return Generator\DocblockGenerator
83     */
84    public static function createDocblock($docblock, $forceIndent = null)
85    {
86        return Reflection\DocblockReflection::parse($docblock, $forceIndent);
87    }
88
89    /**
90     * Create function
91     *
92     * @param  mixed  $function
93     * @param  string $name
94     * @return Generator\FunctionGenerator
95     */
96    public static function createFunction($function, $name = null)
97    {
98        return Reflection\FunctionReflection::parse($function, $name);
99    }
100
101    /**
102     * Create method
103     *
104     * @param  mixed  $method
105     * @param  string $name
106     * @return Generator\MethodGenerator
107     */
108    public static function createMethod($method, $name = null)
109    {
110        return Reflection\MethodReflection::parse($method, $name);
111    }
112
113    /**
114     * Create property
115     *
116     * @param  mixed  $property
117     * @param  string $name
118     * @param  mixed  $value
119     * @return Generator\PropertyGenerator
120     */
121    public static function createProperty($property, $name = null, $value = null)
122    {
123        return Reflection\PropertyReflection::parse($property, $name, $value);
124    }
125
126}