public function locate($type, $filename = '', $return = 'relative', $throws_exception = true)
{
$attempted_locations = array();
if (!$return) {
$return = 'relative';
}
foreach ($this->elements as $key => $location) {
if (!$location instanceof PathFinder_Location) {
continue;
}
$path = $location->locate($type, $filename, $return);
if (is_string($path) || is_object($path)) {
return $path;
} elseif (is_array($path)) {
if ($return === 'array' && @isset($path['name'])) {
return $path;
}
$attempted_locations = array_merge($attempted_locations, $path);
}
}
if ($throws_exception) {
throw $this->exception('File not found')->addMoreInfo('file', $filename)->addMoreInfo('type', $type)->addMoreInfo('attempted_locations', $attempted_locations);
}
}