-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move property name conversion into its own class
- Loading branch information
1 parent
113e1cf
commit 8f90a7d
Showing
4 changed files
with
50 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace SimpleXmlMapper; | ||
|
||
use Doctrine\Common\Inflector\Inflector; | ||
|
||
class CamelCasePropertyNameConverter implements PropertyNameConverterInterface | ||
{ | ||
/** | ||
* Convert the specified XML property name to its PHP property name. | ||
* | ||
* @param string $name | ||
* @return string | ||
*/ | ||
public function convert($name) | ||
{ | ||
return Inflector::camelize($name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace SimpleXmlMapper; | ||
|
||
interface PropertyNameConverterInterface | ||
{ | ||
/** | ||
* Convert the specified XML property name to its PHP property name. | ||
* | ||
* @param string $name | ||
* @return string | ||
*/ | ||
public function convert($name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters