Code Monkey home page Code Monkey logo

jawira / case-converter Goto Github PK

View Code? Open in Web Editor NEW
165.0 5.0 8.0 1.87 MB

Convert strings between 13 naming conventions: Snake case, Camel case, Kebab case, Pascal case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Title case, Sentence case and Dot notation.

Home Page: https://jawira.github.io/case-converter/

License: MIT License

PHP 78.12% Gherkin 21.88%
php camel-case snake-case pascal-case ada-case kebab-case train-case cobol-case macro-case upper-case

case-converter's Introduction

meme

stats langs

case-converter's People

Contributors

jawira avatar szepeviktor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

case-converter's Issues

Fix phpstan

Case Converter > phpstan:run:

 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ---------------------------------------------------------------------------------------------------------- 
  Line   Convert.php                                                                                               
 ------ ---------------------------------------------------------------------------------------------------------- 
  137    Parameter #1 $str of method Jawira\CaseConverter\Convert::readSnake() expects string, string|null given.  
 ------ ---------------------------------------------------------------------------------------------------------- 

 [ERROR] Found 1 error

chaining doc

typo

readme

any underscore _ if found

case mapping methods

create mapping to switch from single mapping to full mapping

$convert->useSimpleMapping()->useFullMapping();

Composer support?

Would you be able to add a composer.json file to this library and register it on Packagist? That'd be brill! :)

Static site

create static site to show docs and explain motivaton

readme: add links to features

In readme.md update:

Features:

    🌐 i18n
    🔁 automatic case detection <-- link here
    [factory] factory <-- link here

Use Phive

Currently phar are downloaded by Phing, Phive should be used instead.

Add more tests

Add more tests in other languages... turkish, georgian, armenian, etc

SOLID

I can't easily inject the functionality this package provides as a dependency to one of my classes because I have to create a new instance every time I want to perform a conversion. This breaks the inversion of control principle of SOLID.

To use this properly I'd have to make a factory and inject it everywhere which is definitely sub-optimal.

Add dot notation

Add dot notation format: all lowercase and concatenated with a dot

this.is.dot

Error with acronyms

Converter doesn't work as expected with acronyms:

$test = new Convert('USA');
echo $test; // Current: usa Expected: u_s_a

Massive renaming

It turns out that "hyphen" could be a better word than "dash" to describe conventions... check this.

Improve PHPUnit coverage

Improve:

  • \Jawira\CaseConverter\Convert::handleSplitterMethod
  • \Jawira\CaseConverter\Convert::handleGluerMethod

Explicitly set input format

Rename \Jawira\CaseConverter\Convert::readSnake to fromSnake

Rename \Jawira\CaseConverter\Convert::readCamel to fromCamel

And made both public.

Fix hack from Uppercase Splitter

A hack is used to split words in Pascal Case and Camel Case strings. Instead of splitting directly, the string is first converted to Snake Case and then splitted as such.

Remove this hack and split string properly.

Add Kebab case

Add kebab case (including train case) as new functionality, maybe new major version?

String not recognized

When a string starts with a delimiter the string is not correctly recognized by \Jawira\CaseConverter\Convert::analyse.

For example . should be recognized as DotNotation, but isn't.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.