protected static function _searchPaths($paths, $library)
{
$result = array();
foreach ($paths as $tpl => $opts) {
if (is_int($tpl)) {
$tpl = $opts;
$opts = array();
}
if (isset($opts['libraries']) && !in_array($library, (array) $opts['libraries'])) {
continue;
}
$result[] = $tpl;
}
return $result;
}