Declare class interfaces.

@param array $interfaces

@return self
347774
public function setInterfaces(array $interfaces): ClassDeclaration
    {
        $this->interfaces = [];
        foreach ($interfaces as $interface) {
            $this->addInterface($interface);
        }

        return $this;
    }
1313583
public function createFromArray(array $types)
    {
        foreach ($types as $type) {
            $this->collection->add(Type::fromString($type));
        }

        return $this->collection;
    }
10015
public function setHeaders(array $headers = [])
    {

        $this->headers = ($headers instanceof Headers) ? $headers : new Headers((array)$headers);

        return $this;

    }
915528
public function addInstances(array $instances): self
    {
        foreach ($instances as $_key => $_instance) {
            if (is_string($_key)) {
                $_class_name = ltrim($_key, '\\');
            } else {
                $_class_name = get_class($_instance);
            }
            $_class_key                   = strtolower($_class_name);
            $this->instances[$_class_key] = $_instance; // Cache the instance.
        } // unset($_key, $_instance, $_class_name, $_class_key);

        return $this;
    }
84358
public function setProperties(array $properties): self
    {
        // check all keys and values are non-empty strings
        $this->properties = [];
        foreach ($properties as $key => $value) {
            assert(is_scalar($key) === true && strlen((string)$key) > 0);
            assert(is_string($value) === true && strlen($value) > 0);
            $this->properties[(string)$key] = (string)$value;
        }

        return $this;
    }
364893
public function through($layers)
	{
		// Merge existing layers (core)
		$this->layers = array_merge(
			$this->layers, $layers
		);

		// Put the layers in reverse
		$this->layers = array_values(array_reverse($this->layers));

		return $this;
	}
573697
public function registerAliases(array $aliases)
    {

        foreach ($aliases as $alias => $className)
            $this->registerAlias($alias, $className);

        return $this;
    }
839091
public static function create(array $types) : IType
    {
        InvalidArgumentException::verifyAllInstanceOf(__METHOD__, 'types', $types, IType::class);

        $flatTypes = [];
        foreach ($types as $type) {
            if ($type instanceof UnionType) {
                $flatTypes += $type->getTypes();
            } else {
                $flatTypes[$type->asTypeString()] = $type;
            }
        }

        foreach ($flatTypes as $key => $type) {
            foreach ($flatTypes as $otherType) {
                if ($type->isSubsetOf($otherType) && !$type->equals($otherType)) {
                    unset($flatTypes[$key]);
                    continue 2;
                }
            }
        }

        if (count($flatTypes) === 1) {
            return reset($flatTypes);
        }

        $typeString = implode('|', array_keys($flatTypes));

        if (!isset(self::$cache[$typeString])) {
            self::$cache[$typeString] = new self($flatTypes, $typeString);
        }

        return self::$cache[$typeString];
    }
152219
public function setHandlers(array $handlers): self
    {
        $this->handlers = [];
        foreach (array_reverse($handlers) as $handler) {
            $this->pushHandler($handler);
        }

        return $this;
    }
23206
public function withCertificates(array $certificates): self
    {
        foreach ($certificates as $key => $certificate) {
            if (!\is_string($key)) {
                throw new \TypeError('Expected an array mapping domain names to Certificate instances');
            }

            if (!$certificate instanceof Certificate) {
                throw new \TypeError('Expected an array of Certificate instances');
            }

            if (\PHP_VERSION_ID < 70200 && $certificate->getCertFile() !== $certificate->getKeyFile()) {
                throw new \Error(
                    'Different files for cert and key are not supported on this version of PHP. ' .
                    'Please upgrade to PHP 7.2 or later.'
                );
            }
        }

        $clone = clone $this;
        $clone->certificates = $certificates;

        return $clone;
    }
1170154
public function argTypes($types) {
		is_array($types) ? $this->argumentTypes = $types : $this->argumentTypes = func_get_args();
		return $this;
	}
1026315
public function addInterface($interface, $extends = [])
    {
        $interfaceId = $this->registerInterface($interface);
        if (!empty($extends)) {
            $interfaceIds = [];
            foreach ($extends as $name) {
                $interfaceIds[] = $this->registerInterface($name);
            }
            $this->interfaceExtends[$interfaceId] = $interfaceIds;
        }
    }
12744
public function fillByArray(array $types)
    {
        foreach ($types as $mimeType => $extensions) {
            $this->extensionsByType[$mimeType] = $extensions;
            foreach ($extensions as $extension) {
                $this->typeByExtension[$extension] = $mimeType;
            }
        }

        return $this;
    }
577684
public function setLayers(array $layers)
    {
        $this->layers = array_values(array_filter($layers, function ($layer): bool {
            return $layer instanceof Layer;
        }));
        return $this;
    }
540606
public function addUses(array $uses): self
    {
        foreach ($uses as $class => $alias) {
            $this->addUse($class, $alias);
        }

        return $this;
    }
1306751
private function registerInitializers(array $initializers)
    {
        foreach ($initializers as $initializer) {
            if (is_string($initializer) && class_exists($initializer)) {
                $initializer = new $initializer();
                if (! ($initializer instanceof InitializerInterface)) {
                    throw InvalidArgumentException::fromInvalidInitializer($initializer);
                }
            }
            if (is_callable($initializer)) {
                $this->initializers[] = $initializer;
            } else {
                throw InvalidArgumentException::fromInvalidInitializer($initializer);
            }
        }
    }
1345044
public function addInterface($interface) {
		if ($interface instanceof PhpInterface) {
			$name = $interface->getName();
			$qname = $interface->getQualifiedName();
			$namespace = $interface->getNamespace();

			if ($namespace != $this->getNamespace()) {
				$this->addUseStatement($qname);
			}
		} else {
			$name = $interface;
		}

		$this->interfaces->add($name);

		return $this;
	}