Renamed main class to Plugin for more clear role.

This commit is contained in:
Andrey Savchenko committed 2018-02-13 18:22:35 +02:00
1 parent a19e4fb019
commit d850fa1b02
6 files changed
+16 -16

No files matched your search

+2 -2
View File
@@ -15,6 +15,6 @@ if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php'; require __DIR__ . '/vendor/autoload.php';
} }
$laps = new \Rarst\Laps\Laps(); $laps = new \Rarst\Laps\Plugin();
$laps->on_load(); $laps->run();
+3 -3
View File
@@ -3,15 +3,15 @@
namespace Rarst\Laps\Manager; namespace Rarst\Laps\Manager;
use Rarst\Laps\Record\Recursive_Record_Iterator; use Rarst\Laps\Record\Recursive_Record_Iterator;
use Rarst\Laps\Laps; use Rarst\Laps\Plugin;
use Rarst\Laps\Record\Timeline_Iterator; use Rarst\Laps\Record\Timeline_Iterator;
class Toolbar_Manager { class Toolbar_Manager {
/** @var Laps $laps */ /** @var Plugin $laps */
protected $laps; protected $laps;
public function __construct( Laps $laps ) { public function __construct( Plugin $laps ) {
$this->laps = $laps; $this->laps = $laps;
+2 -2
View File
@@ -12,7 +12,7 @@ use Rarst\Laps\Provider\Record_Provider;
/** /**
* Main plugin's class. * Main plugin's class.
*/ */
class Laps extends Container { class Plugin extends Container {
protected $providers = []; protected $providers = [];
@@ -50,7 +50,7 @@ class Laps extends Container {
/** /**
* Start Stopwatch and timing plugin load immediately, then set up core events and needed hooks. * Start Stopwatch and timing plugin load immediately, then set up core events and needed hooks.
*/ */
public function on_load() { public function run() {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
return; return;
+2 -2
View File
@@ -2,9 +2,9 @@
namespace Rarst\Laps\Provider; namespace Rarst\Laps\Provider;
use Rarst\Laps\Laps; use Rarst\Laps\Plugin;
interface Bootable_Provider_Interface { interface Bootable_Provider_Interface {
public function boot( Laps $laps ); public function boot( Plugin $laps );
} }
+3 -3
View File
@@ -4,7 +4,7 @@ namespace Rarst\Laps\Provider;
use Pimple\Container; use Pimple\Container;
use Pimple\ServiceProviderInterface; use Pimple\ServiceProviderInterface;
use Rarst\Laps\Laps; use Rarst\Laps\Plugin;
use Rarst\Laps\Manager\Asset_Manager; use Rarst\Laps\Manager\Asset_Manager;
use Rarst\Laps\Manager\Load_Order_Manager; use Rarst\Laps\Manager\Load_Order_Manager;
use Rarst\Laps\Manager\Toolbar_Manager; use Rarst\Laps\Manager\Toolbar_Manager;
@@ -13,7 +13,7 @@ class Manager_Provider implements ServiceProviderInterface, Bootable_Provider_In
public function register( Container $pimple ) { public function register( Container $pimple ) {
$pimple['managers'] = function ( Laps $laps ) { $pimple['managers'] = function ( Plugin $laps ) {
return [ return [
new Load_Order_Manager(), new Load_Order_Manager(),
new Asset_Manager(), new Asset_Manager(),
@@ -22,7 +22,7 @@ class Manager_Provider implements ServiceProviderInterface, Bootable_Provider_In
}; };
} }
public function boot( Laps $laps ) { public function boot( Plugin $laps ) {
$laps['managers']; $laps['managers'];
} }
} }
+4 -4
View File
@@ -4,7 +4,7 @@ namespace Rarst\Laps\Provider;
use Pimple\Container; use Pimple\Container;
use Pimple\ServiceProviderInterface; use Pimple\ServiceProviderInterface;
use Rarst\Laps\Laps; use Rarst\Laps\Plugin;
use Rarst\Laps\Record\Hook_Record_Collector; use Rarst\Laps\Record\Hook_Record_Collector;
use Rarst\Laps\Record\Http_Record_Collector; use Rarst\Laps\Record\Http_Record_Collector;
use Rarst\Laps\Record\Record_Collector_Interface; use Rarst\Laps\Record\Record_Collector_Interface;
@@ -19,7 +19,7 @@ class Record_Provider implements ServiceProviderInterface, Bootable_Provider_Int
return new Stopwatch(); return new Stopwatch();
} ); } );
$pimple['collectors'] = function ( Laps $laps ) { $pimple['collectors'] = function ( Plugin $laps ) {
return [ return [
'hook' => new Hook_Record_Collector( $laps['hook.events'], $laps['stopwatch'] ), 'hook' => new Hook_Record_Collector( $laps['hook.events'], $laps['stopwatch'] ),
'http' => new Http_Record_Collector( $laps['stopwatch'] ), 'http' => new Http_Record_Collector( $laps['stopwatch'] ),
@@ -27,7 +27,7 @@ class Record_Provider implements ServiceProviderInterface, Bootable_Provider_Int
]; ];
}; };
$pimple['records'] = function ( Laps $laps ) { $pimple['records'] = function ( Plugin $laps ) {
$records = []; $records = [];
@@ -40,7 +40,7 @@ class Record_Provider implements ServiceProviderInterface, Bootable_Provider_Int
}; };
} }
public function boot( Laps $laps ) { public function boot( Plugin $laps ) {
$laps['collectors']; $laps['collectors'];
} }
} }