Subversion Repositories cheapmusic

Rev

Rev 10 | Rev 54 | 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 = [];

    const EBAY = 0;
    const DISCOGS = 1;
    const LINKSHARE = 2;
    const CJAFFILIATE = 3;
    const WALMART = 4;

    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;
        }
    }

    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;
        }

        return null;
    }
}