Completed
Branch FET-10580-form-html-parser (9e1c68)
by
unknown
210:04 queued 197:24
created

VsprintfParser::parseHtml()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace EventEspresso\core\libraries\form_sections\strategies\parser;
3
4
defined('EVENT_ESPRESSO_VERSION') || exit;
5
6
7
8
/**
9
 * Class SprintfFormHtmlParser
10
 * parses a form section's rendered HTML using vsprintf()
11
 * PLZ NOTE: the rendered HTML will be the LAST argument in the array of args passed to vsprintf()
12
 *
13
 * @package       Event Espresso
14
 * @author        Brent Christensen
15
 * @since         $VID:$
16
 */
17
class VsprintfParser extends FormHtmlParser
18
{
19
20
    /**
21
     * @var string $format
22
     */
23
    protected $format = '';
24
25
26
    /**
27
     * @var array $args
28
     */
29
    protected $args = array();
30
31
32
33
    /**
34
     * SprintfFormHtmlParser constructor.
35
     *
36
     * @param string $format
37
     * @param array  $args
38
     */
39
    public function __construct($format, array $args)
40
    {
41
        $this->format = $format;
42
        $this->args = $args;
43
    }
44
45
46
47
    /**
48
     * @param string $html
49
     * @return int
50
     */
51
    public function parseHtml($html = '')
52
    {
53
        $this->args[] = $html;
54
        return vprintf($this->format, $this->args);
55
    }
56
57
58
59
}
60
// End of file SprintfFormHtmlParser.php
61
// Location: EventEspresso\core\libraries\form_sections\strategies\parser/SprintfFormHtmlParser.php