/** * Set the symmetric cipher broker * * @param string|PaddingBroker $broker * @return void */ public static function setPaddingBroker($broker) { if (is_string($broker)) { if (!class_exists($broker)) { throw new Exception\InvalidArgumentException(sprintf( 'Unable to locate padding broker of class "%s"', $broker )); } $broker = new $broker(); } if (!$broker instanceof PaddingBroker) { throw new Exception\InvalidArgumentException(sprintf( 'Padding broker must extend PaddingBroker; received "%s"', (is_object($broker) ? get_class($broker) : gettype($broker)) )); } self::$paddingBroker = $broker; }
/** * Set the padding plugin manager * * @param string|PaddingPluginManager $plugins * @throws Exception\InvalidArgumentException * @return void */ public static function setPaddingPluginManager($plugins) { if (is_string($plugins)) { if (!class_exists($plugins)) { throw new Exception\InvalidArgumentException(sprintf('Unable to locate padding plugin manager via class "%s"; class does not exist', $plugins)); } $plugins = new $plugins(); } if (!$plugins instanceof PaddingPluginManager) { throw new Exception\InvalidArgumentException(sprintf('Padding plugins must extend %s\\PaddingPluginManager; received "%s"', __NAMESPACE__, is_object($plugins) ? get_class($plugins) : gettype($plugins))); } self::$paddingPlugins = $plugins; }