protected function buildChannelTree()
    {
        if ($this->channels == array($this->channelNameRoot)) {
            return array();
        }
        \sort($this->channels);
        // move root to the top
        $rootKey = \array_search($this->channelNameRoot, $this->channels);
        if ($rootKey !== false) {
            unset($this->channels[$rootKey]);
            \array_unshift($this->channels, $this->channelName);
        }
        $tree = array();
        foreach ($this->channels as $channel) {
            $ref = &$tree;
            $path = \explode('.', $channel);
            foreach ($path as $k) {
                if (!isset($ref[$k])) {
                    $ref[$k] = array();
                }
                $ref = &$ref[$k];
            }
        }
        return $tree;
    }