src/FactoryMuffin.php
public function define($name)
    {
        if (isset($this->definitions[$name])) {
            throw new DefinitionAlreadyDefinedException($name);
        }

        if (strpos($name, ':') !== false) {
            $group = current(explode(':', $name));
            $class = str_replace($group.':', '', $name);
            $this->definitions[$name] = clone $this->getDefinition($class);
            $this->definitions[$name]->setGroup($group);
        } else {
            $this->definitions[$name] = new Definition($name);
        }

        return $this->definitions[$name];
    }
public function define($name)
    {
        if (isset($this->definitions[$name])) {
            throw new DefinitionAlreadyDefinedException($name);
        }

        if (strpos($name, ':') !== false) {
            $group = current(explode(':', $name));
            $class = str_replace($group.':', '', $name);
            $this->definitions[$name] = clone $this->getDefinition($class);
            $this->definitions[$name]->setGroup($group);
        } else {
            $this->definitions[$name] = new Definition($name);
        }

        return $this->definitions[$name];
    }
public function define ( $ name ) { if ( isset ( $ this -> definitions [ $ name ] ) ) { throw new DefinitionAlreadyDefinedException ( $ name ) ; } if ( strpos ( $ name , ':' ) !== false ) { $ group = current ( explode ( ':' , $ name ) ) ; $ class = str_replace ( $ group . ':' , '' , $ name ) ; $ this -> definitions [ $ name ] = clone $ this -> getDefinition ( $ class ) ; $ this -> definitions [ $ name ] -> setGroup ( $ group ) ; } else { $ this -> definitions [ $ name ] = new Definition ( $ name ) ; } return $ this -> definitions [ $ name ] ; }
Define a new model definition.

Note that this method cannot be used to modify existing definitions.
Please use the getDefinition method for that.

@param string $name The model definition name.

@throws \League\FactoryMuffin\Exceptions\DefinitionAlreadyDefinedException

@return \League\FactoryMuffin\Definition
Define a new model definition .