Skip to content

Commit

Permalink
Remove autoloaded load.php file
Browse files Browse the repository at this point in the history
  • Loading branch information
atanas-dev committed Jul 20, 2019
1 parent 7b7d005 commit cd81e29
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 19 deletions.
47 changes: 45 additions & 2 deletions src/Theme/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@
namespace WPEmergeTheme\Theme;

use WPEmerge;
use WPEmerge\Application\Application;
use WPEmerge\Exceptions\ConfigurationException;
use WPEmerge\Facades\Application;
use WPEmergeTheme\Assets\AssetsServiceProvider;
use WPEmergeTheme\Avatar\AvatarServiceProvider;
use WPEmergeTheme\Config\ConfigServiceProvider;
use WPEmergeTheme\Facades\Assets;
use WPEmergeTheme\Facades\Theme as ThemeFacade;
use WPEmergeTheme\Image\ImageServiceProvider;
use WPEmergeTheme\Sidebar\SidebarServiceProvider;

/**
* Main communication channel with the theme.
*/
class Theme {
/**
* Application instance.
*
* @var Application
*/
protected $app = null;

/**
* Flag whether the theme has been bootstrapped.
*
Expand All @@ -36,6 +44,41 @@ class Theme {
SidebarServiceProvider::class,
];

/**
* Make a new theme instance.
*
* @return self
*/
public static function make() {
$app = Application::make();
$theme = new self( $app );

$container = $app->getContainer();
$container['wpemerge_theme'] = $theme;

$app->alias( 'WPEmergeTheme', ThemeFacade::class );

return $theme;
}

/**
* Constructor.
*
* @param Application $app
*/
public function __construct( $app ) {
$this->app = $app;
}

/**
* Get application instance.
*
* @return Application
*/
public function getApplication() {
return $this->app;
}

/**
* Get whether the theme has been bootstrapped.
*
Expand All @@ -61,7 +104,7 @@ protected function bootstrapApplication( $config ) {
$this->service_providers
);

Application::bootstrap( $config );
$this->getApplication()->bootstrap( $config );
}

/**
Expand Down
17 changes: 0 additions & 17 deletions src/load.php

This file was deleted.

0 comments on commit cd81e29

Please sign in to comment.