CropFactory.php 1.07 KB
<?php

namespace backend\components\croppers;

use Yii;

class CropFactory
{
    private static $instance;
    private $crops = [];

    private function __construct() {
        $this->init();
    }

    private function init() {
        $this->crops[] = new EconomixCrop();
        $this->crops[] = new GoldenGardenFlowersCrop();
        $this->crops[] = new GoldenGardenVegiesCrop();
        $this->crops[] = new GoldenGardenGiantCrop();
        $this->crops[] = new UkrSeedsNovikGiantCrop();
        $this->crops[] = new UkrSeedsNovikMiniCrop();
        $this->crops[] = new UkrSeedsNovikVegiesCrop();
        $this->crops[] = new UkrSeedsNovikFlowersCrop();
        $this->crops[] = new UkrSeedsTekVegiesCrop();
        $this->crops[] = new UkrSeedsFloraMiniCrop();
        $this->crops[] = new UkrSeedsFloraVegiesCrop();
    }

    public function getCrop($crop_id) {
        return $this->crops[$crop_id];
    }

    public static function getInstance() {
        if (null === self::$instance) {
            self::$instance = new self();
        }
        return self::$instance;
    }
}