PrinsFrank / standards

A collection of standards as PHP Enums: ISO3166, ISO4217, ISO639...
MIT License
375 stars 10 forks source link

Add script detection to script alias #195

Closed PrinsFrank closed 5 months ago

codecov[bot] commented 5 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (7e1ecfa) 100.00% compared to head (1b5ee63) 99.97%.

Files Patch % Lines
src/Scripts/ScriptAlias.php 93.75% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #195 +/- ## ============================================= - Coverage 100.00% 99.97% -0.03% - Complexity 244 251 +7 ============================================= Files 39 39 Lines 4138 4154 +16 ============================================= + Hits 4138 4153 +15 - Misses 0 1 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

szepeviktor commented 5 months ago

Why not test a string for only one script? Aren't ISO script names in a single script?

PrinsFrank commented 5 months ago

Why not test a string for only one script? Aren't ISO script names in one script only?

I tried to make this as generic as possible as these new methods are in the src folder - not in the dev folder - so anyone can use them.

szepeviktor commented 5 months ago

Will it be able to tell whether a string is in a single script?

PrinsFrank commented 5 months ago

Will it be able to tell whether a string is in a single script?

It can be done with this line of code count(ScriptAlias::allForString($string)) === 1. Do you have any suggestions? I'm also not very happy with how complex the method turned out, any suggestion to make it simpler?

szepeviktor commented 5 months ago

I'm also not very happy with how complex the method turned out, any suggestion to make it simpler?

No.

szepeviktor commented 5 months ago

I can't wait to see this in action! eu_greek

szepeviktor commented 5 months ago

Sorry, there is no such a type as empty-array, it is array{}

szepeviktor commented 5 months ago

GHA can cancel previous workflow runs: https://github.com/szepeviktor/byte-level-care/blob/70bb8404654b91e97c20f982c70f7d0ca0ebb98c/.github/workflows/back-end.yml#L17-L19