/** * Renders the citation and stores the result in $this->citation. * @param WCStyle $style * @return array = the rendered citation and sorting parts. */ public function render() { # Build the citation if ( $this->citationLength->key == WCCitationLengthEnum::short ) { switch ( $this->citationType->key ) { case WCCitationTypeEnum::note: list( $citation, $sortingParts ) = $this->style->renderShortNoteCitation( $this ); break; case WCCitationTypeEnum::inline: list( $citation, $sortingParts ) = $this->style->renderShortInlineCitation( $this ); break; case WCCitationTypeEnum::authorDate: list( $citation, $sortingParts ) = $this->style->renderShortAuthorDateCitation( $this ); } } else { switch ( $this->citationType->key ) { case WCCitationTypeEnum::note: list( $citation, $sortingParts ) = $this->style->renderLongNoteCitation( $this ); break; case WCCitationTypeEnum::biblio: list( $citation, $sortingParts ) = $this->style->renderLongBiblioCitation( $this ); break; case WCCitationTypeEnum::authorDate: list( $citation, $sortingParts ) = $this->style->renderLongAuthorDateCitation( $this ); break; default: # case WCCitationTypeEnum::inline: list( $citation, $sortingParts ) = $this->style->renderLongInlineCitation( $this ); } } # Wrap the entire citation in an HTML span element with classes. $classHTML = WCStyle::citationHTML . ' ' . $this->style->styleHTML . ' ' . $this->reference->getWorkType() . ' ' . $this->citationType . ' ' . $this->citationLength; return array( WCStyle::wrapHTMLSpan( $citation, $classHTML ), $sortingParts ); }