@@ 97-120 (lines=24) @@ | ||
94 | * |
|
95 | * @return bool |
|
96 | */ |
|
97 | public function hasMethod($name, $traverse = true) |
|
98 | { |
|
99 | foreach ($this->methods as $method) { |
|
100 | ||
101 | if ($name === $method->getName()) { |
|
102 | return true; |
|
103 | } |
|
104 | } |
|
105 | ||
106 | if ($traverse && $this->hasTraits()) { |
|
107 | ||
108 | /** |
|
109 | * @var TraitMetadata $trait |
|
110 | */ |
|
111 | foreach ($this->traits as $trait) { |
|
112 | ||
113 | if ($trait->hasMethod($name, $traverse)) { |
|
114 | return true; |
|
115 | } |
|
116 | } |
|
117 | } |
|
118 | ||
119 | return false; |
|
120 | } |
|
121 | ||
122 | /** |
|
123 | * Check if trait has public method, with optional trait traverse. |
|
@@ 130-153 (lines=24) @@ | ||
127 | * |
|
128 | * @return bool |
|
129 | */ |
|
130 | public function hasPublicMethod($name, $traverse = true) |
|
131 | { |
|
132 | foreach ($this->methods as $method) { |
|
133 | ||
134 | if ($name === $method->getName()) { |
|
135 | return $method->isPublic(); |
|
136 | } |
|
137 | } |
|
138 | ||
139 | if ($traverse && $this->hasTraits()) { |
|
140 | ||
141 | /** |
|
142 | * @var TraitMetadata $trait |
|
143 | */ |
|
144 | foreach ($this->traits as $trait) { |
|
145 | ||
146 | if ($trait->hasPublicMethod($name, $traverse)) { |
|
147 | return true; |
|
148 | } |
|
149 | } |
|
150 | } |
|
151 | ||
152 | return false; |
|
153 | } |
|
154 | ||
155 | /** |
|
156 | * Get public method for trait, with optional trait traverse. |