SimpleSoftwareIO\QrCode\BaconQrCodeGenerator::format PHP Method

format() public method

Switches the format of the outputted QrCode or defaults to SVG.
public format ( string $format )
$format string The desired format.
    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;
    }

Usage Example

Esempio n. 1
0
 /**
  * Switches the format of the outputted QrCode or defaults to SVG
  *
  * @param string $format The desired format.
  * @return $this 
  * @throws \InvalidArgumentException
  * @static 
  */
 public static function format($format)
 {
     return \SimpleSoftwareIO\QrCode\BaconQrCodeGenerator::format($format);
 }