public function setDirectory($directory)
	{
		// trim trailling slash
		$directory = rtrim($directory,"/");
		$dir       = opendir($directory);
		if ($dir === false)
		{
			throw new UnableToSetException("Could not set '$directory'. It is not a directory!");
		}


		while (($file = readdir($dir)) !== false)
		{
			$path      = $directory.'/'.$file;
			$pathInfo  = pathinfo($path);
			$extension = strtolower($pathInfo['extension']);
			$filename  = $pathInfo['filename'];
			if ($extension == 'php')
			{
				$strings = include $path;
				if (is_array($strings))
				{
					$this->collection->setArray($strings, $filename);
				}
			}
		}
		return $this;
	}
public function setDirectory($directory)
	{
		// trim trailling slash
		$directory = rtrim($directory,"/");
		$dir       = opendir($directory);
		if ($dir === false)
		{
			throw new UnableToSetException("Could not set '$directory'. It is not a directory!");
		}


		while (($file = readdir($dir)) !== false)
		{
			$path      = $directory.'/'.$file;
			$pathInfo  = pathinfo($path);
			$extension = strtolower($pathInfo['extension']);
			$filename  = $pathInfo['filename'];
			if ($extension == 'php')
			{
				$strings = include $path;
				if (is_array($strings))
				{
					$this->collection->setArray($strings, $filename);
				}
			}
		}
		return $this;
	}
public function setDirectory ( $ directory ) { // trim trailling slash $ directory = rtrim ( $ directory , "/" ) ; $ dir = opendir ( $ directory ) ; if ( $ dir === false ) { throw new UnableToSetException ( "Could not set '$directory'. It is not a directory!" ) ; } while ( ( $ file = readdir ( $ dir ) ) !== false ) { $ path = $ directory . '/' . $ file ; $ pathInfo = pathinfo ( $ path ) ; $ extension = strtolower ( $ pathInfo [ 'extension' ] ) ; $ filename = $ pathInfo [ 'filename' ] ; if ( $ extension == 'php' ) { $ strings = include $ path ; if ( is_array ( $ strings ) ) { $ this -> collection -> setArray ( $ strings , $ filename ) ; } } } return $ this ; }
Loads a bunch of files from a given directory as locales into the collection.

@param string $directory
@chainable
Loads a bunch of files from a given directory as locales into the collection .