/src/DMS/Filter/Rules/Trim.php
PHP | 44 lines | 17 code | 5 blank | 22 comment | 1 complexity | 71bdd3cad75bc4959af234394669f076 MD5 | raw file
Possible License(s): LGPL-3.0
- <?php
- namespace DMS\Filter\Rules;
- /**
- * Trim Rule
- *
- * @package DMS
- * @subpackage Filter
- *
- * @Annotation
- */
- class Trim extends Rule
- {
- /**
- * Comma separated string of allowed tags
- *
- * @var string
- */
- public $charlist = null;
-
- /**
- * {@inheritDoc}
- */
- public function applyFilter($value)
- {
- //trim() only operates in default mode
- //if no second argument is passed, it
- //cannot be passed as null
- if ($this->charlist === null) {
- return trim($value);
- }
-
- return trim($value, $this->charlist);
- }
- /**
- * {@inheritDoc}
- */
- public function getDefaultOption()
- {
- return 'charlist';
- }
- }