loopline-systems/closeio-api-wrapper

Dependency clean-up

Closed this issue · 0 comments

Summary

Actually we are using Doctrine inflector for string singularisation, and Zend filter for convert close.io parameter name to class name. Since the Doctrine inflector have the same feature (method classify) I like to reduce dependency by using only Doctrine inflector.

Code snippet that reproduces the problem

<?php

use Zend\Filter\Word\UnderscoreToCamelCase;
use Doctrine\Common\Inflector\Inflector;

class DemoTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider dataProvider
     */
    public function testDifference($string)
    {
        $this->assertEquals((new UnderscoreToCamelCase)->filter($string), Inflector::classify($string));
    }

    public function dataProvider()
    {
        return [
            ["date_updated"],
            ["html_url"],
            ["created_by"],
            ["organization_id"],
            ["url"],
            ["opportunities"],
            ["updated_by"],
            ["date_created"],
            ["id"],
            ["description"],
            ["id"],
            ["first_name"],
            ["last_name"],
            ["date_created"],
            ["date_updated"],
            ["email"],
            ["image"],
            ["phone"],
            ["last_used_timezone"],
        ];
    }
}

More infos