Set type

@param string $type

@return Entity

@throws \InvalidArgumentException
172175
public function setType($type)
    {
        if (!is_string($type)) {
            throw new \InvalidArgumentException('The attribute type on the class Entity has to be string (' . gettype($type) . ('object' === gettype($type) ? ' ' . get_class($type) : '') . ' given).');
        }

        $this->type = $type;

        return $this;
    }
154541
public function setFromType($fromType)
    {
        $allowed_values = array('agent', 'npc_corp', 'faction');
        if ((!in_array($fromType, $allowed_values))) {
            throw new \InvalidArgumentException("Invalid value for 'fromType', must be one of 'agent', 'npc_corp', 'faction'");
        }
        $this->container['fromType'] = $fromType;

        return $this;
    }
548224
public function setType($type)
    {
        if (is_string($type)) {
            $type = ColumnType::createType($type);
        } elseif (!$type instanceof AbstractType) {
            throw new Exception\InvalidArgumentException(__METHOD__ . ' setType() accepts only AbstractType or string.');
        }
        $this->properties['type'] = $type;

        return $this;
    }
69647
public function setRequiredType($type)
    {
        if (!in_array($type, array('file', 'directory'))) {
            throw new \InvalidArgumentException("Input type must be either 'file' or 'directory'.");
        }

        if ($type === 'directory') {
            $this->setAllowDirectory(true);
        } else {
            $this->setAllowDirectory(false);
        }

        $this->requiredType = $type;

        return $this;
    }
828235
public function setType($type)
    {
        if (is_string($type)) {
            if (in_array($type, [
                self::TYPE_ALL, self::TYPE_PRINT, self::TYPE_SCREEN, self::TYPE_SPEECH,
                self::TYPE_AURAL, self::TYPE_BRAILLE, self::TYPE_EMBOSSED, self::TYPE_HANDHELD,
                self::TYPE_PROJECTION, self::TYPE_TTY, self::TYPE_TV
            ])) {
                $this->type = $type;

                return $this;
            } else {
                // Invalid type values have to be handled as "not all"
                // @see: http://dev.w3.org/csswg/mediaqueries-4/#error-handling
                $this->type = self::TYPE_ALL;
                $this->setIsNot(true);
                $this->setIsOnly(false);
            }
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($type). "' for argument 'type' given."
            );
        }
    }
659503
public function setType($type)
    {
        if (empty($type)) return $this;

        $this->checkType($type);
        $this->type = $type;

        return $this->addMeta('card', $type);
    }
554722
public function setType($Type)
    {
        $validTypes = [self::TYPE_ONESHOT, self::TYPE_RECURRING];
        if (!in_array($Type, $validTypes)) {
            throw new \InvalidArgumentException(sprintf('Money out type "%s" not supported. Must be one of: "%s"', $Type, implode(',', $validTypes)));
        }
        $this->Type = $Type;

        return $this;
    }
632852
public function setType($type)
    {
        /**
         * Thoses WordType::__MIN and WordType::__MAX values are
         * only used to check if given type is okay according to
         * what we have in WordType.
         *
         * @see src/Client/Api/Enum/WordType.php
         */
        if (!($type >= WordType::__MIN && $type <= WordType::__MAX)) {
            throw new InvalidWordTypeException();
        }
        $this->type = $type;

        return $this;
    }
879081
public function setPropertyType($type)
    {
        if (empty($type)) {
            $this->propertyType = null;
            return $this;
        }

        if (!is_string($type)) {
            throw new InvalidArgumentException(
                'Property type must be a string'
            );
        }

        $this->propertyType = $type;

        return $this;
    }
983723
public function setType($type)
    {
        if (is_string($type) === true) {
            $this->type = $type;
        } else {
            $msg = "The 'type' argument must be a non-empty string representing a mime-type, '" . gettype($type) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
261736
public function setType(?string $type): self
    {
        $this->type                          = $this->validateType($type);
        $this->type_hint || $this->type_hint = $this->type;

        return $this;
    }
1009926
public function setType($type)
    {
        if (strlen($type) == 0) {
            throw new \InvalidArgumentException(sprintf('MIME type should not be empty'));
        }

        if (!preg_match('@^[^/]+/[^/]+$@', $type)) {
            throw new \InvalidArgumentException(sprintf('Invalid MIME type: %s', $type));
        }

        $this->type = $type;

        return $this;
    }
959964
public function setTypeAttribute($type)
    {
        if (!$type instanceof ContentType) {
            $type = ContentType::getByName($type);
        }
        if (!$type) {
            throw new InvalidArgumentException('Unknown content type');
        }
        $this->type()->associate($type);
    }
827880
public function setType(string $type) : void
    {
        if (empty($type)) {
            throw new InvalidArgumentException('Empty field type is not allowed: ' . $this->getName());
        }

        $this->_type = $this->_extractType($type);
    }
192023
public function addType($type)
    {
        if (!in_array($type, $this->validTypes())) {
            throw new InvalidArgumentException(
                sprintf('Invalid cache type: "%s"', $type)
            );
        }

        $this->types[$type] = true;
        return $this;
    }
53291
public function setDriverType($type)
    {
        if (!is_string($type)) {
            throw new InvalidArgumentException(sprintf(
                'Image driver type must be a string, received %s',
                (is_object($type) ? get_class($type) : gettype($type))
            ));
        }

        $this->driverType = $type;

        return $this;
    }
85394
public function setType($type)
    {
        if (!is_string($type) || empty($type)) {
            throw MetadataException::invalidEntityType();
        }
        $this->type = $type;
        return $this;
    }