/library/Ecart/Collect/CreditCard.php
PHP | 86 lines | 36 code | 4 blank | 46 comment | 3 complexity | ddcd55dbf2fc2e11cec3c48c4e61acb1 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1
- <?php
- /**
- * Ecart
- *
- * This file is part of Ecart.
- *
- * Ecart is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Ecart is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Ecart. If not, see <http://www.gnu.org/licenses/>.
- *
- * @category Ecart
- * @package Ecart_Payment
- * @copyright Copyright 2008-2009 E-Cart LLC
- * @license GNU Public License V3.0
- */
- /**
- *
- * @category Ecart
- * @package Ecart_Payment
- * @subpackage Collect
- * @author Ecart Core Team <core@ecartcommerce.com>
- */
- class Ecart_Collect_CreditCard implements Ecart_Collect_Interface
- {
- /**
- * @static
- * @var const array
- */
- static protected $_cards = array(
- // 'ALL' => Zend_Validate_CreditCard::ALL,
- 'AMERICAN_EXPRESS' => Zend_Validate_CreditCard::AMERICAN_EXPRESS,
- 'UNIONPAY' => Zend_Validate_CreditCard::UNIONPAY,
- 'DINERS_CLUB' => Zend_Validate_CreditCard::DINERS_CLUB,
- 'DINERS_CLUB_US' => Zend_Validate_CreditCard::DINERS_CLUB_US,
- 'DISCOVER' => Zend_Validate_CreditCard::DISCOVER,
- 'JCB' => Zend_Validate_CreditCard::JCB,
- 'LASER' => Zend_Validate_CreditCard::LASER,
- 'MAESTRO' => Zend_Validate_CreditCard::MAESTRO,
- 'MASTERCARD' => Zend_Validate_CreditCard::MASTERCARD,
- 'SOLO' => Zend_Validate_CreditCard::SOLO,
- 'VISA' => Zend_Validate_CreditCard::VISA,
-
- );
- /**
- *
- * @static
- * @return array
- */
- public static function collect()
- {
- return self::$_cards;
- }
- /**
- *
- * @static
- * @param string $id
- * @return string
- */
- public static function getName($id)
- {
- if (!$id) {
- return '';
- }
- if (strstr($id, ",")) {
- $ret = array();
- foreach(explode(",", $id) as $key) {
- if (array_key_exists($key, self::$_cards))
- $ret[$key] = self::$_cards[$key];
- }
- return implode(", ", $ret);
- }
- return self::$_cards[$id];
- }
- }