PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 2.0.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v2.0.0
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / Dom / Contracts / Modifier.php

Modifier.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 2.0.0, at src/Performance/Dom/Contracts/Modifier.php

56 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The pipeline dom modifier stage contract.
4 *
5 * Each modifier should implement this interface.
6 *
7 * @package SolidWP\Performance
8 */
9
10 declare( strict_types=1 );
11
12 namespace SolidWP\Performance\Dom\Contracts;
13
14 use Closure;
15 use SolidWP\Performance\Symfony\Component\DomCrawler\Crawler;
16
17 /**
18 * @internal
19 */
20 interface Modifier {
21
22 /**
23 * Whether this pipeline step is enabled.
24 *
25 * @return bool
26 */
27 public function is_enabled(): bool;
28
29 /**
30 * Allows us to first check all Modifiers via the Pipeline to see if any are enabled before proceeding
31 * with DOM modification.
32 *
33 * Should immediately return true if this pipeline stage is enabled, otherwise
34 * pass the current $enabled value to the next stage.
35 *
36 * @see self::is_enabled()
37 *
38 * @param bool $enabled Whether the previous stage is enabled.
39 * @param Closure $next The closure passed to the next stage.
40 *
41 * @return bool
42 */
43 public function enabled( bool $enabled, Closure $next ): bool;
44
45 /**
46 * Handle modifying the HTML and passing it to the next stage of the pipeline,
47 * assuming it's enabled.
48 *
49 * @param Crawler $crawler The symfony dom crawler instance.
50 * @param Closure $next The closure passed to the next stage.
51 *
52 * @return Crawler
53 */
54 public function modify( Crawler $crawler, Closure $next ): Crawler;
55 }
56