]> git.immae.eu Git - github/wallabag/wallabag.git/blame - inc/3rdparty/htmlpurifier/HTMLPurifier/ErrorStruct.php
remove autoload section in composer.json
[github/wallabag/wallabag.git] / inc / 3rdparty / htmlpurifier / HTMLPurifier / ErrorStruct.php
CommitLineData
d4949327
NL
1<?php\r
2\r
3/**\r
4 * Records errors for particular segments of an HTML document such as tokens,\r
5 * attributes or CSS properties. They can contain error structs (which apply\r
6 * to components of what they represent), but their main purpose is to hold\r
7 * errors applying to whatever struct is being used.\r
8 */\r
9class HTMLPurifier_ErrorStruct\r
10{\r
11\r
12 /**\r
13 * Possible values for $children first-key. Note that top-level structures\r
14 * are automatically token-level.\r
15 */\r
16 const TOKEN = 0;\r
17 const ATTR = 1;\r
18 const CSSPROP = 2;\r
19\r
20 /**\r
21 * Type of this struct.\r
22 * @type string\r
23 */\r
24 public $type;\r
25\r
26 /**\r
27 * Value of the struct we are recording errors for. There are various\r
28 * values for this:\r
29 * - TOKEN: Instance of HTMLPurifier_Token\r
30 * - ATTR: array('attr-name', 'value')\r
31 * - CSSPROP: array('prop-name', 'value')\r
32 * @type mixed\r
33 */\r
34 public $value;\r
35\r
36 /**\r
37 * Errors registered for this structure.\r
38 * @type array\r
39 */\r
40 public $errors = array();\r
41\r
42 /**\r
43 * Child ErrorStructs that are from this structure. For example, a TOKEN\r
44 * ErrorStruct would contain ATTR ErrorStructs. This is a multi-dimensional\r
45 * array in structure: [TYPE]['identifier']\r
46 * @type array\r
47 */\r
48 public $children = array();\r
49\r
50 /**\r
51 * @param string $type\r
52 * @param string $id\r
53 * @return mixed\r
54 */\r
55 public function getChild($type, $id)\r
56 {\r
57 if (!isset($this->children[$type][$id])) {\r
58 $this->children[$type][$id] = new HTMLPurifier_ErrorStruct();\r
59 $this->children[$type][$id]->type = $type;\r
60 }\r
61 return $this->children[$type][$id];\r
62 }\r
63\r
64 /**\r
65 * @param int $severity\r
66 * @param string $message\r
67 */\r
68 public function addError($severity, $message)\r
69 {\r
70 $this->errors[] = array($severity, $message);\r
71 }\r
72}\r
73\r
74// vim: et sw=4 sts=4\r