/**
  * @param AJXP_Node $node
  * @param string $scope
  * @return CompositeShare[]
  */
 protected function compositeShareFromMetaWithScope($node, $scope = "private")
 {
     if ($scope !== AJXP_METADATA_ALLUSERS) {
         $scope = $scope == "private";
     }
     $meta = $node->retrieveMetadata(AJXP_SHARED_META_NAMESPACE, $scope, AJXP_METADATA_SCOPE_REPOSITORY, true);
     $shares = array();
     $composites = array();
     if (!isset($meta["shares"])) {
         return $shares;
     }
     foreach ($meta["shares"] as $id => $shareData) {
         $type = $shareData["type"];
         if ($type == "repository") {
             if (!isset($shares[$id])) {
                 $shares[$id] = array("repository" => $id, "links" => array());
             }
         } else {
             if ($type == "minisite" || $type == "ocs_remote") {
                 $link = $this->shareStore->loadShareObject($id);
                 if (!empty($link)) {
                     $link->setAdditionalMeta($shareData);
                     $linkRepoId = $link->getRepositoryId();
                     if (empty($linkRepoId)) {
                         continue;
                     }
                     if (!isset($shares[$linkRepoId])) {
                         $shares[$linkRepoId] = array("repository" => $linkRepoId, "links" => array());
                     }
                     $shares[$linkRepoId]["links"][] = $link;
                 }
             }
         }
     }
     foreach ($shares as $repoId => $repoData) {
         $composite = new CompositeShare($node, $repoId);
         foreach ($repoData["links"] as $link) {
             $composite->addLink($link);
         }
         $composites[] = $composite;
     }
     return $composites;
 }