Showing 18 of 109 total issues
DebtAmortizator
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class DebtAmortizator extends CalculatorAbstract
{
/** @var RepaymentInstance[] */
// list of individual debt's repayments as an array of RepaymentInstance objects
protected $debtRepayments;
AnnuityCalculator
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class AnnuityCalculator extends CalculatorAbstract
{
// amount of each individual payment = 'K'
protected $annuitySinglePaymentAmount;
Function populateFactoryClassesArray
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function populateFactoryClassesArray()
{
$factoryFiles = glob(FinanCalc::getPath() . Config::getConfigField('factories_relative_path') . '/*.php');
$factoriesNamespace = Config::getConfigField('factories_namespace');
- 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
TimeSpan
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class TimeSpan
{
/** @var DateTime */
private $startDate;
/** @var DateTime */
Method getAnnuityValue
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAnnuityValue(
AnnuityPaymentTypes $annuityPaymentType = null,
AnnuityValueTypes $annuityValueType
) {
// if the number of the annuity's compounding periods
Method getBondFairValue
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBondFairValue()
{
// we need to get the coupon rate per payment period = c/payment frequency
$couponRateForPeriod = MathFuncs::div(
$this->bondAnnualCouponRate,
Function getResultAsArray
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
final public function getResultAsArray(array $propResultArray = null)
{
if ($propResultArray === null) {
if ($this->propResultArray !== null && is_array($this->propResultArray)) {
$propResultArray = $this->propResultArray;
- 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 getAnnuityValue
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getAnnuityValue(
AnnuityPaymentTypes $annuityPaymentType = null,
AnnuityValueTypes $annuityValueType
) {
// if the number of the annuity's compounding periods
- 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 populateFactoryClassesArray
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function populateFactoryClassesArray()
{
$factoryFiles = glob(FinanCalc::getPath() . Config::getConfigField('factories_relative_path') . '/*.php');
$factoriesNamespace = Config::getConfigField('factories_namespace');
Method getApproxBondYTM
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getApproxBondYTM()
{
// we need to calculate the coupon payment C = F*(c/payment frequency)
$couponPayment =
MathFuncs::mul(
Method getResultAsArray
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function getResultAsArray(array $propResultArray = null)
{
if ($propResultArray === null) {
if ($this->propResultArray !== null && is_array($this->propResultArray)) {
$propResultArray = $this->propResultArray;
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$bondFaceValue,
$bondMarketValue,
$bondAnnualCouponRate,
$bondYearsToMaturity,
$bondPaymentFrequency = 1
Method newCustomCouponFrequencyBond
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$bondFaceValue,
$bondMarketValue,
$bondAnnualCouponRate,
$bondYearsToMaturity,
$bondPaymentFrequency
Method newCustomCouponFrequencyBond
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$bondFaceValue,
$bondAnnualCouponRate,
$bondVIR,
$bondYearsToMaturity,
$bondPaymentFrequency
Method newCustomCouponFrequencyBond
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$bondFaceValue,
$bondAnnualCouponRate,
$bondAnnualYield,
$bondYearsToMaturity,
$bondPaymentFrequency
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$bondFaceValue,
$bondAnnualCouponRate,
$bondVIR,
$bondYearsToMaturity,
$bondPaymentFrequency = 1
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$bondFaceValue,
$bondAnnualCouponRate,
$bondAnnualYield,
$bondYearsToMaturity,
$bondPaymentFrequency = 1
Function setProperty
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
final protected function setProperty($name, $value, $callbackBefore = null)
{
if (is_callable($callbackBefore)) {
$callbackBefore($value);
}
- 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"