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 / SeparatorToCamelCase.php
blob88c5b8e8afb250ed14d02935ae8ad576b1923310
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 SeparatorToCamelCase extends AbstractSeparator
16 /**
17 * Defined by Zend\Filter\Filter
19 * @param string $value
20 * @return string
22 public function filter($value)
24 // a unicode safe way of converting characters to \x00\x00 notation
25 $pregQuotedSeparator = preg_quote($this->separator, '#');
27 if (StringUtils::hasPcreUnicodeSupport()) {
28 $patterns = array(
29 '#(' . $pregQuotedSeparator.')(\p{L}{1})#u',
30 '#(^\p{Ll}{1})#u',
32 if (!extension_loaded('mbstring')) {
33 $replacements = array(
34 function ($matches) {
35 return strtoupper($matches[2]);
37 function ($matches) {
38 return strtoupper($matches[1]);
41 } else {
42 $replacements = array(
43 function ($matches) {
44 return mb_strtoupper($matches[2], 'UTF-8');
46 function ($matches) {
47 return mb_strtoupper($matches[1], 'UTF-8');
51 } else {
52 $patterns = array(
53 '#(' . $pregQuotedSeparator.')([A-Za-z]{1})#',
54 '#(^[A-Za-z]{1})#',
56 $replacements = array(
57 function ($matches) {
58 return strtoupper($matches[2]);
60 function ($matches) {
61 return strtoupper($matches[1]);
66 $filtered = $value;
67 foreach ($patterns as $index => $pattern) {
68 $filtered = preg_replace_callback($pattern, $replacements[$index], $filtered);
70 return $filtered;