Changeset View
Standalone View
modules/in-commerce/units/product_option_combinations/product_option_formatters.php
Show All 18 Lines | |||||
* Formats value of a given field | * Formats value of a given field | ||||
* | * | ||||
* @param string $value | * @param string $value | ||||
* @param string $field_name | * @param string $field_name | ||||
* @param kDBItem|kDBList $object | * @param kDBItem|kDBList $object | ||||
* @param string $format | * @param string $format | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
function Format($value, $field_name, $object, $format=null) | function Format($value, $field_name, &$object, $format=null) | ||||
Lint: CodingStandard.Commenting.FunctionComment.ScalarTypeHintMissing: Type hint "string" missing for $format | |||||
Type hint "string" missing for $field_name Lint: CodingStandard.Commenting.FunctionComment.ScalarTypeHintMissing: Type hint "string" missing for $field_name | |||||
Type hint "string" missing for $value Lint: CodingStandard.Commenting.FunctionComment.ScalarTypeHintMissing: Type hint "string" missing for $value | |||||
Lint: Squiz.Scope.MethodScope.Missing: Visibility must be declared on method "Format" | |||||
Method name "kCombinationFormatter::Format" is not in camel caps format Lint: CodingStandard.NamingConventions.ValidFunctionName.NotCamelCaps: Method name "kCombinationFormatter::Format" is not in camel caps format | |||||
Incorrect spacing between default value and equals sign for argument "$format"; expected 1 but found 0 Lint: Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterDefault: Incorrect spacing between default value and equals sign for argument "$format"; expected 1 but… | |||||
Incorrect spacing between argument "$format" and equals sign; expected 1 but found 0 Lint: Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals: Incorrect spacing between argument "$format" and equals sign; expected 1 but found 0 | |||||
Line indented incorrectly; expected 1 tabs, found 2 Lint: Generic.WhiteSpace.ScopeIndent.IncorrectExact: Line indented incorrectly; expected 1 tabs, found 2 | |||||
{ | { | ||||
$o = ''; | $o = ''; | ||||
$options = $object->GetFieldOptions($field_name); | $options = $object->GetFieldOptions($field_name); | ||||
if ( isset($format) ) $options['format'] = $format; | if ( isset($format) ) $options['format'] = $format; | ||||
$data = unserialize($value); | $data = unserialize($value); | ||||
$opt_helper = $this->Application->recallObject('kProductOptionsHelper'); | $opt_helper = $this->Application->recallObject('kProductOptionsHelper'); | ||||
$top_prefix = $this->Application->GetTopmostPrefix($object->Prefix); | $top_prefix = $this->Application->GetTopmostPrefix($object->Prefix); | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
* Formats value of a given field | * Formats value of a given field | ||||
* | * | ||||
* @param string $value | * @param string $value | ||||
* @param string $field_name | * @param string $field_name | ||||
* @param kDBItem|kDBList $object | * @param kDBItem|kDBList $object | ||||
* @param string $format | * @param string $format | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
function Format($value, $field_name, $object, $format=null) | function Format($value, $field_name, &$object, $format=null) | ||||
Type hint "string" missing for $value Lint: CodingStandard.Commenting.FunctionComment.ScalarTypeHintMissing: Type hint "string" missing for $value | |||||
Type hint "string" missing for $field_name Lint: CodingStandard.Commenting.FunctionComment.ScalarTypeHintMissing: Type hint "string" missing for $field_name | |||||
Method name "kCombPriceFormatter::Format" is not in camel caps format Lint: CodingStandard.NamingConventions.ValidFunctionName.NotCamelCaps: Method name "kCombPriceFormatter::Format" is not in camel caps format | |||||
Line indented incorrectly; expected 1 tabs, found 2 Lint: Generic.WhiteSpace.ScopeIndent.IncorrectExact: Line indented incorrectly; expected 1 tabs, found 2 | |||||
Incorrect spacing between argument "$format" and equals sign; expected 1 but found 0 Lint: Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals: Incorrect spacing between argument "$format" and equals sign; expected 1 but found 0 | |||||
Incorrect spacing between default value and equals sign for argument "$format"; expected 1 but found 0 Lint: Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterDefault: Incorrect spacing between default value and equals sign for argument "$format"; expected 1 but… | |||||
Lint: Squiz.Scope.MethodScope.Missing: Visibility must be declared on method "Format" | |||||
Type hint "string" missing for $format Lint: CodingStandard.Commenting.FunctionComment.ScalarTypeHintMissing: Type hint "string" missing for $format | |||||
{ | { | ||||
$options = $object->GetFieldOptions($field_name); | $options = $object->GetFieldOptions($field_name); | ||||
$converted = array_key_exists('converted', $options) ? $options['converted'] : false; | $converted = array_key_exists('converted', $options) ? $options['converted'] : false; | ||||
if ($converted) { | if ($converted) { | ||||
$lang = $this->Application->recallObject('lang.current'); | $lang = $this->Application->recallObject('lang.current'); | ||||
return $lang->formatNumber($object->GetDBField($field_name), 2); | return $lang->formatNumber($object->GetDBField($field_name), 2); | ||||
} | } | ||||
Show All 37 Lines | |||||
$price = $price + $price_mod; | $price = $price + $price_mod; | ||||
break; | break; | ||||
case 3: // percent | case 3: // percent | ||||
$price = $price * (1 + $price_mod / 100); | $price = $price * (1 + $price_mod / 100); | ||||
break; | break; | ||||
} | } | ||||
return $price; | return $price; | ||||
} | } | ||||
} | } | ||||
Expected 0 spaces before closing brace; 4 found Lint: CodingStandard.Classes.ClassDeclaration.SpaceBeforeCloseBrace: Expected 0 spaces before closing brace; 4 found | |||||
Line indented incorrectly; expected 0 tabs, found 1 Lint: Generic.WhiteSpace.ScopeIndent.IncorrectExact: Line indented incorrectly; expected 0 tabs, found 1 | |||||
No newline at end of file |
Type hint "string" missing for $format