Permalink
Browse files

Merge branch 'BinaryKitten-closure'

  • Loading branch information...
2 parents 8da4d97 + 5288adb commit db4523e7e43b43c5ade0585ed053881b259aa00d @EvanDotPro EvanDotPro committed Jan 3, 2012
Showing with 6 additions and 7 deletions.
  1. +6 −7 Module.php
View
13 Module.php
@@ -53,13 +53,12 @@ public function init()
$interfaces = array_diff($interfaces, $iReflection->getInterfaceNames());
}
$declaration .= $r->isInterface() ? ' extends ' : ' implements ';
- $lastInterface = array_pop($interfaces);
- foreach ($interfaces as $interface) {
- $iReflection = new \Zend\Code\Reflection\ClassReflection($interface);
- $declaration .= (array_key_exists($iReflection->getName(), $usesNames) ? ($usesNames[$iReflection->getName()] ?: $iReflection->getShortName()) : ((0 === strpos($iReflection->getName(), $r->getNamespaceName())) ? substr($iReflection->getName(), strlen($r->getNamespaceName()) + 1) : '\\' . $iReflection->getName())) . ', ';
- }
- $iReflection = new \Zend\Code\Reflection\ClassReflection($lastInterface);
- $declaration .= array_key_exists($iReflection->getName(), $usesNames) ? ($usesNames[$iReflection->getName()] ?: $iReflection->getShortName()) : ((0 === strpos($iReflection->getName(), $r->getNamespaceName())) ? substr($iReflection->getName(), strlen($r->getNamespaceName()) + 1) : '\\' . $iReflection->getName());
+ $declaration .= implode(', ', array_map(function($interface) use ($usesNames, $r) {
+ $iReflection = new \Zend\Code\Reflection\ClassReflection($interface);
+ return (array_key_exists($iReflection->getName(), $usesNames) ? ($usesNames[$iReflection->getName()] ?: $iReflection->getShortName()) : ((0 === strpos($iReflection->getName(), $r->getNamespaceName())) ? substr($iReflection->getName(), strlen($r->getNamespaceName()) + 1) : '\\' . $iReflection->getName()));
+
+ }, $interfaces)
+ );
}
return "\nnamespace "
. $r->getNamespaceName()

0 comments on commit db4523e

Please sign in to comment.