This commit is contained in:
stubbfel
2013-06-26 14:00:16 +02:00
parent 27604f0c3f
commit 34c0549ac8
12 changed files with 338 additions and 98 deletions

View File

@@ -0,0 +1,58 @@
<?php
namespace utiliy;
include_once "../../global.inc.php";
include_once PATH_UTILITTY . "/StringManager.php";
/**
* The ArrayManager provides some array-methods
* @author stubbfel
* @since 26.06.2013
*/
class ArrayManager {
/**
* Method remove all empty itmes
* @param array $queryArgs
* @return array
*/
public static function removeEmptyItmes($array) {
foreach ($array as $key => $value) {
if (empty($value)) {
unset($array[$key]);
}
}
return $array;
}
/**
* Method convert a pidList to a where-string
* @param array $pidList
* @return string
*/
public static function toSqlWhereString($array, $operator = "", $fieldname = "") {
$arrayStr = StringManager::$emptyString;
foreach ($array as $value) {
$arrayStr .= $fieldname . $value . $operator;
}
$result = substr($arrayStr, 0, strlen($arrayStr) - strlen($operator));
return $result;
}
/**
* Method check if all items of the pidlist are only digits
* @param array $poly
* @return boolean
*/
public static function validIntList($list) {
foreach ($list as $value) {
if (!ctype_digit($value) || PHP_INT_MAX < $value) {
return FALSE;
}
}
return TRUE;
}
}
?>