theorchard / monolog-cascade

Configure multiple loggers and handlers in the blink of an eye
MIT License
145 stars 62 forks source link

Replace symfony/serializer with a dedicated case-changing component #46

Closed djmattyg007 closed 7 years ago

djmattyg007 commented 8 years ago

Given the only thing symonfy/serializer appears to be used for is to convert snake_case names to camelCase, it seems a bit unnecessary to require the entire serializer component for this one task. Surely a smaller, dedicated library would be more suited to the task? There are plenty of examples here: https://packagist.org/search/?q=camel

djmattyg007 commented 8 years ago

Alternatively you could just pull out the relevant code from the symfony/serializer package and call it yourself manually, as it's only really a couple of lines of code:

public function snakeCaseToCamelCase($unnormalizedName)
{
    $camelCasedName = preg_replace_callback('/(^|_)+(.)/', function ($match) {
        return strtoupper($match[2]);
    }, $unnormalizedName);
    return lcfirst($camelCasedName);
}
rantonmattei commented 8 years ago

Shoot a PR

denizdogan commented 7 years ago

67

rantonmattei commented 7 years ago

Thx @denizdogan ! 👍