mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-10-10 05:46:01 +00:00
added QROutput*
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Class QROutputBase
|
||||
*
|
||||
* @filesource QROutputBase.php
|
||||
* @created 09.12.2015
|
||||
* @package chillerlan\QRCode\Output
|
||||
* @author Smiley <smiley@chillerlan.net>
|
||||
* @copyright 2015 Smiley
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
namespace chillerlan\QRCode\Output;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class QROutputBase{
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $matrix;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $pixelCount;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* @param array $matrix
|
||||
*
|
||||
* @return $this
|
||||
* @throws \chillerlan\QRCode\Output\QRCodeOutputException
|
||||
*/
|
||||
public function setMatrix(array $matrix){
|
||||
$this->pixelCount = count($matrix);
|
||||
|
||||
// todo: specify valid range
|
||||
if($this->pixelCount < 2
|
||||
|| !isset($matrix[$this->pixelCount - 1])
|
||||
|| $this->pixelCount !== count($matrix[$this->pixelCount - 1])
|
||||
){
|
||||
throw new QRCodeOutputException('Invalid matrix!');
|
||||
}
|
||||
|
||||
$this->matrix = $matrix;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user