League\FactoryMuffin\FactoryMuffin::__construct PHP Метод

__construct() публичный Метод

Create a new factory muffin instance.
public __construct ( League\FactoryMuffin\Stores\StoreInterface $store = null, GeneratorFactory $factory = null ) : void
$store League\FactoryMuffin\Stores\StoreInterface The store instance.
$factory League\FactoryMuffin\Generators\GeneratorFactory The generator factory instance.
Результат void
    public function __construct(StoreInterface $store = null, GeneratorFactory $factory = null)
    {
        $this->store = $store ?: new ModelStore();
        $this->factory = $factory ?: new GeneratorFactory();
    }

Usage Example

Пример #1
0
 /**
  * @param array $models ex: [ Model1::className(), Model2::className() ]
  * @throws ModelException
  * @throws ModelNotFoundException
  * @throws \League\FactoryMuffin\Exceptions\DefinitionAlreadyDefinedException
  */
 public function __construct($models = [])
 {
     parent::__construct(new ModelStoreYii());
     if (!empty($models)) {
         $this->loadModelDefinitions($models);
     }
 }
All Usage Examples Of League\FactoryMuffin\FactoryMuffin::__construct