prepare stack list

@param StackFormation\Stack[]
@return array
326976
protected function prepareTree(array $arr) {
        $tree = [];
        foreach ($arr as $a) {
            $name = $a->getName();
            $cur = &$tree;
            foreach (explode("-", $name) as $e) {
                if (empty($cur[$e])) $cur[$e] = [];
                $cur = &$cur[$e];
            }
        }
        return $tree;
    }
493938
protected function prepareCallbacks($callbacks)
    {
        if (is_array($callbacks)) {
            foreach ($callbacks as &$callback) {
                $callback['callback'] = $this->serializeClosure($callback['callback']);
            }
        } else {
            $callbacks = $this->serializeClosure($callbacks);
        }

        return $callbacks;
    }
796311
public java.util.List<Stack> getStacks() {
        if (stacks == null) {
            stacks = new com.amazonaws.internal.SdkInternalList<Stack>();
        }
        return stacks;
    }
1250905
private static function _stack($matches = false)
    {
        static $safe_blocks = [];
        if ($matches !== false) {
            $key = '<' . count($safe_blocks) . '>';
            $safe_blocks[$key] = $matches[0];
            return $key;
        } else {
            $tmp = $safe_blocks;
            unset($safe_blocks);
            return $tmp;
        }
    }
821058
public static function stack(string $stack): string
    {
        $content = implode('', self::$stacks[$stack] ?? []);

        self::$stacks[$stack] = [];

        return $content;
    }
1139395
public function addStack(StackInterface $stack): ResultInterface
    {
        $this->stack->addStack($stack, false);
        return $this;
    }
541305
public function getChildrenStacks(Stack $parent)
    {
        return array_filter($this->data['stacks'], function (Stack $stack) use ($parent) {
            return $stack->getParent() === $parent;
        });
    }
958974
public function toArray()
	{

		$list = parent::toArray();

		$list['order.status.parentid'] = $this->getParentId();
		$list['order.status.type'] = $this->getType();
		$list['order.status.value'] = $this->getValue();



		return $list;
	}
1205602
protected function buildParserStack()
    {
        $parsers = array_reverse($this->parsers);

        return array_reduce($parsers, $this->prepareParser(), $this);
    }
332580
protected static function searchForFileAndLineCalledFromStack(array $stack)
    {
        for ($i=0;$i<count($stack);$i++) {
            if(array_key_exists("file", $stack[$i]) && array_key_exists("line", $stack[$i])) return $stack[$i];
        }

        return null;
    }
468839
public function prepare($items = null)
    {
        $items->each(function ($item) {
            $item->items = collect();
            if ($item->has_categories) {
                $item->items = $this->prepare(ProjectCategories::allForMenu($item->page->uri()));
            }
            $item->href = $this->setHref($item);
            $item->class = $this->setClass($item);
        });

        return $items;
    }
976057
protected function prepareList(array $list)
    {
        foreach ($list as &$item) {
            $item['fields'] = $this->getFieldValues($item['combination_id']);
        }

        return $list;
    }
274557
private static function getStackCalls() {

        $i = 1;
        $result = [];
        foreach(xdebug_get_function_stack() as $node) {
            if(isset($node['line']) === true) {
                $result[] = "$i. ".basename($node['file']) .":" .$node['function'] ."(" .$node['line'].")";
            }
            $i++;
        }
        return $result;
    }
887196
function stack() {
    if (!isset($this->stack[$this->parser->tagName])) {
      $this->stack[$this->parser->tagName] = array();
    }
    array_push($this->stack[$this->parser->tagName], $this->parser->tagAttributes);
  }
