You are here

public function Rss::getLanguage in Zircon Profile 8

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

Get the feed language

Return value

string|null

Overrides FeedInterface::getLanguage

File

vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php, line 433

Class

Rss

Namespace

Zend\Feed\Reader\Feed

Code

public function getLanguage() {
  if (array_key_exists('language', $this->data)) {
    return $this->data['language'];
  }
  $language = null;
  if ($this
    ->getType() !== Reader\Reader::TYPE_RSS_10 && $this
    ->getType() !== Reader\Reader::TYPE_RSS_090) {
    $language = $this->xpath
      ->evaluate('string(/rss/channel/language)');
  }
  if (!$language && $this
    ->getExtension('DublinCore') !== null) {
    $language = $this
      ->getExtension('DublinCore')
      ->getLanguage();
  }
  if (empty($language)) {
    $language = $this
      ->getExtension('Atom')
      ->getLanguage();
  }
  if (!$language) {
    $language = $this->xpath
      ->evaluate('string(//@xml:lang[1])');
  }
  if (!$language) {
    $language = null;
  }
  $this->data['language'] = $language;
  return $this->data['language'];
}