oxbasketcontentmarkgenerator.php

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