1164109
def list_stacks(stack_ref: List[str], all: bool, remote: str, region: str,
                watch: int, output: str):
    """"""
    lizzy = setup_lizzy_client(remote)
    stack_references = parse_stack_refs(stack_ref)

    while True:
        rows = []
        for stack in lizzy.get_stacks(stack_references, region=region):
            creation_time = dateutil.parser.parse(stack['creation_time'])
            rows.append({'stack_name': stack['stack_name'],
                         'version': stack['version'],
                         'status': stack['status'],
                         'creation_time': creation_time.timestamp(),
                         'description': stack['description']})

        rows.sort(key=lambda x: (x['stack_name'], x['version']))
        with OutputFormat(output):
            print_table(
                'stack_name version status creation_time description'.split(),
                rows, styles=STYLES, titles=TITLES)

        if watch:  # pragma: no cover
            time.sleep(watch)
            click.clear()
        else:
            break
976089
public function getSortedModuleList() : array {
		$moduleList = $this->modules;

		foreach ($moduleList as $moduleSpec) {
			$moduleClass = $moduleSpec['class'];
			$module      = $moduleSpec['object'];

			if ($module instanceof OrderAwareModule) {
				//All modules that should be loaded after this one
				foreach ($module->getModulesAfter() as $afterModuleClass) {
					if (\array_key_exists($afterModuleClass, $moduleList)) {
						$moduleList[$moduleClass]['after'][] = $afterModuleClass;
						$moduleList[$afterModuleClass]['before'][] = $moduleClass;
					}
				}
				//All modules that should be loaded before this one
				foreach ($module->getModulesBefore() as $afterModuleClass) {
					if (\array_key_exists($afterModuleClass, $moduleList)) {
						$moduleList[$moduleClass]['before'][] = $afterModuleClass;
						$moduleList[$afterModuleClass]['after'][] = $moduleClass;
					}
				}
			}
		}

		$sortedList = [];
		$noIncomingNodes = [];
		foreach ($moduleList as $moduleSpec) {
			$moduleSpec['after']  = \array_unique($moduleSpec['after']);
			$moduleSpec['before'] = \array_unique($moduleSpec['before']);
			if (empty($moduleSpec['before'])) {
				$noIncomingNodes[$moduleSpec['class']] = $moduleSpec;
			}
		}

		//Do the topological sorting (Kahn's algorithm)
		while (!empty($noIncomingNodes)) {
			$moduleSpec = array_shift($noIncomingNodes);
			\array_push($sortedList, $moduleSpec);
			unset($moduleList[$moduleSpec['class']]);

			foreach ($moduleSpec['after'] as $nextModuleKey => $nextModuleClass) {
				unset($moduleList[$nextModuleClass]['before'][
					\array_search($moduleSpec['class'], $moduleList[$nextModuleClass]['before'])
				]);
				if (empty($moduleList[$nextModuleClass]['before'])) {
					$noIncomingNodes[] = $moduleList[$nextModuleClass];
				}
				unset($moduleSpec['after'][$nextModuleKey]);
			}
		}

		foreach ($moduleList as $key => $remainingModuleSpec) {
			if (empty($remainingModuleSpec['before'])) {
				$sortedList[] = $moduleList[$remainingModuleSpec['class']];
				unset($moduleList[$key]);
			}
		}

		if (!empty($moduleList)) {
			throw new CircularModuleLoadOrderDetectedException($this->getDotGraph());
		} else {
			$result = [];
			foreach ($sortedList as $moduleSpec) {
				$result[] = $moduleSpec['object'];
			}
			return $result;
		}
	}
828872
private function stackTrace($stack)
    {
        $counter = count($stack);
        $lines = array();
        foreach ($stack as $frame) {
            $ret = 'Frame #' . $counter . ' - ';
            $line = isset($frame['line']) ? $frame['line'] : 0;
            $file = isset($frame['file']) ? $frame['file'] : 'Unknown file';
            $args = isset($frame['args']) ? $frame['args'] : array();
            $ret .= 'File ' . $file . ', Line ' . $line 
                . ', function ' . $this->frameToFunction($frame);
            $lines[] = $ret;
            $counter--;
        }

        return $lines;
    }