Skip to content

Commit a46f883

Browse files
committed
Add camelCase filter - Close #15
1 parent 1b4621a commit a46f883

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/FilterFactory.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public static function snakeCaseFilter(): callable
4949
);
5050
}
5151

52+
public static function camelCaseFilter(): callable
53+
{
54+
return new LowerCaseFirst(self::normalizeFilter());
55+
}
56+
5257
/**
5358
* Returns a filter for valid class names e.g. AddBuilding
5459
*

tests/FilterFactoryTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ public function it_filters_snake_case(string $label): void
3636
$this->assertSame('add_building', ($filter)($label));
3737
}
3838

39+
/**
40+
* @test
41+
* @dataProvider providerForLabel
42+
* @param string $label
43+
*/
44+
public function it_filters_camel_case(string $label): void
45+
{
46+
$filter = FilterFactory::camelCaseFilter();
47+
$this->assertSame('addBuilding', ($filter)($label));
48+
}
49+
3950
/**
4051
* @test
4152
* @dataProvider providerForLabel

0 commit comments

Comments
 (0)