lib/Elastica/Type/Mapping.php
public static function create($mapping): Mapping
    {
        if (\is_array($mapping)) {
            $mappingObject = new self();
            $mappingObject->setProperties($mapping);

            return $mappingObject;
        }

        if ($mapping instanceof self) {
            return $mapping;
        }

        throw new InvalidException('Invalid object type');
    }
public static function create($mapping): Mapping
    {
        if (\is_array($mapping)) {
            $mappingObject = new self();
            $mappingObject->setProperties($mapping);

            return $mappingObject;
        }

        if ($mapping instanceof self) {
            return $mapping;
        }

        throw new InvalidException('Invalid object type');
    }
public static function create ( $ mapping ) : Mapping { if ( \ is_array ( $ mapping ) ) { $ mappingObject = new self ( ) ; $ mappingObject -> setProperties ( $ mapping ) ; return $ mappingObject ; } if ( $ mapping instanceof self ) { return $ mapping ; } throw new InvalidException ( 'Invalid object type' ) ; }
Creates a mapping object.

@param array|Mapping $mapping Mapping object or properties array

@throws InvalidException If invalid type

@return self
Creates a mapping object .