Skip to content
Snippets Groups Projects

1.x

Merged 1.x
11 unresolved threads
Merged Bartek Jaskulski requested to merge 1.x into review
11 unresolved threads
11 files
+ 60
60
Compare changes
  • Side-by-side
  • Inline

Files

<?php
declare(strict_types=1);
namespace WPDesk\Init\Binding\Binder;
use WPDesk\Init\Binding\Binder;
use WPDesk\Init\Binding\Definition;
use WPDesk\Init\Binding\Definition\HookableDefinition;
final class CompositeBinder implements Binder {
/** @var Binder[] */
private $binders;
public function __construct( Binder ...$binders ) {
$this->binders = $binders;
}
public function add( Binder $binder ): void {
$this->binders[] = $binder;
}
public function bind( Definition $def ): void {
foreach ( $this->binders as $binder ) {
if ( $binder->can_bind( $def ) ) {
$binder->bind( $def );
break;
}
}
}
}
Loading