Subversion Repositories cheapmusic

Rev

Rev 65 | Rev 83 | 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 = [];
81 - 10
    private static $amazon = [];
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;
81 - 18
    const AMAZON = 6;
9 - 19
 
65 - 20
    public static function getInstance() {
21
        if (is_null(self::$instance)) {
9 - 22
            self::$instance = new self();
23
        }
24
 
25
        return self::$instance;
26
    }
27
 
65 - 28
    public function setVendor($vendorArray, $type) {
10 - 29
        if ($type == self::EBAY) {
9 - 30
            self::$ebay = $vendorArray;
65 - 31
        }
32
        else if ($type == self::DISCOGS) {
9 - 33
            self::$discogs = $vendorArray;
65 - 34
        }
35
        else if ($type == self::LINKSHARE) {
20 - 36
            self::$linkshare = $vendorArray;
65 - 37
        }
38
        else if ($type == self::CJAFFILIATE) {
20 - 39
            self::$cjaffiliate = $vendorArray;
65 - 40
        }
41
        else if ($type == self::WALMART) {
20 - 42
            self::$walmart = $vendorArray;
65 - 43
        }
44
        else if ($type == self::ITUNES) {
54 - 45
            self::$itunes = $vendorArray;
9 - 46
        }
81 - 47
        else if ($type == self::AMAZON) {
48
            self::$amazon = $vendorArray;
49
        }
9 - 50
    }
51
 
65 - 52
    public function getVendor($type) {
10 - 53
        if ($type == self::EBAY) {
9 - 54
            return self::$ebay;
65 - 55
        }
56
        else if ($type == self::DISCOGS) {
9 - 57
            return self::$discogs;
65 - 58
        }
59
        else if ($type == self::LINKSHARE) {
20 - 60
            return self::$linkshare;
65 - 61
        }
62
        else if ($type == self::CJAFFILIATE) {
20 - 63
            return self::$cjaffiliate;
65 - 64
        }
65
        else if ($type == self::WALMART) {
20 - 66
            return self::$walmart;
65 - 67
        }
68
        else if ($type == self::ITUNES) {
54 - 69
            return self::$itunes;
9 - 70
        }
81 - 71
        else if ($type == self::AMAZON) {
72
            return self::$amazon;
73
        }
9 - 74
 
75
        return null;
76
    }
10 - 77
}