-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#12] Add links.primo to PrimoRecordGroup
The current link format yields strange results though, see #12 for more info.
- Loading branch information
1 parent
b36bb99
commit 62ebd11
Showing
3 changed files
with
57 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use BCLib\PrimoServices\DeepLink; | ||
use BCLib\PrimoServices\QueryTerm; | ||
use Danmichaelo\QuiteSimpleXMLElement\QuiteSimpleXMLElement; | ||
|
||
class PrimoResult | ||
{ | ||
|
||
public function toArray($fullRepr=false) | ||
{ | ||
$data = $this->brief; | ||
$data['links'] = [ | ||
'self' => $this->link(), | ||
]; | ||
if ($fullRepr) { | ||
$data['links']['primo'] = $this->primoLink(); | ||
if ($this instanceof PrimoRecord) { | ||
$data['links']['group'] = $this->groupLink(); | ||
$data['links']['cover'] = $this->coverLink(); | ||
} | ||
// $this->addLocations(); | ||
} | ||
|
||
if ($fullRepr) { | ||
$data = array_merge($data, $this->full); | ||
} | ||
return $data; | ||
} | ||
|
||
public function jsonSerialize() | ||
{ | ||
return toArray('full'); | ||
} | ||
} |