Git Product home page Git Product logo

ar-php's People

Contributors

alhoqbani avatar

Stargazers

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

Watchers

 avatar  avatar

ar-php's Issues

cleanCommon cleans too much

Method cleanCommon performs str_replaceon the full string, without parsing the string into separate words.

This will remove stopwords from the string even if it was part of a word. For example, الأهل will be replaced with الأ because هل, which is part of the word, is a stopword.

It should use preg_replace to replace only fill words, or explode the string into array of words.

KeySwap is not accurate

From the example file:
"ٍمخصمغ لاعف سعقثمغ"
is swapped as: Slowly ghut surely where it should be: Slowly but surely.

It's shown in the test at line 68

Method setArrFields is not getting params.

When passing an array to setArrFields, class I18N_Arabic:: __call does not pass the arguments.
This is because in #10 we put a condition to pass params only if string or numeric.

The array should be passed directly, or after calling iconv on all elements.

Method dateCorrection is not working

The method dateCorrection is supposed to calculate the correction factor for the Hijri date conversion based on Um Alqura calendar. It supports date range 1420-1459, and should return a correction factor range from -2 to +2.

However, the method is not working and almost always returns 0.

I have tested every month from the supported range (1420-1459). Out of 456 tested months, only 21 months returned a value different than 0, which does not seem right.

This commit a121197 adds a test to check the functionality of the method.

Undefined index in normaliseHamza method

This line

$this->_chars['HAMZA_ABOVE,HAMZA_BELOW']

seems to have a typo which throw a notice causing the test to fail.

Notice: Undefined index: HAMZA_ABOVE,HAMZA_BELOW in /Users/hamoud/Sites/i18n/Arabic/Normalise.php on line 176

Method unshape is not working

mehtod unshape is not working.

It should replace Arabic letter for its joined form to the standalone shape.
e.g. أحمد should be أ ح م د with no spaces !!

it failed to do the replacement when passed a string. However, it can replace a single character which is not useful.

Also, the use case for this method is not clear to me.

setlocalecausing a problem to preg_split

setlocale at line 189 in the Transliteration class is causing a problem in other parts of the code.

When running the full test suit, codes with preg_split fail.

I have no idea, why. but for now I will comment out this line.

Duplicate values in char_names array

The char_names array references Unicode Character 0x0670 twice with the keys SMALL_ALEF and MINI_ALEF.

This is casing the method isSamll() to fail when passed a small Alef, because the the array search return the first key SMALL_ALEF.

The duplication must be resolved by removing one of the two elements.

Update Hijri date when Carbon instance date changes

When the date is changed using one of Carbon methods, e.g. addDays, the Hijri date does not change accordingly.

        $arD = ArUtil::date()->arCreateFromDate(1438, 10, 15);
	    
        $arD->addDays(10);
	    
	echo $arD->arDay // 15 <- should be 25

str2graph Undefined index when a text has a space.

Method str2graph from Hiero class will fail the test when passed Arabic text with a space.

This is because the array of arabic letters does not have a space. And line 225 $char = $arabic[$char] checks for a space which casues an undefined index notice when a text has a space.

We either add the space to the array or check if the index is set.

Booleans are not passed to the methods.

When changes were made to the method __call in the main Arabic class to address #10 & #19. Some params are not passed to the called method if it's not one of the types (string, numeric, and array) specified in the foreach which applied to filter the params.

For example, when trying to implement #29 by passing a boolean flag to the method, it was not passed to the target method.

There should a catch all clause to pass any params which is not processed by the foreach.

setMode, getMode, setLang are not probably called.

When any of these methods is called (setMode, getMode & setLang) , line 255 will try to reload their respective classes. This is because different classes have methods with the same name (Date, Query, Soundex, CompressStr).

However, this leads to invoking the wrong class. For example, calling Query::setMode, will invoke Date::setMode because Date comes before Query in the config.xml

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.