commit 140093bc51b4689b2c45261d2164b1e877fecf99
parent 1cfc56f43ef5afbb1adf6947978a2391cd9451f1
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date: Sat, 19 Nov 2016 18:39:19 +0100
Commenting helpers
Diffstat:
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/php/helpers.php b/php/helpers.php
@@ -2,7 +2,9 @@
// This file is in the public domain.
/**
- * ???
+ * If '$arr[$idx]' exists, return it. Otherwise
+ * set '$arr[$idx]' to '$default' and then return it
+ * as well.
*/
function &pull(&$arr, $idx, $default) {
if (!isset($arr[$idx])) {
@@ -12,7 +14,9 @@
}
/**
- * ???
+ * Concatenates '$base' and '$path'. Tipically used
+ * to add the path (represented by '$path') to a base URL
+ * (represented by '$base').
*/
function url_join($base, $path) {
// Please note that this simplistic way of joining URLs is
@@ -22,8 +26,9 @@
}
/**
- * ???
- * $path must have a leading '/'.
+ * Construct a URL having the host where the script is
+ * running as the base URL, and concatenating '$path' to
+ * it. NOTE: $path must have a leading '/'.
*/
function url_rel($path){
// Make sure 'REQUEST_SCHEME' is http/https, as in some setups it may
@@ -32,7 +37,8 @@
}
/**
- * Convert ???
+ * Take date in Taler format, as "/Date(timestamp)/", and
+ * convert it in a human-readable string.
*/
function get_pretty_date($taler_date){
$match = array();
@@ -43,7 +49,10 @@
}
/**
- * ???
+ * Take amount object in Taler format, and converts it
+ * in a human-readable string. NOTE: Taler amounts objects
+ * come from JSON of the form:
+ * '{"value" x, "fraction": y, "currency": "CUR"}'
*/
function get_amount($taler_amount){
$PRECISION = 100000000;