diff --git "a/class-wb\\Label.php" "b/class-wb\\Label.php" index a799c08..4ffdfa6 100644 --- "a/class-wb\\Label.php" +++ "b/class-wb\\Label.php" @@ -1,60 +1,69 @@ . # Wikibase namespace wb; /** * An entity Label. * * @see https://www.wikidata.org/wiki/Wikidata:Glossary#Label */ class Label { var $language; var $value; public function __construct( $language, $value ) { $this->setLanguage( $language ) ->setValue( $value ); } public function getLanguage() { return $this->language; } public function getValue() { return $this->value; } public function setLanguage( $language ) { $this->language = $language; return $this; } public function setValue( $value ) { $this->value = $value; return $this; } public static function createFromData( $data ) { if( ! isset( $data['language'], $data['value'] ) ) { throw new WrongDataException( __CLASS__ ); } return new static( $data['language'], $data['value'] ); } + + /** + * String rappresentation + * + * @return string + */ + public function __toString() { + return sprintf( '%s: %s', $this->getLanguage(), $this->getValue() ); + } }