public static function resolve(): Application
    {
        $app = (new self)->createApplication();

        $composerFile = getcwd().DIRECTORY_SEPARATOR.'composer.json';

        if (file_exists($composerFile)) {
            $namespace = (string) key(json_decode((string) file_get_contents($composerFile), true)['autoload']['psr-4']);

            $serviceProviders = array_values(array_filter(self::getProjectClasses(), function (string $class) use (
                $namespace
            ) {
                return substr($class, 0, strlen($namespace)) === $namespace && self::isServiceProvider($class);
            }));

            foreach ($serviceProviders as $serviceProvider) {
                $app->register($serviceProvider);
            }
        }

        return $app;
    }
public static function resolve(): Application
    {
        $app = (new self)->createApplication();

        $composerFile = getcwd().DIRECTORY_SEPARATOR.'composer.json';

        if (file_exists($composerFile)) {
            $namespace = (string) key(json_decode((string) file_get_contents($composerFile), true)['autoload']['psr-4']);

            $serviceProviders = array_values(array_filter(self::getProjectClasses(), function (string $class) use (
                $namespace
            ) {
                return substr($class, 0, strlen($namespace)) === $namespace && self::isServiceProvider($class);
            }));

            foreach ($serviceProviders as $serviceProvider) {
                $app->register($serviceProvider);
            }
        }

        return $app;
    }
public static function resolve ( ) : Application { $ app = ( new self ) -> createApplication ( ) ; $ composerFile = getcwd ( ) . DIRECTORY_SEPARATOR . 'composer.json' ; if ( file_exists ( $ composerFile ) ) { $ namespace = ( string ) key ( json_decode ( ( string ) file_get_contents ( $ composerFile ) , true ) [ 'autoload' ] [ 'psr-4' ] ) ; $ serviceProviders = array_values ( array_filter ( self :: getProjectClasses ( ) , function ( string $ class ) use ( $ namespace ) { return substr ( $ class , 0 , strlen ( $ namespace ) ) === $ namespace && self :: isServiceProvider ( $ class ) ; } ) ) ; foreach ( $ serviceProviders as $ serviceProvider ) { $ app -> register ( $ serviceProvider ) ; } } return $ app ; }
Creates an application and registers service providers found.

@return \Illuminate\Contracts\Foundation\Application
Creates an application and registers service providers found .