public static function flysystemFactory(array $adapter) {
		if (class_exists($adapter['adapterClass'])) {
			return (new ReflectionClass($adapter['adapterClass']))->newInstanceArgs($adapter['adapterOptions']);
		}

		$leagueAdapter = '\\League\\Flysystem\\Adapter\\' . $adapter['adapterClass'];
		if (class_exists($leagueAdapter)) {
			return (new ReflectionClass($leagueAdapter))->newInstanceArgs($adapter['adapterOptions']);
		}

		$leagueAdapter = '\\League\\Flysystem\\' . $adapter['adapterClass'] . '\\' . $adapter['adapterClass'] . 'Adapter';
		if (class_exists($leagueAdapter)) {
			return (new ReflectionClass($leagueAdapter))->newInstanceArgs($adapter['adapterOptions']);
		}

		throw new InvalidArgumentException('Unknown adapter');
	}