Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SeparatorToCamelCase.php
Go to the documentation of this file.
1 <?php
25 #require_once 'Zend/Filter/Word/Separator/Abstract.php';
26 
34 {
35 
36  public function filter($value)
37  {
38  // a unicode safe way of converting characters to \x00\x00 notation
39  $pregQuotedSeparator = preg_quote($this->_separator, '#');
40 
41  if (self::isUnicodeSupportEnabled()) {
42  parent::setMatchPattern(array('#('.$pregQuotedSeparator.')(\p{L}{1})#','#(^\p{Ll}{1})#'));
43  parent::setReplacement(array('Zend_Filter_Word_SeparatorToCamelCase', '_strtoupperArray'));
44  } else {
45  parent::setMatchPattern(array('#('.$pregQuotedSeparator.')([A-Za-z]{1})#','#(^[A-Za-z]{1})#'));
46  parent::setReplacement(array('Zend_Filter_Word_SeparatorToCamelCase', '_strtoupperArray'));
47  }
48 
49  return preg_replace_callback($this->_matchPattern, $this->_replacement, $value);
50  }
51 
56  private static function _strtoupperArray(array $matches)
57  {
58  if (array_key_exists(2, $matches)) {
59  return strtoupper($matches[2]);
60  }
61  return strtoupper($matches[1]);
62  }
63 
64 }
$value
Definition: gender.phtml:16