append a group or array to the group
@param string $groupName
@param string|array $groupName2OrArray
@param bool $replace
968644
public function groupAppend( $groupName, $groupName2OrArray , $replace = true ){
		$this->load($groupName);
		$data = [];
		if( is_array( $groupName2OrArray ) ){
			$data = $groupName2OrArray;
		}
		else{
			$this->load( $groupName2OrArray );
			$data = $this->langs[ $groupName2OrArray];
		}
		if( !empty( $data)){
			foreach ($data as $k => $v ){
				if( isset( $this->langs[$groupName][$k])){
					if( $replace == true ){
						$this->langs[ $groupName ][$k] = $v;
					}
				}
				else{
					$this->langs[ $groupName ][$k] = $v;
				}
				
			}
		}
		
	}
81913
public function groupBy($groupBy)
    {
        if (is_string($groupBy)) {
            if (strpos($groupBy, '(') !== false) {
                if (preg_match('#^([\w\.]+)\((.*)\)$#', $groupBy, $match) === 1) {
                    $func = strtoupper($match[1]);
                    if ($func === 'SUBSTR') {
                        $parts = explode(',', $match[2]);

                        if ($parts[1] === '0') {
                            throw new MisuseException(['`:group` substr index is 1-based', 'group' => $groupBy]);
                        }
                        $this->_group[$parts[0]] = ['$substr' => ['$' . $parts[0], $parts[1] - 1, (int)$parts[2]]];
                    }
                } else {
                    throw new MisuseException(['`:group` group is not supported. ', 'group' => $groupBy]);
                }
            } else {
                foreach (explode(',', str_replace(' ', '', $groupBy)) as $field) {
                    $this->_group[$field] = '$' . $field;
                }
            }
        } elseif (is_array($groupBy)) {
            foreach ($groupBy as $k => $v) {
                if (is_int($k)) {
                    $this->_group[$v] = '$' . $v;
                } else {
                    $this->_group[$k] = $v;
                }
            }
        }

        return $this;
    }
1286609
public function replace($items = array(), $recursive = true)
	{
		$items = (array) $items;

		if ($recursive) {
			$this->data = array_replace_recursive($this->data, $items);
		} else {
			$this->data = $items;
		}
	}
317663
public static function replaceInArray($search = '', $replace = '', $array = false, $isKeys = true)
    {
        if (!is_array($array)) {
            return str_replace($search, $replace, $array);
        }

        $newArr = array();
        foreach ($array as $key => $value) {
            $addKey = $key;
            if ($isKeys) { //Replace keys
                $addKey = str_replace($search, $replace, $key);
            }

            // Recurse
            $newArr[$addKey] = static::replaceInArray($search, $replace, $value, $isKeys);
        }

        return $newArr;
    }
674752
public function removeGroup($groupName)
    {

		if(isset($this->groups[$groupName])){
			foreach($this->groups[$groupName]['elements'] as $element){
				$this->removeElement($element);
			}
			unset($this->groups[$groupName]);
		}

    }
178162
public function add(string $name, string $value, bool $replace = true): Headers
	{
		$normalizedName = $this->normalizeName($name);

		$this->headers[$normalizedName]['name'] = $name;

		if($replace === true)
		{
			$this->headers[$normalizedName]['value'] = [$value];
		}
		else
		{
			$headers = $this->headers[$normalizedName]['value'] ?? [];

			$this->headers[$normalizedName]['value'] = array_merge($headers, [$value]);
		}

		return $this;
	}
368110
public function setReplacement($replacement)
    {
        if (!is_array($replacement) && !is_string($replacement)) {
            throw new Exception\InvalidArgumentException(sprintf(
                '%s expects replacement to be array or string; received "%s"',
                __METHOD__,
                (is_object($replacement) ? get_class($replacement) : gettype($replacement))
            ));
        }
        $this->options['replacement'] = $replacement;
        return $this;
    }
16036
def RenameGroup(r, group, new_name):
    

    body = {
        "new_name": new_name,
    }

    return r.request("put", "/2/groups/%s/rename" % group, content=body)
