} elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
// Already destructed object
$this->debugOutput(sprintf("[%s:] The object <span class=\"object_name\">%s</span> is already destroyed.",
- __CLASS__, $this->__toString()
+ __CLASS__,
+ $this->__toString()
));
}
}
$argsString = '';
if (empty($args)) {
// No arguments
- $argsString = "NULL";
+ $argsString = 'NULL';
} elseif (is_array($args)) {
// Some arguments are there
foreach ($args as $arg) {
// Add the type
- $argsString .= $arg." (".gettype($arg);
+ $argsString .= $arg . ' (' . gettype($arg);
// Add length if type is string
- if (gettype($arg) == 'string') $argsString .= ", ".strlen($arg);
+ if (gettype($arg) == 'string') $argsString .= ', '.strlen($arg);
// Closing bracket
- $argsString .= "), ";
+ $argsString .= '), ';
} // END - foreach
// Remove last comma
- if (substr($argsString, -2, 1) === ",") {
+ if (substr($argsString, -2, 1) == ',') {
$argsString = substr($argsString, 0, -2);
} // END - if
} else {
// Invalid arguments!
- $argsString = sprintf("!INVALID:%s!", $args);
+ $argsString = '!INVALID:' . gettype($args) . '!';
}
// Output stub message
* thousands seperator
* is missing
*/
- public function formatCurrency ($value, $currency = "€", $decNum = 2) {
+ public function formatCurrency ($value, $currency = '€', $decNum = 2) {
// Are all required attriutes set?
if ((!isset($this->decimals)) || (!isset($this->thousands))) {
// Throw an exception
$value = (float) $value;
// Reformat the US number
- $price = sprintf("%s %s",
- number_format($value, $decNum, $this->decimals, $this->thousands),
- $currency
- );
+ $price = number_format($value, $decNum, $this->decimals, $this->thousands) . $currency;
// Return as string...
return $price;
*/
public final function addMissingTrailingSlash ($str) {
// Is there a trailing slash?
- if (substr($str, -1, 1) != "/") $str .= "/";
+ if (substr($str, -1, 1) != '/') $str .= '/';
return $str;
}
$backtrace = debug_backtrace();
// Generate the class::method string
- $methodName = "UnknownClass->unknownMethod";
+ $methodName = 'UnknownClass->unknownMethod';
if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
$methodName = $backtrace[1]['class']."->".$backtrace[1]['function'];
} // END - if
$className = '';
// Convert all dashes in underscores
- $str = str_replace("-", "_", $str);
+ $str = $this->convertDashesToUnderscore($str);
// Now use that underscores to get classname parts for hungarian style
- foreach (explode("_", $str) as $strPart) {
+ foreach (explode('_', $str) as $strPart) {
// Make the class name part lower case and first upper case
$className .= ucfirst(strtolower($strPart));
} // END - foreach
return $className;
}
+ /**
+ * Converts dashes to underscores, e.g. useable for configuration entries
+ *
+ * @param $str The string with maybe dashes inside
+ * @return $str The converted string with no dashed, but underscores
+ */
+ public final function convertDashesToUnderscores ($str) {
+ // Convert them all
+ $str = str_replace('-', '_', $str);
+
+ // Return converted string
+ return $str;
+ }
+
/**
* Marks up the code by adding e.g. line numbers
*
*/
public function doFilterFormatTimestamp ($timestamp) {
// Default value to return
- $readable = "???";
+ $readable = '???';
// Is the timestamp null?
if (is_null($timestamp)) {
switch ($this->getLanguageInstance()->getLanguageCode()) {
case "de": // German format is a bit different to default
// Split the GMT stamp up
- $dateTime = explode(" ", $timestamp);
- $dateArray = explode("-", $dateTime[0]);
- $timeArray = explode(":", $dateTime[1]);
+ $dateTime = explode(' ', $timestamp );
+ $dateArray = explode('-', $dateTime[0]);
+ $timeArray = explode(':', $dateTime[1]);
// Construct the timestamp
$readable = sprintf($this->getConfigInstance()->readConfig('german_date_time'),