vindi/vindi-woocommerce

View on GitHub
src/utils/Conversions.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
 
namespace VindiPaymentGateways;
 
Opening brace of a class must be on the line after the definition
class VindiConversions {
 
/**
* Converts the months, weeks and years of a Trial period into days.
*
* Used to send days in parameter to Vindi.
*
*
* @since 1.0.1
*
* @return number
*/
Opening brace should be on a new line
Line indented incorrectly; expected 4 spaces, found 2
public static function convertTriggerToDay($number, $type = 'month') {
Line indented incorrectly; expected at least 8 spaces, found 4
$types = array(
Line indented incorrectly; expected at least 8 spaces, found 6
"day" => 1,
Line indented incorrectly; expected at least 8 spaces, found 6
"month" => 30,
Line indented incorrectly; expected at least 8 spaces, found 6
"week" => 7,
Line indented incorrectly; expected at least 8 spaces, found 6
"year" => 365,
Line indented incorrectly; expected at least 8 spaces, found 4
);
 
Line indented incorrectly; expected at least 8 spaces, found 4
$verifyType = $types[$type];
 
Line indented incorrectly; expected 8 spaces, found 4
Expected 1 space after IF keyword; 0 found
if(!$verifyType) {
Line indented incorrectly; expected at least 12 spaces, found 6
return false;
Line indented incorrectly; expected 8 spaces, found 4
}
 
Line indented incorrectly; expected at least 8 spaces, found 4
return intval($number) * intval($verifyType);
 
Function closing brace must go on the next line following the body; found 1 blank lines before brace
Line indented incorrectly; expected 4 spaces, found 2
}
/**
* Converts the months, weeks and years of a Trial period into days.
*
* Used to send days in parameter to Vindi.
*
*
* @since 1.0.1
*
* @return number
*/
Line indented incorrectly; expected 4 spaces, found 2
Opening brace should be on a new line
public static function convert_interval($interval_count, $interval_type = 'month') {
Line indented incorrectly; expected at least 8 spaces, found 4
$interval_multiplier = array(
Line indented incorrectly; expected at least 8 spaces, found 6
"day" => 1,
Line indented incorrectly; expected at least 8 spaces, found 6
"week" => 7,
Line indented incorrectly; expected at least 8 spaces, found 6
"month" => 1,
Line indented incorrectly; expected at least 8 spaces, found 6
"year" => 12,
Line indented incorrectly; expected at least 8 spaces, found 4
);
Line indented incorrectly; expected at least 8 spaces, found 4
$interval_types = array(
Line indented incorrectly; expected at least 8 spaces, found 6
"day" => "days",
Line indented incorrectly; expected at least 8 spaces, found 6
"week" => "days",
Line indented incorrectly; expected at least 8 spaces, found 6
"month" => "months",
Line indented incorrectly; expected at least 8 spaces, found 6
"year" => "months",
Line indented incorrectly; expected at least 8 spaces, found 4
);
 
Line indented incorrectly; expected at least 8 spaces, found 4
$get_interval_multiplier = $interval_multiplier[$interval_type];
Line indented incorrectly; expected at least 8 spaces, found 4
$get_type = $interval_types[$interval_type];
 
Expected 1 space after IF keyword; 0 found
Line indented incorrectly; expected 8 spaces, found 4
if(!$get_type || !$get_interval_multiplier) {
Line indented incorrectly; expected at least 12 spaces, found 6
return false;
Line indented incorrectly; expected 8 spaces, found 4
}
 
Line indented incorrectly; expected at least 8 spaces, found 4
return array(
Line indented incorrectly; expected at least 8 spaces, found 6
'interval' => $get_type,
Line indented incorrectly; expected at least 8 spaces, found 6
'interval_count' => intval($interval_count) * intval($get_interval_multiplier)
Line indented incorrectly; expected at least 8 spaces, found 4
);
 
Function closing brace must go on the next line following the body; found 1 blank lines before brace
Line indented incorrectly; expected 4 spaces, found 2
}
}
 
A closing tag is not permitted at the end of a PHP file
?>