986996
private function addGroup(Group $group, array $names = [], array $match = []) : array
    {
        $return = [];
        if ($group->getName()) {
            $names[] = $group->getName();
        }
        if ($group->getMatch()) {
            $match[] = $group->getMatch();
        }

        /** @var Route|Group|string $route */
        foreach ($group->getRoutes() as $name => $route) {
            $routeName = $names;
            $routeMatch = $match;

            if (is_string($route) || $route instanceof Route) {
                if (is_string($route)) {
                    $route = (new Route($route))
                        ->setName($name);
                } elseif ($name) {
                    $route->setName($name);
                }

                if ($route->getMatch()) {
                    $routeMatch[] = $route->getMatch();
                }

                if ($route->getName()) {
                    $routeName[] = $route->getName();
                }

                $route
                    ->setName(implode('/', $routeName))
                    ->setMatch('/' . implode('/', $routeMatch))
                ;

                $route->addGroupConfiguration($group);

                $return[$route->getName()] = $route;
            } elseif ($route instanceof Group) {
                $route->addGroupConfiguration($group);

                $return = array_merge(
                    $return,
                    $this->addGroup($route, $names, $match)
                );
            } else {
                throw new \InvalidArgumentException(sprintf("Invalid route type '%s'", gettype($route)));
            }
        }

        return $return;
    }
12565
protected static function createReplacementNode(DOMDocument $dom, array $replacement)
	{
		if ($replacement[0] === 'expression')
		{
			$newNode = $dom->createElementNS(self::XMLNS_XSL, 'xsl:value-of');
			$newNode->setAttribute('select', $replacement[1]);
		}
		elseif ($replacement[0] === 'passthrough')
		{
			$newNode = $dom->createElementNS(self::XMLNS_XSL, 'xsl:apply-templates');
			if (isset($replacement[1]))
			{
				$newNode->setAttribute('select', $replacement[1]);
			}
		}
		else
		{
			$newNode = $dom->createTextNode($replacement[1]);
		}

		return $newNode;
	}
728568
public function addGroupAlias($groupName, $alias)
    {
       if(is_array($alias))
           foreach($alias as $item)
               $this->groupAliasIndices[$item] = $groupName;
       else
           $this->groupAliasIndices[$alias] = $groupName;

        return $this;
    }
537771
public function regexplace($pattern, $replacement)
    {
        $result = preg_replace($pattern, $replacement, $this->getInternalValue());
        $this->setInternalValue($result);

        return $this;
    }
1189606
private function insertOrReplaceTag($content, $search, $replace)
    {
        $newContent =  null;

        $regexSearch = "/(\<$search\>\<\!\[CDATA\[([0-9.])+\]\]\>\<\/$search\>)/";
        if(preg_match($regexSearch, $content)) {
            $newContent = preg_replace($regexSearch, $replace, $content);
        }
        else {
            $newContent = $content . $replace;

        }

        return $newContent;
    }
1213918
public function replaceWith(Collection $replacement)
    {
        $this->pool = [];
        $this->map = [];
        $this->indexed = [];

        foreach ($replacement as $entity) {
            $this->addEntity($entity);
        }
    }
604938
public function load($groupName)
    {
        if (! count($this->readers)) {
            throw new \RuntimeException('No config readers attached');
        }

        if (! $groupName) {
            throw new \InvalidArgumentException('No config group specified');
        }

        if (! is_string($groupName)) {
            throw new \InvalidArgumentException('Config group must be a string');
        }

        if (isset($this->groups[$groupName])) {
            return $this->groups[$groupName];
        }

        $config = [];

        foreach ($this->readers as $reader) {
            if ($groupConfig = $reader->load($groupName)) {
                $config = array_replace_recursive($config, $groupConfig);
            }
        }

        $this->groups[$groupName] = $config;

        return $this->groups[$groupName];
    }
396810
public function replaceGroup($groupId, Api\GroupCreate $group)
    {
        $json = Serialize::group($group);
        $result = $this->_put($this->_groupUrl($groupId), $json);
        return Deserialize::groupResponse($result);
    }
724445
public function addGroupBy(array $groupBy): void
    {
        if (empty($groupBy)) {
            return;
        }
        foreach ($groupBy as $i => $field) {
            $groupBy[$i] = $this->quoteName($field);
        }
        $groupByList = implode(', ', $groupBy);
        $this->statement .= ' GROUP BY ' . $groupByList . PHP_EOL;
    }