Skip to content

Commit

Permalink
Modules: added DecoratorModule
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Apr 19, 2024
1 parent 89c284a commit 0fa3b87
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/Modules/DecoratorModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Teio\Modules;

use Teio\Dom\Dom;
use Teio\Module;


class DecoratorModule implements Module
{
/** @var array<string, callable> */
private $decorators;


/**
* @param array<string, callable> $decorators
*/
public function __construct(array $decorators)
{
$this->decorators = $decorators;
}


public function process(Dom $dom): void
{
foreach ($this->decorators as $selector => $decorator) {
$dom->find($selector, $decorator);
}
}
}

0 comments on commit 0fa3b87

Please sign in to comment.