|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
-
- namespace Lc\ShopBundle\Model;
-
- use Doctrine\ORM\Mapping as ORM;
-
-
- abstract class MerchantConfig
- {
-
-
- protected $merchant;
-
-
-
- protected $name;
-
-
-
- protected $value;
-
- public static $availableOptions = [] ;
-
- public function getMerchant(): ?Merchant
- {
- return $this->merchant;
- }
-
- public function setMerchant(?Merchant $merchant): self
- {
- $this->merchant = $merchant;
-
- return $this;
- }
-
- public function getName(): ?string
- {
- return $this->name;
- }
-
- public function setName(string $name): self
- {
- $this->name = $name;
-
- return $this;
- }
-
- public function getValue(): ?string
- {
- return $this->value;
- }
-
- public function setValue(string $value): self
- {
- $this->value = $value;
-
- return $this;
- }
-
- public static function getAvailableOptions(): array
- {
- return static::$availableOptions ;
- }
-
- public function getOption()
- {
- if(isset(static::$availableOptions[$this->getName()])) {
- return static::$availableOptions[$this->getName()] ;
- }
- return false ;
- }
-
- public function getOptionValue($key, $default = '')
- {
- $option = $this->getOption() ;
- if($option) {
- if(isset($option[$key])) {
- return $option[$key] ;
- }
- }
-
- return $default ;
- }
-
- public function getLabel()
- {
- return $this->getOptionValue('label') ;
- }
-
- public function getFieldType()
- {
- return $this->getOptionValue('type', 'text') ;
- }
-
- public function getDefaultValue()
- {
- return $this->getOptionValue('default') ;
- }
- }
|