Subversion Repositories cheapmusic

Rev

Rev 10 | Rev 54 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
9 - 1
<?php
2
class Vendors
3
{
4
    private static $instance = null;
5
    private static $ebay = [];
6
    private static $discogs = [];
20 - 7
    private static $linkshare = [];
8
    private static $cjaffiliate = [];
9
    private static $walmart = [];
9 - 10
 
11
    const EBAY = 0;
12
    const DISCOGS = 1;
20 - 13
    const LINKSHARE = 2;
14
    const CJAFFILIATE = 3;
15
    const WALMART = 4;
9 - 16
 
10 - 17
    public static function getInstance()
9 - 18
    {
19
        if (is_null(self::$instance)){
20
            self::$instance = new self();
21
        }
22
 
23
        return self::$instance;
24
    }
25
 
26
    public function setVendor($vendorArray, $type)
27
    {
10 - 28
        if ($type == self::EBAY) {
9 - 29
            self::$ebay = $vendorArray;
10 - 30
        } else if ($type == self::DISCOGS) {
9 - 31
            self::$discogs = $vendorArray;
20 - 32
        } else if ($type == self::LINKSHARE) {
33
            self::$linkshare = $vendorArray;
34
        } else if ($type == self::CJAFFILIATE) {
35
            self::$cjaffiliate = $vendorArray;
36
        } else if ($type == self::WALMART) {
37
            self::$walmart = $vendorArray;
9 - 38
        }
39
    }
40
 
41
    public function getVendor($type)
42
    {
10 - 43
        if ($type == self::EBAY) {
9 - 44
            return self::$ebay;
10 - 45
        } else if ($type == self::DISCOGS) {
9 - 46
            return self::$discogs;
20 - 47
        } else if ($type == self::LINKSHARE) {
48
            return self::$linkshare;
49
        } else if ($type == self::CJAFFILIATE) {
50
            return self::$cjaffiliate;
51
        } else if ($type == self::WALMART) {
52
            return self::$walmart;
9 - 53
        }
54
 
55
        return null;
56
    }
10 - 57
}