You are here

public function Entry::getLicenses in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/CreativeCommons/Entry.php \Zend\Feed\Reader\Extension\CreativeCommons\Entry::getLicenses()

Get the entry licenses

Return value

array

1 call to Entry::getLicenses()
Entry::getLicense in vendor/zendframework/zend-feed/src/Reader/Extension/CreativeCommons/Entry.php
Get the entry license

File

vendor/zendframework/zend-feed/src/Reader/Extension/CreativeCommons/Entry.php, line 38

Class

Entry

Namespace

Zend\Feed\Reader\Extension\CreativeCommons

Code

public function getLicenses() {
  $name = 'licenses';
  if (array_key_exists($name, $this->data)) {
    return $this->data[$name];
  }
  $licenses = [];
  $list = $this->xpath
    ->evaluate($this
    ->getXpathPrefix() . '//cc:license');
  if ($list->length) {
    foreach ($list as $license) {
      $licenses[] = $license->nodeValue;
    }
    $licenses = array_unique($licenses);
  }
  else {
    $cc = new Feed();
    $licenses = $cc
      ->getLicenses();
  }
  $this->data[$name] = $licenses;
  return $this->data[$name];
}