Initialize this filter, parse configuration.
32 parent::__construct(
$config, $reserved);
37 foreach (
$config as $attribute => $rules) {
38 if ($attribute ===
'%ignoreEntities') {
39 $this->ignoreEntities =
$config[
'%ignoreEntities'];
43 if (!is_string($attribute)) {
46 $this->cardinality[$attribute] = array(
'warn' =>
false);
49 if (isset($rules[0])) {
50 $this->cardinality[$attribute][
'min'] = $rules[0];
51 } elseif (isset($rules[
'min'])) {
52 $this->cardinality[$attribute][
'min'] = $rules[
'min'];
54 if (isset($rules[1])) {
55 $this->cardinality[$attribute][
'max'] = $rules[1];
56 } elseif (isset($rules[
'max'])) {
57 $this->cardinality[$attribute][
'max'] = $rules[
'max'];
59 if (array_key_exists(
'warn', $rules)) {
60 $this->cardinality[$attribute][
'warn'] = (bool) $rules[
'warn'];
64 if (!array_key_exists(
'min', $this->cardinality[$attribute])) {
65 $this->cardinality[$attribute][
'min'] = 0;
66 } elseif (!is_int($this->cardinality[$attribute][
'min']) ||
67 $this->cardinality[$attribute][
'min'] < 0
70 var_export($attribute,
true));
72 if (array_key_exists(
'max', $this->cardinality[$attribute]) &&
73 !is_int($this->cardinality[$attribute][
'max'])
76 var_export($attribute,
true));
78 if (array_key_exists(
'min', $this->cardinality[$attribute]) &&
79 array_key_exists(
'max', $this->cardinality[$attribute]) &&
80 $this->cardinality[$attribute][
'min'] > $this->cardinality[$attribute][
'max']
83 var_export($attribute,
true));
87 $this->cardinality[$attribute][
'_expr'] = sprintf(
'%d ≤ n', $this->cardinality[$attribute][
'min']);
88 if (array_key_exists(
'max', $this->cardinality[$attribute])) {
89 $this->cardinality[$attribute][
'_expr'] .= sprintf(
' ≤ %d', $this->cardinality[$attribute][
'max']);
static http()
Fetches the global http state from ILIAS.