src/Factory/ChargeRequest.php
public function setCardExpYear($sCardExpYear)
    {
        //  Validate
        if (is_numeric($sCardExpYear)) {

            //  Accept two digits or 4 digits only
            if (strlen($sCardExpYear) == 2 || strlen($sCardExpYear) == 4) {

                //  Two digit values should be turned into a 4 digit value
                if (strlen($sCardExpYear) == 2) {

                    //  Sorry people living in the 2100's, I'm very sorry everything is broken.
                    $sCardExpYear = '20' . $sCardExpYear;
                }

                $iYear = (int) $sCardExpYear;
                $oNow  = Factory::factory('DateTime');

                if ($oNow->format('Y') > $iYear) {
                    throw new ChargeRequestException(
                        '"' . $sCardExpYear . '" is an invalid expiry year; must be ' . $oNow->format('Y') . ' or later.',
                        1
                    );
                }

                $this->oCard->exp->year = (string) $iYear;
                return $this;

            } else {
                throw new ChargeRequestException(
                    '"' . $sCardExpYear . '" is an invalid expiry year; must be 2 or 4 digits.',
                    1
                );
            }

        } else {
            throw new ChargeRequestException(
                '"' . $sCardExpYear . '" is an invalid expiry year; must be numeric.',
                1
            );
        }
    }
public function setCardExpYear($sCardExpYear)
    {
        //  Validate
        if (is_numeric($sCardExpYear)) {

            //  Accept two digits or 4 digits only
            if (strlen($sCardExpYear) == 2 || strlen($sCardExpYear) == 4) {

                //  Two digit values should be turned into a 4 digit value
                if (strlen($sCardExpYear) == 2) {

                    //  Sorry people living in the 2100's, I'm very sorry everything is broken.
                    $sCardExpYear = '20' . $sCardExpYear;
                }

                $iYear = (int) $sCardExpYear;
                $oNow  = Factory::factory('DateTime');

                if ($oNow->format('Y') > $iYear) {
                    throw new ChargeRequestException(
                        '"' . $sCardExpYear . '" is an invalid expiry year; must be ' . $oNow->format('Y') . ' or later.',
                        1
                    );
                }

                $this->oCard->exp->year = (string) $iYear;
                return $this;

            } else {
                throw new ChargeRequestException(
                    '"' . $sCardExpYear . '" is an invalid expiry year; must be 2 or 4 digits.',
                    1
                );
            }

        } else {
            throw new ChargeRequestException(
                '"' . $sCardExpYear . '" is an invalid expiry year; must be numeric.',
                1
            );
        }
    }
public function setCardExpYear ( $ sCardExpYear ) { //  Validate if ( is_numeric ( $ sCardExpYear ) ) { //  Accept two digits or 4 digits only if ( strlen ( $ sCardExpYear ) == 2 || strlen ( $ sCardExpYear ) == 4 ) { //  Two digit values should be turned into a 4 digit value if ( strlen ( $ sCardExpYear ) == 2 ) { //  Sorry people living in the 2100's, I'm very sorry everything is broken. $ sCardExpYear = '20' . $ sCardExpYear ; } $ iYear = ( int ) $ sCardExpYear ; $ oNow = Factory :: factory ( 'DateTime' ) ; if ( $ oNow -> format ( 'Y' ) > $ iYear ) { throw new ChargeRequestException ( '"' . $ sCardExpYear . '" is an invalid expiry year; must be ' . $ oNow -> format ( 'Y' ) . ' or later.' , 1 ) ; } $ this -> oCard -> exp -> year = ( string ) $ iYear ; return $ this ; } else { throw new ChargeRequestException ( '"' . $ sCardExpYear . '" is an invalid expiry year; must be 2 or 4 digits.' , 1 ) ; } } else { throw new ChargeRequestException ( '"' . $ sCardExpYear . '" is an invalid expiry year; must be numeric.' , 1 ) ; } }
Set the card's expiry year

@param string $sCardExpYear The card's expiry year

@throws ChargeRequestException
@return $this
Set the card s expiry year