Endroid\QrCode\QrCode::setImageType PHP Method

setImageType() public method

Set image type for rendering.
public setImageType ( string $image_type ) : QrCode
$image_type string Image type
return QrCode
    public function setImageType($image_type)
    {
        if (!in_array($image_type, $this->image_types_available)) {
            throw new ImageTypeInvalidException('QRCode: image type ' . $image_type . ' is invalid.');
        }
        $this->image_type = $image_type;
        return $this;
    }

Usage Example

コード例 #1
0
 public function testGetQrCodeWithParams()
 {
     $params = new Params();
     $routeParams = array('extension' => 'png', 'size' => 123, 'message' => 'this is a long message', 'padding' => 10);
     $params->setController(new ControllerMock($routeParams));
     $qrCode = new QrCode($routeParams['message']);
     $qrCode->setImageType($routeParams['extension']);
     $qrCode->setSize($routeParams['size']);
     $qrCode->setPadding($routeParams['padding']);
     $this->assertEquals($qrCode->get(), $this->qrCodeService->getQrCodeContent($params));
 }
All Usage Examples Of Endroid\QrCode\QrCode::setImageType