diff --git a/src/Binding/Loader/ArrayBindingLoader.php b/src/Binding/Loader/ArrayBindingLoader.php index 4991d12be416d950658b5294dd9b62735c599861..6eacee1ef23de2ac3b058196ce4456b442ec260e 100644 --- a/src/Binding/Loader/ArrayBindingLoader.php +++ b/src/Binding/Loader/ArrayBindingLoader.php @@ -7,7 +7,7 @@ use WPDesk\Init\Binding\DefinitionFactory; use WPDesk\Init\Configuration\ReadableConfig; use WPDesk\Init\Plugin\Plugin; -class ArrayBindingLoader implements BindingDefinitions { +class ArrayDefinitions implements BindingDefinitions { /** @var array */ private $bindings; diff --git a/src/Binding/Loader/FilesystemDefinitions.php b/src/Binding/Loader/FilesystemDefinitions.php index d46262d3cdcbce769e6cd1b8cabbfc03de7a2f8d..504ff665dec60e154316890ad26b761935da6e20 100644 --- a/src/Binding/Loader/FilesystemDefinitions.php +++ b/src/Binding/Loader/FilesystemDefinitions.php @@ -45,6 +45,6 @@ class FilesystemDefinitions implements BindingDefinitions { $hooks = [ $filename->get_filename_without_extension() => $hooks ]; } - yield from (new ArrayBindingLoader( $hooks ) )->load(); + yield from (new ArrayDefinitions( $hooks ) )->load(); } } diff --git a/src/Extension/ConditionalExtension.php b/src/Extension/ConditionalExtension.php index dcc5dc527d4a5e246fa83ff24fa52a41c708fb79..f77d8e03015107fe97da7916fd2f26bc9750bc73 100644 --- a/src/Extension/ConditionalExtension.php +++ b/src/Extension/ConditionalExtension.php @@ -11,7 +11,7 @@ use Monolog\Processor\PsrLogMessageProcessor; use Monolog\Processor\UidProcessor; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; -use WPDesk\Init\Binding\Loader\ArrayBindingLoader; +use WPDesk\Init\Binding\Loader\ArrayDefinitions; use WPDesk\Init\Binding\Loader\BindingDefinitions; use WPDesk\Init\Configuration\ReadableConfig; use WPDesk\Init\DependencyInjection\ContainerBuilder; @@ -33,7 +33,7 @@ class ConditionalExtension implements Extension { $bindings[] = WPDeskTrackerBridge::class; } - return new ArrayBindingLoader( $bindings ); + return new ArrayDefinitions( $bindings ); } public function build( ContainerBuilder $builder, Plugin $plugin, ReadableConfig $config ): void { diff --git a/src/Extension/ConfigExtension.php b/src/Extension/ConfigExtension.php index 035d384fa7418ad771ad482b740ac91435a6940a..303c514b2b45b664140fd11ae754d79a2e74931d 100644 --- a/src/Extension/ConfigExtension.php +++ b/src/Extension/ConfigExtension.php @@ -5,7 +5,7 @@ declare(strict_types=1); namespace WPDesk\Init\Extension; use Psr\Container\ContainerInterface; -use WPDesk\Init\Binding\Loader\ArrayBindingLoader; +use WPDesk\Init\Binding\Loader\ArrayDefinitions; use WPDesk\Init\Binding\Loader\BindingDefinitions; use WPDesk\Init\Binding\Loader\FilesystemDefinitions; use WPDesk\Init\Configuration\Configuration; @@ -24,7 +24,7 @@ class ConfigExtension implements Extension { ); } - return new ArrayBindingLoader( [] ); + return new ArrayDefinitions( [] ); } public function build( ContainerBuilder $builder, Plugin $plugin, ReadableConfig $config ): void { diff --git a/src/Extension/LegacyExtension.php b/src/Extension/LegacyExtension.php index 4dd299a419dd305c5d98daf9983826f5e10a22a6..b03a2750c38c49b7e228580fa6f7462783284956 100644 --- a/src/Extension/LegacyExtension.php +++ b/src/Extension/LegacyExtension.php @@ -5,7 +5,6 @@ declare(strict_types=1); namespace WPDesk\Init\Extension; use Psr\Container\ContainerInterface; -use WPDesk\Init\Binding\Loader\ArrayBindingLoader; use WPDesk\Init\Binding\Loader\BindingDefinitions; use WPDesk\Init\Configuration\ReadableConfig; use WPDesk\Init\DependencyInjection\ContainerBuilder; diff --git a/tests/Binding/ArrayBindingLoaderTest.php b/tests/Binding/ArrayBindingLoaderTest.php index 978d74387434e0b757648369e22cd78e8d72276c..a7e5a20192e09150a6a9ef5076f86e2414769d3f 100644 --- a/tests/Binding/ArrayBindingLoaderTest.php +++ b/tests/Binding/ArrayBindingLoaderTest.php @@ -3,18 +3,18 @@ declare( strict_types=1 ); namespace WPDesk\Init\Tests\Binding; -use WPDesk\Init\Binding\Loader\ArrayBindingLoader; +use WPDesk\Init\Binding\Loader\ArrayDefinitions; use WPDesk\Init\Tests\TestCase; class ArrayBindingLoaderTest extends TestCase { public function test_loading_empty_bindings(): void { - $a = new ArrayBindingLoader([]); + $a = new ArrayDefinitions([]); $this->assertEquals(0, iterator_count($a->load())); } public function test_loading_structured_bindings(): void { - $a = new ArrayBindingLoader([ + $a = new ArrayDefinitions([ 'hook' => [ 'bind1', 'bind2', @@ -38,7 +38,7 @@ class ArrayBindingLoaderTest extends TestCase { } public function test_loading_unstructured_bindings(): void { - $a = new ArrayBindingLoader([ + $a = new ArrayDefinitions([ 'bind1', 'bind2', 'hook' => 'bind3', @@ -51,7 +51,7 @@ class ArrayBindingLoaderTest extends TestCase { iterator_to_array($a->load()) ); - $a = new ArrayBindingLoader([ + $a = new ArrayDefinitions([ 'bind1', 'not_a_hook' => 'bind2', 'hook' => ['bind3'], diff --git a/tests/Binding/CompositeBindingLoaderTest.php b/tests/Binding/CompositeBindingLoaderTest.php index 0d8a7555de1caf65eeea78d20f61d409e1174543..9cfb1186f1bbbb348bd27beef459d085f6b6b685 100644 --- a/tests/Binding/CompositeBindingLoaderTest.php +++ b/tests/Binding/CompositeBindingLoaderTest.php @@ -3,20 +3,20 @@ declare( strict_types=1 ); namespace WPDesk\Init\Tests\Binding; -use WPDesk\Init\Binding\Loader\ArrayBindingLoader; +use WPDesk\Init\Binding\Loader\ArrayDefinitions; use WPDesk\Init\Binding\Loader\CompositeBindingLoader; use WPDesk\Init\Tests\TestCase; class CompositeBindingLoaderTest extends TestCase { public function test_loading_empty_bindings(): void { - $a = new CompositeBindingLoader(new ArrayBindingLoader([])); + $a = new CompositeBindingLoader(new ArrayDefinitions([])); $this->assertEquals(0, iterator_count($a->load())); } public function test_loading_structured_bindings(): void { $a = new CompositeBindingLoader( - new ArrayBindingLoader( + new ArrayDefinitions( [ 'hook' => [ 'bind1', @@ -24,7 +24,7 @@ class CompositeBindingLoaderTest extends TestCase { ], ] ), - new ArrayBindingLoader( + new ArrayDefinitions( [ 'hook2' => [ 'bind3', @@ -48,13 +48,13 @@ class CompositeBindingLoaderTest extends TestCase { public function test_loading_unstructured_bindings(): void { $a = new CompositeBindingLoader( - new ArrayBindingLoader( [ + new ArrayDefinitions( [ 'bind1', ]), - new ArrayBindingLoader([ + new ArrayDefinitions([ 'bind2', ]), - new ArrayBindingLoader([ + new ArrayDefinitions([ 'hook' => 'bind3', ]) ); @@ -71,13 +71,13 @@ class CompositeBindingLoaderTest extends TestCase { ); $a = new CompositeBindingLoader( - new ArrayBindingLoader([ + new ArrayDefinitions([ 'bind1', ]), - new ArrayBindingLoader([ + new ArrayDefinitions([ 'not_a_hook' => 'bind2', ]), - new ArrayBindingLoader([ + new ArrayDefinitions([ 'hook' => ['bind3'], ]), ); diff --git a/tests/Binding/DirectoryBasedLoaderTest.php b/tests/Binding/DirectoryBasedLoaderTest.php index 9db2c1a3647ba55ffb944c5eee90ddf77a8ecea1..68cacc30567e70ee3d9ca90770e442dc4eefcc4c 100644 --- a/tests/Binding/DirectoryBasedLoaderTest.php +++ b/tests/Binding/DirectoryBasedLoaderTest.php @@ -4,7 +4,7 @@ declare( strict_types=1 ); namespace WPDesk\Init\Tests\Binding; use WPDesk\Init\Binding\Definition\UnknownDefinition; -use WPDesk\Init\Binding\Loader\DirectoryBasedLoader; +use WPDesk\Init\Binding\Loader\FilesystemDefinitions; use WPDesk\Init\Configuration\Configuration; use WPDesk\Init\Tests\TestCase; @@ -12,13 +12,13 @@ class DirectoryBasedLoaderTest extends TestCase { public function xtest_throws_when_configuration_entry_is_missing(): void { $this->expectException(\InvalidArgumentException::class); - $a = new DirectoryBasedLoader(new Configuration([])); + $a = new FilesystemDefinitions(new Configuration([])); $a->load(); } public function test_loading_empty_bindings(): void { $this->initTempPlugin('hook-bindings'); - $a = new DirectoryBasedLoader('./'); + $a = new FilesystemDefinitions('./'); $actual = iterator_to_array($a->load(), false); $this->assertEquals( [ @@ -32,7 +32,7 @@ class DirectoryBasedLoaderTest extends TestCase { public function test_load_illogical_bindings(): void { $this->initTempPlugin('borked-bindings'); - $a = new DirectoryBasedLoader('./'); + $a = new FilesystemDefinitions('./'); $actual = iterator_to_array($a->load(), false); $this->assertEquals( diff --git a/tests/HookDriver/GenericDriverTest.php b/tests/HookDriver/GenericDriverTest.php index e5249989a683390838b8bcea219c821d2a4e4882..991b0e1c708ed04abb128b868cb143fbdae03b82 100644 --- a/tests/HookDriver/GenericDriverTest.php +++ b/tests/HookDriver/GenericDriverTest.php @@ -8,7 +8,7 @@ use WPDesk\Init\Binding\ObservableBinder; use WPDesk\Init\HookDriver\GenericDriver; use WPDesk\Init\Configuration\Configuration; use Psr\Container\ContainerInterface; -use WPDesk\Init\Binding\Loader\ArrayBindingLoader; +use WPDesk\Init\Binding\Loader\ArrayDefinitions; use WPDesk\Init\Binding\StoppableBinder; use WPDesk\Init\Tests\TestCase; @@ -59,7 +59,7 @@ class GenericDriverTest extends TestCase { /** @dataProvider provider */ public function test_register_hooks( array $hook_bindings, callable $assertion ): void { - $driver = new GenericDriver( new ArrayBindingLoader(array_keys($hook_bindings)) ); + $driver = new GenericDriver( new ArrayDefinitions(array_keys($hook_bindings)) ); $driver->register_hooks( new Configuration([]), $this->getContainer($hook_bindings) );