public function testNewFactoryWithParams() { $hashFactory = new HashFactory(['test' => 'testData']); $hash = $hashFactory->getMd5Hash('TEST'); $this->assertInstanceOf('\\SimpleHash\\Container\\HashContainer', $hash); $this->assertEquals('033bd94b1168d7e4f0d644c3c95e35bf', $hash); }
/** * Facade interface method * * @param string $name * @param array $arguments * @return \SimpleHash\Container\HashContainer * @throws \SimpleHash\Exception\SimpleHashException */ public static function __callStatic($name, $arguments) { $factory = new HashFactory(self::getCalclatorParams($arguments)); // Check if the requested algorithm is implemented if (!$factory->hasCalculator($name)) { throw SimpleHashException::make('Algorithm "' . $name . '" is not implemented yet!'); } // Build hash container $getterMethod = self::getFactoryMethodName($name); return $factory->{$getterMethod}(self::getPlainTextString($arguments)); }