public static function inspect($dir)
    {
        if (!is_dir($dir)) {
            throw new FileNotFoundException(sprintf('Directory "%s" does not exist.', $dir));
        }

        foreach (self::getStacks() as $stack) {
            if ($stack->inspect($dir) === true) {
                return $stack;
            }
        }

        // Stacks were not able to identify the structure.
        return new Stacks\NullStack();
    }