classes/XLite/Model/Payment/Method.php line 22

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved.
  4.  * See https://www.x-cart.com/license-agreement.html for license details.
  5.  */
  6. namespace XLite\Model\Payment;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Includes\Utils\ConfigParser;
  9. use Includes\Utils\Module\Module;
  10. use XCart\Domain\ModuleManagerDomain;
  11. use XLite\Core\Cache\ExecuteCachedTrait;
  12. /**
  13.  * Payment method
  14.  *
  15.  * @ORM\Entity
  16.  * @ORM\Table  (name="payment_methods",
  17.  *      indexes={
  18.  *          @ORM\Index (name="orderby", columns={"orderby"}),
  19.  *          @ORM\Index (name="class", columns={"class","enabled"}),
  20.  *          @ORM\Index (name="enabled", columns={"enabled"}),
  21.  *          @ORM\Index (name="serviceName", columns={"service_name"})
  22.  *      }
  23.  * )
  24.  */
  25. class Method extends \XLite\Model\Base\I18n
  26. {
  27.     use ExecuteCachedTrait;
  28.     /**
  29.      * Type codes
  30.      */
  31.     public const TYPE_ALLINONE    'A';
  32.     public const TYPE_CC_GATEWAY  'C';
  33.     public const TYPE_ALTERNATIVE 'N';
  34.     public const TYPE_OFFLINE     'O';
  35.     /**
  36.      * Payment method unique id
  37.      *
  38.      * @var integer
  39.      *
  40.      * @ORM\Id
  41.      * @ORM\GeneratedValue (strategy="AUTO")
  42.      * @ORM\Column         (type="integer")
  43.      */
  44.     protected $method_id;
  45.     /**
  46.      * Method service name (gateway or API name)
  47.      *
  48.      * @var string
  49.      *
  50.      * @ORM\Column (type="string", length=128)
  51.      */
  52.     protected $service_name;
  53.     /**
  54.      * Process class name
  55.      *
  56.      * @var string
  57.      *
  58.      * @ORM\Column (type="string", length=255)
  59.      */
  60.     protected $class;
  61.     /**
  62.      * Specific module family name
  63.      *
  64.      * @var string
  65.      *
  66.      * @ORM\Column (type="string", length=255)
  67.      */
  68.     protected $moduleName '';
  69.     /**
  70.      * Position
  71.      *
  72.      * @var integer
  73.      *
  74.      * @ORM\Column (type="integer")
  75.      */
  76.     protected $orderby 0;
  77.     /**
  78.      * Position in popup
  79.      *
  80.      * @var integer
  81.      *
  82.      * @ORM\Column (type="integer")
  83.      */
  84.     protected $adminOrderby 0;
  85.     /**
  86.      * Enabled status
  87.      *
  88.      * @var boolean
  89.      *
  90.      * @ORM\Column (type="boolean")
  91.      */
  92.     protected $enabled false;
  93.     /**
  94.      * Added status
  95.      *
  96.      * @var boolean
  97.      *
  98.      * @ORM\Column (type="boolean")
  99.      */
  100.     protected $added false;
  101.     /**
  102.      * Credit card rate
  103.      *
  104.      * @var string
  105.      *
  106.      * @ORM\Column (type="string")
  107.      */
  108.     protected $creditCardRate '';
  109.     /**
  110.      * Transaction fee
  111.      *
  112.      * @var string
  113.      *
  114.      * @ORM\Column (type="string")
  115.      */
  116.     protected $transactionFee '';
  117.     /**
  118.      * Predefined status
  119.      *
  120.      * @var boolean
  121.      *
  122.      * @ORM\Column (type="boolean")
  123.      */
  124.     protected $predefined false;
  125.     /**
  126.      * Type
  127.      *
  128.      * @var string
  129.      *
  130.      * @ORM\Column (type="string", options={ "fixed": true }, length=1)
  131.      */
  132.     protected $type self::TYPE_OFFLINE;
  133.     /**
  134.      * Settings
  135.      *
  136.      * @var \XLite\Model\Payment\MethodSetting
  137.      *
  138.      * @ORM\OneToMany (targetEntity="XLite\Model\Payment\MethodSetting", mappedBy="payment_method", cascade={"all"})
  139.      */
  140.     protected $settings;
  141.     /**
  142.      * Flag:
  143.      *   1 - method has been got from marketplace,
  144.      *   0 - method has been added after distr or module installation
  145.      *
  146.      * @var boolean
  147.      *
  148.      * @ORM\Column (type="boolean")
  149.      */
  150.     protected $fromMarketplace false;
  151.     /**
  152.      * @ORM\Column (type="string", nullable=true)
  153.      */
  154.     protected $modulePageURL;
  155.     /**
  156.      * Countries of merchant (merchants from these countries can sign up and use this method)
  157.      *
  158.      * @var array
  159.      *
  160.      * @ORM\Column (type="array", nullable=true)
  161.      */
  162.     protected $countries;
  163.     /**
  164.      * Excluded countries (merchants from these countries cannot sign up for payment account)
  165.      *
  166.      * @var array
  167.      *
  168.      * @ORM\Column (type="array", nullable=true)
  169.      */
  170.     protected $exCountries;
  171.     /**
  172.      * Settings
  173.      *
  174.      * @var \XLite\Model\Payment\MethodCountryPosition[]
  175.      *
  176.      * @ORM\OneToMany (targetEntity="XLite\Model\Payment\MethodCountryPosition", mappedBy="paymentMethod", cascade={"all"})
  177.      */
  178.     protected $countryPositions;
  179.     /**
  180.      * @var \Doctrine\Common\Collections\Collection
  181.      *
  182.      * @ORM\OneToMany (targetEntity="XLite\Model\Payment\MethodTranslation", mappedBy="owner", cascade={"all"})
  183.      */
  184.     protected $translations;
  185.     /**
  186.      * Get processor
  187.      *
  188.      * @return \XLite\Model\Payment\Base\Processor|null
  189.      */
  190.     public function getProcessor()
  191.     {
  192.         $class $this->getClass();
  193.         return isset($class) && class_exists($class) ? $class::getInstance() : null;
  194.     }
  195.     /**
  196.      * @return bool
  197.      */
  198.     public function isExisting()
  199.     {
  200.         if ($this->isModuleInstalled()) {
  201.             $result $this->isModuleEnabled()
  202.                 ? $this->isPaymentClassExists()
  203.                 : $this->isFileWithPaymentClassExists();
  204.         } else {
  205.             $result true;
  206.         }
  207.         return $result;
  208.     }
  209.     protected function isPaymentClassExists()
  210.     {
  211.         return class_exists($this->getClass());
  212.     }
  213.     protected function isFileWithPaymentClassExists()
  214.     {
  215.         $class $this->getClass();
  216.         if (
  217.             strpos($class'XLite') !== 0
  218.             && preg_match('/(\w+\\\\\w+)\\\\(.*)/'$class$matches)
  219.         ) {
  220.             return file_exists(
  221.                 LC_DIR_MODULES
  222.                 str_replace('\\''/'$matches[1] . '/src/' $matches[2])
  223.                 . '.php'
  224.             );
  225.         }
  226.         return file_exists(
  227.             LC_DIR_CLASSES
  228.             str_replace('\\''/'$class)
  229.             . '.php'
  230.         );
  231.     }
  232.     /**
  233.      * Check - enabled method or not
  234.      * FIXME - must be removed
  235.      *
  236.      * @return boolean
  237.      */
  238.     public function isEnabled()
  239.     {
  240.         return ($this->getEnabled() || $this->isForcedEnabled())
  241.             && $this->getAdded()
  242.             && $this->isModuleEnabled()
  243.             && $this->getProcessor()
  244.             && $this->getProcessor()->isConfigured($this);
  245.     }
  246.     /**
  247.      * Set class
  248.      *
  249.      * @return void
  250.      */
  251.     public function setClass($class)
  252.     {
  253.         $this->class $class;
  254.         if (strpos($class'XLite') !== 0) {
  255.             [$author$name] = explode('\\'$class3);
  256.             $this->setModuleName($author '_' $name);
  257.         }
  258.     }
  259.     /**
  260.      * Get setting value by name
  261.      *
  262.      * @param string $name Name
  263.      *
  264.      * @return string|void
  265.      */
  266.     public function getSetting($name)
  267.     {
  268.         $entity $this->getSettingEntity($name);
  269.         return $entity $entity->getValue() : null;
  270.     }
  271.     /**
  272.      * Get position
  273.      *
  274.      * @return integer
  275.      */
  276.     public function getPosition()
  277.     {
  278.         return $this->getOrderby();
  279.     }
  280.     /**
  281.      * Set position
  282.      *
  283.      * @param integer $position Position
  284.      *
  285.      * @return integer
  286.      */
  287.     public function setPosition($position)
  288.     {
  289.         return $this->setOrderby($position);
  290.     }
  291.     /**
  292.      * Get setting by name
  293.      *
  294.      * @param string $name Name
  295.      *
  296.      * @return \XLite\Model\Payment\MethodSetting
  297.      */
  298.     public function getSettingEntity($name)
  299.     {
  300.         $result null;
  301.         foreach ($this->getSettings() as $setting) {
  302.             if ($setting->getName() == $name) {
  303.                 $result $setting;
  304.                 break;
  305.             }
  306.         }
  307.         return $result;
  308.     }
  309.     /**
  310.      * Set setting value by name
  311.      *
  312.      * @param string $name  Name
  313.      * @param string $value Value
  314.      *
  315.      * @return boolean
  316.      */
  317.     public function setSetting($name$value)
  318.     {
  319.         $result false;
  320.         // Update settings which is already stored in database
  321.         $setting $this->getSettingEntity($name);
  322.         if ($setting) {
  323.             $setting->setValue(strval($value));
  324.             $result true;
  325.         } else {
  326.             // Create setting which is not in database but specified in the processor class
  327.             $processor $this->getProcessor();
  328.             if ($processor && method_exists($processor'getAvailableSettings')) {
  329.                 $availableSettings $processor->getAvailableSettings();
  330.                 if (in_array($name$availableSettings)) {
  331.                     $setting = new \XLite\Model\Payment\MethodSetting();
  332.                     $setting->setName($name);
  333.                     $setting->setValue(strval($value));
  334.                     $setting->setPaymentMethod($this);
  335.                     $this->addSettings($setting);
  336.                     \XLite\Core\Database::getEM()->persist($setting);
  337.                 }
  338.             }
  339.         }
  340.         return $result;
  341.     }
  342.     /**
  343.      * Constructor
  344.      *
  345.      * @param array $data Entity properties OPTIONAL
  346.      *
  347.      * @return void
  348.      */
  349.     public function __construct(array $data = [])
  350.     {
  351.         $this->settings     = new \Doctrine\Common\Collections\ArrayCollection();
  352.         $this->transactions = new \Doctrine\Common\Collections\ArrayCollection();
  353.         parent::__construct($data);
  354.     }
  355.     /**
  356.      * Call processor methods
  357.      *
  358.      * @param string $method    Method name
  359.      * @param array  $arguments Arguments OPTIONAL
  360.      *
  361.      * @return mixed
  362.      */
  363.     public function __call($method, array $arguments = [])
  364.     {
  365.         array_unshift($arguments$this);
  366.         return $this->getProcessor()
  367.             ? call_user_func_array([$this->getProcessor(), $method], $arguments)
  368.             : null;
  369.     }
  370.     /**
  371.      * Get warning note
  372.      *
  373.      * @return string
  374.      */
  375.     public function getWarningNote()
  376.     {
  377.         $message null;
  378.         if ($this->getProcessor() && !$this->getProcessor()->isConfigured($this)) {
  379.             $message = static::t('The method is not configured and cannot be used');
  380.         }
  381.         if (!$message) {
  382.             $message $this->getProcessor() ? $this->getProcessor()->getWarningNote($this) : null;
  383.         }
  384.         return $message;
  385.     }
  386.     /**
  387.      * Get payment method admin zone icon URL
  388.      *
  389.      * @return string
  390.      */
  391.     public function getAdminIconURL()
  392.     {
  393.         $processor $this->getProcessor();
  394.         [$author$name] = explode('_'$this->getModuleName());
  395.         $url $processor
  396.             $processor->getAdminIconURL($this)
  397.             : null;
  398.         if ($url === true) {
  399.             $url $author && $name
  400.                 \XLite\Core\Layout::getInstance()
  401.                     ->getResourceWebPath('modules/' $author '/' $name '/method_icon.png')
  402.                 : null;
  403.         }
  404.         if (!$url) {
  405.             $addonImagesUrl ConfigParser::getOptions(['marketplace''addon_images_url']);
  406.             $url            "{$addonImagesUrl}{$author}/{$name}/list_icon.jpg";
  407.         }
  408.         return $url;
  409.     }
  410.     /**
  411.      * Get payment method alternative admin zone icon URL
  412.      *
  413.      * @return string
  414.      */
  415.     public function getAltAdminIconURL()
  416.     {
  417.         [$author$name] = Module::explodeModuleId($this->getProcessor()->getModuleId());
  418.         return $author && $name
  419.             \XLite\Core\Layout::getInstance()->getResourceWebPath(
  420.                 'modules/' $author '/' $name '/method_icon_' $this->getAdaptedServiceName() . '.png'
  421.             )
  422.             : null;
  423.     }
  424.     /**
  425.      * Get adapted service name (e.g. 'Sage Pay form protocol' will be converted to 'Sage_Pay_form_protocol')
  426.      *
  427.      * @return string
  428.      */
  429.     public function getAdaptedServiceName()
  430.     {
  431.         return preg_replace('/_+/''_'preg_replace('/[^\w\d]+/''_'$this->getServiceName()));
  432.     }
  433.     /**
  434.      * Set enabled
  435.      *
  436.      * @param boolean $enabled Property value
  437.      *
  438.      * @return \XLite\Model\Payment\Method
  439.      */
  440.     public function setEnabled($enabled)
  441.     {
  442.         $this->enabled $enabled;
  443.         if ($this->getProcessor()) {
  444.             $this->getProcessor()->enableMethod($this);
  445.         }
  446.         return $this;
  447.     }
  448.     /**
  449.      * Translation getter
  450.      *
  451.      * @return string
  452.      */
  453.     public function getDescription()
  454.     {
  455.         $description $this->getSoftTranslation()->getDescription();
  456.         if (\XLite\Core\Auth::getInstance()->isOperatingAsUserMode()) {
  457.             $methods \XLite\Core\Auth::getInstance()->getOperateAsUserPaymentMethods();
  458.             $currentServiceName $this->getServiceName();
  459.             $found array_reduce(
  460.                 $methods,
  461.                 static function ($carry$method) use ($currentServiceName) {
  462.                     return $carry ?: $method->getServiceName() === $currentServiceName;
  463.                 },
  464.                 false
  465.             );
  466.             if ($found && !$this->isEnabled()) {
  467.                 $description = static::t('This method is displayed because you are logged in as admin and operating as another user');
  468.             }
  469.         }
  470.         return $description;
  471.     }
  472.     /**
  473.      * Set 'added' property
  474.      *
  475.      * @param boolean $added Property value
  476.      *
  477.      * @return \XLite\Model\Payment\Method
  478.      */
  479.     public function setAdded($added)
  480.     {
  481.         $this->added $added;
  482.         if (!$added) {
  483.             $this->setEnabled(false);
  484.         }
  485.         return $this;
  486.     }
  487.     /**
  488.      * Get message why we can't switch payment method
  489.      *
  490.      * @return string
  491.      */
  492.     public function getNotSwitchableReason()
  493.     {
  494.         return static::t('This payment method is not configured.');
  495.     }
  496.     /**
  497.      * Get payment module ID
  498.      *
  499.      * @return string|null
  500.      */
  501.     public function getModuleId()
  502.     {
  503.         [$author$name] = explode('_'$this->getModuleName());
  504.         $moduleId Module::buildId($author$name);
  505.         return $this->getModuleManagerDomain()->isEnabled($moduleId)
  506.             ? $moduleId
  507.             null;
  508.     }
  509.     /**
  510.      * @return bool
  511.      */
  512.     public function isModuleInstalled()
  513.     {
  514.         if (!$this->getModuleName()) {
  515.             return false// for example PhoneOrdering
  516.         }
  517.         [$author$name] = explode('_'$this->getModuleName());
  518.         $moduleId Module::buildId($author$name);
  519.         return $this->getModuleManagerDomain()->isInstalled($moduleId);
  520.     }
  521.     /**
  522.      * Get method_id
  523.      *
  524.      * @return integer
  525.      */
  526.     public function getMethodId()
  527.     {
  528.         return $this->method_id;
  529.     }
  530.     /**
  531.      * Set service_name
  532.      *
  533.      * @param string $serviceName
  534.      *
  535.      * @return Method
  536.      */
  537.     public function setServiceName($serviceName)
  538.     {
  539.         $this->service_name $serviceName;
  540.         return $this;
  541.     }
  542.     /**
  543.      * Get service_name
  544.      *
  545.      * @return string
  546.      */
  547.     public function getServiceName()
  548.     {
  549.         return $this->service_name;
  550.     }
  551.     /**
  552.      * Get class
  553.      *
  554.      * @return string
  555.      */
  556.     public function getClass()
  557.     {
  558.         return $this->class;
  559.     }
  560.     /**
  561.      * Set moduleName
  562.      *
  563.      * @param string $moduleName
  564.      *
  565.      * @return Method
  566.      */
  567.     public function setModuleName($moduleName)
  568.     {
  569.         $this->moduleName $moduleName;
  570.         return $this;
  571.     }
  572.     /**
  573.      * Get moduleName
  574.      *
  575.      * @return string
  576.      */
  577.     public function getModuleName()
  578.     {
  579.         return $this->moduleName;
  580.     }
  581.     /**
  582.      * Set orderby
  583.      *
  584.      * @param integer $orderby
  585.      *
  586.      * @return Method
  587.      */
  588.     public function setOrderby($orderby)
  589.     {
  590.         $this->orderby $orderby;
  591.         return $this;
  592.     }
  593.     /**
  594.      * Get orderby
  595.      *
  596.      * @return integer
  597.      */
  598.     public function getOrderby()
  599.     {
  600.         return $this->orderby;
  601.     }
  602.     /**
  603.      * Set adminOrderby
  604.      *
  605.      * @param integer $adminOrderby
  606.      *
  607.      * @return Method
  608.      */
  609.     public function setAdminOrderby($adminOrderby)
  610.     {
  611.         $this->adminOrderby $adminOrderby;
  612.         return $this;
  613.     }
  614.     /**
  615.      * Get adminOrderby
  616.      *
  617.      * @return integer
  618.      */
  619.     public function getAdminOrderby()
  620.     {
  621.         return $this->adminOrderby;
  622.     }
  623.     /**
  624.      * Get enabled
  625.      *
  626.      * @return boolean
  627.      */
  628.     public function getEnabled()
  629.     {
  630.         return $this->enabled;
  631.     }
  632.     /**
  633.      * Get moduleEnabled
  634.      *
  635.      * @return boolean
  636.      */
  637.     public function isModuleEnabled()
  638.     {
  639.         $moduleName $this->getModuleName();
  640.         return $this->executeCachedRuntime(
  641.             function () use ($moduleName) {
  642.                 $result true;
  643.                 if ($moduleName) {
  644.                     [$author$name] = explode('_'$moduleName);
  645.                     $moduleId Module::buildId($author$name);
  646.                     $result $this->getModuleManagerDomain()->isEnabled($moduleId);
  647.                 }
  648.                 return $result;
  649.             },
  650.             [__CLASS____METHOD__$moduleName]
  651.         );
  652.     }
  653.     /**
  654.      * Get added
  655.      *
  656.      * @return boolean
  657.      */
  658.     public function getAdded()
  659.     {
  660.         return $this->added;
  661.     }
  662.     /**
  663.      * Set type
  664.      *
  665.      * @param string $type
  666.      *
  667.      * @return Method
  668.      */
  669.     public function setType($type)
  670.     {
  671.         $this->type $type;
  672.         return $this;
  673.     }
  674.     /**
  675.      * Get type
  676.      *
  677.      * @return string
  678.      */
  679.     public function getType()
  680.     {
  681.         return $this->type;
  682.     }
  683.     /**
  684.      * Set fromMarketplace
  685.      *
  686.      * @param boolean $fromMarketplace
  687.      *
  688.      * @return Method
  689.      */
  690.     public function setFromMarketplace($fromMarketplace)
  691.     {
  692.         $this->fromMarketplace $fromMarketplace;
  693.         return $this;
  694.     }
  695.     /**
  696.      * Get fromMarketplace
  697.      *
  698.      * @return boolean
  699.      */
  700.     public function getFromMarketplace()
  701.     {
  702.         return $this->fromMarketplace;
  703.     }
  704.     /**
  705.      * @param string $modulePageURL
  706.      *
  707.      * @return Method
  708.      */
  709.     public function setModulePageURL($modulePageURL)
  710.     {
  711.         $this->modulePageURL $modulePageURL;
  712.         return $this;
  713.     }
  714.     /**
  715.      * @return string
  716.      */
  717.     public function getModulePageURL()
  718.     {
  719.         return $this->modulePageURL;
  720.     }
  721.     /**
  722.      * Set countries
  723.      *
  724.      * @param array $countries
  725.      *
  726.      * @return Method
  727.      */
  728.     public function setCountries($countries)
  729.     {
  730.         $this->countries $countries;
  731.         return $this;
  732.     }
  733.     /**
  734.      * Get countries
  735.      *
  736.      * @return array
  737.      */
  738.     public function getCountries()
  739.     {
  740.         return $this->countries;
  741.     }
  742.     /**
  743.      * Set exCountries
  744.      *
  745.      * @param array $exCountries
  746.      *
  747.      * @return Method
  748.      */
  749.     public function setExCountries($exCountries)
  750.     {
  751.         $this->exCountries $exCountries;
  752.         return $this;
  753.     }
  754.     /**
  755.      * Get exCountries
  756.      *
  757.      * @return array
  758.      */
  759.     public function getExCountries()
  760.     {
  761.         return $this->exCountries;
  762.     }
  763.     /**
  764.      * Add settings
  765.      *
  766.      * @param \XLite\Model\Payment\MethodSetting $settings
  767.      *
  768.      * @return Method
  769.      */
  770.     public function addSettings(\XLite\Model\Payment\MethodSetting $settings)
  771.     {
  772.         $this->settings[] = $settings;
  773.         return $this;
  774.     }
  775.     /**
  776.      * Get settings
  777.      *
  778.      * @return \Doctrine\Common\Collections\Collection|\XLite\Model\Payment\MethodSetting[]
  779.      */
  780.     public function getSettings()
  781.     {
  782.         return $this->settings;
  783.     }
  784.     /**
  785.      * @return MethodCountryPosition[]
  786.      */
  787.     public function getCountryPositions()
  788.     {
  789.         return $this->countryPositions;
  790.     }
  791.     /**
  792.      * @param string $countryCode
  793.      *
  794.      * @return MethodCountryPosition|null
  795.      */
  796.     public function getCountryPosition($countryCode): ?MethodCountryPosition
  797.     {
  798.         foreach ($this->countryPositions ?: [] as $countryPosition) {
  799.             if ($countryPosition->getCountryCode() === $countryCode) {
  800.                 return $countryPosition;
  801.             }
  802.         }
  803.         return null;
  804.     }
  805.     /**
  806.      * @param MethodCountryPosition $countryPosition
  807.      */
  808.     public function addCountryPositions($countryPosition): void
  809.     {
  810.         $this->countryPositions[] = $countryPosition;
  811.     }
  812.     /**
  813.      * @param string $creditCardRate
  814.      */
  815.     public function setCreditCardRate($creditCardRate)
  816.     {
  817.         $this->creditCardRate $creditCardRate;
  818.     }
  819.     /**
  820.      * @return string
  821.      */
  822.     public function getCreditCardRate()
  823.     {
  824.         return $this->creditCardRate;
  825.     }
  826.     /**
  827.      * @param string $transactionFee
  828.      */
  829.     public function setTransactionFee($transactionFee)
  830.     {
  831.         $this->transactionFee $transactionFee;
  832.     }
  833.     /**
  834.      * @return string
  835.      */
  836.     public function getTransactionFee()
  837.     {
  838.         return $this->transactionFee;
  839.     }
  840.     /**
  841.      * @return boolean
  842.      */
  843.     public function isOffline()
  844.     {
  845.         return $this->type === self::TYPE_OFFLINE;
  846.     }
  847.     /**
  848.      * @return ModuleManagerDomain
  849.      */
  850.     protected function getModuleManagerDomain()
  851.     {
  852.         return \XCart\Container::getContainer()->get(ModuleManagerDomain::class);
  853.     }
  854.     // {{{ Translation Getters / setters
  855.     /**
  856.      * @return string
  857.      */
  858.     public function getTitle()
  859.     {
  860.         return $this->getTranslationField(__FUNCTION__);
  861.     }
  862.     /**
  863.      * @param string $title
  864.      *
  865.      * @return \XLite\Model\Base\Translation
  866.      */
  867.     public function setTitle($title)
  868.     {
  869.         return $this->setTranslationField(__FUNCTION__$title);
  870.     }
  871.     /**
  872.      * @param string $description
  873.      *
  874.      * @return \XLite\Model\Base\Translation
  875.      */
  876.     public function setDescription($description)
  877.     {
  878.         return $this->setTranslationField(__FUNCTION__$description);
  879.     }
  880.     /**
  881.      * @return string
  882.      */
  883.     public function getAdminDescription()
  884.     {
  885.         return $this->getTranslationField(__FUNCTION__);
  886.     }
  887.     /**
  888.      * @param string $adminDescription
  889.      *
  890.      * @return \XLite\Model\Base\Translation
  891.      */
  892.     public function setAdminDescription($adminDescription)
  893.     {
  894.         return $this->setTranslationField(__FUNCTION__$adminDescription);
  895.     }
  896.     /**
  897.      * @return string
  898.      */
  899.     public function getAltAdminDescription()
  900.     {
  901.         return $this->getTranslationField(__FUNCTION__);
  902.     }
  903.     /**
  904.      * @param string $altAdminDescription
  905.      *
  906.      * @return \XLite\Model\Base\Translation
  907.      */
  908.     public function setAltAdminDescription($altAdminDescription)
  909.     {
  910.         return $this->setTranslationField(__FUNCTION__$altAdminDescription);
  911.     }
  912.     /**
  913.      * @return string
  914.      */
  915.     public function getInstruction()
  916.     {
  917.         return $this->getTranslationField(__FUNCTION__);
  918.     }
  919.     /**
  920.      * @param string $instruction
  921.      *
  922.      * @return \XLite\Model\Base\Translation
  923.      */
  924.     public function setInstruction($instruction)
  925.     {
  926.         return $this->setTranslationField(__FUNCTION__$instruction);
  927.     }
  928.     // }}}
  929. }