Group branches by their content and return the switch values for each branch

@return array
357098
protected function getValuesPerCodeBranch()
	{
		$values = [];
		foreach ($this->branchesCode as $value => $branchCode)
		{
			$values[$branchCode][] = $value;
		}

		return $values;
	}
509914
public function getRemoteGroups(): array
    {
        $result = [];

        if (!(bool)Configure::read('Groups.remoteGroups.enabled')) {
            return $result;
        }

        if ((bool)Configure::read('Groups.remoteGroups.LDAP.enabled')) {
            $result = $this->_getLdapGroups();
        }

        return $result;
    }
1286433
public function getSiblings() {
        $parent = $this->getParent();
        if (is_null($parent)) {
            // This is the root node.
            return [];
        }

        $children = $parent->getChildren();
        $index = array_search($this, $children);
        unset($children[$index]);
        return $children;
    }
648361
protected function getGroups()
	{
		// Initialize variables.
		$groups = array();

		$keyField = $this->element['key_field'] ? (string) $this->element['key_field'] : 'id';
		$keyValue = $this->form->getValue($keyField);

		// If the timezone is not set use the server setting.
		if (strlen($this->value) == 0 && empty($keyValue))
		{
			$this->value = \App::get('config')->get('offset');
		}

		// Get the list of time zones from the server.
		$zones = \DateTimeZone::listIdentifiers();

		// Build the group lists.
		foreach ($zones as $zone)
		{

			// Time zones not in a group we will ignore.
			if (strpos($zone, '/') === false)
			{
				continue;
			}

			// Get the group/locale from the timezone.
			list ($group, $locale) = explode('/', $zone, 2);

			// Only use known groups.
			if (in_array($group, self::$zones))
			{

				// Initialize the group if necessary.
				if (!isset($groups[$group]))
				{
					$groups[$group] = array();
				}

				// Only add options where a locale exists.
				if (!empty($locale))
				{
					$groups[$group][$zone] = Dropdown::option($zone, str_replace('_', ' ', $locale), 'value', 'text', false);
				}
			}
		}

		// Sort the group lists.
		ksort($groups);
		foreach ($groups as $zone => & $location)
		{
			sort($location);
		}

		// Merge any additional groups in the XML definition.
		$groups = array_merge(parent::getGroups(), $groups);

		return $groups;
	}
687048
public function getLocations() {
    $data = [];

    $location_ids = $this->queryFactory->get('node')
      ->condition('type', 'branch')
      ->execute();

    if (!$location_ids) {
      return [];
    }

    $storage = $this->entityTypeManager->getStorage('node');
    $locations = $storage->loadMultiple($location_ids);

    foreach ($locations as $location) {
      $data[$location->id()] = [
        'title' => $location->label(),
      ];
    }

    return $data;
  }
778951
public function list_remote_branches() {
		$branchArray = explode("\n", $this->run("branch -r"));
		foreach($branchArray as $i => &$branch) {
			$branch = trim($branch);
			if ($branch == "" || strpos($branch, 'HEAD -> ') !== false) {
				unset($branchArray[$i]);
			}
		}
		return $branchArray;
	}
1070716
public function optionsGrouped($options = []) {
		$result = $this->options($options);
		if (!empty($result)) {
			$converted = \Helper\Tree::convertByParent($result, 'parent_id');
			$result = [];
			\Helper\Tree::convertTreeToOptionsMulti($converted, 0, ['name_field' => 'name'], $result);
		}
		return $result;
	}
27786
public function getCurrentBranch()
    {
        $output = $this->git('branch');

        foreach(explode("\n", $this->git('branch')) as $branchLine) {
            if('*' === $branchLine{0}) {
                return substr($branchLine, 2);
            }
        }
    }
292339
public function getAll() {
        if (!$this->finalized) $this->autoFinalize();
        $ret = array();
        foreach ($this->plist->squash() as $name => $value) {
            list($ns, $key) = explode('.', $name, 2);
            $ret[$ns][$key] = $value;
        }
        return $ret;
    }
426789
public function listBranches(): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/branches', $this->getOwner(),
            $this->getRepo()));
    }
1077863
public function getDescendantGroups() {
    if (!isset($this->descendantGroups)) {
      $this->descendantGroups = [];
      if (isset($this->group)) {
        $this->descendantGroups =
          (array) $this->group->getDescendants();
      }
      foreach ($this->groups as $curGroup) {
        $this->descendantGroups =
          array_merge(
              (array) $this->descendantGroups,
              (array) $curGroup->getDescendants()
          );
      }
    }
    return $this->descendantGroups;
  }
167481
protected function _getSegmentValues()
    {
        return array(
            'customer_group_id' => array(self::XML_PATH_SEGMENT_CUSTOMER_GROUP, function () {
                return $this->_noSessionCall ? 0 : Mage::getSingleton('customer/session')->getCustomerGroupId();
            }),
            'store_id' => array(self::XML_PATH_SEGMENT_STORE, function () {
                return Mage::app()->getStore()->getId();
            }),
            'currency' => array(self::XML_PATH_SEGMENT_CURRENCY, function () {
                return Mage::app()->getStore()->getCurrentCurrencyCode();
            })
        );
    }
17160
protected function getSections(): array
    {
        $sections = explode($this->getDivider(), $this->getNotation());
        foreach ($sections as $index => $section) {
            $sections[$index] = explode($this->getSeparator(), $section);
        }

        return $sections;
    }
504434
public function getSitesGroups()
    {
        $db = $this->getDb();
        $groups = $db->fetchAll("SELECT DISTINCT `group` FROM " . $this->table);

        $cleanedGroups = array();
        foreach ($groups as $group) {
            $cleanedGroups[] = $group['group'];
        }

        return $cleanedGroups;
    }
424501
public function toArray()
    {
        $remotes = [];

        foreach ($this->remotes as $remote) {
            $remotes[] = $remote->toArray();
        }

        return [
            'branch' => $this->branch,
            'head' => $this->head->toArray(),
            'remotes' => $remotes,
        ];
    }
1214916
public function getAllCategoryTreesAsArray()
    {
        $rootIds = $this->getAllRootIds();

        $trees = array();
        foreach ($rootIds as $rootId) {
            $trees[$rootId] = $this->getCategoryTreeAsArray($rootId);
        }

        return $trees;
    }
152044
public function getGroups() {
		$data = $this->getData('/cgi-bin/groups/get', [
			'access_token' => $this->getAccessToken(),
		]);

		if(isset($data['groups'])) {
			foreach($data['groups'] as $_group) {
				$group = WechatUserGroup::findOne(['appid' => $this->app->appid, 'gid' => $_group['id']]);
				if(!$group) {
					$group = new WechatUserGroup;
					$group->appid = $this->app->appid;
					$group->gid = $_group['id'];
				}
				$group->name = $_group['name'];
				$group->count = $_group['count'];
				$group->save();
			}
		}

		return $this->errcode == 0;
	}