From 9a411b5087855d435c0a2840805532e7e34a8d65 Mon Sep 17 00:00:00 2001 From: travail Date: Fri, 9 Oct 2015 18:20:27 +0900 Subject: [PATCH] Add the method Image\PerceptualHash::version() --- lib/PerceptualHash.php | 10 ++++++++++ tests/BasicTest.php | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/PerceptualHash.php b/lib/PerceptualHash.php index e2bca3c..3a6fa50 100644 --- a/lib/PerceptualHash.php +++ b/lib/PerceptualHash.php @@ -10,6 +10,8 @@ use Image\PerceptualHash\Algorithm\AverageHash; use Image\PerceptualHash\Exception\FileNotFoundException; class PerceptualHash { + const VERSION = '0.1.0'; + /** * @var Algorithm Instance of Algorithm */ @@ -39,6 +41,14 @@ class PerceptualHash { $this->hex = $this->algorithm->hex($this->bin); } + /** + * @return string The version of Image\PerceptualHash. + */ + public static function version() + { + return (string) self::VERSION; + } + /** * Returns binary hash. * diff --git a/tests/BasicTest.php b/tests/BasicTest.php index bbbca5d..17d6fc2 100644 --- a/tests/BasicTest.php +++ b/tests/BasicTest.php @@ -16,6 +16,14 @@ class BasicTest extends PHPUnit_Framework_TestCase $this->bin_inuo2 = '1111011111110011000000100000000011000011110000111100001111111111'; } + public function testVersion() + { + $version = PerceptualHash::version(); + $this->assertTrue(isset($version)); + $this->assertTrue(is_string($version)); + $this->assertSame(PerceptualHash::VERSION, $version); + } + public function testLoad() { try {