/**
* Adds to the search path for templates and resources.
*
* @param string $type The path type (e.g. 'model', 'view').
* @param mixed $path The directory string or stream array to search.
*
* @return static A \JControllerLegacy object to support chaining.
*
* @since 3.0
*/
protected function addPath($type, $path)
{
if (!isset($this->paths[$type])) {
$this->paths[$type] = array();
}
// Loop through the path directories
foreach ((array) $path as $dir) {
// No surrounding spaces allowed!
$dir = rtrim(Path::check($dir), '/') . '/';
// Add to the top of the search dirs
array_unshift($this->paths[$type], $dir);
}
return $this;
}