camelCaseToUnderscore() public static method

Example: $string = 'LannistersAlwaysPayTheirDebts'; $underscored = Strings::camelCaseToUnderscore($string); Result: lannisters_always_pay_their_debts
public static camelCaseToUnderscore ( string $string ) : string
$string string
return string
 public function parse()
 {
     if (preg_match('/^findBy([a-zA-Z]\\w*)$/', $this->method, $names)) {
         $names = explode('And', $names[1]);
         $this->names = Arrays::map($names, function ($name) {
             return Strings::camelCaseToUnderscore($name);
         });
     }
 }
示例#2
0
 /**
  * @test
  */
 public function shouldConvertCamelCaseWithUnderscoreToUnderscore()
 {
     //given
     $string = 'LannistersAlwaysPay_Their_Debts';
     //when
     $underscored = Strings::camelCaseToUnderscore($string);
     //then
     $this->assertEquals('lannisters_always_pay_their_debts', $underscored);
 }
示例#3
0
 public function getTab()
 {
     $noController = Strings::remove(get_called_class(), 'Controller');
     $noSlashes = Strings::remove($noController, '\\');
     return Strings::camelCaseToUnderscore($noSlashes);
 }
示例#4
0
 private function _objectName()
 {
     return Strings::camelCaseToUnderscore($this->_object->getModelName());
 }