Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Filter / Word / CamelCaseToSeparator.php
blobe97ab67bf85f635090831bcad044198d859c8230
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Filter\Word;
12 use Zend\Stdlib\StringUtils;
14 class CamelCaseToSeparator extends AbstractSeparator
16 /**
17 * Defined by Zend\Filter\Filter
19 * @param string $value
20 * @return string
22 public function filter($value)
24 if (StringUtils::hasPcreUnicodeSupport()) {
25 $pattern = array('#(?<=(?:\p{Lu}))(\p{Lu}\p{Ll})#', '#(?<=(?:\p{Ll}|\p{Nd}))(\p{Lu})#');
26 $replacement = array($this->separator . '\1', $this->separator . '\1');
27 } else {
28 $pattern = array('#(?<=(?:[A-Z]))([A-Z]+)([A-Z][a-z])#', '#(?<=(?:[a-z0-9]))([A-Z])#');
29 $replacement = array('\1' . $this->separator . '\2', $this->separator . '\1');
32 return preg_replace($pattern, $replacement, $value);