quoter = $quoter ?: new N3Quoter(); } /** * @param string $base * @param string|null $local */ protected function writeRef( $base, $local = null ) { if ( $local === null ) { if ( $base === 'a' ) { $this->write( 'a' ); } else { $this->writeIRI( $base ); } } else { $this->write( "$base:$local" ); } } /** * @param string $iri * @param bool $trustIRI */ protected function writeIRI( $iri, $trustIRI = false ) { if ( !$trustIRI ) { $iri = $this->quoter->escapeIRI( $iri ); } $this->write( "<$iri>" ); } /** * @inheritDoc */ protected function writeText( $text, $language = null ) { $value = $this->quoter->escapeLiteral( $text ); $this->write( '"' . $value . '"' ); if ( $this->isValidLanguageCode( $language ) ) { $this->write( '@' . $language ); } } /** * @param string $value * @param string|null $typeBase * @param string|null $typeLocal */ protected function writeValue( $value, $typeBase, $typeLocal = null ) { $value = $this->quoter->escapeLiteral( $value ); $this->write( '"' . $value . '"' ); if ( $typeBase !== null ) { $this->write( '^^' ); $this->writeRef( $typeBase, $typeLocal ); } } }