Beispiel #1
0
 /**
  * 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;
 }