src/ApplicationResolver.php
/**
     * Creates an application and registers service providers found.
     *
     * @return \Illuminate\Contracts\Foundation\Application
     * @throws \ReflectionException
     */
Creates an application and registers service providers found.
Creates an application and registers service providers found .
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($namespace), 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 ( $ namespace ) , 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.
Creates an application and registers service providers found .