Skip to content
Snippets Groups Projects
Select Git revision
  • b3f53d425d3c05c43bb358bf899d7a845afed072
  • main default protected
  • v0.10
  • 0.10.6
  • 0.10.5
  • 0.10.4
  • 0.10.3
  • 0.10.2
  • 0.10.1
  • 0.10.0
  • 0.9.1
  • 0.9.0
12 results

HookableBinder.php

Blame
  • HookableBinder.php 642 B
    <?php
    
    declare(strict_types=1);
    
    namespace WPDesk\Init\Binding\Binder;
    
    use Psr\Container\ContainerInterface;
    use WPDesk\Init\Binding\ComposableBinder;
    use WPDesk\Init\Binding\Definition;
    use WPDesk\Init\Binding\Definition\HookableDefinition;
    
    class HookableBinder implements ComposableBinder {
    
    	/** @var ContainerInterface */
    	private $container;
    
    	public function __construct( ContainerInterface $c ) {
    		$this->container = $c;
    	}
    
    	public function can_bind( Definition $def ): bool {
    		return $def instanceof HookableDefinition;
    	}
    
    	public function bind( Definition $def ): void {
    		$this->container->get( $def->value() )->hooks();
    	}
    }