private static function unwrapArgs(array $args) : array
    {
        $hasExtractable = false;

        $unwrappedArgs = self::flatten(array_map(function ($arg) use (&$hasExtractable) {
            if (method_exists($arg, 'extract')) {
                $hasExtractable = true;
                return $arg->extract();
            }

            return $arg;
        }, $args));

        return [$hasExtractable, $unwrappedArgs];
    }