Sanitizes multiple tags with sanitizeTag()

@param array $tags Multiple tags
@return array The sanitized tags
771317
protected function sanitizeTags(array $tags)
    {
        foreach ($tags as $key => $value) {
            $tags[$key] = $this->sanitizeTag($value);
        }
        return $tags;
    }
822412
function clean($tag) {
		if (isset($this->_tags[$tag])) {
			foreach ($this->_tags[$tag] as $k) { /** @var string $k */
				unset($this->_data[$k]);
			}
			unset($this->_tags[$tag]);
		}
	}
1097870
protected function checkAnnotationTagOrder(array $tags): array
    {
        $order = $this->getTagOrderMap();

        $currentOrder = null;
        foreach ($tags as $i => $tag) {
            if (!isset($order[$tag['tag']])) {
                if ($currentOrder !== null) {
                    $tags[$i]['error'] = 'Position of ' . $tag['tag'] . ' tag too low.';
                    return $tags;
                }
                continue;
            }

            $tagOrder = $order[$tag['tag']];
            if ($currentOrder === null || $tagOrder >= $currentOrder) {
                $currentOrder = $tagOrder;
                continue;
            }

            $tags[$i]['error'] = 'Position of ' . $tag['tag'] . ' tag too low.';
            continue;
        }

        return $tags;
    }
998528
public function removeTags($tags)
    {
        $result = $this->getClient()
            ->send('/v1/customers/'.$this->uuid.'/attributes/tags', 'DELETE', [
                'tags' => func_get_args()
            ]);

        $this->attributes['tags'] = $result['tags'];
        return $result['tags'];
    }
196739
protected function _normalizeTag($tag) {
		$namespace = null;
		$label = $tag;
		$separator = $this->getConfig('separator');
		if ($separator === null) {
			return [
				null,
				$tag,
			];
		}

		if (strpos($tag, $separator) !== false) {
			list($namespace, $label) = explode($separator, $tag);
		}

		return [
			trim($namespace),
			trim($label)
		];
	}
1059730
public static function serializeTags(array $tags)
    {
        if (empty($tags))
            return '';

        self::validateTags($tags);
        $tagstrs = array();
        foreach ($tags as $tag)
            $tagstrs[] = $tag->toString(true);

        return implode(';', $tagstrs);
    }
81745
protected function sanitizeArray($array)
    {
        foreach($array as $key => $value){
            if(is_array($value)){
                $array[$key] = $this->sanitizeArray($value);
            } else {
                $array[$key] = $this->convertStaticPhpExcelConstantsFromStringsToConstants($value);
            }
        }

        return $array;
    }
146260
protected function getTags($tag = null)
    {
        $tags = [$this->cacheKey];

        if ($tag) {
            if (! is_array($tag)) {
                $tag = [$tag];
            }

            $tags = array_merge($tags, $tag);
        }

        return $tags;
    }
1182561
public function normalizeTags($tags)
    {
        if (is_string($tags)) {
            $tags = explode($this->getConfig('delimiter'), $tags);
        }

        $result = [];

        $common = ['_joinData' => [$this->getConfig('fkTableField') => $this->_table->getTable()]];
        $namespace = $this->getConfig('namespace');
        if ($namespace) {
            $common += compact('namespace');
        }

        $tagsTable = $this->_table->{$this->getConfig('tagsAlias')};
        $pk = $tagsTable->getPrimaryKey();
        $df = $tagsTable->getDisplayField();

        foreach ($tags as $tag) {
            $tag = trim($tag);
            if (empty($tag)) {
                continue;
            }
            $tagKey = $this->_getTagKey($tag);
            $existingTag = $this->_tagExists($tagKey);
            if (!empty($existingTag)) {
                $result[] = $common + ['id' => $existingTag];
                continue;
            }
            list($id, $label) = $this->_normalizeTag($tag);
            $result[] = $common + compact(empty($id) ? $df : $pk) + [
                'tag_key' => $tagKey,
            ];
        }

        return $result;
    }
1028549
public function prune(array $tags)
    {
        if (!count($tags)) {
            return $this;
        }

        $first = array_shift($tags);
        $query = $this->storage->where('tags', 'like', "%|$first|%");

        foreach ($tags as $tag) {
            $query = $query->orWhere('tags', 'like', "%|$tag|%");
        }

        $deletedIds = [];

        foreach ($query as $cacheId=>$entry) {

            $this->entryCache[$cacheId] = $this->createMissEntry();
            $deletedIds[] = $cacheId;

        }

        $this->writeStorage->clear($deletedIds);

        if ($this->bigStorage) {
            $this->bigStorage->clear($deletedIds);
        }

        return $this;
    }
666001
private function getContextFromTags(array $tags)
    {
        return array_filter(array_map(static function (array $attribute) {
            if (\array_key_exists('context', $attribute) && \is_string($attribute['context'])) {
                return $attribute['context'];
            }

            return null;
        }, $tags));
    }
523460
public function removeTag($tag)
    {
        if (is_array($tag))
        {
            foreach ($tag as $t)
            {
                if (isset($this->allowed_tags[$t]))
                    unset($this->allowed_tags[$t]);
                $this->remove_tags[$t] = true;
            }
        }
        else
        {
            if (isset($this->allowed_tags[$tag]))
                unset($this->allowed_tags[$tag]);
            $this->remove_tags[$tag] = true;
        }
        return $this;
    }
701631
static function tagsToString( array $tags ) {

		$tags = wp_list_sort( $tags, 'tag', 'asc' );

		$str = '';
		foreach ( $tags as $tag ) {
			$str .= $tag['tag'] . ', ';
		}

		return rtrim( $str, ', ' );
	}
721054
public function prepareTags($tags) : array
    {
        if (is_null($tags)) {
            return [];
        }

        if (is_string($tags)) {
            $delimiter = preg_quote(self::getTagsDelimiter(), '#');

            $tags = array_map('trim',
                preg_split("#[{$delimiter}]#", $tags)
            );
        }

        return array_unique(array_filter($tags));
    }
1190445
public function removeTags(array $tags)
    {
        $this->tagsChanges['removed'] = array_unique(
            array_merge($this->tagsChanges['removed'], $tags)
        );

        return $this;
    }
1032108
public function transform($tags)
    {
        // die(var_dump($tags));
        if (null === $tags) {
            return null;
        }
        $texts = [];

        foreach ($tags as $tag) {
            $texts[] = $tag->getText();
        }

        return $texts;
    }
12438
public function tags(array $tags)
    {
        $this->tags = array_unique(array_merge($this->tags, $tags));

        return $this;
    }