Blame view

frontend/widgets/VariantOptionHelper.php 907 Bytes
6ba3c88a   Alex Savenko   all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  <?php
      
      namespace frontend\widgets;
      
      use artbox\catalog\models\VariantOptionExcl;
      
      class VariantOptionHelper
      {
          protected $options = [];
          
          public function addOption(VariantOptionExcl $option)
          {
              if (!array_key_exists($option->id, $this->options)) {
                  $this->options[ $option->id ][ 'option' ] = $option;
                  $this->options[ $option->id ][ 'variants' ] = new VariantHelper();
              }
          }
          
          public function getVariantContainer(VariantOptionExcl $option)
          {
              /**
               * @var \frontend\widgets\VariantHelper $variantHelper
               */
              $variantHelper = $this->options[ $option->id ][ 'variants' ];
              return $variantHelper;
          }
          
          public function getOptions()
          {
              return $this->options;
          }
      }