/**
  * @param array|MessageGroup $mixed
  * @param array $props List of props as the array keys
  * @param int $depth
  * @return array
  */
 protected function formatGroup($mixed, $props, $depth = 0)
 {
     $params = $this->extractRequestParams();
     // Default
     $g = $mixed;
     $subgroups = array();
     // Format = tree and has subgroups
     if (is_array($mixed)) {
         $g = array_shift($mixed);
         $subgroups = $mixed;
     }
     wfProfileIn(__METHOD__ . '-' . get_class($g));
     $a = array();
     $groupId = $g->getId();
     wfProfileIn(__METHOD__ . '-basic');
     if (isset($props['id'])) {
         $a['id'] = $groupId;
     }
     if (isset($props['label'])) {
         $a['label'] = $g->getLabel();
     }
     if (isset($props['description'])) {
         $a['description'] = $g->getDescription();
     }
     if (isset($props['class'])) {
         $a['class'] = get_class($g);
     }
     if (isset($props['namespace'])) {
         $a['namespace'] = $g->getNamespace();
     }
     wfProfileOut(__METHOD__ . '-basic');
     wfProfileIn(__METHOD__ . '-exists');
     if (isset($props['exists'])) {
         $a['exists'] = $g->exists();
     }
     wfProfileOut(__METHOD__ . '-exists');
     wfProfileIn(__METHOD__ . '-icon');
     if (isset($props['icon'])) {
         $formats = TranslateUtils::getIcon($g, $params['iconsize']);
         if ($formats) {
             $a['icon'] = $formats;
         }
     }
     wfProfileOut(__METHOD__ . '-icon');
     wfProfileIn(__METHOD__ . '-priority');
     if (isset($props['priority'])) {
         $priority = MessageGroups::getPriority($g);
         $a['priority'] = $priority ?: 'default';
     }
     if (isset($props['prioritylangs'])) {
         $prioritylangs = TranslateMetadata::get($groupId, 'prioritylangs');
         $a['prioritylangs'] = $prioritylangs ? explode(',', $prioritylangs) : false;
     }
     if (isset($props['priorityforce'])) {
         $a['priorityforce'] = TranslateMetadata::get($groupId, 'priorityforce') === 'on';
     }
     wfProfileOut(__METHOD__ . '-priority');
     wfProfileIn(__METHOD__ . '-workflowstates');
     if (isset($props['workflowstates'])) {
         $a['workflowstates'] = $this->getWorkflowStates($g);
     }
     wfProfileOut(__METHOD__ . '-workflowstates');
     Hooks::run('TranslateProcessAPIMessageGroupsProperties', array(&$a, $props, $params, $g));
     wfProfileOut(__METHOD__ . '-' . get_class($g));
     // Depth only applies to tree format
     if ($depth >= $params['depth'] && $params['format'] === 'tree') {
         $a['groupcount'] = count($subgroups);
         // Prevent going further down in the three
         return $a;
     }
     // Always empty array for flat format, only sometimes for tree format
     if ($subgroups !== array()) {
         foreach ($subgroups as $sg) {
             $a['groups'][] = $this->formatGroup($sg, $props);
         }
         $result = $this->getResult();
         $result->setIndexedTagName($a['groups'], 'group');
     }
     return $a;
 }