public static function create($params = array())
    {
        if (isset($params['type'])) {
            $className = "Didww\API2\Mapping\\" . $params['type'];
            $mapping = new $className();
            unset($params['type']);
        } else {
            $mapping = new Mapping();
        }
        $mapping->fromArray($params);

        return $mapping;
    }
public static function create($params = array())
    {
        if (isset($params['type'])) {
            $className = "Didww\API2\Mapping\\" . $params['type'];
            $mapping = new $className();
            unset($params['type']);
        } else {
            $mapping = new Mapping();
        }
        $mapping->fromArray($params);

        return $mapping;
    }
public static function create ( $ params = array ( ) ) { if ( isset ( $ params [ 'type' ] ) ) { $ className = "Didww\API2\Mapping\\" . $ params [ 'type' ] ; $ mapping = new $ className ( ) ; unset ( $ params [ 'type' ] ) ; } else { $ mapping = new Mapping ( ) ; } $ mapping -> fromArray ( $ params ) ; return $ mapping ; }
factory to build mapping object by params array
@param array $params array of key=>value properties
@return Mapping
factory to build mapping object by params array