Skip to content

Commit

Permalink
refactor(util.meta): add class namespace and name
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Aug 25, 2018
1 parent 7c5767a commit 34a2e02
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Util/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ public function forClass(string $classFqcn): array

public function forReflectionClass(\ReflectionClass $class): array
{
$name = $class->name;
$texts = (new DocBlock($class))->texts();
$title = \array_shift($texts);

$metadata = [
'classFqcn' => $class->name,
'namespace' => \preg_replace('!\W\w+$!', '', $name),
'classFqcn' => $name,
'classPath' => $class->getFileName(),
'name' => $class->getShortName(),
'className' => $class->getShortName(),
'isTrait' => $class->isTrait(),
'isAbstract' => $class->isAbstract(),
'isInterface' => $class->isInterface(),
Expand All @@ -39,7 +42,7 @@ public function forReflectionClass(\ReflectionClass $class): array
];

foreach ($class->getMethods() as $method) {
if ($method->class !== $class->name) {
if ($method->class !== $name) {
continue;
}

Expand Down

0 comments on commit 34a2e02

Please sign in to comment.