Example #1
0
 public function testUnderscore()
 {
     $tests = array('Foo' => 'foo', 'FooBar' => 'foo_bar', 'FooBarBAZ' => 'foo_bar_baz');
     foreach ($tests as $input => $expected) {
         $this->assertEquals($expected, Str::underscore($input));
     }
 }
Example #2
0
 /**
  * Converts from camel case to underscored, i.e. FooBarBaz -> foo_bar_baz
  * Inspired by Symfony
  *
  * @return StrObject
  */
 public function underscore()
 {
     $value = Str::underscore($this->value);
     return new self($value);
 }