Subversion Repositories cheapmusic

Rev

Rev 65 | Rev 83 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
class Vendors {
    private static $instance = null;
    private static $ebay = [];
    private static $discogs = [];
    private static $linkshare = [];
    private static $cjaffiliate = [];
    private static $walmart = [];
    private static $itunes = [];
    private static $amazon = [];

    const EBAY = 0;
    const DISCOGS = 1;
    const LINKSHARE = 2;
    const CJAFFILIATE = 3;
    const WALMART = 4;
    const ITUNES = 5;
    const AMAZON = 6;

    public static function getInstance() {
        if (is_null(self::$instance)) {
            self::$instance = new self();
        }

        return self::$instance;
    }

    public function setVendor($vendorArray, $type) {
        if ($type == self::EBAY) {
            self::$ebay = $vendorArray;
        }
        else if ($type == self::DISCOGS) {
            self::$discogs = $vendorArray;
        }
        else if ($type == self::LINKSHARE) {
            self::$linkshare = $vendorArray;
        }
        else if ($type == self::CJAFFILIATE) {
            self::$cjaffiliate = $vendorArray;
        }
        else if ($type == self::WALMART) {
            self::$walmart = $vendorArray;
        }
        else if ($type == self::ITUNES) {
            self::$itunes = $vendorArray;
        }
        else if ($type == self::AMAZON) {
            self::$amazon = $vendorArray;
        }
    }

    public function getVendor($type) {
        if ($type == self::EBAY) {
            return self::$ebay;
        }
        else if ($type == self::DISCOGS) {
            return self::$discogs;
        }
        else if ($type == self::LINKSHARE) {
            return self::$linkshare;
        }
        else if ($type == self::CJAFFILIATE) {
            return self::$cjaffiliate;
        }
        else if ($type == self::WALMART) {
            return self::$walmart;
        }
        else if ($type == self::ITUNES) {
            return self::$itunes;
        }
        else if ($type == self::AMAZON) {
            return self::$amazon;
        }

        return null;
    }
}