comparison vendor/masterminds/html5/src/HTML5/InstructionProcessor.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
1 <?php 1 <?php
2 /** 2 /**
3 * A handler for processor instructions. 3 * A handler for processor instructions.
4 */ 4 */
5
5 namespace Masterminds\HTML5; 6 namespace Masterminds\HTML5;
6 7
7 /** 8 /**
8 * Provide an processor to handle embedded instructions. 9 * Provide an processor to handle embedded instructions.
9 * 10 *
16 * One could, for example, use this mechanism to execute well-formed PHP 17 * One could, for example, use this mechanism to execute well-formed PHP
17 * code embedded inside of an HTML5 document. 18 * code embedded inside of an HTML5 document.
18 */ 19 */
19 interface InstructionProcessor 20 interface InstructionProcessor
20 { 21 {
21
22 /** 22 /**
23 * Process an individual processing instruction. 23 * Process an individual processing instruction.
24 * 24 *
25 * The process() function is responsible for doing the following: 25 * The process() function is responsible for doing the following:
26 * - Determining whether $name is an instruction type it can handle. 26 * - Determining whether $name is an instruction type it can handle.
27 * - Determining what to do with the data passed in. 27 * - Determining what to do with the data passed in.
28 * - Making any subsequent modifications to the DOM by modifying the 28 * - Making any subsequent modifications to the DOM by modifying the
29 * DOMElement or its attached DOM tree. 29 * DOMElement or its attached DOM tree.
30 * 30 *
31 * @param DOMElement $element 31 * @param \DOMElement $element The parent element for the current processing instruction.
32 * The parent element for the current processing instruction. 32 * @param string $name The instruction's name. E.g. `&lt;?php` has the name `php`.
33 * @param string $name 33 * @param string $data All of the data between the opening and closing PI marks.
34 * The instruction's name. E.g. `&lt;?php` has the name `php`. 34 *
35 * @param string $data 35 * @return \DOMElement The element that should be considered "Current". This may just be
36 * All of the data between the opening and closing PI marks. 36 * the element passed in, but if the processor added more elements,
37 * @return DOMElement The element that should be considered "Current". This may just be 37 * it may choose to reset the current element to one of the elements
38 * the element passed in, but if the processor added more elements, 38 * it created. (When in doubt, return the element passed in.)
39 * it may choose to reset the current element to one of the elements
40 * it created. (When in doubt, return the element passed in.)
41 */ 39 */
42 public function process(\DOMElement $element, $name, $data); 40 public function process(\DOMElement $element, $name, $data);
43 } 41 }