Showing 133 of 211 total issues
Function toWords
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function toWords($number, $currencyGender = -1)
{
if ($number === 0) {
return $this->zero;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function transformToWords
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function transformToWords(int $number, int $power): string
{
$units = $number % 10;
$tens = (int) ($number / 10) % 10;
$hundreds = (int) ($number / 100) % 10;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method toCurrencyWords
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toCurrencyWords($currency, $decimal, $fraction = null)
{
$currency = strtoupper($currency);
if (!array_key_exists($currency, static::$currencyNames)) {
Method toWords
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function toWords($num)
{
$neg = 0;
$ret = [];
Method toWords
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function toWords($num)
{
$ret = '';
$num = strval($num);
Method toWords
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function toWords($num)
{
$ret = '';
$num = strval($num);
Method toWords
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function toWords($number, $currencyGender = -1)
{
if ($number === 0) {
return $this->zero;
}
Method showDigitsGroup
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showDigitsGroup($number, $noun, $forceNoun = false, $forcePlural = false)
{
$ret = '';
$units = $number % 10;
Method toCurrencyWords
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toCurrencyWords($currency, $decimal, $fraction = null)
{
$currency = strtoupper($currency);
if (!array_key_exists($currency, self::$currencyNames)) {
Function getSubHundred
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function getSubHundred($tens, $units, $power)
{
$words = [];
if ($tens === 1) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method transformToWords
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transformToWords(int $number, int $power): string
{
$units = $number % 10;
$tens = (int) ($number / 10) % 10;
$hundreds = (int) ($number / 100) % 10;
Method toWords
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function toWords($number)
{
if ($number === 0) {
return $this->zero;
}
Method toWords
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toWords(int $amount, string $currency, $options = null): string
{
$dictionary = new ArabicDictionary();
$numberToTripletsConverter = new NumberToTripletsConverter();
$tripletTransformer = new ArabicTripletTransformer($dictionary);
Method convertIntegerPart
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function convertIntegerPart($number)
{
$result = '';
if ($number >= 1000000000000) {
Method getWordsBySplittingIntoTriplets
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getWordsBySplittingIntoTriplets(int $number): array
{
$words = [];
$triplets = $this->numberToTripletsConverter->convertToTriplets($number);
Method toWords
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function toWords($num)
{
$return = '';
if ($num === 0) {
Method toWords
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toWords(int $amount, string $currency, ?CurrencyTransformerOptions $options = null): string
{
$dictionary = new LatvianDictionary();
$numberTransformer = new LatvianNumberTransformer();
Method toWords
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function toWords($number)
{
$ret = '';
if ($number === 0) {
Method toWords
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toWords(int $amount, string $currency, ?CurrencyTransformerOptions $options = null): string
{
$dictionary = new LithuanianDictionary();
$numberTransformer = new LithuanianNumberTransformer();
Method transformToWords
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transformToWords(int $number, int $power): string
{
$units = $number % 10;
$tens = (int) ($number / 10) % 10;
$hundreds = (int) ($number / 100) % 10;