Defines the given item in the typemap.

@param string $id The name of the item
@param string $type The required type of the value

@throws InvalidArgumentException if the ID name is invalid.
508748
public function define($id, $type)
    {
        $id = (string) $id;

        $this->validateName($id);

        if ($type[0] == ':') {
            $expectedType = substr($type, 1);
            $allowedTypes = (array) $this->getAllowedTypes();
            if (!in_array($expectedType, $allowedTypes)) {
                throw new InvalidArgumentException(sprintf('Cannot use type %s to define item "%s" in %s container. Allowed types are: %s.',
                    $expectedType, $id, $this->name, join(', ', $allowedTypes)));
            }
        } else {
            if (!class_exists($type)) {
                throw new InvalidArgumentException(sprintf('Cannot use non-existing class %s as type to define item "%s" in %s container.',
                    $type, $id, $this->name));
            }
        }

        $this->typemap[$id] = $type;
    }
112754
public function view($type = null, $id = null)
    {
        $this->_validateActionIsEnabled('view');

        $this->_event('beforeView', [
            'id' => $id
        ]);

        $data = $this->Model->get($id, [
            'contain' => $this->type['contain']
        ]);
        $this->set('data', $data);

        $this->_event('afterView', [
            'id' => $id
        ]);
    }
585140
public function setType($type)
    {
        if (! in_array($type, self::$types, true)) {
            throw new InvalidArgumentException(sprintf(
                '"%s" is not a valid type! Valid types: %s',
                $type,
                implode(', ', self::$types)
            ));
        }

        $this->type = $type;

        return $this;
    }
412042
public function deleteCategory($id)
    {
        $this->validateId($id);

        $category = $this->getMapper()->find($id);

        if (null === $category) {
            throw new \InvalidArgumentException('No category found for id "' . $id . '"');
        }

        $node = $this->getNestedSetManager()->wrapNode($category);
        $node->delete();

        return $this;
    }
1141389
public function setType($type)
    {
        if (empty($type)) {
            $this->type = null;
            return $this;
        }

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

        if ($this->propertyFactory()->isResolvable($type)) {
            $this->setPropertyType($type);
        }

        $this->type = $type;

        return $this;
    }
253236
public function problem($id, $type = 'id')
    {
        $problem = $this->load('p', array($type, $id));

        return Helper\formatProblem($problem);
    }
534489
public function setTypeId( $typeId )
	{
		if ( $typeId == $this->getTypeId() ) { return; }

		$this->_values['typeid'] = (int) $typeId;
		$this->setModified();
	}
1097424
protected function setType(string $type) : void
    {
        if (empty($type)) {
            throw new InvalidArgumentException(__CLASS__ . ': Empty field type is not allowed');
        }

        if (! in_array($type, array_keys($this->defaultOptions))) {
            throw new InvalidArgumentException(__CLASS__ . ': Unsupported field type: ' . $type);
        }

        $this->type = $type;
    }
730908
public function setTypeMapping($type, $class = null)
    {
        if (is_string($type)) {
            if ($class === null) {
                throw new InvalidArgumentException(
                    'If $type is specified, $class is required'
                );
            }
            $type = array($type => (string) $class);
            $class = null;
        }

        if (!is_array($type)) {
            throw new InvalidArgumentException(
                'Type must either be an array or a string.'
            );
        }

        if ($class !== null) {
            throw new InvalidArgumentException(
                'If $type is an array, $class must not be specified.'
            );
        }

        $this->type_map = array_merge($this->type_map, $type);
    }
128231
public function setType($type)
    {
        if (!array_key_exists($type, self::$Supported)) {
            throw new \InvalidArgumentException(sprintf(
                    'Invalid Sharpen Type "%s"', $type
            ));
        }
        $this->type = $type;
    }
786362
public function getTypeElementById( $id, $types = null )
	{
		$fragment = parse_url( $id, PHP_URL_FRAGMENT );
		$fragment = $fragment ? $fragment : $id;

		$taxonomy = $this->getTaxonomyForXSD( $id );
		if ( ! $taxonomy )
		{
			$this->log()->warning( "Unable to locate taxonomy for id '$id'" );
			return false;
		}

		if ( is_null( $types ) ) $types = XBRL_Types::getInstance();
		return $types->getElement( $fragment, $taxonomy->getPrefix() );
	}
297846
public function addType(WidgetTypeInterface $widget)
    {
        if (!$this->hasType($widget)) {
            $this->types[$widget->getName()] = $widget;
        } else {
            throw new \InvalidArgumentException(sprintf('Widget type "%s" is already registered.', $widget->getName()));
        }
    }
1205232
public static function add($action, $type, $id = null)
    {
        if (!is_null($id))
            self::$modelMap[$type][$id] = $action;
        else
            self::$typeMap[$type] = $action;
    }
729413
public function contentTypeGroup($id)
    {
        if ($this->allCleared === true || $this->isSwitchedOff()) {
            return;
        }

        if (is_scalar($id)) {
            // @todo should also clear content type cache for items themselves in case of link/unlink changes, kernel should have a "type-all" tag for this
            $this->cache->invalidateTags(['type-group-' . $id, 'type-map']);
        } else {
            throw new InvalidArgumentType('$id', 'int|null', $id);
        }
    }
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;
    }
135974
private function set($type, $id)
    {
        if (isset($this->definedTypes[$type])) {
            return;
        }

        // is this already a type/class that is known to match multiple services?
        if (isset($this->ambiguousServiceTypes[$type])) {
            $this->ambiguousServiceTypes[$type][] = $id;

            return;
        }

        // check to make sure the type doesn't match multiple services
        if (!isset($this->types[$type]) || $this->types[$type] === $id) {
            $this->types[$type] = $id;

            return;
        }

        // keep an array of all services matching this type
        if (!isset($this->ambiguousServiceTypes[$type])) {
            $this->ambiguousServiceTypes[$type] = array($this->types[$type]);
            unset($this->types[$type]);
        }
        $this->ambiguousServiceTypes[$type][] = $id;
    }
1174393
public function make( $id, array $parameters = [] ) {
		if ( ! $this->bound( $id ) ) {
			throw new InvalidArgumentException( sprintf( 'Identifier `%s` is not defined', $id ) );
		}

		$id      = $this->get_class_prefix( $id );
		$value   = $this->bindings[$id];
		$closure = $value['closure'];

		return $this->call_closure( $closure, $parameters );
	}