Skip to content
Snippets Groups Projects
Select Git revision
  • 97ef7576ea8656b9978a559d0e70619447e2e93a
  • 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

configuration.md

Blame
  • ExtensionsSet.php 671 B
    <?php
    
    declare( strict_types=1 );
    
    namespace WPDesk\Init\Extension;
    
    /**
     * @implements \IteratorAggregate<class-string, Extension>
     */
    class ExtensionsSet implements \IteratorAggregate {
    
    	/** @var array<class-string<Extension>, Extension> */
    	private $extensions = [];
    
    	public function __construct( Extension ...$extensions ) {
    		foreach ( $extensions as $extension ) {
    			$this->add( $extension );
    		}
    	}
    
    	public function add( Extension $extension ): void {
    		$class                      = \get_class( $extension );
    		$this->extensions[ $class ] = $extension;
    	}
    
    	public function getIterator(): \Traversable {
    		return new \ArrayIterator( $this->extensions );
    	}
    }