1 <?php 2 /** 3 * Zend Framework 4 * 5 * LICENSE 6 * 7 * This source file is subject to the new BSD license that is bundled 8 * with this package in the file LICENSE.txt. 9 * It is also available through the world-wide-web at this URL: 10 * http://framework.zend.com/license/new-bsd 11 * If you did not receive a copy of the license and are unable to 12 * obtain it through the world-wide-web, please send an email 13 * to license@zend.com so we can send you a copy immediately. 14 * 15 * @category Zend 16 * @package Zend_Filter 17 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 18 * @license http://framework.zend.com/license/new-bsd New BSD License 19 * @version $Id$ 20 */ 21 22 /** 23 * @see Zend_Filter_PregReplace 24 */ 25 26 /** 27 * @category Zend 28 * @package Zend_Filter 29 * @uses Zend_Filter_PregReplace 30 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 31 * @license http://framework.zend.com/license/new-bsd New BSD License 32 */ 33 abstract class Zend_Filter_Word_Separator_Abstract extends Zend_Filter_PregReplace 34 { 35 36 protected $_separator = null; 37 38 /** 39 * Constructor 40 * 41 * @param string $separator Space by default 42 * @return void 43 */ 44 public function __construct($separator = ' ') 45 { 46 $this->setSeparator($separator); 47 } 48 49 /** 50 * Sets a new seperator 51 * 52 * @param string $separator Seperator 53 * @return $this 54 */ 55 public function setSeparator($separator) 56 { 57 if ($separator == null) { 58 throw new Zend_Filter_Exception('"' . $separator . '" is not a valid separator.'); 59 } 60 $this->_separator = $separator; 61 return $this; 62 } 63 64 /** 65 * Returns the actual set seperator 66 * 67 * @return string 68 */ 69 public function getSeparator() 70 { 71 return $this->_separator; 72 } 73 74 }