WormsAdapter
class WormsAdapter implements LabelSourceAdapterContract
WoRMS label source adapter.
Constants
MAX_RESULTS |
WoRMS limits their results to a maximum of 50. We use a loop to get more results
for each "find" request. This is the number of maximum results that the loop will
return to prevent too many requests. |
Properties
protected SoapClient | $client | SOAP client for the WoRMS webservice. |
Methods
Set the SOAP client instance to use for requests.
Get the SOAP client instance to use for requests.
Find labels by scientific name.
Create the label (or labels) from the label source based on an API request.
Returns true
for accepted WoRMS items and false
otherwise.
Parse a WoRMS item to the internal representation.
Create (and save) a single label.
Create (and save) a label and all WoRMS parents that don't already exist in the tree.
Extract the aphia IDs in correct ordering from a WoRMS classification hierarchy.
Details
at line 39
setSoapClient(SoapClient $client)
Set the SOAP client instance to use for requests.
at line 49
SoapClient
getSoapClient()
Get the SOAP client instance to use for requests.
at line 68
array
find(Request $request)
Find labels by scientific name.
Uses the getAphiaRecords
function of the WoRMS web service.
see: http://www.marinespecies.org/aphia.php?p=soap
at line 129
array
create(int $id, Request $request)
Create the label (or labels) from the label source based on an API request.
Required request parameters:
string name Name of the new label
string color Color of the new label (like bada55
)
int source_id AphiaID of the new label in WoRMS
int label_source_id ID of the WoRMS LabelSource
Optional request parameters:
bool recursive Specifies if all parent labels should be fetched and inserted, too. int parent_id ID of the parent label. Must not be present if recursive is present.
at line 169
private bool
filterUnaccepted(object $item)
Returns true
for accepted WoRMS items and false
otherwise.
at line 180
private array
parseItem(object $item)
Parse a WoRMS item to the internal representation.
at line 211
private array
createSingleLabel(array $attributes)
Create (and save) a single label.
at line 233
private array
createRecursiveLabels(array $attributes)
Create (and save) a label and all WoRMS parents that don't already exist in the tree.
at line 291
private array
extractParents(object $hierarchy)
Extract the aphia IDs in correct ordering from a WoRMS classification hierarchy.