* Set created_at.
* Only used when importing data from an other service.
*
- * @param \DateTime $createdAt
- *
* @return Entry
*/
public function setCreatedAt(\DateTime $createdAt)
return $this->annotations;
}
- /**
- * @param Annotation $annotation
- */
public function setAnnotation(Annotation $annotation)
{
$this->annotations[] = $annotation;
return $data;
}
- /**
- * @param Tag $tag
- */
public function addTag(Tag $tag)
{
if ($this->tags->contains($tag)) {
/**
* Remove the given tag from the entry (if the tag is associated).
- *
- * @param Tag $tag
*/
public function removeTag(Tag $tag)
{
return $this->language;
}
+ /**
+ * Format the entry language to a valid html lang attribute.
+ */
+ public function getHTMLLanguage()
+ {
+ $parsedLocale = \Locale::parseLocale($this->getLanguage());
+ $lang = '';
+ $lang .= $parsedLocale['language'] ?? '';
+ $lang .= isset($parsedLocale['region']) ? '-' . $parsedLocale['region'] : '';
+
+ return $lang;
+ }
+
/**
* @return string|null
*/
}
/**
- * @param \Datetime $publishedAt
- *
* @return Entry
*/
public function setPublishedAt(\Datetime $publishedAt)