diff --git "a/include/class-wb\\DataValueCommonsCategory.php" "b/include/class-wb\\DataValueCommonsCategory.php" index e3d8cbf..691a318 100644 --- "a/include/class-wb\\DataValueCommonsCategory.php" +++ "b/include/class-wb\\DataValueCommonsCategory.php" @@ -1,35 +1,35 @@ . # Wikibase namespace wb; /** * A DataValue for a Wikimedia Commons category. * * There is no special datavalue for a Wikimedia Commons file :^) */ -class DataValueCommonsCategory extends DataValueCommonsCategory { +class DataValueCommonsCategory extends DataValueCommonsMedia { /** * @return string */ public function __toString() { return "[[c:Category:{$this->getValue()}]]"; } } diff --git "a/include/class-wb\\DataValueCommonsCategory.php" "b/include/class-wb\\SnakCommonsCategory.php" similarity index 67% copy from "include/class-wb\\DataValueCommonsCategory.php" copy to "include/class-wb\\SnakCommonsCategory.php" index e3d8cbf..a27fc16 100644 --- "a/include/class-wb\\DataValueCommonsCategory.php" +++ "b/include/class-wb\\SnakCommonsCategory.php" @@ -1,35 +1,38 @@ . # Wikibase namespace wb; /** - * A DataValue for a Wikimedia Commons category. - * - * There is no special datavalue for a Wikimedia Commons file :^) + * A Snak for a Commons category */ -class DataValueCommonsCategory extends DataValueCommonsCategory { +class SnakCommonsCategory extends Snak { /** - * @return string + * @param $property string Property as 'P123' + * @param $categoryname string Category name as 'Example.png' */ - public function __toString() { - return "[[c:Category:{$this->getValue()}]]"; + public function __construct( $property, $categoryname ) { + parent::__construct( + 'value', + $property, + DataType::COMMONS_MEDIA, + new DataValueCommonsCategory( $categoryname ) + ); } - } diff --git "a/include/class-wb\\DataValueCommonsCategory.php" "b/include/class-wb\\StatementCommonsCategory.php" similarity index 67% copy from "include/class-wb\\DataValueCommonsCategory.php" copy to "include/class-wb\\StatementCommonsCategory.php" index e3d8cbf..7194d97 100644 --- "a/include/class-wb\\DataValueCommonsCategory.php" +++ "b/include/class-wb\\StatementCommonsCategory.php" @@ -1,35 +1,33 @@ . # Wikibase namespace wb; /** - * A DataValue for a Wikimedia Commons category. - * - * There is no special datavalue for a Wikimedia Commons file :^) + * A StatementCommonCategory is a Statement that contains a SnakCommonCategory. */ -class DataValueCommonsCategory extends DataValueCommonsCategory { +class StatementCommonsCategory extends Statement { /** - * @return string + * @param $property string Property as 'P123' + * @param $filename string File category as 'Category:Example.png' */ - public function __toString() { - return "[[c:Category:{$this->getValue()}]]"; + public function __construct( $property, $filename ) { + parent::__construct( new SnakCommonsCategory( $property, $filename ) ); } - }