BaseContext.class.php (613B)
1 <?php 2 3 4 namespace cms\generator; 5 6 7 use cms\generator\link\LinkFormat; 8 use cms\generator\link\PreviewLink; 9 use cms\generator\link\PublicLink; 10 11 abstract class BaseContext 12 { 13 /** 14 * Scheme, 15 * one of PREVIEW or PUBLIC. 16 * @var int 17 */ 18 public $scheme; 19 20 public abstract function getCacheKey(); 21 22 public abstract function getObjectId(); 23 24 /** 25 * @return LinkFormat 26 */ 27 public function getLinkScheme() { 28 29 switch( $this->scheme ) { 30 case Producer::SCHEME_PREVIEW: 31 return new PreviewLink( $this ); 32 case Producer::SCHEME_PUBLIC: 33 return new PublicLink( $this ); 34 default: 35 return null; 36 } 37 } 38 39 }