| Current Path : /home/h/a/p/happyrenas/old/happy-r.fr/transfere_pro/mangopay/MangoPay/tools/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/h/a/p/happyrenas/old/happy-r.fr/transfere_pro/mangopay/MangoPay/tools/sorting.inc |
<?php
namespace MangoPay;
/**
* Base sorting object
*/
class Sorting {
/**
* Fields separator in sort parameters in URL
*/
const SortFieldSeparator = "_";
/**
* Fields separator in sort parameters in URL
*/
const SortUrlParameterName = "Sort";
/**
* Array with fileds to sort
* @var type Array
*/
private $_sortFields;
/**
* Add filed to sort
* @param string $filedName Property name to sort
* @param \MangoPay\SortDirection $sortDirection Sort direction
*/
public function AddField($filedName, $sortDirection) {
$this->_sortFields[$filedName] = $sortDirection;
}
public function AddFiled($filedName, $sortDirection) {//for backward comptability from before typo fix
$this->AddField($filedName, $sortDirection);
}
/**
* Get sort parametrs to URL
* @return array
*/
public function GetSortParameter() {
return array(self::SortUrlParameterName => $this->_getFields());
}
private function _getFields() {
$sortValues = "";
foreach ($this->_sortFields as $key => $value) {
if (!empty($sortValues))
$sortValues .= self::SortFieldSeparator;
$sortValues .= $key . ":" . $value;
}
return $sortValues;
}
}