public static function addDirectory($directory, $extensionToFind = '.php', $bypassDirectories = '')
	{
        self::register();

		$dir = new SplFileInfo($directory);
		if (!$dir->isDir()) {
		    throw new ApplicationContextException('Cannot add directory to ClassLoader, directory does not exist: ' . $directory);
        }

        if (!is_array($bypassDirectories)) {
            $bypassDirectories = explode(',', $bypassDirectories);
        }

		$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::SELF_FIRST);
		foreach ($objects as $name => $object) {
		    if (self::isVcsFile($name)) {
		        continue;
            }

            $tmpPath = explode(DIRECTORY_SEPARATOR, ltrim(str_replace($directory, '', $name), DIRECTORY_SEPARATOR));
            $rootNode = array_shift($tmpPath);
            if (in_array($rootNode, $bypassDirectories)) {
                continue;
            }

			if (!$object->isFile()) {
			    continue;
            }

            $extension = substr($object->getFilename(), strlen($extensionToFind)*-1);
            if ($extension !== $extensionToFind) {
                continue;
            }

			self::addFile($object, $extensionToFind);
		}
	}