TYPO3 CMS  TYPO3_6-2
InArrayValidator.php
Go to the documentation of this file.
1 <?php
3 
23 
29  const LOCALISATION_OBJECT_NAME = 'tx_form_system_validate_inarray';
30 
36  protected $array;
37 
43  protected $strict;
44 
50  public function __construct($arguments) {
51  $this->setArray($arguments['array.'])->setStrict($arguments['strict']);
52  parent::__construct($arguments);
53  }
54 
61  public function isValid() {
62  if ($this->requestHandler->has($this->fieldName)) {
63  $value = $this->requestHandler->getByMethod($this->fieldName);
64  if (!in_array($value, $this->array, $this->strict)) {
65  return FALSE;
66  }
67  }
68  return TRUE;
69  }
70 
77  public function setArray($array) {
78  $this->array = (array) $array;
79  return $this;
80  }
81 
88  public function setStrict($strict) {
89  $this->strict = (bool) $strict;
90  return $this;
91  }
92 
93 }