-
Notifications
You must be signed in to change notification settings - Fork 703
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: Negotiation/FormatNegotiator.php Resources/config/body_listener.xml Resources/config/util.xml Resources/doc/3-listener-support.rst Resources/doc/format_listener.rst Tests/EventListener/FormatListenerTest.php Tests/EventListener/MimeTypeListenerTest.php Tests/Negotiation/FormatNegotiatorTest.php Tests/Routing/Loader/LoaderTest.php Tests/Validator/ViolationFormatterTest.php Util/FormatNegotiator.php Util/MediaTypeNegotiatorInterface.php Validator/ViolationFormatter.php Version/VersionResolverInterface.php
- Loading branch information
Showing
7 changed files
with
87 additions
and
3 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,45 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the FOSRestBundle package. | ||
* | ||
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FOS\RestBundle\Normalizer; | ||
|
||
/** | ||
* Normalizes the array by changing its keys from underscore to camel case, while | ||
* leaving leading underscores unchanged. | ||
* | ||
* @author Lukas Kahwe Smith <smith@pooteeweet.org> | ||
*/ | ||
class CamelKeysNormalizerWithLeadingUnderscore extends CamelKeysNormalizer | ||
{ | ||
/** | ||
* Normalizes a string while leaving leading underscores unchanged. | ||
* | ||
* @param string $string | ||
* | ||
* @return string | ||
*/ | ||
protected function normalizeString($string) | ||
{ | ||
if (false === strpos($string, '_')) { | ||
return $string; | ||
} | ||
|
||
$offset = strspn($string, '_'); | ||
if ($offset) { | ||
$underscorePrefix = substr($string, 0, $offset); | ||
$string = substr($string, $offset); | ||
} else { | ||
$underscorePrefix = ''; | ||
} | ||
|
||
return $underscorePrefix.parent::normalizeString($string); | ||
} | ||
} |
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
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
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