Register all

@param mixed[] $types
Keys are type names, values are either class name or instances

@return TypeRegistry
515098
public function register($types)
    {
        foreach ($types as $type => $definition) {
            $this->register($type, $definition);
        }

        return $this;
    }
1100864
public function setType($types)
    {
        if (!is_array($types)) {
            $types = [$types];
        }

        $typesToSet = [];
        foreach ($types as $type) {
            if ($type === 'int') {
                $type = 'integer';
            }
            if ($type === 'hash') {
                $type = 'object';
            }

            // handle non-primitive types
            if (!in_array($type, $this->primitiveTypes)) {
                $setType = 'string';
                if (isset($this->specialTypeMapping[$type])) {
                    $setType = $this->specialTypeMapping[$type];
                }
                $typesToSet[] = $setType;

                if (isset($this->formatOverrides[$type])) {
                    $type = $this->formatOverrides[$type];
                }

                $this->setFormat($type);
            } else {
                $typesToSet[] = $type;
            }
        }

        $this->type = new SchemaType($typesToSet);
    }
105395
protected function registerDataTypeRegistry()
    {
        $this->app->singleton(Registry::class, function () {
            $registry = new Registry();
            foreach (config('metable.datatypes') as $handler) {
                $registry->addHandler(new $handler());
            }

            return $registry;
        });
        $this->app->alias(Registry::class, 'metable.datatype.registry');
    }
970361
public function registerConverter($name, ConverterInterface $converter, array $types, $strict = null)
    {
        $this->addConverter($name, $converter, $strict);

        foreach ($types as $type) {
            $this->addTypeToConverter($name, $type);
        }

        return $this;
    }
442894
public function setRegistries(array $registries, $classname)
    {
        $this->classname = $classname;
        $this->registries = $registries;

        return $this;
    }
127738
private function prepareComponentList (array $types)
    {
        $this->types = [];

        foreach ($types as $type)
        {
            $this->types[$type->getKey()] = $type;
        }
    }
763478
public static function registerFonts($fonts = array())
    {
        if (empty($fonts))
            return;

        foreach ($fonts as $font) {
            Icon::registerIconFontSet($font);
        }
    }
732198
protected function clear($types = [])
    {
        if (empty($types)) {
            unset($_SESSION[$this->alias]);
        } else {
            foreach ((array)$types as $type) {
                unset($_SESSION[$this->alias][$type]);
            }
        }

        return $this;
    }
517512
public function setAllowedTypes($types)
    {
        $this->allowedTypes = [];
        $token = ' ,;';
        $type = strtok($types, $token);
        while ($type !== false) {
            $this->allowedTypes[] = $type;
            $type = strtok($token);
        }
    }
1313583
public function createFromArray(array $types)
    {
        foreach ($types as $type) {
            $this->collection->add(Type::fromString($type));
        }

        return $this->collection;
    }
1073631
public function registerNamedType($typeName)
    {
        if (isset($this->namedTypes[$typeName])) {
            throw new \InvalidArgumentException("`$typeName` is already registerd.");
        }

        $type = new \ReflectionClass($typeName);
        $this->namedTypes[$typeName] = $type;

        return $this;
    }
435751
def register(type, plural = nil)
    type = type.to_sym

    if plural
      plural = plural.to_sym
    else
      plural = "#{type}s".to_sym
    end
    @plurals[plural] = type
    @types[type]     = Config.new
  end
1372295
public function getAllInterfaces($types = self::FULL_HIERARCHY) {
    if ($types & self::WITH_OWN) {
      $interfaces = clone $this->interfaces;
    } else {
      $interfaces = new GObjectCollection(array());
    }
    
    if (($types & self::WITH_PARENTS) && ($parent = $this->getParent()) != NULL) {
      $parentTypes = $types | self::WITH_OWN;
      foreach ($parent->getAllInterfaces($parentTypes) as $interface) {
        if (!$interfaces->has($interface)) {
          $interfaces->add($interface);
        }
      }
    }
    
    return $interfaces->toArray();
  }
316963
public function registerArray(array $instances)
    {
        foreach ($instances as $name => $instance) {
            $this->register($name, $instance);
        }

        return $this;
    }
46841
public function registerMaps(array $maps)
    {
        foreach ($maps as $name => $map) {
            $this->maps[$name] = $map;
        }

        return $this;
    }
1030659
public static function setDataTypes(array $types) : void
    {
        // Datatypes key validation
        foreach ($types as $key => $value) {
            if (!preg_match('/^[A-Za-z0-9-_]+$/', $key)) {
                throw new \UnexpectedValueException("<b>$key</b> is not a valid datatype key", 1);

            } elseif (!is_string($value)) {
                throw new \LogicException("<b>$key</b> must have a string value", 1);
            }
        }

        // Put keys between brackets
        self::$datatypes = array_combine(
            array_map(function ($t) {
                return '/\{' . $t . '\}/';
            }, array_keys($types)),
            $types
        );
    }
156810
protected function valTypes(array $types)
    {
        $nonEmptyTypes = array_filter(array_map([$this, 'valType'], $types));

        // If there are no valid types
        if (!count($nonEmptyTypes)) {
            throw new InvalidArgumentException(
                InvalidArgumentException::EMPTY_TYPES_STR,
                InvalidArgumentException::EMPTY_TYPES
            );
        }

        return array_values($nonEmptyTypes);
    }