Add layer(s) or Middleware
@param  mixed $layers
341709
public function layer($layers) {
        if ($layers instanceof Middleware) {
            $layers = $layers->toArray();
        }
        if ($layers instanceof MiddlewareInterface) {
            $layers = [$layers];
        }
        if (!is_array($layers)) {
            throw new InvalidArgumentException(get_class($layers) . " is not a valid middleware.");
        }
        $this->layers = array_merge($this->layers, $layers);
    }
1219622
async def setLayers(self, layers):
        '''
        
        '''
        layrs = []

        for iden in layers:
            layr = self.core.layers.get(iden)
            if layr is None:
                raise s_exc.NoSuchLayer(iden=iden)
            if not layrs and layr.readonly:
                raise s_exc.ReadOnlyLayer(mesg=f'First layer {layr.iden} must not be read-only')

            layrs.append(layr)

        self.borked = None
        self.layers = layrs

        await self.info.set('layers', layers)
1070361
private function addProcessors(array $processors)
    {
        // We need to reverse the array because Monolog "pushes" processors to top of the stack
        foreach (array_reverse($processors) as $processor) {
            $this->logger->pushProcessor($processor);
        }
    }
1296245
public function setCustomLayer(Layer $customLayer)
    {
        Assertion::count($this->getMethodCalls(), 0, 'Setting custom layer has to be done before any method call.');

        $this->customLayer = $customLayer;

        return $this;
    }
978820
public function pushMiddleware(array $middlewares)
    {
        foreach ($middlewares as $key => $middleware) {
            $this->middlewares[$key] = $middleware;
        }
    }
512727
def add_middleware(self, middleware):
        """"""
        if self.middleware is None:
            self._middleware = []
        self.middleware.append(middleware)
910305
function(layerArray, layer) {
        if (layer.layersContext) {
            for (var i=0, len = layer.layersContext.length; i<len; i++) {
                var l = layer.layersContext[i];
                layerArray.push(l);
                if (l.layersContext) {
                    this.processLayer(layerArray, l);
                }
            }
        }
    }
1238630
def add_layers(self, *layers):
		
		for layer in layers:
			if layer.name() in self.__layers.keys():
				raise ValueError('Layer "%s" already exists' % layer.name())
			self.__layers[layer.name()] = layer
605879
public function addMiddleware(callable $middleware, string $type = self::BEFORE)
  {
;    $type = self::validateMiddlewareType($type);
    $this->middlewares[$type][] = $middleware;
  }
136487
public function addGroup(string $name, string $prefix = '', array $middlewares = [])
    {
        $this->groups[$name] = [$prefix, $middlewares];
    }
770695
public static function setSites($sites)
    {
        self::triggerSetSitesEvent($sites);

        foreach ($sites as $idsite => $site) {
            self::setSiteFromArray($idsite, $site);
        }
    }
897671
def add_layer(self, layer):
        
        assert (
            isinstance(layer,
                       (TiledTileLayer, TiledImageLayer, TiledObjectGroup)))

        self.layers.append(layer)
        self.layernames[layer.name] = layer
823083
public function addFields(array $fields)
    {
        array_walk(
            $fields,
            function ($field, $key) {
                $this->addField($key, $field);
            }
        );
    }
676762
public function add($objects)
    {
        $objects = is_array($objects) ? $objects : array($objects);

        foreach ($objects as $object) {
            if ($this->has($object)) {
                continue;
            }

            $this->objects[] = $object;
        }
    }
1228361
function(layer) {
            var layers = this.layers,
                len, n;

            if (layers) {
                len = layers.length;

                // don't add the layer if it already exists
                for (n = 0; n < len; n++) {
                    if (layers[n]._id === layer._id) {
                        return false;
                    }
                }
            }
            else {
                this.layers = [];
            }

            this.layers.push(layer);
            return true;
        }
1107154
public static function addJsFiles($files = array())
    {
        
		foreach($files as $file){
			self::addFile($file, tao_helpers_Scriptloader::JS);
		}
        
    }
235351
public function addHeaders(array $headers)
    {
        foreach ($headers as $name => $value) {
            $this->headers->add($name, $value);
        }
    }