Created
November 4, 2012 22:12
-
-
Save Freeaqingme/4013995 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ServiceManager extends ZendServiceManager | |
{ | |
public function getSubClasses($class, $directOnly = true) | |
{ | |
$class .= '\\'; | |
$length = strlen($class); | |
$filtered = array(); | |
$cNames = $this->getCanonicalNames(); | |
array_walk($cNames, function ($value, $key) use (&$filtered, $class, $directOnly, $length) | |
{ | |
if (substr($key, 0, $length) != $class) { | |
return; | |
} | |
$strrpos = strrpos($key, '\\'); | |
if (!$directOnly || !$strrpos || $strrpos <= $length-1) { | |
$filtered[$key] = $value; | |
} | |
}); | |
return $filtered; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment