<commit_before><?php
/*!
 * yii2 extension - qrcode
 * xiewulong <<EMAIL>>
 * https://github.com/xiewulong/yii2-qrcode
 * https://raw.githubusercontent.com/xiewulong/yii2-qrcode/master/LICENSE
 * create: 2015/1/8
 * update: 2015/5/26
 * version: 0.0.1
 */

namespace yii\qrcode;

use Yii;
use PHPQRCode\QRcode;

class Manager{

	//文件名前缀
	public $pre = 'qr_';

	//错误纠正等级0-3
	public $level = 2;

	//尺寸1-27
	public $size = 6;

	//周围间距, 正整数, 默认2 * 4(px)
	public $margin = 2;

	//扩展名
	private $ext = 'png';

	/**
	 * 设置尺寸
	 * @method setSize
	 * @since 0.0.1
	 * @param {number} $size 尺寸
	 * @return {object}
	 * @example Yii::$app->qrcode->setSize($size);
	 */
	public function setSize($size){
		$this->size = $size;

		return $this;
	}

	/**
	 * 设置纠错等级
	 * @method setLevel
	 * @since 0.0.1
	 * @param {string} $level 等级
	 * @return {object}
	 * @example Yii::$app->qrcode->setLevel($level);
	 */
	public function setLevel($level){
		$this->level = $level;

		return $this;
	}

	/**
	 * 设置外间距
	 * @method setMargin
	 * @since 0.0.1
	 * @param {number} $margin 外间距
	 * @return {object}
	 * @example Yii::$app->qrcode->setMargin($margin);
	 */
	public function setMargin($margin){
		$this->margin = $margin;

		return $this;
	}

	/**
	 * 创建二维码
	 * @method create
	 * @since 0.0.1
	 * @param {string} $data 数据
	 * @return {array}
	 * @example Yii::$app->qrcode->create($data);
	 */
	public function create($data){
		$fileupload = \Yii::$app->fileupload;
		$file = $fileupload->createFile($this->ext, null, $this->pre);
		QRcode::png($data, $file['tmp'], $this->level, $this->size, $this->margin);
<commit_msg>qrcode<commit_after><?php
/*!
 * yii2 extension - qrcode
 * xiewulong <<EMAIL>>
 * https://github.com/xiewulong/yii2-qrcode
 * https://raw.githubusercontent.com/xiewulong/yii2-qrcode/master/LICENSE
 * create: 2015/1/8
 * update: 2015/10/6
 * version: 0.0.1
 */

namespace yii\qrcode;

use Yii;
use PHPQRCode\QRcode;

class Manager{

	//文件名前缀
	public $pre = 'qr_';

	//错误纠正等级0-3
	public $level = 2;

	//尺寸1-27
	public $size = 6;

	//周围间距, 正整数, 默认2 * 4(px)
	public $margin = 2;

	//扩展名
	private $ext = 'png';

	/**
	 * 设置尺寸
	 * @method setSize
	 * @since 0.0.1
	 * @param {number} $size 尺寸
	 * @return {object}
	 * @example \Yii::$app->qrcode->setSize($size);
	 */
	public function setSize($size){
		$this->size = $size;

		return $this;
	}

	/**
	 * 设置纠错等级
	 * @method setLevel
	 * @since 0.0.1
	 * @param {string} $level 等级
	 * @return {object}
	 * @example \Yii::$app->qrcode->setLevel($level);
	 */
	public function setLevel($level){
		$this->level = $level;

		return $this;
	}

	/**
	 * 设置外间距
	 * @method setMargin
	 * @since 0.0.1
	 * @param {number} $margin 外间距
	 * @return {object}
	 * @example \Yii::$app->qrcode->setMargin($margin);
	 */
	public function setMargin($margin){
		$this->margin = $margin;

		return $this;
	}

	/**
	 * 创建二维码
	 * @method create
	 * @since 0.0.1
	 * @param {string} $data 数据
	 * @return {array}
	 * @example \Yii::$app->qrcode->create($data);
	 */
	public function create($data){
		$fileupload = \Yii::$app->fileupload;
		$file = $fileupload->createFile($this->ext, null, $this->pre);
		QRcode::png($data, $file['tmp'], $this->level, $this->size, $this->margin);

{'fraction_non_alphanumeric': 0.19981267561660943, 'fraction_numerical': 0.025600999063378083, 'mean_word_length': 3.199213630406291, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 43, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5340231', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1371, 'n_words': 264}