Subversion Repositories cheapmusic

Rev

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