Skip to content

Commit

Permalink
fix validation and bump to v3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Parziale committed Feb 6, 2020
1 parent e37456a commit ce1a4bf
Show file tree
Hide file tree
Showing 11 changed files with 470 additions and 384 deletions.
22 changes: 10 additions & 12 deletions Aeria/Action/ServiceProviders/ActionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Aeria\Action\ServiceProviders;

use Aeria\Aeria;
use Aeria\Container\Interfaces\ServiceProviderInterface;
use Aeria\Container\Container;
use Aeria\Action\ActionDispatcher;
Expand All @@ -10,48 +11,45 @@

/**
* ActionProvider is in charge of registering the Action service
* to the container
*
* to the container.
*
* @category Action
* @package Aeria
*
* @author Jacopo Martinelli <jacopo.martinelli@caffeina.com>
* @license https://github.com/caffeinalab/aeria/blob/master/LICENSE MIT license
* @link https://github.com/caffeinalab/aeria
*
* @see https://github.com/caffeinalab/aeria
*/
class ActionProvider implements ServiceProviderInterface
{
/**
* Registers the service to the provided container, as a singleton
* Registers the service to the provided container, as a singleton.
*
* @param Container $container Aeria's container
*
* @return void
*
* @access public
* @since Method available since Release 3.0.0
*/
public function register(Container $container)
{
$container->singleton('action', ActionDispatcher::class);
}

/**
* In charge of booting the service.
*
* @param Container $container Aeria's container
*
* @return bool true: service booted
*
* @access public
* @since Method available since Release 3.0.0
*/
public function boot(Container $container): bool
{
$dispatcher = $container->make('action');
$aeria_base_path = plugins_url('aeria');

$aeria_js = new ScriptsEnqueuer(
'aeria-js',
"{$aeria_base_path}/assets/js/aeria.js",
"{$aeria_base_path}/assets/js/aeria.js?v=".Aeria::version(),
null,
null,
true
Expand All @@ -63,7 +61,7 @@ public function boot(Container $container): bool

$dispatcher->register($admin_enqueue_scripts);
$dispatcher->dispatch($container);

return true;
}

}
67 changes: 32 additions & 35 deletions Aeria/Aeria.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php

namespace Aeria;

use Aeria\Config\Config;
use Aeria\Container\Container;
use Aeria\Container\Interfaces\{
ContainerInterface,
ServiceProviderInterface
};
use Aeria\Container\Interfaces\ContainerInterface;
use Aeria\Config\ServiceProviders\ConfigProvider;
use Aeria\PostType\ServiceProviders\PostTypeProvider;
use Aeria\Taxonomy\ServiceProviders\TaxonomyProvider;
Expand All @@ -24,35 +21,34 @@

/**
* Aeria is a lightweight and modular WP development tool.
*
*
* @category Action
* @package Aeria
*
* @author Caffeina Devs <dev@caffeinalab.com>
* @license https://github.com/caffeinalab/aeria/blob/master/LICENSE MIT license
* @link https://github.com/caffeinalab/aeria
*
* @see https://github.com/caffeinalab/aeria
*/
class Aeria extends Container
{
public const VERSION = '3.0.18';
const VERSION = '3.1.0';

/**
* Constructs the Aeria container
*
* @return void
* Constructs the Aeria container.
*
*
* @access public
* @since Method available since Release 3.0.0
*/
public function __construct()
{
$this->registerBindings();
$this->registerServiceProviders();
}

/**
* Registers Aeria's bindings
*
* @return void
* Registers Aeria's bindings.
*
*
* @access protected
* @since Method available since Release 3.0.0
*/
protected function registerBindings()
Expand All @@ -63,12 +59,11 @@ protected function registerBindings()

$this->bind(Container::class, $this);
}

/**
* Registers all the required ServiceProviders to the container
* Registers all the required ServiceProviders to the container.
*
* @return void
*
* @access protected
* @since Method available since Release 3.0.0
*/
protected function registerServiceProviders() // : void
Expand All @@ -88,49 +83,51 @@ protected function registerServiceProviders() // : void
$this->register(new OptionsPageServiceProvider());
$this->register(new RenderEngineServiceProvider());
}

/**
* Returns Aeria's version
*
* Returns Aeria's version.
*
* @return string the version
*
* @access public
* @since Method available since Release 3.0.0
*/
public function version() : string
public static function version(): string
{
return static::VERSION;
return self::VERSION;
}

/**
* Returns Aeria's instance
*
* Returns Aeria's instance.
*
* @return Aeria the instance
*
* @access public
* @static
*
* @since Method available since Release 3.0.0
*/
public static function getInstance() : ContainerInterface
public static function getInstance(): ContainerInterface
{
if (is_null(static::$instance)) {
static::$instance = new static;
static::$instance = new static();
}

return static::$instance;
}

/**
* Sets Aeria's instance
*
* Sets Aeria's instance.
*
* @param ContainerInterface $container the container
*
*
* @return ContainerInterface the instance we've set
*
* @access public
* @static
*
* @since Method available since Release 3.0.0
*/
public static function setInstance(
ContainerInterface $container
) : ContainerInterface {
): ContainerInterface {
static::$instance = $container;

return static::$instance;
Expand Down
Loading

0 comments on commit ce1a4bf

Please sign in to comment.