Fakoli Framework
CurrencyTypeRenderer Class Reference
+ Inheritance diagram for CurrencyTypeRenderer:
+ Collaboration diagram for CurrencyTypeRenderer:

Public Member Functions

 CurrencyTypeRenderer ()
 
- Public Member Functions inherited from AbstractTypeRenderer
 AbstractTypeRenderer ()
 

Static Public Member Functions

static format ($value, $template="")
 
- Static Public Member Functions inherited from AbstractTypeRenderer
static format ($value, $template="")
 
static translationDateTemplate ($template, $includeTime=true)
 

Detailed Description

Definition at line 37 of file currency_type_renderer.inc.

Member Function Documentation

◆ CurrencyTypeRenderer()

CurrencyTypeRenderer::CurrencyTypeRenderer ( )

Definition at line 40 of file currency_type_renderer.inc.

41  {
42  }

◆ format()

static CurrencyTypeRenderer::format (   $value,
  $template = "" 
)
static

Definition at line 62 of file currency_type_renderer.inc.

63  {
64  $template = trim($template);
65 
66  if ($value == "" || !isset($value) || !is_numeric($value))
67  {
68  $value = "0";
69  }
70 
71  if ($template == "numeric")
72  {
73  $text = number_format($value, 2, ".", "");
74  }
75  else if (startsWith($template, "numeric,"))
76  {
77  $places = substr($template, 8);
78  $text = number_format($value, 2, ".", "");
79  }
80  else if ($template != "" && is_numeric($template))
81  {
82  $text = number_format($value, $template);
83  }
84  else
85  {
86  $text = number_format($value, 2);
87  }
88 
89  return $text;
90  }
startsWith($text, $start)
Tests whether a string starts with a given sub-string.
Definition: functions.inc:1419

The documentation for this class was generated from the following file: