public function getNotebook($notebook_guid, $scope = null)
{
if (null === $scope || self::PERSONAL_SCOPE === $scope) {
try {
$edamNotebook = $this->getUserNotestore()->getNotebook($this->token, $notebook_guid);
return new Notebook($edamNotebook);
} catch (EDAMNotFoundException $e) {
if (self::PERSONAL_SCOPE === $scope) {
return null;
}
}
}
if (null === $scope || self::LINKED_SCOPE === $scope) {
$linkedNotebooks = $this->listLinkedNotebooks();
foreach ($linkedNotebooks as $linkedNotebook) {
try {
$sharedNotebook = $this->getNoteBookByLinkedNotebook($linkedNotebook);
if ($this->isAppNotebookToken($this->token)) {
return $sharedNotebook;
}
} catch (EDAMUserException $e) {
// No right on this notebook.
continue;
}
if ($sharedNotebook->guid === $notebook_guid) {
return $sharedNotebook;
}
}
return null;
}
}