File NumberConverter.php
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace HnhDigital\PhpNumberConverter;
/**
Method convertToRoman
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function convertToRoman($number)
{
$error_code = $this->checkParamaters($number, 'r');
if ($error_code > 0) {
Method convertToWord
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function convertToWord($number)
{
$error_code = $this->checkParamaters($number, 'w');
if ($error_code > 0) {
Function convertToWord
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function convertToWord($number)
{
$error_code = $this->checkParamaters($number, 'w');
if ($error_code > 0) {
- 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 convertToRoman
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function convertToRoman($number)
{
$error_code = $this->checkParamaters($number, 'r');
if ($error_code > 0) {
- 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 checkParamaters
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function checkParamaters($number, $type)
{
if ($number === '' || !is_numeric($number)) {
return 101;
}
- 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
Avoid too many return
statements within this method. Open
return $number.'th';
Avoid too many return
statements within this method. Open
return 106;
Avoid too many return
statements within this method. Open
return 0;
Avoid too many return
statements within this method. Open
return $number.'rd';
Avoid too many return
statements within this method. Open
return 105;
Function convertToOrdinal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function convertToOrdinal($number)
{
$error_code = $this->checkParamaters($number, 'o');
if ($error_code > 0) {
- 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"