Subversion Repositories cheapmusic

Rev

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

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