oxbasketcontentmarkgenerator.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class oxBasketContentMarkGenerator
00007 {
00011     const DEFAULT_EXPLANATION_MARK = '**';
00012 
00018     private $_aMarks;
00019 
00025     private $_oBasket;
00026 
00032     public function __construct(oxBasket $oBasket)
00033     {
00034         $this->_oBasket = $oBasket;
00035     }
00036 
00044     public function getMark($sMarkIdentification)
00045     {
00046         if (is_null($this->_aMarks)) {
00047             $sCurrentMark = self::DEFAULT_EXPLANATION_MARK;
00048             $aMarks = $this->_formMarks($sCurrentMark);
00049             $this->_aMarks = $aMarks;
00050         }
00051 
00052         return $this->_aMarks[$sMarkIdentification];
00053     }
00054 
00060     private function _getBasket()
00061     {
00062         return $this->_oBasket;
00063     }
00064 
00072     private function _formMarks($sCurrentMark)
00073     {
00074         $oBasket = $this->_getBasket();
00075         $aMarks = array();
00076         if ($oBasket->hasSkipedDiscount()) {
00077             $aMarks['skippedDiscount'] = $sCurrentMark;
00078             $sCurrentMark .= '*';
00079         }
00080         if ($oBasket->hasArticlesWithDownloadableAgreement()) {
00081             $aMarks['downloadable'] = $sCurrentMark;
00082             $sCurrentMark .= '*';
00083         }
00084         if ($oBasket->hasArticlesWithIntangibleAgreement()) {
00085             $aMarks['intangible'] = $sCurrentMark;
00086         }
00087 
00088         return $aMarks;
00089     }
00090 }