コード例 #1
0
 /**
  * Switches the format of the outputted QrCode or defaults to SVG
  *
  * @param string $format The desired format.
  * @return $this
  * @throws \InvalidArgumentException
  */
 public function format($format)
 {
     switch ($format) {
         case 'png':
             $this->writer->setRenderer(new Png());
             break;
         case 'eps':
             $this->writer->setRenderer(new Eps());
             break;
         case 'svg':
             $this->writer->setRenderer(new Svg());
             break;
         default:
             throw new \InvalidArgumentException('Invalid format provided.');
     }
     return $this;
 }