Payment.class.php
955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?
namespace Cpeople\Classes\Sale;
class Payment
{
private $data = array();
public static function getPayment($id = false)
{
static $result = null;
static $resultById = null;
if($result === null)
{
$rs = \CSalePaySystem::GetList(array(), array(), false, false, array('ID', 'NAME'));
while($ar = $rs->GetNext(true, false))
{
$obj = new Payment($ar);
$resultById[ $ar['ID'] ] = &$obj;
$result[] = &$obj;
unset($obj);
}
}
return $id ? (isset($resultById[$id]) ? $resultById[$id] : false) : $result;
}
public function __construct($data)
{
$this->data = $data;
}
public function getId()
{
return $this->data['ID'];
}
public function getName()
{
return $this->data['NAME'];
}
}