diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 41227271..00000000
--- a/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-/.idea
-/.vscode
-*.log
-.env
-.DS_Store
-runtime/
-vendor/
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 36f7b6f9..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-sudo: false
-
-language: php
-
-branches:
- only:
- - stable
-
-cache:
- directories:
- - $HOME/.composer/cache
-
-before_install:
- - composer self-update
-
-install:
- - composer install --no-dev --no-interaction --ignore-platform-reqs
- - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
- - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
- - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
- - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
- - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
- - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
- - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
- - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
- - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
- - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
- - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
-
-script:
- - php think unit
-
-deploy:
- provider: releases
- api_key:
- secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
- file:
- - ThinkPHP_Core.zip
- - ThinkPHP_Full.zip
- skip_cleanup: true
- on:
- tags: true
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index 574a39c4..00000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-
-ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
-版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
-All rights reserved。
-ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
-
-Apache Licence是著名的非盈利开源组织Apache采用的协议。
-该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
-允许代码修改,再作为开源或商业软件发布。需要满足
-的条件:
-1. 需要给代码的用户一份Apache Licence ;
-2. 如果你修改了代码,需要在被修改的文件中说明;
-3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
-带有原来代码中的协议,商标,专利声明和其他原来作者规
-定需要包含的说明;
-4. 如果再发布的产品中包含一个Notice文件,则在Notice文
-件中需要带有本协议内容。你可以在Notice中增加自己的
-许可,但不可以表现为对Apache Licence构成更改。
-具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
deleted file mode 100644
index ef27d58e..00000000
--- a/README.md
+++ /dev/null
@@ -1,68 +0,0 @@
-
-# 免费学生成绩统计系统
-
- 坦率地讲,在不久的将来,这也许会是辽东半岛上第二好用的成绩统计系统。如果你觉得还可以,还不赶紧 Watch 、 Start 一下。如果觉得不好,何不给个改进意见再离开,反正已经来了,是吧?
-
-
-
- 言归正传
-
- 这是一款注重优化成绩采集方法、丰富成绩分析维度的小学成绩统计系统,力争做到符合教师工作习惯、使用方法简单、数据分析多样、分析结果科学,为教师的试卷分析、教育科研提供数据参考。
-
- 开发者是一名非计算机专业的小学教师,只因工作遇到了兴趣,才有了这个小项目。为了让自己统计成绩工作变得更优雅,才边学边写这个成绩统计项目。信息录入简单,学生、老师的信息可以直接从学籍、人事负责人获取,将获取的数据复制到模板中便可上传。在操作设计中,遵循 Giles Colborne 的简约至上原则,尽量做到三步便可到达要操作的位置。统计维度参考华东师范大学教育学系王孝玲教授著作的《教育统计学》第五版。前端采用X-admin,后端采用ThinkPHP框架开发。
-
-
- “情怀”的代言人罗永浩说:“科技的每一次进步,给我们带来的是更好的世界,而不是完美的世界”。因此,我会不断完善系统功能,让统计成绩不再是一份辛苦的工作,让大家变成成绩分析牛人!
-
-
-
-## 主要功能:
-
-* 设置系统信息、单位信息管理、类别管理
-* 学期、班级、学科 管理
-* 管理员与权限管理
-* 教师与学生信息管理
-* 考试信息设置
-* 生成学生的考试号
-* 生成学生试卷标签
-* 生成学生成绩采集表
-* 使用电子表格录入成绩
-* 使用二维码录入成绩
-* 编辑、删除成绩
-* 查看成绩列表
-* 查看成绩统计结果
-
-
-学生成绩列表
-
-
-班级成绩统计
-
-
-扫码录入成绩页面
-
-
-权限分配页面
-
-
-## 演示地址
-[http://xiaoshongshu.cn](http://xiaoshongshu.cn)
-
-帐号 test1 密码 123456
-
-里面隐藏了两个很实用的功能,如果想了解隐藏功能,请下载。
-
-## 更新内容
- 前端使用X-admin(感谢singliang大神建议),最佳浏览器为 Chrome 和 Firefox ,搜狗、360等浏览器请打开极速模式,只使用IE浏览器的朋友请绕行。后端更新最新TP框架。优化代码。
-## 升级提示
- 相比1.0版,增减了很多字段和数据,建议重新建表。
-
-
-## 更详细信息请查阅官方手册
-https://www.kancloud.cn/llblax/abcd/789222
-
-## 下一步工作
-* 继续增加统计项目
-* 以图表形式呈现统计结果
-* 增加教师职务权限验证
-* 增加学生自助查询成绩
\ No newline at end of file
diff --git a/application/.htaccess b/application/.htaccess
deleted file mode 100644
index 3418e55a..00000000
--- a/application/.htaccess
+++ /dev/null
@@ -1 +0,0 @@
-deny from all
\ No newline at end of file
diff --git a/application/admin/common.php b/application/admin/common.php
deleted file mode 100644
index b3d9bbc7..00000000
--- a/application/admin/common.php
+++ /dev/null
@@ -1 +0,0 @@
-assign('list',$list);
-
- // 渲染模板
- return $this->fetch();
- }
-
-
- // 获取角色列表
- public function ajaxData()
- {
- // 获取参数
- $src = $this->request
- ->only([
- 'page'=>'1',
- 'limit'=>'10',
- 'field'=>'id',
- 'type'=>'asc',
- 'searchval'=>''
- ],'POST');
-
-
- // 实例化
- $ag = new AG;
-
- // 查询要显示的数据
- $data = $ag->search($src);
- // 获取符合条件记录总数
- $cnt = $data->count();
- // 获取当前页数据
- $limit_start = $src['page'] * $src['limit'] - $src['limit'];
- $limit_length = $src['limit'];
- $data = $data->slice($limit_start,$limit_length);
-
- // 重组返回内容
- $data = [
- 'code'=> 0 , // ajax请求次数,作为标识符
- 'msg'=>"", // 获取到的结果数(每页显示数量)
- 'count'=>$cnt, // 符合条件的总数据量
- 'data'=>$data, //获取到的数据结果
- ];
-
- return json($data);
- }
-
-
- // 创建角色
- public function create()
- {
- // 设置页面标题
- $list['set'] = array(
- 'webtitle'=>'添加角色',
- 'butname'=>'添加',
- 'formpost'=>'POST',
- 'url'=>'/authgroup',
- );
-
-
- // 模板赋值
- $this->assign('list',$list);
-
- // 渲染
- return $this->fetch();
- }
-
-
- // 保存角色信息
- public function save()
- {
-
- // 实例化验证模型
- $validate = new \app\admin\validate\RuleGroup;
-
-
- // 获取表单数据
- $list = request()->only(['title','rules','miaoshu'],'post');
- $list['rules'] = implode(",",$list['rules']);
-
-
- // 验证表单数据
- $result = $validate->check($list);
- $msg = $validate->getError();
-
-
- // 如果验证不通过则停止保存
- if(!$result){
- return json(['msg'=>$msg,'val'=>0]);;
- }
-
- // 保存数据
- $data = AG::create($list);
-
-
- // 根据更新结果设置返回提示信息
- $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
- /**
- * 显示指定的资源
- *
- * @param int $id
- * @return \think\Response
- */
- public function read($id)
- {
- //
- }
-
-
-
-
- // 修改角色信息
- public function edit($id)
- {
- // 获取单位信息
- $list['data'] = AG::field('id,title,miaoshu,rules')
- ->find($id);
-
- // 设置页面标题
- $list['set'] = array(
- 'webtitle'=>'编辑角色',
- 'butname'=>'修改',
- 'formpost'=>'PUT',
- 'url'=>'/authgroup/'.$id,
- );
-
- // 模板赋值
- $this->assign('list',$list);
- // 渲染
- return $this->fetch('create');
- }
-
-
-
-
-
- // 更新角色信息
- public function update($id)
- {
-
- // 实例化验证模型
- $validate = new \app\admin\validate\RuleGroup;
-
- // 获取表单数据
- $list = request()->only(['title','rules','miaoshu'],'put');
- $list['rules'] = implode(",",$list['rules']);
-
- // 验证表单数据
- $result = $validate->check($list);
- $msg = $validate->getError();
-
- // 如果验证不通过则停止保存
- if(!$result){
- return json(['msg'=>$msg,'val'=>0]);;
- }
-
-
- $data = AG::where('id',$id)->update($list);
-
- // 根据更新结果设置返回提示信息
- $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
-
-
-
- // 删除角色
- public function delete($id)
- {
-
- if($id == 'm')
- {
- $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
- }
-
- $data = AG::destroy($id);
-
- // 根据更新结果设置返回提示信息
- $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
-
-
- // 设置角色状态
- public function setStatus()
- {
-
- // 获取id变量
- $id = request()->post('id');
- $value = request()->post('value');
-
- // 更新数据
- $data= AG::where('id',$id)->update(['status'=>$value]);
-
- // 根据更新结果设置返回提示信息
- $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
-
-}
diff --git a/application/admin/controller/AuthGroupAccess.php b/application/admin/controller/AuthGroupAccess.php
deleted file mode 100644
index d55b50f9..00000000
--- a/application/admin/controller/AuthGroupAccess.php
+++ /dev/null
@@ -1,14 +0,0 @@
-assign('list',$list);
-
- // 渲染模板
- return $this->fetch();
- }
-
-
- // 获取权限信息列表
- public function ajaxData()
- {
- // 获取参数
- $src = $this->request
- ->only([
- 'page'=>'1'
- ,'limit'=>'10'
- ,'field'=>'id'
- ,'type'=>'asc'
- ,'searchval'=>''
- ],'POST');
-
- // 实例化
- $ar = new AR;
-
- // 查询要显示的数据
- $data = $ar->search($src);
- // 获取符合条件记录总数
- $cnt = $data->count();
- // 获取当前页数据
- $limit_start = $src['page'] * $src['limit'] - $src['limit'];
- $limit_length = $src['limit'];
- $data = $data->slice($limit_start,$limit_length);
-
- // 重组返回内容
- $data = [
- 'code'=> 0 , // ajax请求次数,作为标识符
- 'msg'=>"", // 获取到的结果数(每页显示数量)
- 'count'=>$cnt, // 符合条件的总数据量
- 'data'=>$data, //获取到的数据结果
- ];
-
- return json($data);
- }
-
-
-
- // 创建权限
- public function create()
- {
- // 设置页面标题
- $list['set'] = array(
- 'webtitle'=>'添加权限',
- 'butname'=>'添加',
- 'formpost'=>'POST',
- 'url'=>'/authrule',
- );
-
-
- // 模板赋值
- $this->assign('list',$list);
- // 渲染
- return $this->fetch('create');
- }
-
-
-
- // 保存信息
- public function save()
- {
- // 实例化验证模型
- $validate = new \app\admin\validate\Rule;
-
-
- // 获取表单数据
- $list = request()->only(['title','name','pid','condition','paixu','ismenu','font','beizhu','url'],'post');
-
-
- // 验证表单数据
- $result = $validate->check($list);
- $msg = $validate->getError();
-
-
- // 如果验证不通过则停止保存
- if(!$result){
- return json(['msg'=>$msg,'val'=>0]);;
- }
-
- // 保存数据
- $data = AR::create($list);
-
- // 根据更新结果设置返回提示信息
- $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
- //
- public function read($id)
- {
- //
- }
-
-
-
-
- // 修改权限信息
- public function edit($id)
- {
-
- // 获取权限信息
- $list['data'] = AR::field('id,title,name,condition,pid,paixu,ismenu,font,url')
- ->find($id);
-
- // 设置页面标题
- $list['set'] = array(
- 'webtitle'=>'编辑权限',
- 'butname'=>'修改',
- 'formpost'=>'PUT',
- 'url'=>'/authrule/'.$id,
- );
-
-
- // 模板赋值
- $this->assign('list',$list);
- // 渲染
- return $this->fetch('create');
- }
-
-
-
-
-
- // 更新权限信息
- public function update($id)
- {
- $validate = new \app\admin\validate\Rule;
-
- // 获取表单数据
- $list = request()->only(['title','name','pid','condition','paixu','ismenu','font','beizhu','url'],'put');
-
- // 验证表单数据
- $result = $validate->check($list);
- $msg = $validate->getError();
-
- // 如果验证不通过则停止保存
- if(!$result){
- return json(['msg'=>$msg,'val'=>0]);;
- }
-
-
- $data = AR::where('id',$id)->update($list);
-
- // 根据更新结果设置返回提示信息
- $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
-
-
-
-
- // 删除权限
- public function delete($id)
- {
- if($id == 'm')
- {
- $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
- }
-
- $data = AR::destroy($id);
-
- // 根据更新结果设置返回提示信息
- $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
-
-
- // 设置权限状态
- public function setStatus()
- {
-
- // 获取id变量
- $id = request()->post('id');
- $value = request()->post('value');
-
- // 获取权限信息
- $data = AR::where('id',$id)->update(['status'=>$value]);
-
- // 根据更新结果设置返回提示信息
- $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
-
-}
diff --git a/application/admin/controller/Error.php b/application/admin/controller/Error.php
deleted file mode 100644
index 23d823e6..00000000
--- a/application/admin/controller/Error.php
+++ /dev/null
@@ -1,11 +0,0 @@
-assign('list',$list);
-
- // 渲染模板
- return $this->fetch();
- }
-
-
- // 获取数据管理员数据
- public function ajaxData()
- {
- // 获取参数
- $src = $this->request
- ->only([
- 'page'=>'1'
- ,'limit'=>'10'
- ,'field'=>'id'
- ,'type'=>'desc'
- ,'searchval'=>''
- ],'POST');
-
- // 实例化
- $ad = new AD;
-
- // 查询要显示的数据
- $data = $ad->search($src);
-
- // 获取符合条件记录总数
- $cnt = $data->count();
- // 获取当前页数据
- $limit_start = $src['page'] * $src['limit'] - $src['limit'];
- $limit_length = $src['limit'];
- $data = $data->slice($limit_start,$limit_length);
-
- // 重组返回内容
- $data = [
- 'code'=> 0 , // ajax请求次数,作为标识符
- 'msg'=>"", // 获取到的结果数(每页显示数量)
- 'count'=>$cnt, // 符合条件的总数据量
- 'data'=>$data, //获取到的数据结果
- ];
-
- return json($data);
- }
-
-
- // 创建用户信息
- public function create()
- {
- // 设置页面标题
- $list['set'] = array(
- 'webtitle'=>'添加管理员',
- 'butname'=>'添加',
- 'formpost'=>'POST',
- 'url'=>'/admin',
- );
-
-
- // 模板赋值
- $this->assign('list',$list);
- // 渲染
- return $this->fetch('create');
- }
-
-
- // 保存管理员
- public function save()
- {
-
- // 实例化加密类
- $md5 = new APR1_MD5();
- // 实例化验证模型
- $validate = new \app\admin\validate\Admin;
-
-
- // 获取表单数据
- $list = request()->only(['xingming','school','username','sex','shengri','phone','beizhu','group_id'],'post');
-
-
- // 设置密码,默认为123456
- $list['password'] = $md5->hash('123456');
-
-
- // 验证表单数据
- $result = $validate->check($list);
- $msg = $validate->getError();
-
-
- // 如果验证不通过则停止保存
- if(!$result){
- return json(['msg'=>$msg,'val'=>0]);;
- }
-
- // 实例化管理员数据模型类
- $admin = new AD();
- $admindata = $admin->create($list);
-
- // 更新中间表
- $groupdata=$admindata->glGroup()->saveAll($list['group_id']);
-
-
- // 根据更新结果设置返回提示信息
- $admindata&&$groupdata ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
-
- }
-
-
-
-
- // 读取用户信息
- public function read($id)
- {
- // 获取管理员信息
- $ad = new AD;
- $list = AD::where('id',$id)
- ->field('id,xingming,sex,shengri,username,school,phone,denglucishu,lastip,ip,lasttime,thistime,create_time,update_time')
- ->with([
- 'adSchool'=>function($query){
- $query->field('id,title');
- }
- ])
- ->find();
- $list['webtitle'] = '帐号信息';
- $list->groupnames = $ad->getGroupnames($id);
-
- // 模板赋值
- $this->assign('list',$list);
-
- // 渲染模板
- return $this->fetch();
- }
-
-
- // 读取用户信息
- public function myinfo()
- {
- $id = session('userid');
- $ad = new AD;
- // 获取管理员信息
- $list = $ad->where('id',$id)
- ->field('id,xingming,sex,shengri,username,school,phone,denglucishu,lastip,ip,lasttime,thistime,create_time,update_time')
- ->with([
- 'adSchool'=>function($query){
- $query->field('id,title');
- }
- ])
- ->find();
- $list->groupnames = $ad->getGroupnames($id);
-
-
- $list['webtitle'] = '我的信息';
-
- // 模板赋值
- $this->assign('list',$list);
-
-
- // 渲染模板
- return $this->fetch('read');
- }
-
-
-
-
- //
- public function edit($id)
- {
-
- // 获取用户信息
- $list['data'] = AD::where('id',$id)
- ->field('id,school,username,xingming,sex,shengri,phone,beizhu')
- ->with([
- 'adSchool'=>function($query){
- $query->field('id,jiancheng');
- }
- ,'glGroup'=>function($query){
- $query->where('status',1)->field('title,rules,miaoshu');
- }
- ])
- ->find();
-
- // 设置页面标题
- $list['set'] = array(
- 'webtitle'=>'编辑管理员',
- 'butname'=>'修改',
- 'formpost'=>'PUT',
- 'url'=>'/admin/'.$id,
- );
-
-
- // 模板赋值
- $this->assign('list',$list);
- // 渲染
- return $this->fetch('create');
-
- }
-
- // 更新管理员信息
- public function update($id)
- {
-
- // 实例化验证模型
- $validate = new \app\admin\validate\Admin;
-
- // 获取表单数据
- $list = request()->only(['xingming','school','username','sex','shengri','phone','beizhu','group_id'],'put');
-
- $list['group_id'] = array_values($list['group_id']);
-
- // 验证表单数据
- $result = $validate->check($list);
- $msg = $validate->getError();
-
- // 如果验证不通过则停止保存
- if(!$result){
- return json(['msg'=>$msg,'val'=>0]);;
- }
-
-
- // 更新管理员信息
- $list['id'] = $id;
- $admindata = AD::update($list);
-
- // 更新中间表
- $groupdata=$admindata->glGroup()->detach();
- $groupdata=$admindata->glGroup()->attach($list['group_id']);
-
- // 根据更新结果设置返回提示信息
- $admindata&&$groupdata ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
- /**
- * 删除指定资源
- *
- * @param int $id
- * @return \think\Response
- */
- public function delete($id)
- {
-
- if($id == 'm'){
- $id = request()->delete('ids');
- }
-
- $data = AD::destroy($id);
-
- // 根据更新结果设置返回提示信息
- $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
-
- // 修改管理员状态
- public function setStatus()
- {
-
- // 获取id变量
- $id = request()->post('id');
- $value = request()->post('value');
-
- // 更新管理员信息
- $data = AD::where('id',$id)->update(['status'=>$value]);
-
- // 根据更新结果设置返回提示信息
- $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
-
- // 重置密码
- public function resetpassword($id)
- {
-
- // 实例化加密类
- $md5 = new APR1_MD5();
-
- // 生成密码
- $password = $md5->hash('123456');
-
- // 查询用户信息
- $data = AD::where('id',$id)->update(['password'=>$password]);
-
- // 根据更新结果设置返回提示信息
- $data ? $data=['msg'=>'密码已经重置为:
123456','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
-
- // 修改自己的密码
- public function editPassword()
- {
- // 设置页面标题
- $list['set'] = array(
- 'webtitle'=>'修改密码',
- 'butname'=>'修改',
- 'formpost'=>'PUT',
- 'url'=>'/editpassword/'.session('userid'),
- );
-
- // 模板赋值
- $this->assign('list',$list);
-
- // 渲染模板
- return $this->fetch();
- }
-
-
- // 保存新密码
- public function updatePassword($id)
- {
- // 获取表单数据
- $list = request()->post();
-
- // 验证表单数据
- // 实例化验证模型
- $validate = new \app\admin\validate\SetPassword;
- $result = $validate->check($list);
- $msg = $validate->getError();
-
- // 如果验证不通过则停止保存
- if(!$result){
- return json(['msg'=>$msg,'val'=>0]);;
- }
-
-
- // 获取用户名
- $serpassword = AD::where('id',$id)->value('password');
-
- // 实例化加密类
- $md5 = new APR1_MD5();
- //验证密码
- $check = $md5->check($list['oldpassword'],$serpassword);
-
- if(!$check)
- {
- $data=['msg'=>'旧密码错误','val'=>0];
- return json($data);
- }
-
- // 更新密码
- $password = $md5->hash($list['newpassword']);
- $data = AD::update(['id'=>$id,'password'=>$password]);
-
-
- // 根据更新结果设置返回提示信息
- $data ? $data=['msg'=>'修改成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
-
- // 返回信息
- return json($data);
- }
-
-}
diff --git a/application/admin/model/Admin.php b/application/admin/model/Admin.php
deleted file mode 100644
index 2d89a907..00000000
--- a/application/admin/model/Admin.php
+++ /dev/null
@@ -1,146 +0,0 @@
-order([$src['field'] =>$src['type']])
- ->where('id','>',2)
- ->when(strlen($searchval)>0,function($query) use($searchval){
- $query->where('xingming|username','like','%'.$searchval.'%');
- })
- ->with([
- 'adSchool'=>function($query){
- $query->field('id,jiancheng');
- }
- ,'glGroup'=>function($query){
- $query->where('status',1)->field('title,rules,miaoshu');
- }
- ])
- ->hidden(['password','create_time','update_time','delete_time'])
- ->select();
- return $data;
- }
-
- public function glGroup()
- {
- return $this->belongsToMany('AuthGroup','AuthGroupAccess','group_id','uid');
- }
-
-
- // 用户角色获取器
- public function userGroup()
- {
- return $this->belongsToMany('AuthGroup','AuthGroupAccess','id','uid');
- }
-
-
- // 获取密码
- public function password($username)
- {
- // 查询数据
- $pasW = $this
- ->where('username',$username)
- ->value('password');
-
- // 返回数据
- return $pasW;
- }
-
- // 生日修改器
- public function setShengriAttr($value)
- {
- return strtotime($value);
- }
-
- // 生日获取器
- public function getShengriAttr($value)
- {
- return date('Y-m-d',$value);
- }
-
- // 创建时间获取器
- public function getCreateTimeAttr($value)
- {
- return date('Y-m-d',$value);
- }
-
- // 性别获取器
- public function getSexAttr($value)
- {
- $sex = array('0'=>'女','1'=>'男','2'=>'保密');
- return $sex[$value];
- }
-
-
- // 最后登录时间取器
- public function getLasttimeAttr($value)
- {
- return date('Y年m月d日 H:i:s',$value);
- }
-
- // 本次登录时间取器
- public function getThistimeAttr($value)
- {
- return date('Y年m月d日 H:i:s',$value);
- }
-
-
- // 角色关联
- public function authGroup()
- {
- return $this->hasMany('AuthGroupAccess','uid','id')->field('id,uid,group_id');
- }
-
-
- // 获取角色名称
- public function getGroupnames($userid)
- {
- // 如果用户ID为1或2,则为超级管理员
- if($userid == 1 || $userid == 2)
- {
- return '超级管理员';
- }
-
- // 查询用户拥有的权限
- $admininfo = $this->where('id',$userid)
- ->field('id')
- ->with([
- 'glGroup'=>function($query){
- $query->where('status',1)->field('title');
- }
- ])
- ->find();
- $groupname = '';
- foreach ($admininfo->gl_group as $key => $value) {
- if($key == 0){
- $groupname = $value->title;
- }else{
- $groupname = $groupname.'、'.$value->title;
- }
- }
-
- // 返回角色名
- return $groupname;
- }
-
- // 单位关联模型
- public function adSchool()
- {
- return $this->belongsTo('\app\system\model\School','school','id');
- }
-
-
-
-}
diff --git a/application/admin/model/AuthGroup.php b/application/admin/model/AuthGroup.php
deleted file mode 100644
index 06696f77..00000000
--- a/application/admin/model/AuthGroup.php
+++ /dev/null
@@ -1,26 +0,0 @@
-order([$src['field'] =>$src['type']])
- ->when(strlen($searchval)>0,function($query) use($searchval){
- $query->where('title','like','%'.$searchval.'%');
- })
- ->select();
- return $data;
- }
-
-}
diff --git a/application/admin/model/AuthGroupAccess.php b/application/admin/model/AuthGroupAccess.php
deleted file mode 100644
index b8cede76..00000000
--- a/application/admin/model/AuthGroupAccess.php
+++ /dev/null
@@ -1,11 +0,0 @@
-belongsTo('AuthRule','pid','id');
- }
-
-
- // 子菜单数据模型关联
- public function authCid()
- {
- return $this->hasMany('AuthRule','pid','id');
- }
-
-
- // 查询所有角色
- public function search($src)
- {
- // 整理变量
- $searchval = $src['searchval'];
-
- // 查询数据
- $data = $this
- ->order([$src['field'] =>$src['type']])
- ->when(strlen($searchval)>0,function($query) use($searchval){
- $query->where('title|name','like','%'.$searchval.'%');
- })
- ->with(['authPid'=>function($query){
- $query->field('id,title');
- }])
- ->select();
- return $data;
- }
-}
diff --git a/application/admin/validate/Admin.php b/application/admin/validate/Admin.php
deleted file mode 100644
index d18987eb..00000000
--- a/application/admin/validate/Admin.php
+++ /dev/null
@@ -1,34 +0,0 @@
- ['规则1','规则2'...]
- *
- * @var array
- */
- protected $rule = [
- 'xingming|用户姓名' => 'require|chs|length:2,6',
- 'username|帐号' => ['require','uset'=>'/^[a-z][a-z0-9-_]*$/'],
- 'group_id|角色' => 'require|array',
- 'shengri|出生日期' => 'date',
- 'xingbie|性别' => 'in:0,1,2',
- 'phone|手机' => 'mobile',
- 'beizhu|备注' => 'max:80',
- ];
-
- /**
- * 定义错误信息
- * 格式:'字段名.规则名' => '错误信息'
- *
- * @var array
- */
- protected $message = [
- 'username.ustr' => '帐号格式错误',
- ];
-}
diff --git a/application/admin/validate/Rule.php b/application/admin/validate/Rule.php
deleted file mode 100644
index da6525ef..00000000
--- a/application/admin/validate/Rule.php
+++ /dev/null
@@ -1,28 +0,0 @@
- ['规则1','规则2'...]
- *
- * @var array
- */
- protected $rule = [
- 'title|规则名' => 'require|chs|length:2,6',
- 'name|规则' => ['require','length:1,80','uset'=>'/^[a-zA-Z\/]*$/'],
- 'paixu|排序' => 'number|max:999',
- ];
-
- /**
- * 定义错误信息
- * 格式:'字段名.规则名' => '错误信息'
- *
- * @var array
- */
- protected $message = [];
-}
diff --git a/application/admin/validate/RuleGroup.php b/application/admin/validate/RuleGroup.php
deleted file mode 100644
index 3cad141f..00000000
--- a/application/admin/validate/RuleGroup.php
+++ /dev/null
@@ -1,24 +0,0 @@
- ['规则1','规则2'...]
- *
- * @var array
- */
- protected $rule = [];
-
- /**
- * 定义错误信息
- * 格式:'字段名.规则名' => '错误信息'
- *
- * @var array
- */
- protected $message = [];
-}
diff --git a/application/admin/validate/SetPassword.php b/application/admin/validate/SetPassword.php
deleted file mode 100644
index 93735d8e..00000000
--- a/application/admin/validate/SetPassword.php
+++ /dev/null
@@ -1,30 +0,0 @@
- ['规则1','规则2'...]
- *
- * @var array
- */
- protected $rule = [
- 'oldpassword|原密码' => 'require',
- 'newpassword|新密码' => ['require','regex'=>'/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){6,20}$/'],
- 'newpassword2|两次密码' => 'require|confirm:newpassword',
- ];
-
- /**
- * 定义错误信息
- * 格式:'字段名.规则名' => '错误信息'
- *
- * @var array
- */
- protected $message = [
- 'newpassword.regex' => '只能输入6-16个字母、数字、半角句号、下划线',
- ];
-}
diff --git a/application/admin/view/auth_group/create.html b/application/admin/view/auth_group/create.html
deleted file mode 100644
index 78097456..00000000
--- a/application/admin/view/auth_group/create.html
+++ /dev/null
@@ -1,179 +0,0 @@
-{extend name="common@create" /}
-
-{block name="form"}
-
ThinkPHP V5.1
12载初心不改(2006-2018) - 你值得信赖的PHP框架
-$value) { ?>
| - | - - | -
| - | - - | -
' . $textCode . ''; - - return $result; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Text/Plain.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Text/Plain.php deleted file mode 100644 index a7e4cfb7..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Text/Plain.php +++ /dev/null @@ -1,150 +0,0 @@ -fullBlock = $fullBlock; - } - - /** - * Get char used as full block (occupied space, "black"). - * - * @return string - */ - public function getFullBlock() - { - return $this->fullBlock; - } - - /** - * Set char used as empty block (empty space, "white"). - * - * @param string $emptyBlock - */ - public function setEmptyBlock($emptyBlock) - { - $this->emptyBlock = $emptyBlock; - } - - /** - * Get char used as empty block (empty space, "white"). - * - * @return string - */ - public function getEmptyBlock() - { - return $this->emptyBlock; - } - - /** - * Sets the margin around the QR code. - * - * @param integer $margin - * @return AbstractRenderer - * @throws Exception\InvalidArgumentException - */ - public function setMargin($margin) - { - if ($margin < 0) { - throw new Exception\InvalidArgumentException('Margin must be equal to greater than 0'); - } - - $this->margin = (int) $margin; - - return $this; - } - - /** - * Gets the margin around the QR code. - * - * @return integer - */ - public function getMargin() - { - return $this->margin; - } - - /** - * render(): defined by RendererInterface. - * - * @see RendererInterface::render() - * @param QrCode $qrCode - * @return string - */ - public function render(QrCode $qrCode) - { - $result = ''; - $matrix = $qrCode->getMatrix(); - $width = $matrix->getWidth(); - - // Top margin - for ($x = 0; $x < $this->margin; $x++) { - $result .= str_repeat($this->emptyBlock, $width + 2 * $this->margin)."\n"; - } - - // Body - $array = $matrix->getArray(); - - foreach ($array as $row) { - $result .= str_repeat($this->emptyBlock, $this->margin); // left margin - foreach ($row as $byte) { - $result .= $byte ? $this->fullBlock : $this->emptyBlock; - } - $result .= str_repeat($this->emptyBlock, $this->margin); // right margin - $result .= "\n"; - } - - // Bottom margin - for ($x = 0; $x < $this->margin; $x++) { - $result .= str_repeat($this->emptyBlock, $width + 2 * $this->margin)."\n"; - } - - return $result; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Writer.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Writer.php deleted file mode 100644 index 0f803138..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Writer.php +++ /dev/null @@ -1,105 +0,0 @@ -renderer = $renderer; - } - - /** - * Sets the renderer used to create a byte stream. - * - * @param RendererInterface $renderer - * @return Writer - */ - public function setRenderer(RendererInterface $renderer) - { - $this->renderer = $renderer; - return $this; - } - - /** - * Gets the renderer used to create a byte stream. - * - * @return RendererInterface - */ - public function getRenderer() - { - return $this->renderer; - } - - /** - * Writes QR code and returns it as string. - * - * Content is a string which *should* be encoded in UTF-8, in case there are - * non ASCII-characters present. - * - * @param string $content - * @param string $encoding - * @param integer $ecLevel - * @return string - * @throws Exception\InvalidArgumentException - */ - public function writeString( - $content, - $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, - $ecLevel = ErrorCorrectionLevel::L - ) { - if (strlen($content) === 0) { - throw new Exception\InvalidArgumentException('Found empty contents'); - } - - $qrCode = Encoder::encode($content, new ErrorCorrectionLevel($ecLevel), $encoding); - - return $this->getRenderer()->render($qrCode); - } - - /** - * Writes QR code to a file. - * - * @see Writer::writeString() - * @param string $content - * @param string $filename - * @param string $encoding - * @param integer $ecLevel - * @return void - */ - public function writeFile( - $content, - $filename, - $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, - $ecLevel = ErrorCorrectionLevel::L - ) { - file_put_contents($filename, $this->writeString($content, $encoding, $ecLevel)); - } -} diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitArrayTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitArrayTest.php deleted file mode 100644 index 81bcbce6..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitArrayTest.php +++ /dev/null @@ -1,201 +0,0 @@ -assertFalse($array->get($i)); - $array->set($i); - $this->assertTrue($array->get($i)); - } - } - - public function testGetNextSet1() - { - $array = new BitArray(32); - - for ($i = 0; $i < $array->getSize(); $i++) { - $this->assertEquals($i, 32, '', $array->getNextSet($i)); - } - - $array = new BitArray(33); - - for ($i = 0; $i < $array->getSize(); $i++) { - $this->assertEquals($i, 33, '', $array->getNextSet($i)); - } - } - - public function testGetNextSet2() - { - $array = new BitArray(33); - - for ($i = 0; $i < $array->getSize(); $i++) { - $this->assertEquals($i, $i <= 31 ? 31 : 33, '', $array->getNextSet($i)); - } - - $array = new BitArray(33); - - for ($i = 0; $i < $array->getSize(); $i++) { - $this->assertEquals($i, 32, '', $array->getNextSet($i)); - } - } - - public function testGetNextSet3() - { - $array = new BitArray(63); - $array->set(31); - $array->set(32); - - for ($i = 0; $i < $array->getSize(); $i++) { - if ($i <= 31) { - $expected = 31; - } elseif ($i <= 32) { - $expected = 32; - } else { - $expected = 63; - } - - $this->assertEquals($i, $expected, '', $array->getNextSet($i)); - } - } - - public function testGetNextSet4() - { - $array = new BitArray(63); - $array->set(33); - $array->set(40); - - for ($i = 0; $i < $array->getSize(); $i++) { - if ($i <= 33) { - $expected = 33; - } elseif ($i <= 40) { - $expected = 40; - } else { - $expected = 63; - } - - $this->assertEquals($i, $expected, '', $array->getNextSet($i)); - } - } - - public function testGetNextSet5() - { - if (defined('MT_RAND_PHP')) { - mt_srand(0xdeadbeef, MT_RAND_PHP); - } else { - mt_srand(0xdeadbeef); - } - - for ($i = 0; $i < 10; $i++) { - $array = new BitArray(mt_rand(1, 100)); - $numSet = mt_rand(0, 19); - - for ($j = 0; $j < $numSet; $j++) { - $array->set(mt_rand(0, $array->getSize() - 1)); - } - - $numQueries = mt_rand(0, 19); - - for ($j = 0; $j < $numQueries; $j++) { - $query = mt_rand(0, $array->getSize() - 1); - $expected = $query; - - while ($expected < $array->getSize() && !$array->get($expected)) { - $expected++; - } - - $actual = $array->getNextSet($query); - - if ($actual !== $expected) { - $array->getNextSet($query); - } - - $this->assertEquals($expected, $actual); - } - } - } - - public function testSetBulk() - { - $array = new BitArray(64); - $array->setBulk(32, 0xFFFF0000); - - for ($i = 0; $i < 48; $i++) { - $this->assertFalse($array->get($i)); - } - - for ($i = 48; $i < 64; $i++) { - $this->assertTrue($array->get($i)); - } - } - - public function testClear() - { - $array = new BitArray(32); - - for ($i = 0; $i < 32; $i++) { - $array->set($i); - } - - $array->clear(); - - for ($i = 0; $i < 32; $i++) { - $this->assertFalse($array->get($i)); - } - } - - public function testGetArray() - { - $array = new BitArray(64); - $array->set(0); - $array->set(63); - - $ints = $array->getBitArray(); - - $this->assertEquals(1, $ints[0]); - $this->assertEquals(0x80000000, $ints[1]); - } - - public function testIsRange() - { - $array = new BitArray(64); - $this->assertTrue($array->isRange(0, 64, false)); - $this->assertFalse($array->isRange(0, 64, true)); - - $array->set(32); - $this->assertTrue($array->isRange(32, 33, true)); - - $array->set(31); - $this->assertTrue($array->isRange(31, 33, true)); - - $array->set(34); - $this->assertFalse($array->isRange(31, 35, true)); - - for ($i = 0; $i < 31; $i++) { - $array->set($i); - } - - $this->assertTrue($array->isRange(0, 33, true)); - - for ($i = 33; $i < 64; $i++) { - $array->set($i); - } - - $this->assertTrue($array->isRange(0, 64, true)); - $this->assertFalse($array->isRange(0, 64, false)); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitMatrixTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitMatrixTest.php deleted file mode 100644 index 89a58812..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitMatrixTest.php +++ /dev/null @@ -1,119 +0,0 @@ -assertEquals(33, $matrix->getHeight()); - - for ($y = 0; $y < 33; $y++) { - for ($x = 0; $x < 33; $x++) { - if ($y * $x % 3 === 0) { - $matrix->set($x, $y); - } - } - } - - for ($y = 0; $y < 33; $y++) { - for ($x = 0; $x < 33; $x++) { - $this->assertEquals($x * $y % 3 === 0, $matrix->get($x, $y)); - } - } - } - - public function testSetRegion() - { - $matrix = new BitMatrix(5); - $matrix->setRegion(1, 1, 3, 3); - - for ($y = 0; $y < 5; $y++) { - for ($x = 0; $x < 5; $x++) { - $this->assertEquals($y >= 1 && $y <= 3 && $x >= 1 && $x <= 3, $matrix->get($x, $y)); - } - } - } - - public function testRectangularMatrix() - { - $matrix = new BitMatrix(75, 20); - $this->assertEquals(75, $matrix->getWidth()); - $this->assertEquals(20, $matrix->getHeight()); - - $matrix->set(10, 0); - $matrix->set(11, 1); - $matrix->set(50, 2); - $matrix->set(51, 3); - $matrix->flip(74, 4); - $matrix->flip(0, 5); - - $this->assertTrue($matrix->get(10, 0)); - $this->assertTrue($matrix->get(11, 1)); - $this->assertTrue($matrix->get(50, 2)); - $this->assertTrue($matrix->get(51, 3)); - $this->assertTrue($matrix->get(74, 4)); - $this->assertTrue($matrix->get(0, 5)); - - $matrix->flip(50, 2); - $matrix->flip(51, 3); - - $this->assertFalse($matrix->get(50, 2)); - $this->assertFalse($matrix->get(51, 3)); - } - - public function testRectangularSetRegion() - { - $matrix = new BitMatrix(320, 240); - $this->assertEquals(320, $matrix->getWidth()); - $this->assertEquals(240, $matrix->getHeight()); - - $matrix->setRegion(105, 22, 80, 12); - - for ($y = 0; $y < 240; $y++) { - for ($x = 0; $x < 320; $x++) { - $this->assertEquals($y >= 22 && $y < 34 && $x >= 105 && $x < 185, $matrix->get($x, $y)); - } - } - } - - public function testGetRow() - { - $matrix = new BitMatrix(102, 5); - - for ($x = 0; $x < 102; $x++) { - if ($x & 3 === 0) { - $matrix->set($x, 2); - } - } - - $array1 = $matrix->getRow(2, null); - $this->assertEquals(102, $array1->getSize()); - - $array2 = new BitArray(60); - $array2 = $matrix->getRow(2, $array2); - $this->assertEquals(102, $array2->getSize()); - - $array3 = new BitArray(200); - $array3 = $matrix->getRow(2, $array3); - $this->assertEquals(200, $array3->getSize()); - - for ($x = 0; $x < 102; $x++) { - $on = ($x & 3 === 0); - - $this->assertEquals($on, $array1->get($x)); - $this->assertEquals($on, $array2->get($x)); - $this->assertEquals($on, $array3->get($x)); - } - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitUtilsTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitUtilsTest.php deleted file mode 100644 index b80ff7df..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitUtilsTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertEquals(1, BitUtils::unsignedRightShift(1, 0)); - $this->assertEquals(1, BitUtils::unsignedRightShift(10, 3)); - $this->assertEquals(536870910, BitUtils::unsignedRightShift(-10, 3)); - } - - public function testNumberOfTrailingZeros() - { - $this->assertEquals(32, BitUtils::numberOfTrailingZeros(0)); - $this->assertEquals(1, BitUtils::numberOfTrailingZeros(10)); - $this->assertEquals(0, BitUtils::numberOfTrailingZeros(15)); - $this->assertEquals(2, BitUtils::numberOfTrailingZeros(20)); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ErrorCorrectionLevelTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ErrorCorrectionLevelTest.php deleted file mode 100644 index 736e995d..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ErrorCorrectionLevelTest.php +++ /dev/null @@ -1,40 +0,0 @@ -assertEquals(0x0, ErrorCorrectionLevel::M); - $this->assertEquals(0x1, ErrorCorrectionLevel::L); - $this->assertEquals(0x2, ErrorCorrectionLevel::H); - $this->assertEquals(0x3, ErrorCorrectionLevel::Q); - } - - public function testInvalidErrorCorrectionLevelThrowsException() - { - $this->setExpectedException( - 'BaconQrCode\Exception\UnexpectedValueException', - 'Value not a const in enum BaconQrCode\Common\ErrorCorrectionLevel' - ); - new ErrorCorrectionLevel(4); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/FormatInformationTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/FormatInformationTest.php deleted file mode 100644 index 5f6ee58c..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/FormatInformationTest.php +++ /dev/null @@ -1,104 +0,0 @@ -unmaskedTestFormatInfo = $this->maskedTestFormatInfo ^ 0x5412; - } - - - public function testBitsDiffering() - { - $this->assertEquals(0, FormatInformation::numBitsDiffering(1, 1)); - $this->assertEquals(1, FormatInformation::numBitsDiffering(0, 2)); - $this->assertEquals(2, FormatInformation::numBitsDiffering(1, 2)); - $this->assertEquals(32, FormatInformation::numBitsDiffering(-1, 0)); - } - - public function testDecode() - { - $expected = FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo, - $this->maskedTestFormatInfo - ); - - $this->assertNotNull($expected); - $this->assertEquals(7, $expected->getDataMask()); - $this->assertEquals(ErrorCorrectionLevel::Q, $expected->getErrorCorrectionLevel()->get()); - - $this->assertEquals( - $expected, - FormatInformation::decodeFormatInformation( - $this->unmaskedTestFormatInfo, - $this->maskedTestFormatInfo - ) - ); - } - - public function testDecodeWithBitDifference() - { - $expected = FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo, - $this->maskedTestFormatInfo - ); - - $this->assertEquals( - $expected, - FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo ^ 0x1, - $this->maskedTestFormatInfo ^ 0x1 - ) - ); - $this->assertEquals( - $expected, - FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo ^ 0x3, - $this->maskedTestFormatInfo ^ 0x3 - ) - ); - $this->assertEquals( - $expected, - FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo ^ 0x7, - $this->maskedTestFormatInfo ^ 0x7 - ) - ); - $this->assertNull( - FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo ^ 0xf, - $this->maskedTestFormatInfo ^ 0xf - ) - ); - } - - public function testDecodeWithMisRead() - { - $expected = FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo, - $this->maskedTestFormatInfo - ); - - $this->assertEquals( - $expected, - FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo ^ 0x3, - $this->maskedTestFormatInfo ^ 0xf - ) - ); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ModeTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ModeTest.php deleted file mode 100644 index 4daab7c3..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ModeTest.php +++ /dev/null @@ -1,42 +0,0 @@ -assertEquals(0x0, Mode::TERMINATOR); - $this->assertEquals(0x1, Mode::NUMERIC); - $this->assertEquals(0x2, Mode::ALPHANUMERIC); - $this->assertEquals(0x4, Mode::BYTE); - $this->assertEquals(0x8, Mode::KANJI); - } - - public function testInvalidModeThrowsException() - { - $this->setExpectedException( - 'BaconQrCode\Exception\UnexpectedValueException', - 'Value not a const in enum BaconQrCode\Common\Mode' - ); - new Mode(10); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ReedSolomonCodecTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ReedSolomonCodecTest.php deleted file mode 100644 index 604641a0..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ReedSolomonCodecTest.php +++ /dev/null @@ -1,111 +0,0 @@ -encode($block, $parity); - - // Copy parity into test blocks - for ($i = 0; $i < $numRoots; $i++) { - $block[$i + $dataSize] = $parity[$i]; - $tBlock[$i + $dataSize] = $parity[$i]; - } - - // Seed with errors - for ($i = 0; $i < $errors; $i++) { - $errorValue = mt_rand(1, $blockSize); - - do { - $errorLocation = mt_rand(0, $blockSize); - } while ($errorLocations[$errorLocation] !== 0); - - $errorLocations[$errorLocation] = 1; - - if (mt_rand(0, 1)) { - $erasures[] = $errorLocation; - } - - $tBlock[$errorLocation] ^= $errorValue; - } - - $erasures = SplFixedArray::fromArray($erasures, false); - - // Decode the errored block - $foundErrors = $codec->decode($tBlock, $erasures); - - if ($errors > 0 && $foundErrors === null) { - $this->assertEquals($block, $tBlock, 'Decoder failed to correct errors'); - } - - $this->assertEquals($errors, $foundErrors, 'Found errors do not equal expected errors'); - - for ($i = 0; $i < $foundErrors; $i++) { - if ($errorLocations[$erasures[$i]] === 0) { - $this->fail(sprintf('Decoder indicates error in location %d without error', $erasures[$i])); - } - } - - $this->assertEquals($block, $tBlock, 'Decoder did not correct errors'); - } - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/VersionTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/VersionTest.php deleted file mode 100644 index 8b3fc01f..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/VersionTest.php +++ /dev/null @@ -1,88 +0,0 @@ -assertNotNull($version); - $this->assertEquals($versionNumber, $version->getVersionNumber()); - $this->assertNotNull($version->getAlignmentPatternCenters()); - - if ($versionNumber > 1) { - $this->assertTrue(count($version->getAlignmentPatternCenters()) > 0); - } - - $this->assertEquals($dimension, $version->getDimensionForVersion()); - $this->assertNotNull($version->getEcBlocksForLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::H))); - $this->assertNotNull($version->getEcBlocksForLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::L))); - $this->assertNotNull($version->getEcBlocksForLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::M))); - $this->assertNotNull($version->getEcBlocksForLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::Q))); - $this->assertNotNull($version->buildFunctionPattern()); - } - - /** - * @dataProvider versionProvider - * @param integer $versionNumber - * @param integer $dimension - */ - public function testGetProvisionalVersionForDimension($versionNumber, $dimension) - { - $this->assertEquals( - $versionNumber, - Version::getProvisionalVersionForDimension($dimension)->getVersionNumber() - ); - } - - /** - * @dataProvider decodeInformationProvider - * @param integer $expectedVersion - * @param integer $mask - */ - public function testDecodeVersionInformation($expectedVersion, $mask) - { - $version = Version::decodeVersionInformation($mask); - $this->assertNotNull($version); - $this->assertEquals($expectedVersion, $version->getVersionNumber()); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/EncoderTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/EncoderTest.php deleted file mode 100644 index 31cdaa4e..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/EncoderTest.php +++ /dev/null @@ -1,468 +0,0 @@ -getMethods(ReflectionMethod::IS_STATIC) as $method) { - $method->setAccessible(true); - $this->methods[$method->getName()] = $method; - } - } - - public function testGetAlphanumericCode() - { - // The first ten code points are numbers. - for ($i = 0; $i < 10; $i++) { - $this->assertEquals($i, $this->methods['getAlphanumericCode']->invoke(null, ord('0') + $i)); - } - - // The next 26 code points are capital alphabet letters. - for ($i = 10; $i < 36; $i++) { - // The first ten code points are numbers - $this->assertEquals($i, $this->methods['getAlphanumericCode']->invoke(null, ord('A') + $i - 10)); - } - - // Others are symbol letters. - $this->assertEquals(36, $this->methods['getAlphanumericCode']->invoke(null, ' ')); - $this->assertEquals(37, $this->methods['getAlphanumericCode']->invoke(null, '$')); - $this->assertEquals(38, $this->methods['getAlphanumericCode']->invoke(null, '%')); - $this->assertEquals(39, $this->methods['getAlphanumericCode']->invoke(null, '*')); - $this->assertEquals(40, $this->methods['getAlphanumericCode']->invoke(null, '+')); - $this->assertEquals(41, $this->methods['getAlphanumericCode']->invoke(null, '-')); - $this->assertEquals(42, $this->methods['getAlphanumericCode']->invoke(null, '.')); - $this->assertEquals(43, $this->methods['getAlphanumericCode']->invoke(null, '/')); - $this->assertEquals(44, $this->methods['getAlphanumericCode']->invoke(null, ':')); - - // Should return -1 for other letters. - $this->assertEquals(-1, $this->methods['getAlphanumericCode']->invoke(null, 'a')); - $this->assertEquals(-1, $this->methods['getAlphanumericCode']->invoke(null, '#')); - $this->assertEquals(-1, $this->methods['getAlphanumericCode']->invoke(null, "\0")); - } - - public function testChooseMode() - { - // Numeric mode - $this->assertSame(Mode::NUMERIC, $this->methods['chooseMode']->invoke(null, '0')->get()); - $this->assertSame(Mode::NUMERIC, $this->methods['chooseMode']->invoke(null, '0123456789')->get()); - - // Alphanumeric mode - $this->assertSame(Mode::ALPHANUMERIC, $this->methods['chooseMode']->invoke(null, 'A')->get()); - $this->assertSame(Mode::ALPHANUMERIC, $this->methods['chooseMode']->invoke(null, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:')->get()); - - // 8-bit byte mode - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, 'a')->get()); - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, '#')->get()); - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, '')->get()); - - // AIUE in Hiragana in SHIFT-JIS - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, "\x8\xa\x8\xa\x8\xa\x8\xa6")->get()); - - // Nihon in Kanji in SHIFT-JIS - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, "\x9\xf\x9\x7b")->get()); - - // Sou-Utso-Byou in Kanji in SHIFT-JIS - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, "\xe\x4\x9\x5\x9\x61")->get()); - } - - public function testEncode() - { - $qrCode = Encoder::encode('ABCDEF', new ErrorCorrectionLevel(ErrorCorrectionLevel::H)); - $expected = "<<\n" - . " mode: ALPHANUMERIC\n" - . " ecLevel: H\n" - . " version: 1\n" - . " maskPattern: 0\n" - . " matrix:\n" - . " 1 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0\n" - . " 0 0 1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 0 1\n" - . " 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0\n" - . " 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 1 0\n" - . " 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 0\n" - . " 0 0 1 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 1 1 0\n" - . " 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 1 0 1 0 0 0\n" - . " 1 1 1 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0 0 0 1\n" - . " 1 0 0 0 0 0 1 0 1 1 1 1 0 1 0 1 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 0 1 0\n" - . " 1 0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 0 0 1 1\n" - . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1\n" - . ">>\n"; - - $this->assertEquals($expected, $qrCode->__toString()); - } - - public function testSimpleUtf8Eci() - { - $qrCode = Encoder::encode('hello', new ErrorCorrectionLevel(ErrorCorrectionLevel::H), 'utf-8'); - $expected = "<<\n" - . " mode: BYTE\n" - . " ecLevel: H\n" - . " version: 1\n" - . " maskPattern: 3\n" - . " matrix:\n" - . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 1 1 0 0 1 1 1 1 0 0 0 1 1 0 1 0 0 0 0\n" - . " 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 1 1 1 0\n" - . " 0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 1 1 1\n" - . " 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 1 0 1 1 0\n" - . " 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 1 0 0 1 0 0\n" - . " 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0\n" - . " 1 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0\n" - . " 1 0 1 1 1 0 1 0 1 1 1 0 1 0 0 0 1 1 0 0 0\n" - . " 1 0 1 1 1 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0\n" - . " 1 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1 0\n" - . " 1 1 1 1 1 1 1 0 0 1 0 1 1 1 0 1 1 0 0 0 0\n" - . ">>\n"; - - $this->assertEquals($expected, $qrCode->__toString()); - } - - public function testAppendModeInfo() - { - $bits = new BitArray(); - $this->methods['appendModeInfo']->invoke(null, new Mode(Mode::NUMERIC), $bits); - $this->assertEquals(' ...X', $bits->__toString()); - } - - public function testAppendLengthInfo() - { - // 1 letter (1/1), 10 bits. - $bits = new BitArray(); - $this->methods['appendLengthInfo']->invoke( - null, - 1, - Version::getVersionForNumber(1), - new Mode(Mode::NUMERIC), - $bits - ); - $this->assertEquals(' ........ .X', $bits->__toString()); - - // 2 letters (2/1), 11 bits. - $bits = new BitArray(); - $this->methods['appendLengthInfo']->invoke( - null, - 2, - Version::getVersionForNumber(10), - new Mode(Mode::ALPHANUMERIC), - $bits - ); - $this->assertEquals(' ........ .X.', $bits->__toString()); - - // 255 letters (255/1), 16 bits. - $bits = new BitArray(); - $this->methods['appendLengthInfo']->invoke( - null, - 255, - Version::getVersionForNumber(27), - new Mode(Mode::BYTE), - $bits - ); - $this->assertEquals(' ........ XXXXXXXX', $bits->__toString()); - - // 512 letters (1024/2), 12 bits. - $bits = new BitArray(); - $this->methods['appendLengthInfo']->invoke( - null, - 512, - Version::getVersionForNumber(40), - new Mode(Mode::KANJI), - $bits - ); - $this->assertEquals(' ..X..... ....', $bits->__toString()); - } - - public function testAppendBytes() - { - // Should use appendNumericBytes. - // 1 = 01 = 0001 in 4 bits. - $bits = new BitArray(); - $this->methods['appendBytes']->invoke( - null, - '1', - new Mode(Mode::NUMERIC), - $bits, - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals(' ...X', $bits->__toString()); - - // Should use appendAlphaNumericBytes. - // A = 10 = 0xa = 001010 in 6 bits. - $bits = new BitArray(); - $this->methods['appendBytes']->invoke( - null, - 'A', - new Mode(Mode::ALPHANUMERIC), - $bits, - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals(' ..X.X.', $bits->__toString()); - - // Should use append8BitBytes. - // 0x61, 0x62, 0x63 - $bits = new BitArray(); - $this->methods['appendBytes']->invoke( - null, - 'abc', - new Mode(Mode::BYTE), - $bits, - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals(' .XX....X .XX...X. .XX...XX', $bits->__toString()); - - // Should use appendKanjiBytes. - // 0x93, 0x5f - $bits = new BitArray(); - $this->methods['appendBytes']->invoke( - null, - "\x93\x5f", - new Mode(Mode::KANJI), - $bits, - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals(' .XX.XX.. XXXXX', $bits->__toString()); - - // Lower letters such as 'a' cannot be encoded in alphanumeric mode. - $this->setExpectedException( - 'BaconQrCode\Exception\WriterException', - 'Invalid alphanumeric code' - ); - $this->methods['appendBytes']->invoke( - null, - "a", - new Mode(Mode::ALPHANUMERIC), - $bits, - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - } - - public function testTerminateBits() - { - $bits = new BitArray(); - $this->methods['terminateBits']->invoke(null, 0, $bits); - $this->assertEquals('', $bits->__toString()); - - $bits = new BitArray(); - $this->methods['terminateBits']->invoke(null, 1, $bits); - $this->assertEquals(' ........', $bits->__toString()); - - $bits = new BitArray(); - $bits->appendBits(0, 3); - $this->methods['terminateBits']->invoke(null, 1, $bits); - $this->assertEquals(' ........', $bits->__toString()); - - $bits = new BitArray(); - $bits->appendBits(0, 5); - $this->methods['terminateBits']->invoke(null, 1, $bits); - $this->assertEquals(' ........', $bits->__toString()); - - $bits = new BitArray(); - $bits->appendBits(0, 8); - $this->methods['terminateBits']->invoke(null, 1, $bits); - $this->assertEquals(' ........', $bits->__toString()); - - $bits = new BitArray(); - $this->methods['terminateBits']->invoke(null, 2, $bits); - $this->assertEquals(' ........ XXX.XX..', $bits->__toString()); - - $bits = new BitArray(); - $bits->appendBits(0, 1); - $this->methods['terminateBits']->invoke(null, 3, $bits); - $this->assertEquals(' ........ XXX.XX.. ...X...X', $bits->__toString()); - } - - public function testGetNumDataBytesAndNumEcBytesForBlockId() - { - // Version 1-H. - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 26, 9, 1, 0); - $this->assertEquals(9, $numDataBytes); - $this->assertEquals(17, $numEcBytes); - - // Version 3-H. 2 blocks. - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 70, 26, 2, 0); - $this->assertEquals(13, $numDataBytes); - $this->assertEquals(22, $numEcBytes); - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 70, 26, 2, 1); - $this->assertEquals(13, $numDataBytes); - $this->assertEquals(22, $numEcBytes); - - // Version 7-H. (4 + 1) blocks. - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 196, 66, 5, 0); - $this->assertEquals(13, $numDataBytes); - $this->assertEquals(26, $numEcBytes); - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 196, 66, 5, 4); - $this->assertEquals(14, $numDataBytes); - $this->assertEquals(26, $numEcBytes); - - // Version 40-H. (20 + 61) blocks. - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 3706, 1276, 81, 0); - $this->assertEquals(15, $numDataBytes); - $this->assertEquals(30, $numEcBytes); - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 3706, 1276, 81, 20); - $this->assertEquals(16, $numDataBytes); - $this->assertEquals(30, $numEcBytes); - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 3706, 1276, 81, 80); - $this->assertEquals(16, $numDataBytes); - $this->assertEquals(30, $numEcBytes); - } - - public function testInterleaveWithEcBytes() - { - $dataBytes = SplFixedArray::fromArray(array(32, 65, 205, 69, 41, 220, 46, 128, 236), false); - $in = new BitArray(); - - foreach ($dataBytes as $dataByte) { - $in->appendBits($dataByte, 8); - } - - $outBits = $this->methods['interleaveWithEcBytes']->invoke(null, $in, 26, 9, 1); - $expected = SplFixedArray::fromArray(array( - // Data bytes. - 32, 65, 205, 69, 41, 220, 46, 128, 236, - // Error correction bytes. - 42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61, - ), false); - - $out = $outBits->toBytes(0, count($expected)); - - $this->assertEquals($expected, $out); - } - - public function testAppendNumericBytes() - { - // 1 = 01 = 0001 in 4 bits. - $bits = new BitArray(); - $this->methods['appendNumericBytes']->invoke(null, '1', $bits); - $this->assertEquals(' ...X', $bits->__toString()); - - // 12 = 0xc = 0001100 in 7 bits. - $bits = new BitArray(); - $this->methods['appendNumericBytes']->invoke(null, '12', $bits); - $this->assertEquals(' ...XX..', $bits->__toString()); - - // 123 = 0x7b = 0001111011 in 10 bits. - $bits = new BitArray(); - $this->methods['appendNumericBytes']->invoke(null, '123', $bits); - $this->assertEquals(' ...XXXX. XX', $bits->__toString()); - - // 1234 = "123" + "4" = 0001111011 + 0100 in 14 bits. - $bits = new BitArray(); - $this->methods['appendNumericBytes']->invoke(null, '1234', $bits); - $this->assertEquals(' ...XXXX. XX.X..', $bits->__toString()); - - // Empty - $bits = new BitArray(); - $this->methods['appendNumericBytes']->invoke(null, '', $bits); - $this->assertEquals('', $bits->__toString()); - } - - public function testAppendAlphanumericBytes() - { - $bits = new BitArray(); - $this->methods['appendAlphanumericBytes']->invoke(null, 'A', $bits); - $this->assertEquals(' ..X.X.', $bits->__toString()); - - $bits = new BitArray(); - $this->methods['appendAlphanumericBytes']->invoke(null, 'AB', $bits); - $this->assertEquals(' ..XXX..X X.X', $bits->__toString()); - - $bits = new BitArray(); - $this->methods['appendAlphanumericBytes']->invoke(null, 'ABC', $bits); - $this->assertEquals(' ..XXX..X X.X..XX. .', $bits->__toString()); - - // Empty - $bits = new BitArray(); - $this->methods['appendAlphanumericBytes']->invoke(null, '', $bits); - $this->assertEquals('', $bits->__toString()); - - // Invalid data - $this->setExpectedException('BaconQrCode\Exception\WriterException', 'Invalid alphanumeric code'); - $bits = new BitArray(); - $this->methods['appendAlphanumericBytes']->invoke(null, 'abc', $bits); - } - - public function testAppend8BitBytes() - { - // 0x61, 0x62, 0x63 - $bits = new BitArray(); - $this->methods['append8BitBytes']->invoke(null, 'abc', $bits, Encoder::DEFAULT_BYTE_MODE_ECODING); - $this->assertEquals(' .XX....X .XX...X. .XX...XX', $bits->__toString()); - - // Empty - $bits = new BitArray(); - $this->methods['append8BitBytes']->invoke(null, '', $bits, Encoder::DEFAULT_BYTE_MODE_ECODING); - $this->assertEquals('', $bits->__toString()); - } - - public function testAppendKanjiBytes() - { - // Numbers are from page 21 of JISX0510:2004 - $bits = new BitArray(); - $this->methods['appendKanjiBytes']->invoke(null, "\x93\x5f", $bits); - $this->assertEquals(' .XX.XX.. XXXXX', $bits->__toString()); - - $this->methods['appendKanjiBytes']->invoke(null, "\xe4\xaa", $bits); - $this->assertEquals(' .XX.XX.. XXXXXXX. X.X.X.X. X.', $bits->__toString()); - } - - public function testGenerateEcBytes() - { - // Numbers are from http://www.swetake.com/qr/qr3.html and - // http://www.swetake.com/qr/qr9.html - $dataBytes = SplFixedArray::fromArray(array(32, 65, 205, 69, 41, 220, 46, 128, 236), false); - $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 17); - $expected = SplFixedArray::fromArray(array(42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61), false); - $this->assertEquals($expected, $ecBytes); - - $dataBytes = SplFixedArray::fromArray(array(67, 70, 22, 38, 54, 70, 86, 102, 118, 134, 150, 166, 182, 198, 214), false); - $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 18); - $expected = SplFixedArray::fromArray(array(175, 80, 155, 64, 178, 45, 214, 233, 65, 209, 12, 155, 117, 31, 140, 214, 27, 187), false); - $this->assertEquals($expected, $ecBytes); - - // High-order zero coefficient case. - $dataBytes = SplFixedArray::fromArray(array(32, 49, 205, 69, 42, 20, 0, 236, 17), false); - $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 17); - $expected = SplFixedArray::fromArray(array(0, 3, 130, 179, 194, 0, 55, 211, 110, 79, 98, 72, 170, 96, 211, 137, 213), false); - $this->assertEquals($expected, $ecBytes); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MaskUtilTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MaskUtilTest.php deleted file mode 100644 index a5c38656..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MaskUtilTest.php +++ /dev/null @@ -1,281 +0,0 @@ -fail('Data mask bit did not match'); - } - } - } - } - - public function testApplyMaskPenaltyRule1() - { - $matrix = new ByteMatrix(4, 1); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(2, 0, 0); - $matrix->set(3, 0, 0); - - $this->assertEquals(0, MaskUtil::applyMaskPenaltyRule1($matrix)); - - // Horizontal - $matrix = new ByteMatrix(6, 1); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(2, 0, 0); - $matrix->set(3, 0, 0); - $matrix->set(4, 0, 0); - $matrix->set(5, 0, 1); - $this->assertEquals(3, MaskUtil::applyMaskPenaltyRule1($matrix)); - $matrix->set(5, 0, 0); - $this->assertEquals(4, MaskUtil::applyMaskPenaltyRule1($matrix)); - - // Vertical - $matrix = new ByteMatrix(1, 6); - $matrix->set(0, 0, 0); - $matrix->set(0, 1, 0); - $matrix->set(0, 2, 0); - $matrix->set(0, 3, 0); - $matrix->set(0, 4, 0); - $matrix->set(0, 5, 1); - $this->assertEquals(3, MaskUtil::applyMaskPenaltyRule1($matrix)); - $matrix->set(0, 5, 0); - $this->assertEquals(4, MaskUtil::applyMaskPenaltyRule1($matrix)); - } - - public function testApplyMaskPenaltyRule2() - { - $matrix = new ByteMatrix(1, 1); - $matrix->set(0, 0, 0); - $this->assertEquals(0, MaskUtil::applyMaskPenaltyRule2($matrix)); - - $matrix = new ByteMatrix(2, 2); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(0, 1, 0); - $matrix->set(1, 1, 1); - $this->assertEquals(0, MaskUtil::applyMaskPenaltyRule2($matrix)); - - $matrix = new ByteMatrix(2, 2); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(0, 1, 0); - $matrix->set(1, 1, 0); - $this->assertEquals(3, MaskUtil::applyMaskPenaltyRule2($matrix)); - - $matrix = new ByteMatrix(3, 3); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(2, 0, 0); - $matrix->set(0, 1, 0); - $matrix->set(1, 1, 0); - $matrix->set(2, 1, 0); - $matrix->set(0, 2, 0); - $matrix->set(1, 2, 0); - $matrix->set(2, 2, 0); - $this->assertEquals(3 * 4, MaskUtil::applyMaskPenaltyRule2($matrix)); - } - - public function testApplyMaskPenalty3() - { - // Horizontal 00001011101 - $matrix = new ByteMatrix(11, 1); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(2, 0, 0); - $matrix->set(3, 0, 0); - $matrix->set(4, 0, 1); - $matrix->set(5, 0, 0); - $matrix->set(6, 0, 1); - $matrix->set(7, 0, 1); - $matrix->set(8, 0, 1); - $matrix->set(9, 0, 0); - $matrix->set(10, 0, 1); - $this->assertEquals(40, MaskUtil::applyMaskPenaltyRule3($matrix)); - - // Horizontal 10111010000 - $matrix = new ByteMatrix(11, 1); - $matrix->set(0, 0, 1); - $matrix->set(1, 0, 0); - $matrix->set(2, 0, 1); - $matrix->set(3, 0, 1); - $matrix->set(4, 0, 1); - $matrix->set(5, 0, 0); - $matrix->set(6, 0, 1); - $matrix->set(7, 0, 0); - $matrix->set(8, 0, 0); - $matrix->set(9, 0, 0); - $matrix->set(10, 0, 0); - $this->assertEquals(40, MaskUtil::applyMaskPenaltyRule3($matrix)); - - // Vertical 00001011101 - $matrix = new ByteMatrix(1, 11); - $matrix->set(0, 0, 0); - $matrix->set(0, 1, 0); - $matrix->set(0, 2, 0); - $matrix->set(0, 3, 0); - $matrix->set(0, 4, 1); - $matrix->set(0, 5, 0); - $matrix->set(0, 6, 1); - $matrix->set(0, 7, 1); - $matrix->set(0, 8, 1); - $matrix->set(0, 9, 0); - $matrix->set(0, 10, 1); - $this->assertEquals(40, MaskUtil::applyMaskPenaltyRule3($matrix)); - - // Vertical 10111010000 - $matrix = new ByteMatrix(1, 11); - $matrix->set(0, 0, 1); - $matrix->set(0, 1, 0); - $matrix->set(0, 2, 1); - $matrix->set(0, 3, 1); - $matrix->set(0, 4, 1); - $matrix->set(0, 5, 0); - $matrix->set(0, 6, 1); - $matrix->set(0, 7, 0); - $matrix->set(0, 8, 0); - $matrix->set(0, 9, 0); - $matrix->set(0, 10, 0); - $this->assertEquals(40, MaskUtil::applyMaskPenaltyRule3($matrix)); - } - - public function testApplyMaskPenaltyRule4() - { - // Dark cell ratio = 0% - $matrix = new ByteMatrix(1, 1); - $matrix->set(0, 0, 0); - $this->assertEquals(100, MaskUtil::applyMaskPenaltyRule4($matrix)); - - // Dark cell ratio = 5% - $matrix = new ByteMatrix(2, 1); - $matrix->set(0, 0, 0); - $matrix->set(0, 0, 1); - $this->assertEquals(0, MaskUtil::applyMaskPenaltyRule4($matrix)); - - // Dark cell ratio = 66.67% - $matrix = new ByteMatrix(6, 1); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 1); - $matrix->set(2, 0, 1); - $matrix->set(3, 0, 1); - $matrix->set(4, 0, 1); - $matrix->set(5, 0, 0); - $this->assertEquals(30, MaskUtil::applyMaskPenaltyRule4($matrix)); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MatrixUtilTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MatrixUtilTest.php deleted file mode 100644 index bf3544f0..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MatrixUtilTest.php +++ /dev/null @@ -1,336 +0,0 @@ -getMethods(ReflectionMethod::IS_STATIC) as $method) { - $method->setAccessible(true); - $this->methods[$method->getName()] = $method; - } - } - - public function testToString() - { - $matrix= new ByteMatrix(3, 3); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 1); - $matrix->set(2, 0, 0); - $matrix->set(0, 1, 1); - $matrix->set(1, 1, 0); - $matrix->set(2, 1, 1); - $matrix->set(0, 2, -1); - $matrix->set(1, 2, -1); - $matrix->set(2, 2, -1); - - $expected = " 0 1 0\n 1 0 1\n \n"; - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testClearMatrix() - { - $matrix = new ByteMatrix(2, 2); - MatrixUtil::clearMatrix($matrix); - - $this->assertEquals(-1, $matrix->get(0, 0)); - $this->assertEquals(-1, $matrix->get(1, 0)); - $this->assertEquals(-1, $matrix->get(0, 1)); - $this->assertEquals(-1, $matrix->get(1, 1)); - } - - public function testEmbedBasicPatterns1() - { - $matrix = new ByteMatrix(21, 21); - MatrixUtil::clearMatrix($matrix); - $this->methods['embedBasicPatterns']->invoke( - null, - Version::getVersionForNumber(1), - $matrix - ); - $expected = " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 \n" - . " 0 \n" - . " 1 \n" - . " 0 \n" - . " 1 \n" - . " 0 0 0 0 0 0 0 0 1 \n" - . " 1 1 1 1 1 1 1 0 \n" - . " 1 0 0 0 0 0 1 0 \n" - . " 1 0 1 1 1 0 1 0 \n" - . " 1 0 1 1 1 0 1 0 \n" - . " 1 0 1 1 1 0 1 0 \n" - . " 1 0 0 0 0 0 1 0 \n" - . " 1 1 1 1 1 1 1 0 \n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testEmbedBasicPatterns2() - { - $matrix = new ByteMatrix(25, 25); - MatrixUtil::clearMatrix($matrix); - $this->methods['embedBasicPatterns']->invoke( - null, - Version::getVersionForNumber(2), - $matrix - ); - $expected = " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 \n" - . " 0 \n" - . " 1 \n" - . " 0 \n" - . " 1 \n" - . " 0 \n" - . " 1 \n" - . " 0 \n" - . " 1 1 1 1 1 1 \n" - . " 0 0 0 0 0 0 0 0 1 1 0 0 0 1 \n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 \n" - . " 1 0 0 0 0 0 1 0 1 0 0 0 1 \n" - . " 1 0 1 1 1 0 1 0 1 1 1 1 1 \n" - . " 1 0 1 1 1 0 1 0 \n" - . " 1 0 1 1 1 0 1 0 \n" - . " 1 0 0 0 0 0 1 0 \n" - . " 1 1 1 1 1 1 1 0 \n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testEmbedTypeInfo() - { - $matrix = new ByteMatrix(21, 21); - MatrixUtil::clearMatrix($matrix); - $this->methods['embedTypeInfo']->invoke( - null, - new ErrorCorrectionLevel(ErrorCorrectionLevel::M), - 5, - $matrix - ); - $expected = " 0 \n" - . " 1 \n" - . " 1 \n" - . " 1 \n" - . " 0 \n" - . " 0 \n" - . " \n" - . " 1 \n" - . " 1 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0\n" - . " \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " 0 \n" - . " 0 \n" - . " 0 \n" - . " 0 \n" - . " 0 \n" - . " 0 \n" - . " 1 \n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testEmbedVersionInfo() - { - $matrix = new ByteMatrix(21, 21); - MatrixUtil::clearMatrix($matrix); - $this->methods['maybeEmbedVersionInfo']->invoke( - null, - Version::getVersionForNumber(7), - $matrix - ); - $expected = " 0 0 1 \n" - . " 0 1 0 \n" - . " 0 1 0 \n" - . " 0 1 1 \n" - . " 1 1 1 \n" - . " 0 0 0 \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " 0 0 0 0 1 0 \n" - . " 0 1 1 1 1 0 \n" - . " 1 0 0 1 1 0 \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " \n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testEmbedDataBits() - { - $matrix = new ByteMatrix(21, 21); - MatrixUtil::clearMatrix($matrix); - $this->methods['embedBasicPatterns']->invoke( - null, - Version::getVersionForNumber(1), - $matrix - ); - - $bits = new BitArray(); - $this->methods['embedDataBits']->invoke( - null, - $bits, - -1, - $matrix - ); - - $expected = " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testBuildMatrix() - { - $bytes = array( - 32, 65, 205, 69, 41, 220, 46, 128, 236, 42, 159, 74, 221, 244, 169, - 239, 150, 138, 70, 237, 85, 224, 96, 74, 219 , 61 - ); - $bits = new BitArray(); - - foreach ($bytes as $byte) { - $bits->appendBits($byte, 8); - } - - $matrix = new ByteMatrix(21, 21); - MatrixUtil::buildMatrix( - $bits, - new ErrorCorrectionLevel(ErrorCorrectionLevel::H), - Version::getVersionForNumber(1), - 3, - $matrix - ); - - $expected = " 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0\n" - . " 0 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 0 0 0 0\n" - . " 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 0 1 1 1 0\n" - . " 1 1 1 1 0 1 1 0 1 0 1 1 1 0 0 1 1 1 0 1 0\n" - . " 1 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 0 1 0 1 0\n" - . " 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 1 1\n" - . " 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0\n" - . " 1 0 0 0 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 0\n" - . " 1 0 1 1 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1\n" - . " 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1 1 0\n" - . " 1 0 1 1 1 0 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0\n" - . " 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0\n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testFindMsbSet() - { - $this->assertEquals(0, $this->methods['findMsbSet']->invoke(null, 0)); - $this->assertEquals(1, $this->methods['findMsbSet']->invoke(null, 1)); - $this->assertEquals(8, $this->methods['findMsbSet']->invoke(null, 0x80)); - $this->assertEquals(32, $this->methods['findMsbSet']->invoke(null, 0x80000000)); - } - - public function testCalculateBchCode() - { - // Encoding of type information. - // From Appendix C in JISX0510:2004 (p 65) - $this->assertEquals(0xdc, $this->methods['calculateBchCode']->invoke(null, 5, 0x537)); - // From http://www.swetake.com/qr/qr6.html - $this->assertEquals(0x1c2, $this->methods['calculateBchCode']->invoke(null, 0x13, 0x537)); - // From http://www.swetake.com/qr/qr11.html - $this->assertEquals(0x214, $this->methods['calculateBchCode']->invoke(null, 0x1b, 0x537)); - - // Encoding of version information. - // From Appendix D in JISX0510:2004 (p 68) - $this->assertEquals(0xc94, $this->methods['calculateBchCode']->invoke(null, 7, 0x1f25)); - $this->assertEquals(0x5bc, $this->methods['calculateBchCode']->invoke(null, 8, 0x1f25)); - $this->assertEquals(0xa99, $this->methods['calculateBchCode']->invoke(null, 9, 0x1f25)); - $this->assertEquals(0x4d3, $this->methods['calculateBchCode']->invoke(null, 10, 0x1f25)); - $this->assertEquals(0x9a6, $this->methods['calculateBchCode']->invoke(null, 20, 0x1f25)); - $this->assertEquals(0xd75, $this->methods['calculateBchCode']->invoke(null, 30, 0x1f25)); - $this->assertEquals(0xc69, $this->methods['calculateBchCode']->invoke(null, 40, 0x1f25)); - } - - public function testMakeVersionInfoBits() - { - // From Appendix D in JISX0510:2004 (p 68) - $bits = new BitArray(); - $this->methods['makeVersionInfoBits']->invoke(null, Version::getVersionForNumber(7), $bits); - $this->assertEquals(' ...XXXXX ..X..X.X ..', $bits->__toString()); - } - - public function testMakeTypeInfoBits() - { - // From Appendix D in JISX0510:2004 (p 68) - $bits = new BitArray(); - $this->methods['makeTypeInfoBits']->invoke(null, new ErrorCorrectionLevel(ErrorCorrectionLevel::M), 5, $bits); - $this->assertEquals(' X......X X..XXX.', $bits->__toString()); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/HtmlTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/HtmlTest.php deleted file mode 100644 index 0c69dd2e..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/HtmlTest.php +++ /dev/null @@ -1,99 +0,0 @@ -renderer = new Html(); - $this->writer = new Writer($this->renderer); - } - - public function testBasicRender() - { - $content = 'foobar'; - $expected = - '
' . - " \n" . - " ███████ █████ ███████ \n" . - " █ █ █ █ █ █ \n" . - " █ ███ █ ██ █ ███ █ \n" . - " █ ███ █ ███ █ ███ █ \n" . - " █ ███ █ █ █ █ ███ █ \n" . - " █ █ ██ █ █ \n" . - " ███████ █ █ █ ███████ \n" . - " █████ \n" . - " ██ ██ █ ██ █ █ █ \n" . - " ██ ██ █ █ ██ \n" . - " ████████ █ ██ █ ██ \n" . - " ██ █ █ \n" . - " ██ ███ █ █ █ █ \n" . - " █ ███ █ █ \n" . - " ███████ ██ ██████ \n" . - " █ █ ████ ██ \n" . - " █ ███ █ ██ ██ ██ █ ██ \n" . - " █ ███ █ ██ ██ █ ██ \n" . - " █ ███ █ █ █ ██ ██ \n" . - " █ █ ███ ███ ████ \n" . - " ███████ ████ ██ \n" . - " \n" . - '' - ; - - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals($expected, $this->renderer->render($qrCode)); - } - - public function testSetStyle() - { - $content = 'foobar'; - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->renderer->setStyle('bar'); - $this->assertEquals('bar', $this->renderer->getStyle()); - $this->assertStringMatchesFormat('%astyle="bar"%a', $this->renderer->render($qrCode)); - } - - public function testSetClass() - { - $content = 'foobar'; - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->renderer->setClass('bar'); - $this->assertEquals('bar', $this->renderer->getClass()); - $this->assertStringMatchesFormat('%aclass="bar"%a', $this->renderer->render($qrCode)); - } -} diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/TextTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/TextTest.php deleted file mode 100644 index d94e8e5d..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/TextTest.php +++ /dev/null @@ -1,149 +0,0 @@ -renderer = new Plain(); - $this->writer = new Writer($this->renderer); - } - - public function testBasicRender() - { - $content = 'foobar'; - $expected = - " \n" . - " ███████ █████ ███████ \n" . - " █ █ █ █ █ █ \n" . - " █ ███ █ ██ █ ███ █ \n" . - " █ ███ █ ███ █ ███ █ \n" . - " █ ███ █ █ █ █ ███ █ \n" . - " █ █ ██ █ █ \n" . - " ███████ █ █ █ ███████ \n" . - " █████ \n" . - " ██ ██ █ ██ █ █ █ \n" . - " ██ ██ █ █ ██ \n" . - " ████████ █ ██ █ ██ \n" . - " ██ █ █ \n" . - " ██ ███ █ █ █ █ \n" . - " █ ███ █ █ \n" . - " ███████ ██ ██████ \n" . - " █ █ ████ ██ \n" . - " █ ███ █ ██ ██ ██ █ ██ \n" . - " █ ███ █ ██ ██ █ ██ \n" . - " █ ███ █ █ █ ██ ██ \n" . - " █ █ ███ ███ ████ \n" . - " ███████ ████ ██ \n" . - " \n" - ; - - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals($expected, $this->renderer->render($qrCode)); - } - - public function testBasicRenderNoMargins() - { - $content = 'foobar'; - $expected = - "███████ █████ ███████\n" . - "█ █ █ █ █ █\n" . - "█ ███ █ ██ █ ███ █\n" . - "█ ███ █ ███ █ ███ █\n" . - "█ ███ █ █ █ █ ███ █\n" . - "█ █ ██ █ █\n" . - "███████ █ █ █ ███████\n" . - " █████ \n" . - "██ ██ █ ██ █ █ █\n" . - " ██ ██ █ █ ██ \n" . - " ████████ █ ██ █ ██\n" . - " ██ █ █\n" . - " ██ ███ █ █ █ █\n" . - " █ ███ █ █ \n" . - "███████ ██ ██████ \n" . - "█ █ ████ ██ \n" . - "█ ███ █ ██ ██ ██ █ ██\n" . - "█ ███ █ ██ ██ █ ██ \n" . - "█ ███ █ █ █ ██ ██\n" . - "█ █ ███ ███ ████\n" . - "███████ ████ ██ \n" - ; - - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->renderer->setMargin(0); - $this->assertEquals(0, $this->renderer->getMargin()); - $this->assertEquals($expected, $this->renderer->render($qrCode)); - } - - public function testBasicRenderCustomChar() - { - $content = 'foobar'; - $expected = - "-----------------------\n" . - "-#######-#####-#######-\n" . - "-#-----#--#-#--#-----#-\n" . - "-#-###-#--##---#-###-#-\n" . - "-#-###-#--###--#-###-#-\n" . - "-#-###-#---#-#-#-###-#-\n" . - "-#-----#----##-#-----#-\n" . - "-#######-#-#-#-#######-\n" . - "---------#####---------\n" . - "-##-##-#--##-#-#-----#-\n" . - "----##----##-#-#-##----\n" . - "--########-#--##-#--##-\n" . - "-----------##------#-#-\n" . - "--##--###--#---#--#--#-\n" . - "---------#-###----#-#--\n" . - "-#######--##-######----\n" . - "-#-----#---####---##---\n" . - "-#-###-#-##-##-##-#-##-\n" . - "-#-###-#-##-##--#-##---\n" . - "-#-###-#---#---#-##-##-\n" . - "-#-----#-###--###-####-\n" . - "-#######-####---##-----\n" . - "-----------------------\n" - ; - - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->renderer->setFullBlock('#'); - $this->renderer->setEmptyBlock('-'); - $this->assertEquals('#', $this->renderer->getFullBlock()); - $this->assertEquals('-', $this->renderer->getEmptyBlock()); - $this->assertEquals($expected, $this->renderer->render($qrCode)); - } -} diff --git a/vendor/bacon/bacon-qr-code/tests/bootstrap.php b/vendor/bacon/bacon-qr-code/tests/bootstrap.php deleted file mode 100644 index 05a49415..00000000 --- a/vendor/bacon/bacon-qr-code/tests/bootstrap.php +++ /dev/null @@ -1,10 +0,0 @@ - -
Sets the given bit to true.
- * - * @param $x ; The horizontal component (i.e. which column) - * @param $y ; The vertical component (i.e. which row) - */ - public function set($x, $y) - { - $offset = (int)($y * $this->rowSize + ($x / 32)); - if (!isset($this->bits[$offset])) { - $this->bits[$offset] = 0; - } - //$this->bits[$offset] = $this->bits[$offset]; - - // if($this->bits[$offset]>200748364){ - //$this->bits= array(0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-1090519040,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,1056964608,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-1358954496,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,117440512,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,50331648,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,33554432,-1,-1,536870911,-4096,65279,0,0,0,0,0,0,0,0,-1,-1,65535,-4096,65535,0,0,0,0,0,0,0,0,-193,536870911,0,-4096,65279,0,0,0,0,0,0,0,0,-254,32767,0,-4096,61951,0,0,0,0,0,0,0,0,20913920,0,0,-4096,50175,0,0,0,0,0,0,0,0,0,0,0,-4096,60159,0,0,0,0,0,0,0,0,0,0,0,-4096,64255,0,0,0,0,0,0,0,0,0,0,0,-8192,56319,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,251658240,0,0,0,-4096,-1,255,0,256,0,0,0,0,117440512,0,0,0,-4096,-1,255,0,512,0,0,0,0,117440512,0,0,0,-4096,-1,255,0,1024,0,0,0,0,117440512,0,0,0,-4096,-1,223,0,256,0,0,0,0,117440512,0,0,33030144,-4096,-1,191,0,256,0,0,0,0,117440512,0,0,33554428,-4096,-1,255,0,768,0,0,0,0,117440512,0,402849792,67108862,-8192,-1,255,0,768,0,0,0,0,117440512,0,470278396,63045630,-8192,-1,255,0,256,0,0,0,0,251658240,-8388608,470278399,58720286,-8192,-1,2686975,0,3842,0,0,0,0,251658240,-131072,1007149567,58720286,-8192,-1,2031615,0,3879,0,0,0,0,251658240,536739840,1007092192,58720286,-8192,-1,851967,0,3840,0,0,0,0,251658240,917504,1007092192,58720284,-8192,-1,2031615,0,3968,0,0,0,0,251658240,917504,1007092160,59244060,-8192,-1,65535,0,7936,0,0,0,0,251658240,917504,1009779136,59244060,-8192,-1,9371647,0,1792,0,0,0,0,251658240,917504,946921920,59244060,-8192,-1,8585215,0,1792,0,0,0,0,117440512,-15859712,477159875,59244060,-8192,-1,65535,0,12032,0,0,0,0,251658240,-15859712,52490691,59244060,-8192,-1,-1,0,65408,0,0,0,0,251658240,-15859712,58778051,59244060,-8192,-1,-1,0,65473,0,0,0,0,251658240,-15859712,125886915,59244060,-8192,-1,-1,0,65472,0,0,0,0,251658240,-15859712,58778051,59244060,-8192,-1,-1,0,65408,0,0,0,0,251658240,-15859712,8380867,59244060,-8192,-1,-1,0,65473,0,0,0,0,251658240,-15859712,8380867,59244060,-8192,-1,-1,0,131011,0,0,0,0,251658240,-15859712,8380867,58720284,-8192,-1,-1,0,130947,0,0,0,0,251658240,-15859712,2089411,58720284,-8192,-1,-1,0,130947,0,0,0,0,251658240,-32636928,449,58720284,-8192,-1,-1,33554431,131015,0,0,0,0,251658240,786432,448,62914588,-8192,-1,-1,16777215,131015,0,0,0,0,251658240,786432,448,67108860,-8192,-1,-1,553648127,131015,0,0,0,0,251658240,786432,946864576,67108860,-8192,-1,-1,32505855,131015,0,0,0,0,251658240,786432,946921976,8388604,-8192,-1,-1,8191999,131015,0,0,0,0,251658240,-262144,946921983,248,-8192,-1,-1,8126463,196551,0,0,0,0,251658240,-262144,7397887,0,-8192,-1,-1,16777215,262087,0,0,0,0,251658240,-262144,8257543,0,-8192,-1,-1,-2121269249,262095,0,0,0,0,520093696,0,8257536,0,-8192,-1,-1,-201326593,262095,0,0,0,0,520290304,0,8257536,117963776,-8192,-1,-1,-201326593,262095,0,0,0,0,520093696,0,-2140143616,118488579,-8192,-1,-1,-201326593,131023,0,0,0,0,520093696,0,-2131697280,118488579,-8192,-1,-1,-503316481,131023,0,0,0,0,520093696,2145386496,-2131631232,118484995,-16384,-1,-1,-469762049,262095,0,0,0,0,520093696,2147221504,552649600,118481344,-16384,-1,-1,-469762049,131023,0,0,0,0,520290304,2147221504,2029002240,118481344,-16384,-1,-1,-469762049,262031,0,0,0,0,520290304,-266600448,2029001791,125952960,-16384,-1,-1,-469762049,262031,0,0,0,0,1057423360,-266600448,2027953215,133177312,-16384,-1,-1,-134217729,262111,0,0,0,0,1058471936,-266600448,-119531393,133177343,-16384,-1,-1,-134217729,262111,0,0,0,0,1058471936,-2145648640,-253754369,66068479,-16384,-1,-1,-134217729,262111,0,0,0,0,1058471936,236716032,-253754369,15729663,-16384,-1,-1,-134217729,262095,0,0,0,0,1057947648,236716032,-253754369,6348807,-16384,-1,-1,-134217729,262095,0,0,0,0,524222464,236716032,-253690305,6348803,-16384,-1,-1,-134217729,262111,0,0,0,0,521076736,2115764224,-253625344,14737411,-16384,-1,-1,-134217729,262095,0,0,0,0,522125312,2115764224,-253625344,14743555,-16384,-1,-1,-134217729,262111,0,0,16772608,0,1073676288,-31719424,-2014283776,14810115,-16384,-1,-1,-1,262143,0,0,16776704,0,1065287680,-1642594304,-1879178880,14810115,-16384,-1,-1,-1,524287,0,0,16776192,0,2139029504,264241152,-2013396089,14809091,-16384,-1,-1,-1,262095,0,0,16776192,0,2139029504,264241152,-2080636025,14803335,-16384,-1,-1,-1,262087,0,0,16776192,0,2147418112,264241152,-2132803581,14803847,-16384,-1,-1,-402653185,524259,0,0,8386048,0,2147418112,0,-2132688896,123783,-16384,-1,-1,1207959551,262112,0,0,16775168,0,2147418112,0,14794752,1046535,-16384,-1,-1,268435455,262128,0,0,16775168,0,2147418112,0,14712832,1047615,-16384,-1,-1,536870911,524284,0,0,16776705,0,2147418112,0,14680832,1047615,-16384,-1,-1,-1,524287,0,0,16776704,0,2147418112,-1048576,14681087,1046591,-32768,-1,-1,-1,524287,0,0,16776704,0,2147418112,-524288,-2132802561,2080831,-32768,-1,-1,-1,524287,0,0,16776705,0,2147418112,-524288,-31718401,2080831,-32768,-1,-1,-1,1048575,0,0,16776193,0,2147418112,3670016,-31718528,2080831,-32768,-1,-1,-1,524287,0,0,16776195,0,2147418112,3670016,-31718528,134086719,-32768,-1,-1,-1,524287,0,0,16776195,0,2147418112,3670016,253494144,268173368,-32768,-1,-1,-1,524287,0,0,16775171,0,2147418112,3670016,268174208,268173368,-32768,-1,-1,-1,1048575,0,0,16771072,0,2147418112,-63438848,268174223,31457328,-32768,-1,-1,-1,1048575,0,0,10418176,0,-65536,-63438848,133957519,14807040,-32768,-1,-1,-1,2097151,0,0,15923200,0,2147418112,-63438848,1968015,14809095,-32768,-1,-1,-1,1048575,0,0,12808192,0,2147418112,-63438848,2082703,12711943,-32768,-1,-1,-1,2097151,0,0,6420480,0,2147418112,-63438848,2082703,14343,-32768,-1,-1,-1,2097151,0,0,15202304,0,-65536,-63438848,2082703,1849351,-32768,-1,-1,-1,2097151,0,0,15464448,0,-65536,-63438848,264472335,1849351,-32768,-1,-1,-1,4194303,0,0,16371712,0,-65536,-63438848,264472335,14343,-32768,-1,-1,-1,8388607,0,0,0,0,-65536,-63438848,532907791,235010048,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,-63438848,-1603833,235010160,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,3670016,-30976,67238000,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,3670016,-30976,48,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,3670016,-29391104,768,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,3670016,-29391104,768,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,-524287,-65042433,768,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,-524287,2082441215,0,-65536,-1,-1,-1,16777215,0,0,0,0,-13697024,-524287,511,0,-65536,-1,-1,-1,16777215,0,0,0,0,-12648448,1,0,0,-65536,-1,-1,-1,14680063,0,0,0,0,-12648448,1,0,0,-65536,-1,-1,-1,16777215,0,0,0,0,-65536,1,0,0,-65536,-1,-1,-1,14680063,0,0,0,0,-8454144,1,0,0,-65536,-1,-1,-1,12582911,0,0,0,0,-12648448,1,0,0,-65536,-1,-1,-1,2097151,0,0,0,0,-12648448,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,-14745600,1,0,0,-65536,-1,-1,-1,3145727,0,0,0,0,1056964608,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,1056964608,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,1056964608,1,0,0,-65536,-1,-1,-1,524287,0,0,0,0,2130706432,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,1056964608,1,0,0,-65536,-1,-1,-1,524287,0,0,0,0,2130706432,1,0,0,-65536,-1,-1,-1,524287,0,0,0,0,2130706432,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,2130706432,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,50331648,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,117440512,1,0,-268435456,-1,-1,-1,-1,524287,0,0,0,0,251658240,1,0,-320,-1,-1,-1,-1,262143,0,0,0,0,520093696,1,-2048,-1,-1,-1,-1,-1,262143,0,0,0,0,1056964608,-16777213,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-121,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,65535,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,65535,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,262143,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,524287,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,524287,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,589823,0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,8179,0,0,0,0,50331648,-1,-1,-1,-1,-1,-1,-1,4080,0,0,0,0,117440512,-1,-1,-1,-1,-1,-1,-1,1016,0,0,0,0,251658240,-1,-1,-1,-1,-1,-1,1073741823,1020,0,0,0,0,50331648,-1,-1,-1,-1,-1,-1,536870911,254,0,0,0,0,50331648,-1,-1,-1,-1,-1,-1,536870911,255,0,0,0,0,50331648,-1,-1,-1,-1,-1,-1,-1879048193,127,0,0,0,0,50331648,-1,-1,-1,-1,-1,-1,-469762049,63,0,0,0,0,1191182336,-1,-1,-1,-1,1023999,0,-520093712,15,0,0,0,0,-218103808,-1,-1,-1,-1,0,-8454144,-260046849,7,0,0,0,0,0,-193,-1,-1,-1057947649,-2147483648,-1,-58720257,1,0,0,0,0,0,-251,-1,-1,-1057423361,-2074,-1,-1,0,0,0,0,0,0,-59648,-1,-1,-1,-1,-1,1073741823,0,0,0,0,0,0,-65536,-1,-1,-1,-1,-1,268435455,0,0,0,0,0,0,-65536,-1,-1,-1,-1,-1,67108863,0,0,0,0,0,0,-65536,-1,-1,-1,-1,-1,8388607,0,0,0,0,0,0,0,-403603456,-1,-1,-1,-1,262143,0,0,0,8388656,0,0,0,-1891434496,-1,-1,-1,-1,16383,0,0,0,8388608,0,0,0,-1612513280,-1,-1,-1,-1,63,0,0,0,0,0,0,0,-24320,-1,-1,-1,8388607,0,0,0,0,0,0,0,0,-256,-1,-1,1073741823,1,0,0,0,0,0,0,0,1610612736,-15,-1,-1,16383,0,0,0,0,0,0,0,0,-16646144,-1,-1,251658239,0,0,0,0,0,0,0,0,0,-51200,-1,-1,40959,0,0,0,0,0,0,268419584,103809024,-12713984,-1,-2147483137,4194303,0,0,0,0,0,0,0,402620416,-2144010240,-13631487,-32513,3,20480,0,0,0,0,0,0,0,419299328,0,-262144,-1,0,0,0,0,0,0,0,0,0,0,0,-5832704,268049407,0,0,0,0,0,0,0,0,0,0,0,0,33030144,0,0,0,0,0,0,0,0,0,0,0,0,3670016,0,0,0,0,0,0,0,0,0,0,0,0,1572864,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,458752,0,0,0,0,0,0,0,0,0,0,0,0,229376,0,0,0,0,0,0,0,0,0,0,0,0,32768,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8192,0,0,0,0,0,0,0,0,0,0,0,0,8192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31744,0,0,0,0,0,0,0,0,0,0,0,0,31744,0,0,0,0,0,0,0,0,0,0,0,0,64512,0,0,0,0,0,0,0,0,0,0,0,0,15872,0,0,0,0,0,0,0,0,0,0,0,0,3584,0,0,0,0,0,0,0,0,0,0,0,0,7680,0,0,0,0,0,0,0,0,0,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,3968,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3840,0,0,0,0,0,0,0,0,0,0,0,0,1855,0,0,0,0,0,0,0,0,0,0,0,0,63,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134217728,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,124,0,0,0,0,0,0,0,0,0,0,0,-260046848,63,0,0,0,0,0,0,0,0,0,0,0,-17301504,127,0,0,0,0,0,0,0,0,0,0,0,-524288,127,0,0,0,0,0,0,0,0,0,0,0,-262144,127,0,0,0,0,0,0,0,0,0,0,0,-262144,63,0,0,0,0,0,0,0,0,0,0,0,-262144,63,0,0,0,0,0,0,0,0,0,0,0,-262144,63,0,0,0,0,0,0,0,0,0,0,0,-262144,31,0,0,0,0,0,0,0,0,0,0,0,-262144,63,0,0,0,0,3,0,0,0,0,0,0,-262144,63,0,0,0,0,7,0,0,0,0,0,0,-262144,63,0,0,0,0,63,0,0,0,0,0,0,-262144,63,0,0,0,0,511,0,0,0,0,0,0,-524288,31,0,0,0,0,8191,0,0,0,0,0,0,-1048576,63,0,0,0,0,131071,0,0,0,0,0,0,-524288,63,0,0,0,0,262143,0,0,0,0,0,0,-524288,63,0,0,0,0,131071,0,0,0,0,0,0,-1048576,63,0,0,0,0,262143,0,0,0,0,0,0,-1048576,63,0,0,0,0,262143,0,0,0,0,0,0,-1048576,63,0,0,0,0,262143,0,0,0,0,0,0,-1048576,63,0,0,0,0,262143,0,0,0,0,0,0,-2097152,127,0,0,0,0,262143,0,0,0,0,0,0,-2097152,127,0,0,0,0,262143,0,0,0,0,0,0,-1048576,127,0,0,0,0,262143,0,0,0,0,0,0,-1048576,127,0,0,0,0,262143,0,0,0,0,0,0,-2097152,255,0,0,0,0,262143,0,0,0,0,0,0,-2097152,255,0,0,0,0,262142,0,0,0,0,0,0,-2097152,255,0,0,0,0,262142,0,0,0,0,0,0,-2097152,255,0,0,0,0,262142,0,0,0,0,0,0,-2097152,255,0,0,0,0,262140,0,0,0,0,0,0,-2097152,255,0,0,0,0,131068,0,0,0,0,0,0,-4194304,255,0,0,0,0,131068,0,0,0,0,0,0,-4194304,255,0,0,0,0,65528,0,0,0,0,0,0,-8388608,255,0,0,0,0,65528,0,0,0,0,0,0,-8388608,255,0,0,0,0,65528,0,0,0,0,0,0,-8388608,255,0,0,0,0,32760,0,0,0,0,0,0,-8388608,255,0,0,0,0,32760,0,0,0,0,0,0,-16777216,255,0,0,-2147483648,255,16368,0,0,0,0,0,0,-16777216,255,0,0,-536870912,1023,16368,0,0,0,0,0,0,-33554432,255,0,0,-16777216,4095,16352,0,0,0,0,0,0,-33554432,255,0,0,-8388608,262143,16352,0,0,0,0,0,0,-33554432,255,0,0,-1048576,2097151,16352,0,0,0,0,0,0,-67108864,255,0,0,-524288,8388607,16352,0,0,0,0,0,0,-67108864,255,0,0,-262144,16777215,16320,0,0,0,0,0,0,-67108864,255,0,0,-131072,16777215,100679648,0,0,0,0,0,0,-67108864,255,0,0,-16384,16776959,125861824,0,0,0,0,0,0,-134217728,255,0,0,-4096,16773121,62930880,0,0,0,0,0,0,-134217728,127,0,0,2147482624,16252928,32704,0,0,0,0,0,0,-134217728,127,0,0,268435200,14680064,16320,0,0,0,0,0,0,-134217728,127,0,0,134217600,0,32704,0,0,0,0,0,0,-33554432,127,0,1056964608,67108736,0,32704,0,0,0,0,0,0,-33554432,127,0,2130706432,33554368,0,65408,0,0,0,0,0,0,-33554432,127,0,-16777216,8388576,0,32640,0,0,0,0,0,0,-134217728,127,0,-16777216,2097136,0,32640,0,0,0,0,0,0,-134217728,63,0,-16776960,1048573,0,32640,0,0,0,0,0,0,-536870912,63,0,-16776448,1048575,0,32640,0,0,0,0,0,0,-536870912,63,0,-33553664,6291455,66752,32640,0,0,0,0,0,0,-536870912,63,0,2013266688,2097148,229376,32640,0,0,0,0,0,0,-536870912,63,0,256,4194300,229376,32640,0,0,0,0,0,0,-536870912,63,0,0,524280,196608,32512,0,0,8,0,0,0,-1073741824,63,0,0,-200,15,65280,0,0,24,0,0,0,-1073741824,63,0,0,-1867768,127,32512,0,0,56,0,0,0,-1073741824,63,0,0,-1056768,4095,32512,0,0,124,0,0,0,-1073741824,63,0,0,-1050624,8191,32512,0,0,508,0,0,0,-2147483648,31,0,0,-7866368,8191,32512,0,0,1020,0,0,0,-2147483648,31,0,0,-33030656,8095,32512,0,0,2046,0,0,0,-2147483648,63,0,0,-66586624,771,32512,0,0,4094,0,0,0,0,63,0,0,-134184960,1,32256,0,0,8190,0,0,0,0,63,0,0,1610612736,0,32256,0,0,16382,0,0,0,-2147483648,63,0,0,0,0,15872,0,0,32767,0,0,0,-2147483648,31,0,0,0,0,15872,0,-2147483648,65535,0,0,0,-2147483648,31,0,0,0,0,7680,0,0,65535,0,0,0,-2147483648,31,0,0,134217728,0,7680,0,-2147483648,65535,0,0,0,-2147483648,31,0,0,0,0,7680,0,-2147483648,65535,0,0,0,-2147483648,31,0,0,0,0,7680,0,-1073741824,65535,0,0,0,-2147483648,31,0,0,0,0,3072,0,-1073741824,65535,0,0,0,-2147483648,31,0,0,0,0,3072,0,-1073741824,65535,0,0,0,-2147483648,31,0,0,0,0,0,0,-2147483648,65535,0,0,0,-2147483648,31,0,0,0,0,0,0,-1073741824,65535,0,0,0,0,31,0,0,0,0,0,0,-1073741824,65535,0,0,0,0,31,0,0,0,0,0,0,-2147483648,65535,0,0,0,0,30,0,0,0,0,0,0,-1073741824,65535,0,0,0,0,30,0,0,0,0,0,0,-2147483648,65535,0,0,0,0,30,0,0,0,0,0,0,0,65535,0,0,0,0,28,0,0,0,0,0,0,0,65535,0,0,0,0,28,0,0,0,0,0,0,0,65535,0,0,0,0,28,0,0,0,0,0,0,0,65535,0,0,0,0,24,0,0,0,0,0,0,-2147483648,65535,0,0,0,0,0,0,0,0,0,0,0,-536870912,65535);//[$offset] |= intval32bits(1 << ($x & 0x1f)); - $bob = $this->bits[$offset]; - $bob |= 1 << ($x & 0x1f); - $this->bits[$offset] |= ($bob); - //$this->bits[$offset] = intval32bits($this->bits[$offset]); - - //} -//16777216 - } - - public function _unset($x, $y) - {//было unset, php не позволяет использовать unset - $offset = (int)($y * $this->rowSize + ($x / 32)); - $this->bits[$offset] &= ~(1 << ($x & 0x1f)); - } - - /**1 << (249 & 0x1f) - *Flips the given bit.
- * - * @param $x ; The horizontal component (i.e. which column) - * @param $y ; The vertical component (i.e. which row) - */ - public function flip($x, $y) - { - $offset = $y * $this->rowSize + (int)($x / 32); - - $this->bits[$offset] = ($this->bits[$offset] ^ (1 << ($x & 0x1f))); - } - - /** - * Exclusive-or (XOR): Flip the bit in this {@code BitMatrix} if the corresponding - * mask bit is set. - * - * @param $mask ; XOR mask - */ - public function _xor($mask) - {//было xor, php не позволяет использовать xor - if ($this->width != $mask->getWidth() || $this->height != $mask->getHeight() - || $this->rowSize != $mask->getRowSize()) { - throw new \InvalidArgumentException("input matrix dimensions do not match"); - } - $rowArray = new BitArray($this->width / 32 + 1); - for ($y = 0; $y < $this->height; $y++) { - $offset = $y * $this->rowSize; - $row = $mask->getRow($y, $rowArray)->getBitArray(); - for ($x = 0; $x < $this->rowSize; $x++) { - $this->bits[$offset + $x] ^= $row[$x]; - } - } - } - - /** - * Clears all bits (sets to false). - */ - public function clear() - { - $max = count($this->bits); - for ($i = 0; $i < $max; $i++) { - $this->bits[$i] = 0; - } - } - - /** - *Sets a square region of the bit matrix to true.
- * - * @param $left ; The horizontal position to begin at (inclusive) - * @param $top ; The vertical position to begin at (inclusive) - * @param $width ; The width of the region - * @param $height ; The height of the region - */ - public function setRegion($left, $top, $width, $height) - { - if ($top < 0 || $left < 0) { - throw new \InvalidArgumentException("Left and top must be nonnegative"); - } - if ($height < 1 || $width < 1) { - throw new \InvalidArgumentException("Height and width must be at least 1"); - } - $right = $left + $width; - $bottom = $top + $height; - if ($bottom > $this->height || $right > $this->width) { //> this.height || right > this.width - throw new \InvalidArgumentException("The region must fit inside the matrix"); - } - for ($y = $top; $y < $bottom; $y++) { - $offset = $y * $this->rowSize; - for ($x = $left; $x < $right; $x++) { - $this->bits[$offset + (int)($x / 32)] = ($this->bits[$offset + (int)($x / 32)] |= 1 << ($x & 0x1f)); - } - } - } - - /** - * Modifies this {@code BitMatrix} to represent the same but rotated 180 degrees - */ - public function rotate180() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - $topRow = new BitArray($width); - $bottomRow = new BitArray($width); - for ($i = 0; $i < ($height + 1) / 2; $i++) { - $topRow = $this->getRow($i, $topRow); - $bottomRow = $this->getRow($height - 1 - $i, $bottomRow); - $topRow->reverse(); - $bottomRow->reverse(); - $this->setRow($i, $bottomRow); - $this->setRow($height - 1 - $i, $topRow); - } - } - - /** - * @return The width of the matrix - */ - public function getWidth() - { - return $this->width; - } - - /** - * A fast method to retrieve one row of data from the matrix as a BitArray. - * - * @param $y ; The row to retrieve - * @param $row ; An optional caller-allocated BitArray, will be allocated if null or too small - * - * @return The resulting BitArray - this reference should always be used even when passing - * your own row - */ - public function getRow($y, $row) - { - if ($row == null || $row->getSize() < $this->width) { - $row = new BitArray($this->width); - } else { - $row->clear(); - } - $offset = $y * $this->rowSize; - for ($x = 0; $x < $this->rowSize; $x++) { - $row->setBulk($x * 32, $this->bits[$offset + $x]); - } - - return $row; - } - - /** - * @param $y ; row to set - * @param $row ; {@link BitArray} to copy from - */ - public function setRow($y, $row) - { - $this->bits = arraycopy($row->getBitArray(), 0, $this->bits, $y * $this->rowSize, $this->rowSize); - } - - /** - * This is useful in detecting the enclosing rectangle of a 'pure' barcode. - * - * @return {@code left,top,width,height} enclosing rectangle of all 1 bits, or null if it is all white - */ - public function getEnclosingRectangle() - { - $left = $this->width; - $top = $this->height; - $right = -1; - $bottom = -1; - - for ($y = 0; $y < $this->height; $y++) { - for ($x32 = 0; $x32 < $this->rowSize; $x32++) { - $theBits = $this->bits[$y * $this->rowSize + $x32]; - if ($theBits != 0) { - if ($y < $top) { - $top = $y; - } - if ($y > $bottom) { - $bottom = $y; - } - if ($x32 * 32 < $left) { - $bit = 0; - while (($theBits << (31 - $bit)) == 0) { - $bit++; - } - if (($x32 * 32 + $bit) < $left) { - $left = $x32 * 32 + $bit; - } - } - if ($x32 * 32 + 31 > $right) { - $bit = 31; - while ((sdvig3($theBits, $bit)) == 0) {//>>> - $bit--; - } - if (($x32 * 32 + $bit) > $right) { - $right = $x32 * 32 + $bit; - } - } - } - } - } - - $width = $right - $left; - $height = $bottom - $top; - - if ($width < 0 || $height < 0) { - return null; - } - - return [$left, $top, $width, $height]; - } - - /** - * This is useful in detecting a corner of a 'pure' barcode. - * - * @return {@code x,y} coordinate of top-left-most 1 bit, or null if it is all white - */ - public function getTopLeftOnBit() - { - $bitsOffset = 0; - while ($bitsOffset < count($this->bits) && $this->bits[$bitsOffset] == 0) { - $bitsOffset++; - } - if ($bitsOffset == count($this->bits)) { - return null; - } - $y = $bitsOffset / $this->rowSize; - $x = ($bitsOffset % $this->rowSize) * 32; - - $theBits = $this->bits[$bitsOffset]; - $bit = 0; - while (($theBits << (31 - $bit)) == 0) { - $bit++; - } - $x += $bit; - - return [$x, $y]; - } - - public function getBottomRightOnBit() - { - $bitsOffset = count($this->bits) - 1; - while ($bitsOffset >= 0 && $this->bits[$bitsOffset] == 0) { - $bitsOffset--; - } - if ($bitsOffset < 0) { - return null; - } - - $y = $bitsOffset / $this->rowSize; - $x = ($bitsOffset % $this->rowSize) * 32; - - $theBits = $this->bits[$bitsOffset]; - $bit = 31; - while ((sdvig3($theBits, $bit)) == 0) {//>>> - $bit--; - } - $x += $bit; - - return [$x, $y]; - } - - /** - * @return The height of the matrix - */ - public function getHeight() - { - return $this->height; - } - - /** - * @return The row size of the matrix - */ - public function getRowSize() - { - return $this->rowSize; - } - - public function equals($o) - { - if (!($o instanceof BitMatrix)) { - return false; - } - $other = $o; - - return $this->width == $other->width - && $this->height == $other->height - && $this->rowSize == $other->rowSize - && $this->bits === $other->bits; - } - - //@Override - - public function hashCode() - { - $hash = $this->width; - $hash = 31 * $hash + $this->width; - $hash = 31 * $hash + $this->height; - $hash = 31 * $hash + $this->rowSize; - $hash = 31 * $hash + hashCode($this->bits); - - return $hash; - } - - //@Override - - public function toString($setString = '', $unsetString = '', $lineSeparator = '') - { - if (!$setString || !$unsetString) { - return (string)'X ' . ' '; - } - if ($lineSeparator && $lineSeparator !== "\n") { - return $this->toString_($setString, $unsetString, $lineSeparator); - } - - return (string)($setString . $unsetString . "\n"); - } - - public function toString_($setString, $unsetString, $lineSeparator) - { - //$result = new StringBuilder(height * (width + 1)); - $result = ''; - for ($y = 0; $y < $this->height; $y++) { - for ($x = 0; $x < $this->width; $x++) { - $result .= ($this->get($x, $y) ? $setString : $unsetString); - } - $result .= ($lineSeparator); - } - - return (string)$result; - } - - /** - * @deprecated call {@link #toString(String,String)} only, which uses \n line separator always - */ - // @Deprecated - /** - *Gets the requested bit, where true means black.
- * - * @param $x ; The horizontal component (i.e. which column) - * @param $y ; The vertical component (i.e. which row) - * - * @return value of given bit in matrix - */ - public function get($x, $y) - { - - $offset = (int)($y * $this->rowSize + ($x / 32)); - if (!isset($this->bits[$offset])) { - $this->bits[$offset] = 0; - } - - // return (($this->bits[$offset] >> ($x & 0x1f)) & 1) != 0; - return (uRShift($this->bits[$offset], ($x & 0x1f)) & 1) != 0;//было >>> вместо >>, не знаю как эмулировать беззнаковый сдвиг - } - -// @Override - - public function _clone() - { - return new BitMatrix($this->width, $this->height, $this->rowSize, $this->bits); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitSource.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitSource.php deleted file mode 100644 index 0ce7f4ce..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitSource.php +++ /dev/null @@ -1,118 +0,0 @@ -This provides an easy abstraction to read bits at a time from a sequence of bytes, where the - * number of bits read is not often a multiple of 8. - * - *This class is thread-safe but not reentrant -- unless the caller modifies the bytes array - * it passed in, in which case all bets are off.
- * - * @author Sean Owen - */ -final class BitSource -{ - - private $bytes; - private $byteOffset = 0; - private $bitOffset = 0; - - /** - * @param bytes bytes from which this will read bits. Bits will be read from the first byte first. - * Bits are read within a byte from most-significant to least-significant bit. - */ - public function __construct($bytes) - { - $this->bytes = $bytes; - } - - /** - * @return index of next bit in current byte which would be read by the next call to {@link #readBits(int)}. - */ - public function getBitOffset() - { - return $this->bitOffset; - } - - /** - * @return index of next byte in input byte array which would be read by the next call to {@link #readBits(int)}. - */ - public function getByteOffset() - { - return $this->byteOffset; - } - - /** - * @param numBits number of bits to read - * - * @return int representing the bits read. The bits will appear as the least-significant - * bits of the int - * @throws IllegalArgumentException if numBits isn't in [1,32] or more than is available - */ - public function readBits($numBits) - { - if ($numBits < 1 || $numBits > 32 || $numBits > $this->available()) { - throw new \InvalidArgumentException(strval($numBits)); - } - - $result = 0; - - // First, read remainder from current byte - if ($this->bitOffset > 0) { - $bitsLeft = 8 - $this->bitOffset; - $toRead = $numBits < $bitsLeft ? $numBits : $bitsLeft; - $bitsToNotRead = $bitsLeft - $toRead; - $mask = (0xFF >> (8 - $toRead)) << $bitsToNotRead; - $result = ($this->bytes[$this->byteOffset] & $mask) >> $bitsToNotRead; - $numBits -= $toRead; - $this->bitOffset += $toRead; - if ($this->bitOffset == 8) { - $this->bitOffset = 0; - $this->byteOffset++; - } - } - - // Next read whole bytes - if ($numBits > 0) { - while ($numBits >= 8) { - $result = ($result << 8) | ($this->bytes[$this->byteOffset] & 0xFF); - $this->byteOffset++; - $numBits -= 8; - } - - // Finally read a partial byte - if ($numBits > 0) { - $bitsToNotRead = 8 - $numBits; - $mask = (0xFF >> $bitsToNotRead) << $bitsToNotRead; - $result = ($result << $numBits) | (($this->bytes[$this->byteOffset] & $mask) >> $bitsToNotRead); - $this->bitOffset += $numBits; - } - } - - return $result; - } - - /** - * @return number of bits that can be read successfully - */ - public function available() - { - return 8 * (count($this->bytes) - $this->byteOffset) - $this->bitOffset; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/CharacterSetECI.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/CharacterSetECI.php deleted file mode 100644 index 086d593d..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/CharacterSetECI.php +++ /dev/null @@ -1,158 +0,0 @@ - self::ISO8859_1, - 'ISO-8859-2' => self::ISO8859_2, - 'ISO-8859-3' => self::ISO8859_3, - 'ISO-8859-4' => self::ISO8859_4, - 'ISO-8859-5' => self::ISO8859_5, - 'ISO-8859-6' => self::ISO8859_6, - 'ISO-8859-7' => self::ISO8859_7, - 'ISO-8859-8' => self::ISO8859_8, - 'ISO-8859-9' => self::ISO8859_9, - 'ISO-8859-10' => self::ISO8859_10, - 'ISO-8859-11' => self::ISO8859_11, - 'ISO-8859-12' => self::ISO8859_12, - 'ISO-8859-13' => self::ISO8859_13, - 'ISO-8859-14' => self::ISO8859_14, - 'ISO-8859-15' => self::ISO8859_15, - 'ISO-8859-16' => self::ISO8859_16, - 'SHIFT-JIS' => self::SJIS, - 'WINDOWS-1250' => self::CP1250, - 'WINDOWS-1251' => self::CP1251, - 'WINDOWS-1252' => self::CP1252, - 'WINDOWS-1256' => self::CP1256, - 'UTF-16BE' => self::UNICODE_BIG_UNMARKED, - 'UTF-8' => self::UTF8, - 'ASCII' => self::ASCII, - 'GBK' => self::GB18030, - 'EUC-KR' => self::EUC_KR, - ]; - /**#@-*/ - /** - * Additional possible values for character sets. - * - * @var array - */ - protected static $additionalValues = [ - self::CP437 => 2, - self::ASCII => 170, - ]; - private static $name = null; - - /** - * Gets character set ECI by value. - * - * @param string $name - * - * @return CharacterSetEci|null - */ - public static function getCharacterSetECIByValue($value) - { - if ($value < 0 || $value >= 900) { - throw new \InvalidArgumentException('Value must be between 0 and 900'); - } - if (false !== ($key = array_search($value, self::$additionalValues))) { - $value = $key; - } - array_search($value, self::$nameToEci); - try { - self::setName($value); - - return new self($value); - } catch (\UnexpectedValueException $e) { - return null; - } - } - - private static function setName($value) - { - foreach (self::$nameToEci as $name => $key) { - if ($key == $value) { - self::$name = $name; - - return true; - } - } - if (self::$name == null) { - foreach (self::$additionalValues as $name => $key) { - if ($key == $value) { - self::$name = $name; - - return true; - } - } - } - } - - /** - * Gets character set ECI name. - * - * @return character set ECI name|null - */ - public static function name() - { - return self::$name; - } - - /** - * Gets character set ECI by name. - * - * @param string $name - * - * @return CharacterSetEci|null - */ - public static function getCharacterSetECIByName($name) - { - $name = strtoupper($name); - if (isset(self::$nameToEci[$name])) { - return new self(self::$nameToEci[$name]); - } - - return null; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DecoderResult.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DecoderResult.php deleted file mode 100644 index 22aee044..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DecoderResult.php +++ /dev/null @@ -1,122 +0,0 @@ -Encapsulates the result of decoding a matrix of bits. This typically - * applies to 2D barcode formats. For now it contains the raw bytes obtained, - * as well as a String interpretation of those bytes, if applicable. - * - * @author Sean Owen - */ -final class DecoderResult -{ - - private $rawBytes; - private $text; - private $byteSegments; - private $ecLevel; - private $errorsCorrected; - private $erasures; - private $other; - private $structuredAppendParity; - private $structuredAppendSequenceNumber; - - - public function __construct( - $rawBytes, - $text, - $byteSegments, - $ecLevel, - $saSequence = -1, - $saParity = -1 - ) { - $this->rawBytes = $rawBytes; - $this->text = $text; - $this->byteSegments = $byteSegments; - $this->ecLevel = $ecLevel; - $this->structuredAppendParity = $saParity; - $this->structuredAppendSequenceNumber = $saSequence; - } - - public function getRawBytes() - { - return $this->rawBytes; - } - - public function getText() - { - return $this->text; - } - - public function getByteSegments() - { - return $this->byteSegments; - } - - public function getECLevel() - { - return $this->ecLevel; - } - - public function getErrorsCorrected() - { - return $this->errorsCorrected; - } - - public function setErrorsCorrected($errorsCorrected) - { - $this->errorsCorrected = $errorsCorrected; - } - - public function getErasures() - { - return $this->erasures; - } - - public function setErasures($erasures) - { - $this->erasures = $erasures; - } - - public function getOther() - { - return $this->other; - } - - public function setOther($other) - { - $this->other = $other; - } - - public function hasStructuredAppend() - { - return $this->structuredAppendParity >= 0 && $this->structuredAppendSequenceNumber >= 0; - } - - public function getStructuredAppendParity() - { - return $this->structuredAppendParity; - } - - public function getStructuredAppendSequenceNumber() - { - return $this->structuredAppendSequenceNumber; - } - -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DefaultGridSampler.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DefaultGridSampler.php deleted file mode 100644 index d2326d3c..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DefaultGridSampler.php +++ /dev/null @@ -1,93 +0,0 @@ -sampleGrid_($image, $dimensionX, $dimensionY, $transform); - } - -//@Override - public function sampleGrid_( - $image, - $dimensionX, - $dimensionY, - $transform - ) { - if ($dimensionX <= 0 || $dimensionY <= 0) { - throw NotFoundException::getNotFoundInstance(); - } - $bits = new BitMatrix($dimensionX, $dimensionY); - $points = fill_array(0, 2 * $dimensionX, 0.0); - for ($y = 0; $y < $dimensionY; $y++) { - $max = count($points); - $iValue = (float)$y + 0.5; - for ($x = 0; $x < $max; $x += 2) { - $points[$x] = (float)($x / 2) + 0.5; - $points[$x + 1] = $iValue; - } - $transform->transformPoints($points); -// Quick check to see if points transformed to something inside the image; -// sufficient to check the endpoints - $this->checkAndNudgePoints($image, $points); - try { - for ($x = 0; $x < $max; $x += 2) { - if ($image->get((int)$points[$x], (int)$points[$x + 1])) { -// Black(-ish) pixel - $bits->set($x / 2, $y); - } - } - } catch (\Exception $aioobe) {//ArrayIndexOutOfBoundsException -// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting -// transform gets "twisted" such that it maps a straight line of points to a set of points -// whose endpoints are in bounds, but others are not. There is probably some mathematical -// way to detect this about the transformation that I don't know yet. -// This results in an ugly runtime exception despite our clever checks above -- can't have -// that. We could check each point's coordinates but that feels duplicative. We settle for -// catching and wrapping ArrayIndexOutOfBoundsException. - throw NotFoundException::getNotFoundInstance(); - } - } - - return $bits; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Detector/MathUtils.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Detector/MathUtils.php deleted file mode 100644 index e88cfc86..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Detector/MathUtils.php +++ /dev/null @@ -1,49 +0,0 @@ -A somewhat generic detector that looks for a barcode-like rectangular region within an image. - * It looks within a mostly white region of an image for a region of black and white, but mostly - * black. It returns the four corners of the region, as best it can determine. - * - * @author Sean Owen - * @port Ashot Khanamiryan - */ -class MonochromeRectangleDetector -{ - private static $MAX_MODULES = 32; - private $image; - - public function __construct(BinaryBitmap $image) - { - $this->image = $image; - - } - - /** - *Detects a rectangular region of black and white -- mostly black -- with a region of mostly - * white, in an image.
- * - * @return {@link ResultPoint}[] describing the corners of the rectangular region. The first and - * last points are opposed on the diagonal, as are the second and third. The first point will be - * the topmost point and the last, the bottommost. The second point will be leftmost and the - * third, the rightmost - * @throws NotFoundException if no Data Matrix Code can be found - */ - public function detect() - { - - $height = $this->image->getHeight(); - $width = $this->image->getWidth(); - $halfHeight = $height / 2; - $halfWidth = $width / 2; - - $deltaY = max(1, $height / (self::$MAX_MODULES * 8)); - $deltaX = max(1, $width / (self::$MAX_MODULES * 8)); - - - $top = 0; - $bottom = $height; - $left = 0; - $right = $width; - $pointA = $this->findCornerFromCenter($halfWidth, 0, $left, $right, - $halfHeight, -$deltaY, $top, $bottom, $halfWidth / 2); - $top = (int)$pointA->getY() - 1; - $pointB = $this->findCornerFromCenter($halfWidth, -$deltaX, $left, $right, - $halfHeight, 0, $top, $bottom, $halfHeight / 2); - $left = (int)$pointB->getX() - 1; - $pointC = $this->findCornerFromCenter($halfWidth, $deltaX, $left, $right, - $halfHeight, 0, $top, $bottom, $halfHeight / 2); - $right = (int)$pointC->getX() + 1; - $pointD = $this->findCornerFromCenter($halfWidth, 0, $left, $right, - $halfHeight, $deltaY, $top, $bottom, $halfWidth / 2); - $bottom = (int)$pointD->getY() + 1; - - // Go try to find po$A again with better information -- might have been off at first. - $pointA = $this->findCornerFromCenter($halfWidth, 0, $left, $right, - $halfHeight, -$deltaY, $top, $bottom, $halfWidth / 4); - - return new ResultPoint($pointA, $pointB, $pointC, $pointD); - - } - - - /** - * Attempts to locate a corner of the barcode by scanning up, down, left or right from a center - * point which should be within the barcode. - * - * @param float $centerX center's x component (horizontal) - * @param float $deltaX same as deltaY but change in x per step instead - * @param float $left minimum value of x - * @param float $right maximum value of x - * @param float $centerY center's y component (vertical) - * @param float $deltaY change in y per step. If scanning up this is negative; down, positive; - * left or right, 0 - * @param float $top minimum value of y to search through (meaningless when di == 0) - * @param float $bottom maximum value of y - * @param float $maxWhiteRun maximum run of white pixels that can still be considered to be within - * the barcode - * - * @return ResultPoint $a {@link com.google.zxing.ResultPoint} encapsulating the corner that was found - * @throws NotFoundException if such a point cannot be found - */ - private function findCornerFromCenter($centerX, - $deltaX, - $left, - $right, - $centerY, - $deltaY, - $top, - $bottom, - $maxWhiteRun) - { - $lastRange = null; - for ($y = $centerY, $x = $centerX; - $y < $bottom && $y >= $top && $x < $right && $x >= $left; - $y += $deltaY, $x += $deltaX) { - $range = 0; - if ($deltaX == 0) { - // horizontal slices, up and down - $range = $this->blackWhiteRange($y, $maxWhiteRun, $left, $right, true); - } else { - // vertical slices, left and right - $range = $this->blackWhiteRange($x, $maxWhiteRun, $top, $bottom, false); - } - if ($range == null) { - if ($lastRange == null) { - throw NotFoundException::getNotFoundInstance(); - } - // lastRange was found - if ($deltaX == 0) { - $lastY = $y - $deltaY; - if ($lastRange[0] < $centerX) { - if ($lastRange[1] > $centerX) { - // straddle, choose one or the other based on direction - return new ResultPoint($deltaY > 0 ? $lastRange[0] : $lastRange[1], $lastY); - } - - return new ResultPoint($lastRange[0], $lastY); - } else { - return new ResultPoint($lastRange[1], $lastY); - } - } else { - $lastX = $x - $deltaX; - if ($lastRange[0] < $centerY) { - if ($lastRange[1] > $centerY) { - return new ResultPoint($lastX, $deltaX < 0 ? $lastRange[0] : $lastRange[1]); - } - - return new ResultPoint($lastX, $lastRange[0]); - } else { - return new ResultPoint($lastX, $lastRange[1]); - } - } - } - $lastRange = $range; - } - throw NotFoundException::getNotFoundInstance(); - } - - - /** - * Computes the start and end of a region of pixels, either horizontally or vertically, that could - * be part of a Data Matrix barcode. - * - * @param fixedDimension if scanning horizontally, this is the row (the fixed vertical location) - * where we are scanning. If scanning vertically it's the column, the fixed horizontal location - * @param maxWhiteRun largest run of white pixels that can still be considered part of the - * barcode region - * @param minDim minimum pixel location, horizontally or vertically, to consider - * @param maxDim maximum pixel location, horizontally or vertically, to consider - * @param horizontal if true, we're scanning left-right, instead of up-down - * - * @return int[] with start and end of found range, or null if no such range is found - * (e.g. only white was found) - */ - - private function blackWhiteRange($fixedDimension, $maxWhiteRun, $minDim, $maxDim, $horizontal) - { - $center = ($minDim + $maxDim) / 2; - - // Scan left/up first - $start = $center; - while ($start >= $minDim) { - if ($horizontal ? $this->image->get($start, $fixedDimension) : $this->image->get($fixedDimension, $start)) { - $start--; - } else { - $whiteRunStart = $start; - do { - $start--; - } while ($start >= $minDim && !($horizontal ? $this->image->get($start, $fixedDimension) : - $this->image->get($fixedDimension, $start))); - $whiteRunSize = $whiteRunStart - $start; - if ($start < $minDim || $whiteRunSize > $maxWhiteRun) { - $start = $whiteRunStart; - break; - } - } - } - $start++; - - // Then try right/down - $end = $center; - while ($end < $maxDim) { - if ($horizontal ? $this->image->get($end, $fixedDimension) : $this->image->get($fixedDimension, $end)) { - $end++; - } else { - $whiteRunStart = $end; - do { - $end++; - } while ($end < $maxDim && !($horizontal ? $this->image->get($end, $fixedDimension) : - $this->image->get($fixedDimension, $end))); - $whiteRunSize = $end - $whiteRunStart; - if ($end >= $maxDim || $whiteRunSize > $maxWhiteRun) { - $end = $whiteRunStart; - break; - } - } - } - $end--; - - return $end > $start ? [$start, $end] : null; - } -} \ No newline at end of file diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DetectorResult.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DetectorResult.php deleted file mode 100644 index d2e9bc86..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DetectorResult.php +++ /dev/null @@ -1,47 +0,0 @@ -Encapsulates the result of detecting a barcode in an image. This includes the raw - * matrix of black/white pixels corresponding to the barcode, and possibly points of interest - * in the image, like the location of finder patterns or corners of the barcode in the image. - * - * @author Sean Owen - */ -class DetectorResult -{ - private $bits; - private $points; - - public function __construct($bits, $points) - { - $this->bits = $bits; - $this->points = $points; - } - - public final function getBits() - { - return $this->bits; - } - - public final function getPoints() - { - return $this->points; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GlobalHistogramBinarizer.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GlobalHistogramBinarizer.php deleted file mode 100644 index 267c3f02..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GlobalHistogramBinarizer.php +++ /dev/null @@ -1,207 +0,0 @@ -luminances = self::$EMPTY; - $this->buckets = fill_array(0, self::$LUMINANCE_BUCKETS, 0); - $this->source = $source; - } - - // Applies simple sharpening to the row data to improve performance of the 1D Readers. - public function getBlackRow($y, $row = null) - { - $this->source = $this->getLuminanceSource(); - $width = $this->source->getWidth(); - if ($row == null || $row->getSize() < $width) { - $row = new BitArray($width); - } else { - $row->clear(); - } - - $this->initArrays($width); - $localLuminances = $this->source->getRow($y, $this->luminances); - $localBuckets = $this->buckets; - for ($x = 0; $x < $width; $x++) { - $pixel = $localLuminances[$x] & 0xff; - $localBuckets[$pixel >> self::$LUMINANCE_SHIFT]++; - } - $blackPoint = self::estimateBlackPoint($localBuckets); - - $left = $localLuminances[0] & 0xff; - $center = $localLuminances[1] & 0xff; - for ($x = 1; $x < $width - 1; $x++) { - $right = $localLuminances[$x + 1] & 0xff; - // A simple -1 4 -1 box filter with a weight of 2. - $luminance = (($center * 4) - $left - $right) / 2; - if ($luminance < $blackPoint) { - $row->set($x); - } - $left = $center; - $center = $right; - } - - return $row; - } - - // Does not sharpen the data, as this call is intended to only be used by 2D Readers. - private function initArrays($luminanceSize) - { - if (count($this->luminances) < $luminanceSize) { - $this->luminances = []; - } - for ($x = 0; $x < self::$LUMINANCE_BUCKETS; $x++) { - $this->buckets[$x] = 0; - } - } - - private static function estimateBlackPoint($buckets) - { - // Find the tallest peak in the histogram. - $numBuckets = count($buckets); - $maxBucketCount = 0; - $firstPeak = 0; - $firstPeakSize = 0; - for ($x = 0; $x < $numBuckets; $x++) { - if ($buckets[$x] > $firstPeakSize) { - $firstPeak = $x; - $firstPeakSize = $buckets[$x]; - } - if ($buckets[$x] > $maxBucketCount) { - $maxBucketCount = $buckets[$x]; - } - } - - // Find the second-tallest peak which is somewhat far from the tallest peak. - $secondPeak = 0; - $secondPeakScore = 0; - for ($x = 0; $x < $numBuckets; $x++) { - $distanceToBiggest = $x - $firstPeak; - // Encourage more distant second peaks by multiplying by square of distance. - $score = $buckets[$x] * $distanceToBiggest * $distanceToBiggest; - if ($score > $secondPeakScore) { - $secondPeak = $x; - $secondPeakScore = $score; - } - } - - // Make sure firstPeak corresponds to the black peak. - if ($firstPeak > $secondPeak) { - $temp = $firstPeak; - $firstPeak = $secondPeak; - $secondPeak = $temp; - } - - // If there is too little contrast in the image to pick a meaningful black point, throw rather - // than waste time trying to decode the image, and risk false positives. - if ($secondPeak - $firstPeak <= $numBuckets / 16) { - throw NotFoundException::getNotFoundInstance(); - } - - // Find a valley between them that is low and closer to the white peak. - $bestValley = $secondPeak - 1; - $bestValleyScore = -1; - for ($x = $secondPeak - 1; $x > $firstPeak; $x--) { - $fromFirst = $x - $firstPeak; - $score = $fromFirst * $fromFirst * ($secondPeak - $x) * ($maxBucketCount - $buckets[$x]); - if ($score > $bestValleyScore) { - $bestValley = $x; - $bestValleyScore = $score; - } - } - - return ($bestValley << self::$LUMINANCE_SHIFT); - } - - public function getBlackMatrix() - { - $source = $this->getLuminanceSource(); - $width = $source->getWidth(); - $height = $source->getHeight(); - $matrix = new BitMatrix($width, $height); - - // Quickly calculates the histogram by sampling four rows from the image. This proved to be - // more robust on the blackbox tests than sampling a diagonal as we used to do. - $this->initArrays($width); - $localBuckets = $this->buckets; - for ($y = 1; $y < 5; $y++) { - $row = (int)($height * $y / 5); - $localLuminances = $source->getRow($row, $this->luminances); - $right = (int)(($width * 4) / 5); - for ($x = (int)($width / 5); $x < $right; $x++) { - $pixel = ($localLuminances[(int)($x)] & 0xff); - $localBuckets[($pixel >> self::$LUMINANCE_SHIFT)]++; - } - } - $blackPoint = self::estimateBlackPoint($localBuckets); - - // We delay reading the entire image luminance until the black point estimation succeeds. - // Although we end up reading four rows twice, it is consistent with our motto of - // "fail quickly" which is necessary for continuous scanning. - $localLuminances = $source->getMatrix(); - for ($y = 0; $y < $height; $y++) { - $offset = $y * $width; - for ($x = 0; $x < $width; $x++) { - $pixel = (int)($localLuminances[$offset + $x] & 0xff); - if ($pixel < $blackPoint) { - $matrix->set($x, $y); - } - } - } - - return $matrix; - } - - public function createBinarizer($source) - { - return new GlobalHistogramBinarizer($source); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GridSampler.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GridSampler.php deleted file mode 100644 index affea31b..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GridSampler.php +++ /dev/null @@ -1,188 +0,0 @@ -Checks a set of points that have been transformed to sample points on an image against - * the image's dimensions to see if the point are even within the image. - * - *This method will actually "nudge" the endpoints back onto the image if they are found to be - * barely (less than 1 pixel) off the image. This accounts for imperfect detection of finder - * patterns in an image where the QR Code runs all the way to the image border.
- * - *For efficiency, the method will check points from either end of the line until one is found - * to be within the image. Because the set of points are assumed to be linear, this is valid.
- * - * @param image image into which the points should map - * @param points actual points in x1,y1,...,xn,yn form - * - * @throws NotFoundException if an endpoint is lies outside the image boundaries - */ - protected static function checkAndNudgePoints( - $image, - $points - ) { - $width = $image->getWidth(); - $height = $image->getHeight(); -// Check and nudge points from start until we see some that are OK: - $nudged = true; - for ($offset = 0; $offset < count($points) && $nudged; $offset += 2) { - $x = (int)$points[$offset]; - $y = (int)$points[$offset + 1]; - if ($x < -1 || $x > $width || $y < -1 || $y > $height) { - throw NotFoundException::getNotFoundInstance(); - } - $nudged = false; - if ($x == -1) { - $points[$offset] = 0.0; - $nudged = true; - } else if ($x == $width) { - $points[$offset] = $width - 1; - $nudged = true; - } - if ($y == -1) { - $points[$offset + 1] = 0.0; - $nudged = true; - } else if ($y == $height) { - $points[$offset + 1] = $height - 1; - $nudged = true; - } - } -// Check and nudge points from end: - $nudged = true; - for ($offset = count($points) - 2; $offset >= 0 && $nudged; $offset -= 2) { - $x = (int)$points[$offset]; - $y = (int)$points[$offset + 1]; - if ($x < -1 || $x > $width || $y < -1 || $y > $height) { - throw NotFoundException::getNotFoundInstance(); - } - $nudged = false; - if ($x == -1) { - $points[$offset] = 0.0; - $nudged = true; - } else if ($x == $width) { - $points[$offset] = $width - 1; - $nudged = true; - } - if ($y == -1) { - $points[$offset + 1] = 0.0; - $nudged = true; - } else if ($y == $height) { - $points[$offset + 1] = $height - 1; - $nudged = true; - } - } - } - - /** - * Samples an image for a rectangular matrix of bits of the given dimension. The sampling - * transformation is determined by the coordinates of 4 points, in the original and transformed - * image space. - * - * @param image image to sample - * @param dimensionX width of {@link BitMatrix} to sample from image - * @param dimensionY height of {@link BitMatrix} to sample from image - * @param p1ToX point 1 preimage X - * @param p1ToY point 1 preimage Y - * @param p2ToX point 2 preimage X - * @param p2ToY point 2 preimage Y - * @param p3ToX point 3 preimage X - * @param p3ToY point 3 preimage Y - * @param p4ToX point 4 preimage X - * @param p4ToY point 4 preimage Y - * @param p1FromX point 1 image X - * @param p1FromY point 1 image Y - * @param p2FromX point 2 image X - * @param p2FromY point 2 image Y - * @param p3FromX point 3 image X - * @param p3FromY point 3 image Y - * @param p4FromX point 4 image X - * @param p4FromY point 4 image Y - * - * @return {@link BitMatrix} representing a grid of points sampled from the image within a region - * defined by the "from" parameters - * @throws NotFoundException if image can't be sampled, for example, if the transformation defined - * by the given points is invalid or results in sampling outside the image boundaries - */ - public abstract function sampleGrid( - $image, - $dimensionX, - $dimensionY, - $p1ToX, $p1ToY, - $p2ToX, $p2ToY, - $p3ToX, $p3ToY, - $p4ToX, $p4ToY, - $p1FromX, $p1FromY, - $p2FromX, $p2FromY, - $p3FromX, $p3FromY, - $p4FromX, $p4FromY - ); - - public abstract function sampleGrid_( - $image, - $dimensionX, - $dimensionY, - $transform - ); - -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/HybridBinarizer.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/HybridBinarizer.php deleted file mode 100644 index c71cc1b0..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/HybridBinarizer.php +++ /dev/null @@ -1,264 +0,0 @@ -matrix !== null) { - return $this->matrix; - } - $source = $this->getLuminanceSource(); - $width = $source->getWidth(); - $height = $source->getHeight(); - if ($width >= self::$MINIMUM_DIMENSION && $height >= self::$MINIMUM_DIMENSION) { - $luminances = $source->getMatrix(); - $subWidth = $width >> self::$BLOCK_SIZE_POWER; - if (($width & self::$BLOCK_SIZE_MASK) != 0) { - $subWidth++; - } - $subHeight = $height >> self::$BLOCK_SIZE_POWER; - if (($height & self::$BLOCK_SIZE_MASK) != 0) { - $subHeight++; - } - $blackPoints = self::calculateBlackPoints($luminances, $subWidth, $subHeight, $width, $height); - - $newMatrix = new BitMatrix($width, $height); - self::calculateThresholdForBlock($luminances, $subWidth, $subHeight, $width, $height, $blackPoints, $newMatrix); - $this->matrix = $newMatrix; - } else { - // If the image is too small, fall back to the global histogram approach. - $this->matrix = parent::getBlackMatrix(); - } - - return $this->matrix; - } - - /** - * Calculates a single black point for each block of pixels and saves it away. - * See the following thread for a discussion of this algorithm: - * http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0 - */ - private static function calculateBlackPoints( - $luminances, - $subWidth, - $subHeight, - $width, - $height - ) { - $blackPoints = fill_array(0, $subHeight, 0); - foreach ($blackPoints as $key => $point) { - $blackPoints[$key] = fill_array(0, $subWidth, 0); - } - for ($y = 0; $y < $subHeight; $y++) { - $yoffset = ($y << self::$BLOCK_SIZE_POWER); - $maxYOffset = $height - self::$BLOCK_SIZE; - if ($yoffset > $maxYOffset) { - $yoffset = $maxYOffset; - } - for ($x = 0; $x < $subWidth; $x++) { - $xoffset = ($x << self::$BLOCK_SIZE_POWER); - $maxXOffset = $width - self::$BLOCK_SIZE; - if ($xoffset > $maxXOffset) { - $xoffset = $maxXOffset; - } - $sum = 0; - $min = 0xFF; - $max = 0; - for ($yy = 0, $offset = $yoffset * $width + $xoffset; $yy < self::$BLOCK_SIZE; $yy++, $offset += $width) { - for ($xx = 0; $xx < self::$BLOCK_SIZE; $xx++) { - $pixel = ((int)($luminances[(int)($offset + $xx)]) & 0xFF); - $sum += $pixel; - // still looking for good contrast - if ($pixel < $min) { - $min = $pixel; - } - if ($pixel > $max) { - $max = $pixel; - } - } - // short-circuit min/max tests once dynamic range is met - if ($max - $min > self::$MIN_DYNAMIC_RANGE) { - // finish the rest of the rows quickly - for ($yy++, $offset += $width; $yy < self::$BLOCK_SIZE; $yy++, $offset += $width) { - for ($xx = 0; $xx < self::$BLOCK_SIZE; $xx++) { - $sum += ($luminances[$offset + $xx] & 0xFF); - } - } - } - } - - // The default estimate is the average of the values in the block. - $average = ($sum >> (self::$BLOCK_SIZE_POWER * 2)); - if ($max - $min <= self::$MIN_DYNAMIC_RANGE) { - // If variation within the block is low, assume this is a block with only light or only - // dark pixels. In that case we do not want to use the average, as it would divide this - // low contrast area into black and white pixels, essentially creating data out of noise. - // - // The default assumption is that the block is light/background. Since no estimate for - // the level of dark pixels exists locally, use half the min for the block. - $average = (int)($min / 2); - - if ($y > 0 && $x > 0) { - // Correct the "white background" assumption for blocks that have neighbors by comparing - // the pixels in this block to the previously calculated black points. This is based on - // the fact that dark barcode symbology is always surrounded by some amount of light - // background for which reasonable black point estimates were made. The bp estimated at - // the boundaries is used for the interior. - - // The (min < bp) is arbitrary but works better than other heuristics that were tried. - $averageNeighborBlackPoint = - (int)(($blackPoints[$y - 1][$x] + (2 * $blackPoints[$y][$x - 1]) + $blackPoints[$y - 1][$x - 1]) / 4); - if ($min < $averageNeighborBlackPoint) { - $average = $averageNeighborBlackPoint; - } - } - } - $blackPoints[$y][$x] = (int)($average); - } - } - - return $blackPoints; - } - - /** - * For each block in the image, calculate the average black point using a 5x5 grid - * of the blocks around it. Also handles the corner cases (fractional blocks are computed based - * on the last pixels in the row/column which are also used in the previous block). - */ - private static function calculateThresholdForBlock( - $luminances, - $subWidth, - $subHeight, - $width, - $height, - $blackPoints, - $matrix - ) { - for ($y = 0; $y < $subHeight; $y++) { - $yoffset = ($y << self::$BLOCK_SIZE_POWER); - $maxYOffset = $height - self::$BLOCK_SIZE; - if ($yoffset > $maxYOffset) { - $yoffset = $maxYOffset; - } - for ($x = 0; $x < $subWidth; $x++) { - $xoffset = ($x << self::$BLOCK_SIZE_POWER); - $maxXOffset = $width - self::$BLOCK_SIZE; - if ($xoffset > $maxXOffset) { - $xoffset = $maxXOffset; - } - $left = self::cap($x, 2, $subWidth - 3); - $top = self::cap($y, 2, $subHeight - 3); - $sum = 0; - for ($z = -2; $z <= 2; $z++) { - $blackRow = $blackPoints[$top + $z]; - $sum += $blackRow[$left - 2] + $blackRow[$left - 1] + $blackRow[$left] + $blackRow[$left + 1] + $blackRow[$left + 2]; - } - $average = (int)($sum / 25); - - self::thresholdBlock($luminances, $xoffset, $yoffset, $average, $width, $matrix); - } - } - } - - private static function cap($value, $min, $max) - { - if ($value < $min) { - return $min; - } elseif ($value > $max) { - return $max; - } else { - return $value; - } - } - - /** - * Applies a single threshold to a block of pixels. - */ - private static function thresholdBlock( - $luminances, - $xoffset, - $yoffset, - $threshold, - $stride, - $matrix - ) { - - for ($y = 0, $offset = $yoffset * $stride + $xoffset; $y < self::$BLOCK_SIZE; $y++, $offset += $stride) { - for ($x = 0; $x < self::$BLOCK_SIZE; $x++) { - // Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0. - if (($luminances[$offset + $x] & 0xFF) <= $threshold) { - $matrix->set($xoffset + $x, $yoffset + $y); - } - } - } - } - - public function createBinarizer($source) - { - return new HybridBinarizer($source); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/PerspectiveTransform.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/PerspectiveTransform.php deleted file mode 100644 index a3a0b971..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/PerspectiveTransform.php +++ /dev/null @@ -1,175 +0,0 @@ -This class implements a perspective transform in two dimensions. Given four source and four - * destination points, it will compute the transformation implied between them. The code is based - * directly upon section 3.4.2 of George Wolberg's "Digital Image Warping"; see pages 54-56. - * - * @author Sean Owen - */ -final class PerspectiveTransform -{ - private $a11; - private $a12; - private $a13; - private $a21; - private $a22; - private $a23; - private $a31; - private $a32; - private $a33; - - private function __construct( - $a11, $a21, $a31, - $a12, $a22, $a32, - $a13, $a23, $a33 - ) { - $this->a11 = $a11; - $this->a12 = $a12; - $this->a13 = $a13; - $this->a21 = $a21; - $this->a22 = $a22; - $this->a23 = $a23; - $this->a31 = $a31; - $this->a32 = $a32; - $this->a33 = $a33; - } - - public static function quadrilateralToQuadrilateral( - $x0, $y0, - $x1, $y1, - $x2, $y2, - $x3, $y3, - $x0p, $y0p, - $x1p, $y1p, - $x2p, $y2p, - $x3p, $y3p - ) { - - $qToS = self::quadrilateralToSquare($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3); - $sToQ = self::squareToQuadrilateral($x0p, $y0p, $x1p, $y1p, $x2p, $y2p, $x3p, $y3p); - - return $sToQ->times($qToS); - } - - public static function quadrilateralToSquare( - $x0, $y0, - $x1, $y1, - $x2, $y2, - $x3, $y3 - ) { -// Here, the adjoint serves as the inverse: - return self::squareToQuadrilateral($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3)->buildAdjoint(); - } - - public function buildAdjoint() - { -// Adjoint is the transpose of the cofactor matrix: - return new PerspectiveTransform($this->a22 * $this->a33 - $this->a23 * $this->a32, - $this->a23 * $this->a31 - $this->a21 * $this->a33, - $this->a21 * $this->a32 - $this->a22 * $this->a31, - $this->a13 * $this->a32 - $this->a12 * $this->a33, - $this->a11 * $this->a33 - $this->a13 * $this->a31, - $this->a12 * $this->a31 - $this->a11 * $this->a32, - $this->a12 * $this->a23 - $this->a13 * $this->a22, - $this->a13 * $this->a21 - $this->a11 * $this->a23, - $this->a11 * $this->a22 - $this->a12 * $this->a21); - } - - public static function squareToQuadrilateral( - $x0, $y0, - $x1, $y1, - $x2, $y2, - $x3, $y3 - ) { - $dx3 = $x0 - $x1 + $x2 - $x3; - $dy3 = $y0 - $y1 + $y2 - $y3; - if ($dx3 == 0.0 && $dy3 == 0.0) { -// Affine - return new PerspectiveTransform($x1 - $x0, $x2 - $x1, $x0, - $y1 - $y0, $y2 - $y1, $y0, - 0.0, 0.0, 1.0); - } else { - $dx1 = $x1 - $x2; - $dx2 = $x3 - $x2; - $dy1 = $y1 - $y2; - $dy2 = $y3 - $y2; - $denominator = $dx1 * $dy2 - $dx2 * $dy1; - $a13 = ($dx3 * $dy2 - $dx2 * $dy3) / $denominator; - $a23 = ($dx1 * $dy3 - $dx3 * $dy1) / $denominator; - - return new PerspectiveTransform($x1 - $x0 + $a13 * $x1, $x3 - $x0 + $a23 * $x3, $x0, - $y1 - $y0 + $a13 * $y1, $y3 - $y0 + $a23 * $y3, $y0, - $a13, $a23, 1.0); - } - } - - public function times($other) - { - return new PerspectiveTransform($this->a11 * $other->a11 + $this->a21 * $other->a12 + $this->a31 * $other->a13, - $this->a11 * $other->a21 + $this->a21 * $other->a22 + $this->a31 * $other->a23, - $this->a11 * $other->a31 + $this->a21 * $other->a32 + $this->a31 * $other->a33, - $this->a12 * $other->a11 + $this->a22 * $other->a12 + $this->a32 * $other->a13, - $this->a12 * $other->a21 + $this->a22 * $other->a22 + $this->a32 * $other->a23, - $this->a12 * $other->a31 + $this->a22 * $other->a32 + $this->a32 * $other->a33, - $this->a13 * $other->a11 + $this->a23 * $other->a12 + $this->a33 * $other->a13, - $this->a13 * $other->a21 + $this->a23 * $other->a22 + $this->a33 * $other->a23, - $this->a13 * $other->a31 + $this->a23 * $other->a32 + $this->a33 * $other->a33); - - } - - public function transformPoints(&$points, &$yValues = 0) - { - if ($yValues) { - $this->transformPoints_($points, $yValues); - - return; - } - $max = count($points); - $a11 = $this->a11; - $a12 = $this->a12; - $a13 = $this->a13; - $a21 = $this->a21; - $a22 = $this->a22; - $a23 = $this->a23; - $a31 = $this->a31; - $a32 = $this->a32; - $a33 = $this->a33; - for ($i = 0; $i < $max; $i += 2) { - $x = $points[$i]; - $y = $points[$i + 1]; - $denominator = $a13 * $x + $a23 * $y + $a33; - $points[$i] = ($a11 * $x + $a21 * $y + $a31) / $denominator; - $points[$i + 1] = ($a12 * $x + $a22 * $y + $a32) / $denominator; - } - } - - public function transformPoints_(&$xValues, &$yValues) - { - $n = count($xValues); - for ($i = 0; $i < $n; $i++) { - $x = $xValues[$i]; - $y = $yValues[$i]; - $denominator = $this->a13 * $x + $this->a23 * $y + $this->a33; - $xValues[$i] = ($this->a11 * $x + $this->a21 * $y + $this->a31) / $denominator; - $yValues[$i] = ($this->a12 * $x + $this->a22 * $y + $this->a32) / $denominator; - } - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGF.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGF.php deleted file mode 100644 index 49d7b61b..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGF.php +++ /dev/null @@ -1,198 +0,0 @@ -This class contains utility methods for performing mathematical operations over - * the Galois Fields. Operations use a given primitive polynomial in calculations. - * - *Throughout this package, elements of the GF are represented as an {@code int} - * for convenience and speed (but at the cost of memory). - *
- * - * @author Sean Owen - * @author David Olivier - */ -final class GenericGF -{ - - public static $AZTEC_DATA_12; - public static $AZTEC_DATA_10; - public static $AZTEC_DATA_6; - public static $AZTEC_PARAM; - public static $QR_CODE_FIELD_256; - public static $DATA_MATRIX_FIELD_256; - public static $AZTEC_DATA_8; - public static $MAXICODE_FIELD_64; - - private $expTable; - private $logTable; - private $zero; - private $one; - private $size; - private $primitive; - private $generatorBase; - - /** - * Create a representation of GF(size) using the given primitive polynomial. - * - * @param primitive irreducible polynomial whose coefficients are represented by - * the bits of an int, where the least-significant bit represents the constant - * coefficient - * @param size the size of the field - * @param b the factor b in the generator polynomial can be 0- or 1-based - * (g(x) = (x+a^b)(x+a^(b+1))...(x+a^(b+2t-1))). - * In most cases it should be 1, but for QR code it is 0. - */ - public function __construct($primitive, $size, $b) - { - $this->primitive = $primitive; - $this->size = $size; - $this->generatorBase = $b; - - $this->expTable = []; - $this->logTable = []; - $x = 1; - for ($i = 0; $i < $size; $i++) { - $this->expTable[$i] = $x; - $x *= 2; // we're assuming the generator alpha is 2 - if ($x >= $size) { - $x ^= $primitive; - $x &= $size - 1; - } - } - for ($i = 0; $i < $size - 1; $i++) { - $this->logTable[$this->expTable[$i]] = $i; - } - // logTable[0] == 0 but this should never be used - $this->zero = new GenericGFPoly($this, [0]); - $this->one = new GenericGFPoly($this, [1]); - } - - public static function Init() - { - self::$AZTEC_DATA_12 = new GenericGF(0x1069, 4096, 1); // x^12 + x^6 + x^5 + x^3 + 1 - self::$AZTEC_DATA_10 = new GenericGF(0x409, 1024, 1); // x^10 + x^3 + 1 - self::$AZTEC_DATA_6 = new GenericGF(0x43, 64, 1); // x^6 + x + 1 - self::$AZTEC_PARAM = new GenericGF(0x13, 16, 1); // x^4 + x + 1 - self::$QR_CODE_FIELD_256 = new GenericGF(0x011D, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1 - self::$DATA_MATRIX_FIELD_256 = new GenericGF(0x012D, 256, 1); // x^8 + x^5 + x^3 + x^2 + 1 - self::$AZTEC_DATA_8 = self::$DATA_MATRIX_FIELD_256; - self::$MAXICODE_FIELD_64 = self::$AZTEC_DATA_6; - } - - /** - * Implements both addition and subtraction -- they are the same in GF(size). - * - * @return sum/difference of a and b - */ - public static function addOrSubtract($a, $b) - { - return $a ^ $b; - } - - public function getZero() - { - return $this->zero; - } - - public function getOne() - { - return $this->one; - } - - /** - * @return the monomial representing coefficient * x^degree - */ - public function buildMonomial($degree, $coefficient) - { - if ($degree < 0) { - throw new \InvalidArgumentException(); - } - if ($coefficient == 0) { - return $this->zero; - } - $coefficients = fill_array(0, $degree + 1, 0);//new int[degree + 1]; - $coefficients[0] = $coefficient; - - return new GenericGFPoly($this, $coefficients); - } - - /** - * @return 2 to the power of a in GF(size) - */ - public function exp($a) - { - return $this->expTable[$a]; - } - - /** - * @return base 2 log of a in GF(size) - */ - public function log($a) - { - if ($a == 0) { - throw new \InvalidArgumentException(); - } - - return $this->logTable[$a]; - } - - /** - * @return multiplicative inverse of a - */ - public function inverse($a) - { - if ($a == 0) { - throw new \Exception(); - } - - return $this->expTable[$this->size - $this->logTable[$a] - 1]; - } - - /** - * @return int product of a and b in GF(size) - */ - public function multiply($a, $b) - { - if ($a == 0 || $b == 0) { - return 0; - } - - return $this->expTable[($this->logTable[$a] + $this->logTable[$b]) % ($this->size - 1)]; - } - - public function getSize() - { - return $this->size; - } - - public function getGeneratorBase() - { - return $this->generatorBase; - } - - // @Override - public function toString() - { - return "GF(0x" . dechex((int)($this->primitive)) . ',' . $this->size . ')'; - } - -} - -GenericGF::Init(); diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGFPoly.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGFPoly.php deleted file mode 100644 index 024af208..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGFPoly.php +++ /dev/null @@ -1,289 +0,0 @@ -Represents a polynomial whose coefficients are elements of a GF. - * Instances of this class are immutable. - * - *Much credit is due to William Rucklidge since portions of this code are an indirect - * port of his C++ Reed-Solomon implementation.
- * - * @author Sean Owen - */ -final class GenericGFPoly -{ - - private $field; - private $coefficients; - - /** - * @param field the {@link GenericGF} instance representing the field to use - * to perform computations - * @param coefficients array coefficients as ints representing elements of GF(size), arranged - * from most significant (highest-power term) coefficient to least significant - * - * @throws IllegalArgumentException if argument is null or empty, - * or if leading coefficient is 0 and this is not a - * constant polynomial (that is, it is not the monomial "0") - */ - public function __construct($field, $coefficients) - { - if (count($coefficients) == 0) { - throw new \InvalidArgumentException(); - } - $this->field = $field; - $coefficientsLength = count($coefficients); - if ($coefficientsLength > 1 && $coefficients[0] == 0) { - // Leading term must be non-zero for anything except the constant polynomial "0" - $firstNonZero = 1; - while ($firstNonZero < $coefficientsLength && $coefficients[$firstNonZero] == 0) { - $firstNonZero++; - } - if ($firstNonZero == $coefficientsLength) { - $this->coefficients = [0]; - } else { - $this->coefficients = fill_array(0, $coefficientsLength - $firstNonZero, 0); - $this->coefficients = arraycopy($coefficients, - $firstNonZero, - $this->coefficients, - 0, - count($this->coefficients)); - } - } else { - $this->coefficients = $coefficients; - } - } - - public function getCoefficients() - { - return $this->coefficients; - } - - /** - * @return evaluation of this polynomial at a given point - */ - public function evaluateAt($a) - { - if ($a == 0) { - // Just return the x^0 coefficient - return $this->getCoefficient(0); - } - $size = count($this->coefficients); - if ($a == 1) { - // Just the sum of the coefficients - $result = 0; - foreach ($this->coefficients as $coefficient) { - $result = GenericGF::addOrSubtract($result, $coefficient); - } - - return $result; - } - $result = $this->coefficients[0]; - for ($i = 1; $i < $size; $i++) { - $result = GenericGF::addOrSubtract($this->field->multiply($a, $result), $this->coefficients[$i]); - } - - return $result; - } - - /** - * @return coefficient of x^degree term in this polynomial - */ - public function getCoefficient($degree) - { - return $this->coefficients[count($this->coefficients) - 1 - $degree]; - } - - public function multiply($other) - { - if (is_int($other)) { - return $this->multiply_($other); - } - if ($this->field !== $other->field) { - throw new \InvalidArgumentException("GenericGFPolys do not have same GenericGF field"); - } - if ($this->isZero() || $other->isZero()) { - return $this->field->getZero(); - } - $aCoefficients = $this->coefficients; - $aLength = count($aCoefficients); - $bCoefficients = $other->coefficients; - $bLength = count($bCoefficients); - $product = fill_array(0, $aLength + $bLength - 1, 0); - for ($i = 0; $i < $aLength; $i++) { - $aCoeff = $aCoefficients[$i]; - for ($j = 0; $j < $bLength; $j++) { - $product[$i + $j] = GenericGF::addOrSubtract($product[$i + $j], - $this->field->multiply($aCoeff, $bCoefficients[$j])); - } - } - - return new GenericGFPoly($this->field, $product); - } - - public function multiply_($scalar) - { - if ($scalar == 0) { - return $this->field->getZero(); - } - if ($scalar == 1) { - return $this; - } - $size = count($this->coefficients); - $product = fill_array(0, $size, 0); - for ($i = 0; $i < $size; $i++) { - $product[$i] = $this->field->multiply($this->coefficients[$i], $scalar); - } - - return new GenericGFPoly($this->field, $product); - } - - /** - * @return true iff this polynomial is the monomial "0" - */ - public function isZero() - { - return $this->coefficients[0] == 0; - } - - public function multiplyByMonomial($degree, $coefficient) - { - if ($degree < 0) { - throw new \InvalidArgumentException(); - } - if ($coefficient == 0) { - return $this->field->getZero(); - } - $size = count($this->coefficients); - $product = fill_array(0, $size + $degree, 0); - for ($i = 0; $i < $size; $i++) { - $product[$i] = $this->field->multiply($this->coefficients[$i], $coefficient); - } - - return new GenericGFPoly($this->field, $product); - } - - public function divide($other) - { - if ($this->field !== $other->field) { - throw new \InvalidArgumentException("GenericGFPolys do not have same GenericGF field"); - } - if ($other->isZero()) { - throw new \InvalidArgumentException("Divide by 0"); - } - - $quotient = $this->field->getZero(); - $remainder = $this; - - $denominatorLeadingTerm = $other->getCoefficient($other->getDegree()); - $inverseDenominatorLeadingTerm = $this->field->inverse($denominatorLeadingTerm); - - while ($remainder->getDegree() >= $other->getDegree() && !$remainder->isZero()) { - $degreeDifference = $remainder->getDegree() - $other->getDegree(); - $scale = $this->field->multiply($remainder->getCoefficient($remainder->getDegree()), $inverseDenominatorLeadingTerm); - $term = $other->multiplyByMonomial($degreeDifference, $scale); - $iterationQuotient = $this->field->buildMonomial($degreeDifference, $scale); - $quotient = $quotient->addOrSubtract($iterationQuotient); - $remainder = $remainder->addOrSubtract($term); - } - - return [$quotient, $remainder]; - } - - /** - * @return degree of this polynomial - */ - public function getDegree() - { - return count($this->coefficients) - 1; - } - - public function addOrSubtract($other) - { - if ($this->field !== $other->field) { - throw new \InvalidArgumentException("GenericGFPolys do not have same GenericGF field"); - } - if ($this->isZero()) { - return $other; - } - if ($other->isZero()) { - return $this; - } - - $smallerCoefficients = $this->coefficients; - $largerCoefficients = $other->coefficients; - if (count($smallerCoefficients) > count($largerCoefficients)) { - $temp = $smallerCoefficients; - $smallerCoefficients = $largerCoefficients; - $largerCoefficients = $temp; - } - $sumDiff = fill_array(0, count($largerCoefficients), 0); - $lengthDiff = count($largerCoefficients) - count($smallerCoefficients); - // Copy high-order terms only found in higher-degree polynomial's coefficients - $sumDiff = arraycopy($largerCoefficients, 0, $sumDiff, 0, $lengthDiff); - - $countLargerCoefficients = count($largerCoefficients); - for ($i = $lengthDiff; $i < $countLargerCoefficients; $i++) { - $sumDiff[$i] = GenericGF::addOrSubtract($smallerCoefficients[$i - $lengthDiff], $largerCoefficients[$i]); - } - - return new GenericGFPoly($this->field, $sumDiff); - } - - //@Override - - public function toString() - { - $result = ''; - for ($degree = $this->getDegree(); $degree >= 0; $degree--) { - $coefficient = $this->getCoefficient($degree); - if ($coefficient != 0) { - if ($coefficient < 0) { - $result .= " - "; - $coefficient = -$coefficient; - } else { - if (strlen($result) > 0) { - $result .= " + "; - } - } - if ($degree == 0 || $coefficient != 1) { - $alphaPower = $this->field->log($coefficient); - if ($alphaPower == 0) { - $result .= '1'; - } else if ($alphaPower == 1) { - $result .= 'a'; - } else { - $result .= "a^"; - $result .= ($alphaPower); - } - } - if ($degree != 0) { - if ($degree == 1) { - $result .= 'x'; - } else { - $result .= "x^"; - $result .= $degree; - } - } - } - } - - return $result; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonDecoder.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonDecoder.php deleted file mode 100644 index f9a3e70a..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonDecoder.php +++ /dev/null @@ -1,201 +0,0 @@ -Implements Reed-Solomon decoding, as the name implies. - * - *The algorithm will not be explained here, but the following references were helpful - * in creating this implementation:
- * - *Much credit is due to William Rucklidge since portions of this code are an indirect - * port of his C++ Reed-Solomon implementation.
- * - * @author Sean Owen - * @author William Rucklidge - * @author sanfordsquires - */ -final class ReedSolomonDecoder -{ - - private $field; - - public function __construct($field) - { - $this->field = $field; - } - - /** - *Decodes given set of received codewords, which include both data and error-correction - * codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place, - * in the input.
- * - * @param received data and error-correction codewords - * @param twoS number of error-correction codewords available - * - * @throws ReedSolomonException if decoding fails for any reason - */ - public function decode(&$received, $twoS) - { - $poly = new GenericGFPoly($this->field, $received); - $syndromeCoefficients = fill_array(0, $twoS, 0); - $noError = true; - for ($i = 0; $i < $twoS; $i++) { - $eval = $poly->evaluateAt($this->field->exp($i + $this->field->getGeneratorBase())); - $syndromeCoefficients[count($syndromeCoefficients) - 1 - $i] = $eval; - if ($eval != 0) { - $noError = false; - } - } - if ($noError) { - return; - } - $syndrome = new GenericGFPoly($this->field, $syndromeCoefficients); - $sigmaOmega = - $this->runEuclideanAlgorithm($this->field->buildMonomial($twoS, 1), $syndrome, $twoS); - $sigma = $sigmaOmega[0]; - $omega = $sigmaOmega[1]; - $errorLocations = $this->findErrorLocations($sigma); - $errorMagnitudes = $this->findErrorMagnitudes($omega, $errorLocations); - $errorLocationsCount = count($errorLocations); - for ($i = 0; $i < $errorLocationsCount; $i++) { - $position = count($received) - 1 - $this->field->log($errorLocations[$i]); - if ($position < 0) { - throw new ReedSolomonException("Bad error location"); - } - $received[$position] = GenericGF::addOrSubtract($received[$position], $errorMagnitudes[$i]); - } - - } - - private function runEuclideanAlgorithm($a, $b, $R) - { - // Assume a's degree is >= b's - if ($a->getDegree() < $b->getDegree()) { - $temp = $a; - $a = $b; - $b = $temp; - } - - $rLast = $a; - $r = $b; - $tLast = $this->field->getZero(); - $t = $this->field->getOne(); - - // Run Euclidean algorithm until r's degree is less than R/2 - while ($r->getDegree() >= $R / 2) { - $rLastLast = $rLast; - $tLastLast = $tLast; - $rLast = $r; - $tLast = $t; - - // Divide rLastLast by rLast, with quotient in q and remainder in r - if ($rLast->isZero()) { - // Oops, Euclidean algorithm already terminated? - throw new ReedSolomonException("r_{i-1} was zero"); - } - $r = $rLastLast; - $q = $this->field->getZero(); - $denominatorLeadingTerm = $rLast->getCoefficient($rLast->getDegree()); - $dltInverse = $this->field->inverse($denominatorLeadingTerm); - while ($r->getDegree() >= $rLast->getDegree() && !$r->isZero()) { - $degreeDiff = $r->getDegree() - $rLast->getDegree(); - $scale = $this->field->multiply($r->getCoefficient($r->getDegree()), $dltInverse); - $q = $q->addOrSubtract($this->field->buildMonomial($degreeDiff, $scale)); - $r = $r->addOrSubtract($rLast->multiplyByMonomial($degreeDiff, $scale)); - } - - $t = $q->multiply($tLast)->addOrSubtract($tLastLast); - - if ($r->getDegree() >= $rLast->getDegree()) { - throw new IllegalStateException("Division algorithm failed to reduce polynomial?"); - } - } - - $sigmaTildeAtZero = $t->getCoefficient(0); - if ($sigmaTildeAtZero == 0) { - throw new ReedSolomonException("sigmaTilde(0) was zero"); - } - - $inverse = $this->field->inverse($sigmaTildeAtZero); - $sigma = $t->multiply($inverse); - $omega = $r->multiply($inverse); - - return [$sigma, $omega]; - } - - private function findErrorLocations($errorLocator) - { - // This is a direct application of Chien's search - $numErrors = $errorLocator->getDegree(); - if ($numErrors == 1) { // shortcut - return [$errorLocator->getCoefficient(1)]; - } - $result = fill_array(0, $numErrors, 0); - $e = 0; - for ($i = 1; $i < $this->field->getSize() && $e < $numErrors; $i++) { - if ($errorLocator->evaluateAt($i) == 0) { - $result[$e] = $this->field->inverse($i); - $e++; - } - } - if ($e != $numErrors) { - throw new ReedSolomonException("Error locator degree does not match number of roots"); - } - - return $result; - } - - private function findErrorMagnitudes($errorEvaluator, $errorLocations) - { - // This is directly applying Forney's Formula - $s = count($errorLocations); - $result = fill_array(0, $s, 0); - for ($i = 0; $i < $s; $i++) { - $xiInverse = $this->field->inverse($errorLocations[$i]); - $denominator = 1; - for ($j = 0; $j < $s; $j++) { - if ($i != $j) { - //denominator = field.multiply(denominator, - // GenericGF.addOrSubtract(1, field.multiply(errorLocations[j], xiInverse))); - // Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug. - // Below is a funny-looking workaround from Steven Parkes - $term = $this->field->multiply($errorLocations[$j], $xiInverse); - $termPlus1 = ($term & 0x1) == 0 ? $term | 1 : $term & ~1; - $denominator = $this->field->multiply($denominator, $termPlus1); - } - } - $result[$i] = $this->field->multiply($errorEvaluator->evaluateAt($xiInverse), - $this->field->inverse($denominator)); - if ($this->field->getGeneratorBase() != 0) { - $result[$i] = $this->field->multiply($result[$i], $xiInverse); - } - } - - return $result; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonException.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonException.php deleted file mode 100644 index cd7babd7..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonException.php +++ /dev/null @@ -1,28 +0,0 @@ -Thrown when an exception occurs during Reed-Solomon decoding, such as when - * there are too many errors to correct. - * - * @author Sean Owen - */ -final class ReedSolomonException extends \Exception -{ -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php deleted file mode 100644 index c336f57c..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php +++ /dev/null @@ -1,101 +0,0 @@ ->= 1; - $num++; - } - - return $num; - } -} - -if (!function_exists('uRShift')) { - function uRShift($a, $b) - { - static $mask = (8 * PHP_INT_SIZE - 1); - if ($b === 0) { - return $a; - } - - return ($a >> $b) & ~(1 << $mask >> ($b - 1)); - } -} - -/* -function sdvig3($num,$count=1){//>>> 32 bit - $s = decbin($num); - - $sarray = str_split($s,1); - $sarray = array_slice($sarray,-32);//32bit - - for($i=0;$i<=1;$i++) { - array_pop($sarray); - array_unshift($sarray, '0'); - } - return bindec(implode($sarray)); -} -*/ - -if (!function_exists('sdvig3')) { - function sdvig3($a, $b) - { - if ($a >= 0) { - return bindec(decbin($a >> $b)); //simply right shift for positive number - } - - $bin = decbin($a >> $b); - - $bin = substr($bin, $b); // zero fill on the left side - - return bindec($bin); - } -} - -if (!function_exists('floatToIntBits')) { - function floatToIntBits($float_val) - { - $int = unpack('i', pack('f', $float_val)); - - return $int[1]; - } -} - - -if (!function_exists('fill_array')) { - function fill_array($index, $count, $value) - { - if ($count <= 0) { - return [0]; - } - - return array_fill($index, $count, $value); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/FormatException.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/FormatException.php deleted file mode 100644 index 64de6509..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/FormatException.php +++ /dev/null @@ -1,49 +0,0 @@ -GDLuminanceSource($gdImage, $dataWidth, $dataHeight); - - return; - } - parent::__construct($width, $height); - if ($left + $width > $dataWidth || $top + $height > $dataHeight) { - throw new \InvalidArgumentException("Crop rectangle does not fit within image data."); - } - $this->luminances = $gdImage; - $this->dataWidth = $dataWidth; - $this->dataHeight = $dataHeight; - $this->left = $left; - $this->top = $top; - } - - public function GDLuminanceSource($gdImage, $width, $height) - { - parent::__construct($width, $height); - - $this->dataWidth = $width; - $this->dataHeight = $height; - $this->left = 0; - $this->top = 0; - $this->$gdImage = $gdImage; - - -// In order to measure pure decoding speed, we convert the entire image to a greyscale array -// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app. - $this->luminances = []; - //$this->luminances = $this->grayScaleToBitmap($this->grayscale()); - - $array = []; - $rgb = []; - - for ($j = 0; $j < $height; $j++) { - for ($i = 0; $i < $width; $i++) { - $argb = imagecolorat($this->$gdImage, $i, $j); - $pixel = imagecolorsforindex($this->$gdImage, $argb); - $r = $pixel['red']; - $g = $pixel['green']; - $b = $pixel['blue']; - if ($r == $g && $g == $b) { -// Image is already greyscale, so pick any channel. - - $this->luminances[] = $r;//(($r + 128) % 256) - 128; - } else { -// Calculate luminance cheaply, favoring green. - $this->luminances[] = ($r + 2 * $g + $b) / 4;//(((($r + 2 * $g + $b) / 4) + 128) % 256) - 128; - } - } - } - - /* - for ($y = 0; $y < $height; $y++) { - $offset = $y * $width; - for ($x = 0; $x < $width; $x++) { - $pixel = $pixels[$offset + $x]; - $r = ($pixel >> 16) & 0xff; - $g = ($pixel >> 8) & 0xff; - $b = $pixel & 0xff; - if ($r == $g && $g == $b) { -// Image is already greyscale, so pick any channel. - - $this->luminances[(int)($offset + $x)] = (($r+128) % 256) - 128; - } else { -// Calculate luminance cheaply, favoring green. - $this->luminances[(int)($offset + $x)] = (((($r + 2 * $g + $b) / 4)+128)%256) - 128; - } - - - - } - */ - //} - // $this->luminances = $this->grayScaleToBitmap($this->luminances); - } - -//@Override - public function getRow($y, $row = null) - { - if ($y < 0 || $y >= $this->getHeight()) { - throw new \InvalidArgumentException('Requested row is outside the image: ' . $y); - } - $width = $this->getWidth(); - if ($row == null || count($row) < $width) { - $row = []; - } - $offset = ($y + $this->top) * $this->dataWidth + $this->left; - $row = arraycopy($this->luminances, $offset, $row, 0, $width); - - return $row; - } - -//@Override - public function getMatrix() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - -// If the caller asks for the entire underlying image, save the copy and give them the -// original data. The docs specifically warn that result.length must be ignored. - if ($width == $this->dataWidth && $height == $this->dataHeight) { - return $this->luminances; - } - - $area = $width * $height; - $matrix = []; - $inputOffset = $this->top * $this->dataWidth + $this->left; - -// If the width matches the full width of the underlying data, perform a single copy. - if ($width == $this->dataWidth) { - $matrix = arraycopy($this->luminances, $inputOffset, $matrix, 0, $area); - - return $matrix; - } - -// Otherwise copy one cropped row at a time. - $rgb = $this->luminances; - for ($y = 0; $y < $height; $y++) { - $outputOffset = $y * $width; - $matrix = arraycopy($rgb, $inputOffset, $matrix, $outputOffset, $width); - $inputOffset += $this->dataWidth; - } - - return $matrix; - } - -//@Override - public function isCropSupported() - { - return true; - } - -//@Override - public function crop($left, $top, $width, $height) - { - return new GDLuminanceSource($this->luminances, - $this->dataWidth, - $this->dataHeight, - $this->left + $left, - $this->top + $top, - $width, - $height); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/IMagickLuminanceSource.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/IMagickLuminanceSource.php deleted file mode 100644 index aac6d541..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/IMagickLuminanceSource.php +++ /dev/null @@ -1,150 +0,0 @@ -_IMagickLuminanceSource($image, $dataWidth, $dataHeight); - - return; - } - parent::__construct($width, $height); - if ($left + $width > $dataWidth || $top + $height > $dataHeight) { - throw new \InvalidArgumentException("Crop rectangle does not fit within image data."); - } - $this->luminances = $image; - $this->dataWidth = $dataWidth; - $this->dataHeight = $dataHeight; - $this->left = $left; - $this->top = $top; - } - - public function _IMagickLuminanceSource(\Imagick $image, $width, $height) - { - parent::__construct($width, $height); - - $this->dataWidth = $width; - $this->dataHeight = $height; - $this->left = 0; - $this->top = 0; - $this->image = $image; - - -// In order to measure pure decoding speed, we convert the entire image to a greyscale array -// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app. - $this->luminances = []; - - $image->setImageColorspace(\Imagick::COLORSPACE_GRAY); - // $image->newPseudoImage(0, 0, "magick:rose"); - $pixels = $image->exportImagePixels(1, 1, $width, $height, "RGB", \Imagick::PIXEL_CHAR); - - $array = []; - $rgb = []; - - $countPixels = count($pixels); - for ($i = 0; $i < $countPixels; $i += 3) { - $r = $pixels[$i] & 0xff; - $g = $pixels[$i + 1] & 0xff; - $b = $pixels[$i + 2] & 0xff; - if ($r == $g && $g == $b) { -// Image is already greyscale, so pick any channel. - - $this->luminances[] = $r;//(($r + 128) % 256) - 128; - } else { -// Calculate luminance cheaply, favoring green. - $this->luminances[] = ($r + 2 * $g + $b) / 4;//(((($r + 2 * $g + $b) / 4) + 128) % 256) - 128; - } - } - } - -//@Override - public function getRow($y, $row = null) - { - if ($y < 0 || $y >= $this->getHeight()) { - throw new \InvalidArgumentException('Requested row is outside the image: ' . $y); - } - $width = $this->getWidth(); - if ($row == null || count($row) < $width) { - $row = []; - } - $offset = ($y + $this->top) * $this->dataWidth + $this->left; - $row = arraycopy($this->luminances, $offset, $row, 0, $width); - - return $row; - } - -//@Override - public function getMatrix() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - -// If the caller asks for the entire underlying image, save the copy and give them the -// original data. The docs specifically warn that result.length must be ignored. - if ($width == $this->dataWidth && $height == $this->dataHeight) { - return $this->luminances; - } - - $area = $width * $height; - $matrix = []; - $inputOffset = $this->top * $this->dataWidth + $this->left; - -// If the width matches the full width of the underlying data, perform a single copy. - if ($width == $this->dataWidth) { - $matrix = arraycopy($this->luminances, $inputOffset, $matrix, 0, $area); - - return $matrix; - } - -// Otherwise copy one cropped row at a time. - $rgb = $this->luminances; - for ($y = 0; $y < $height; $y++) { - $outputOffset = $y * $width; - $matrix = arraycopy($rgb, $inputOffset, $matrix, $outputOffset, $width); - $inputOffset += $this->dataWidth; - } - - return $matrix; - } - -//@Override - public function isCropSupported() - { - return true; - } - -//@Override - public function crop($left, $top, $width, $height) - { - return $this->luminances->cropImage($width, $height, $left, $top); - - return new GDLuminanceSource($this->luminances, - $this->dataWidth, - $this->dataHeight, - $this->left + $left, - $this->top + $top, - $width, - $height); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/LuminanceSource.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/LuminanceSource.php deleted file mode 100644 index ab971cfd..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/LuminanceSource.php +++ /dev/null @@ -1,171 +0,0 @@ -width = $width; - $this->height = $height; - } - - /** - * Fetches luminance data for the underlying bitmap. Values should be fetched using: - * {@code int luminance = array[y * width + x] & 0xff} - * - * @return A row-major 2D array of luminance values. Do not use result.length as it may be - * larger than width * height bytes on some platforms. Do not modify the contents - * of the result. - */ - public abstract function getMatrix(); - - /** - * @return The width of the bitmap. - */ - public final function getWidth() - { - return $this->width; - } - - /** - * @return The height of the bitmap. - */ - public final function getHeight() - { - return $this->height; - } - - /** - * @return bool Whether this subclass supports cropping. - */ - public function isCropSupported() - { - return false; - } - - /** - * Returns a new object with cropped image data. Implementations may keep a reference to the - * original data rather than a copy. Only callable if isCropSupported() is true. - * - * @param left The left coordinate, which must be in [0,getWidth()) - * @param top The top coordinate, which must be in [0,getHeight()) - * @param width The width of the rectangle to crop. - * @param height The height of the rectangle to crop. - * - * @return A cropped version of this object. - */ - public function crop($left, $top, $width, $height) - { - throw new \Exception("This luminance source does not support cropping."); - } - - /** - * @return Whether this subclass supports counter-clockwise rotation. - */ - public function isRotateSupported() - { - return false; - } - - /** - * @return a wrapper of this {@code LuminanceSource} which inverts the luminances it returns -- black becomes - * white and vice versa, and each value becomes (255-value). - */ - public function invert() - { - return new InvertedLuminanceSource($this); - } - - /** - * Returns a new object with rotated image data by 90 degrees counterclockwise. - * Only callable if {@link #isRotateSupported()} is true. - * - * @return A rotated version of this object. - */ - public function rotateCounterClockwise() - { - throw new \Exception("This luminance source does not support rotation by 90 degrees."); - } - - /** - * Returns a new object with rotated image data by 45 degrees counterclockwise. - * Only callable if {@link #isRotateSupported()} is true. - * - * @return A rotated version of this object. - */ - public function rotateCounterClockwise45() - { - throw new \Exception("This luminance source does not support rotation by 45 degrees."); - } - - public final function toString() - { - $row = []; - $result = ''; - for ($y = 0; $y < $this->height; $y++) { - $row = $this->getRow($y, $row); - for ($x = 0; $x < $this->width; $x++) { - $luminance = $row[$x] & 0xFF; - $c = ''; - if ($luminance < 0x40) { - $c = '#'; - } else if ($luminance < 0x80) { - $c = '+'; - } else if ($luminance < 0xC0) { - $c = '.'; - } else { - $c = ' '; - } - $result .= ($c); - } - $result .= ('\n'); - } - - return $result; - } - - /** - * Fetches one row of luminance data from the underlying platform's bitmap. Values range from - * 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have - * to bitwise and with 0xff for each value. It is preferable for implementations of this method - * to only fetch this row rather than the whole image, since no 2D Readers may be installed and - * getMatrix() may never be called. - * - * @param $y ; The row to fetch, which must be in [0,getHeight()) - * @param $row ; An optional preallocated array. If null or too small, it will be ignored. - * Always use the returned object, and ignore the .length of the array. - * - * @return array - * An array containing the luminance data. - */ - public abstract function getRow($y, $row); -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/NotFoundException.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/NotFoundException.php deleted file mode 100644 index 0b3c4237..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/NotFoundException.php +++ /dev/null @@ -1,38 +0,0 @@ - $dataWidth || $top + $height > $dataHeight) { - throw new \InvalidArgumentException("Crop rectangle does not fit within image data."); - } - - $this->yuvData = $yuvData; - $this->dataWidth = $dataWidth; - $this->dataHeight = $dataHeight; - $this->left = $left; - $this->top = $top; - if ($reverseHorizontal) { - $this->reverseHorizontal($width, $height); - } - } - - //@Override - public function getRow($y, $row = null) - { - if ($y < 0 || $y >= getHeight()) { - throw new \InvalidArgumentException("Requested row is outside the image: " + y); - } - $width = $this->getWidth(); - if ($row == null || count($row) < $width) { - $row = [];//new byte[width]; - } - $offset = ($y + $this->top) * $this->dataWidth + $this->left; - $row = arraycopy($this->yuvData, $offset, $row, 0, $width); - - return $row; - } - - //@Override - public function getMatrix() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - - // If the caller asks for the entire underlying image, save the copy and give them the - // original data. The docs specifically warn that result.length must be ignored. - if ($width == $this->dataWidth && $height == $this->dataHeight) { - return $this->yuvData; - } - - $area = $width * $height; - $matrix = [];//new byte[area]; - $inputOffset = $this->top * $this->dataWidth + $this->left; - - // If the width matches the full width of the underlying data, perform a single copy. - if ($width == $this->dataWidth) { - $matrix = arraycopy($this->yuvData, $inputOffset, $matrix, 0, $area); - - return $matrix; - } - - // Otherwise copy one cropped row at a time. - $yuv = $this->yuvData; - for ($y = 0; $y < $height; $y++) { - $outputOffset = $y * $width; - $matrix = arraycopy($this->yuvData, $inputOffset, $matrix, $outputOffset, $width); - $inputOffset += $this->dataWidth; - } - - return $matrix; - } - - // @Override - public function isCropSupported() - { - return true; - } - - // @Override - public function crop($left, $top, $width, $height) - { - return new PlanarYUVLuminanceSource($this->yuvData, - $this->dataWidth, - $this->dataHeight, - $this->left + $left, - $this->top + $top, - $width, - $height, - false); - } - - public function renderThumbnail() - { - $width = (int)($this->getWidth() / self::$THUMBNAIL_SCALE_FACTOR); - $height = (int)($this->getHeight() / self::$THUMBNAIL_SCALE_FACTOR); - $pixels = [];//new int[width * height]; - $yuv = $this->yuvData; - $inputOffset = $this->top * $this->dataWidth + $this->left; - - for ($y = 0; $y < $height; $y++) { - $outputOffset = $y * $width; - for ($x = 0; $x < $width; $x++) { - $grey = ($yuv[$inputOffset + $x * self::$THUMBNAIL_SCALE_FACTOR] & 0xff); - $pixels[$outputOffset + $x] = (0xFF000000 | ($grey * 0x00010101)); - } - $inputOffset += $this->dataWidth * self::$THUMBNAIL_SCALE_FACTOR; - } - - return $pixels; - } - - /** - * @return width of image from {@link #renderThumbnail()} - */ - /* - public int getThumbnailWidth() { - return getWidth() / THUMBNAIL_SCALE_FACTOR; - }*/ - - /** - * @return height of image from {@link #renderThumbnail()} - */ - /* - public int getThumbnailHeight() { - return getHeight() / THUMBNAIL_SCALE_FACTOR; - } - - private void reverseHorizontal(int width, int height) { - byte[] yuvData = this.yuvData; - for (int y = 0, rowStart = top * dataWidth + left; y < height; y++, rowStart += dataWidth) { - int middle = rowStart + width / 2; - for (int x1 = rowStart, x2 = rowStart + width - 1; x1 < middle; x1++, x2--) { - byte temp = yuvData[x1]; - yuvData[x1] = yuvData[x2]; - yuvData[x2] = temp; - } - } - } -*/ -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php deleted file mode 100644 index 200f9105..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php +++ /dev/null @@ -1,105 +0,0 @@ -readImage($imgSource); - } else { - $image = file_get_contents($imgSource); - $im = imagecreatefromstring($image); - } - break; - - case QrReader::SOURCE_TYPE_BLOB: - if ($useImagickIfAvailable && extension_loaded('imagick')) { - $im = new \Imagick(); - $im->readImageBlob($imgSource); - } else { - $im = imagecreatefromstring($imgSource); - } - break; - - case QrReader::SOURCE_TYPE_RESOURCE: - $im = $imgSource; - if ($useImagickIfAvailable && extension_loaded('imagick')) { - $useImagickIfAvailable = true; - } else { - $useImagickIfAvailable = false; - } - break; - } - if ($useImagickIfAvailable && extension_loaded('imagick')) { - if (!$im instanceof \Imagick) { - throw new \InvalidArgumentException('Invalid image source.'); - } - $width = $im->getImageWidth(); - $height = $im->getImageHeight(); - $source = new IMagickLuminanceSource($im, $width, $height); - } else { - if (!is_resource($im)) { - throw new \InvalidArgumentException('Invalid image source.'); - } - $width = imagesx($im); - $height = imagesy($im); - $source = new GDLuminanceSource($im, $width, $height); - } - $histo = new HybridBinarizer($source); - $this->bitmap = new BinaryBitmap($histo); - $this->reader = new QRCodeReader(); - } - - public function decode() - { - try { - $this->result = $this->reader->decode($this->bitmap); - } catch (NotFoundException $er) { - $this->result = false; - } catch (FormatException $er) { - $this->result = false; - } catch (ChecksumException $er) { - $this->result = false; - } - } - - public function text() - { - $this->decode(); - - if (method_exists($this->result, 'toString')) { - return $this->result->toString(); - } - - return $this->result; - } - - public function getResult() - { - return $this->result; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/BitMatrixParser.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/BitMatrixParser.php deleted file mode 100644 index 80607209..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/BitMatrixParser.php +++ /dev/null @@ -1,263 +0,0 @@ -= 21 and 1 mod 4 - */ - public function __construct($bitMatrix) - { - $dimension = $bitMatrix->getHeight(); - if ($dimension < 21 || ($dimension & 0x03) != 1) { - throw FormatException::getFormatInstance(); - } - $this->bitMatrix = $bitMatrix; - } - - /** - *Reads the bits in the {@link BitMatrix} representing the finder pattern in the - * correct order in order to reconstruct the codewords bytes contained within the - * QR Code.
- * - * @return bytes encoded within the QR Code - * @throws FormatException if the exact number of bytes expected is not read - */ - public function readCodewords() - { - - $formatInfo = $this->readFormatInformation(); - $version = $this->readVersion(); - - // Get the data mask for the format used in this QR Code. This will exclude - // some bits from reading as we wind through the bit matrix. - $dataMask = DataMask::forReference($formatInfo->getDataMask()); - $dimension = $this->bitMatrix->getHeight(); - $dataMask->unmaskBitMatrix($this->bitMatrix, $dimension); - - $functionPattern = $version->buildFunctionPattern(); - - $readingUp = true; - if ($version->getTotalCodewords()) { - $result = fill_array(0, $version->getTotalCodewords(), 0); - } else { - $result = []; - } - $resultOffset = 0; - $currentByte = 0; - $bitsRead = 0; - // Read columns in pairs, from right to left - for ($j = $dimension - 1; $j > 0; $j -= 2) { - if ($j == 6) { - // Skip whole column with vertical alignment pattern; - // saves time and makes the other code proceed more cleanly - $j--; - } - // Read alternatingly from bottom to top then top to bottom - for ($count = 0; $count < $dimension; $count++) { - $i = $readingUp ? $dimension - 1 - $count : $count; - for ($col = 0; $col < 2; $col++) { - // Ignore bits covered by the function pattern - if (!$functionPattern->get($j - $col, $i)) { - // Read a bit - $bitsRead++; - $currentByte <<= 1; - if ($this->bitMatrix->get($j - $col, $i)) { - $currentByte |= 1; - } - // If we've made a whole byte, save it off - if ($bitsRead == 8) { - $result[$resultOffset++] = $currentByte; //(byte) - $bitsRead = 0; - $currentByte = 0; - } - } - } - } - $readingUp ^= true; // readingUp = !readingUp; // switch directions - } - if ($resultOffset != $version->getTotalCodewords()) { - throw FormatException::getFormatInstance(); - } - - return $result; - } - - /** - *Reads format information from one of its two locations within the QR Code.
- * - * @return {@link FormatInformation} encapsulating the QR Code's format info - * @throws FormatException if both format information locations cannot be parsed as - * the valid encoding of format information - */ - public function readFormatInformation() - { - - if ($this->parsedFormatInfo != null) { - return $this->parsedFormatInfo; - } - - // Read top-left format info bits - $formatInfoBits1 = 0; - for ($i = 0; $i < 6; $i++) { - $formatInfoBits1 = $this->copyBit($i, 8, $formatInfoBits1); - } - // .. and skip a bit in the timing pattern ... - $formatInfoBits1 = $this->copyBit(7, 8, $formatInfoBits1); - $formatInfoBits1 = $this->copyBit(8, 8, $formatInfoBits1); - $formatInfoBits1 = $this->copyBit(8, 7, $formatInfoBits1); - // .. and skip a bit in the timing pattern ... - for ($j = 5; $j >= 0; $j--) { - $formatInfoBits1 = $this->copyBit(8, $j, $formatInfoBits1); - } - - // Read the top-right/bottom-left pattern too - $dimension = $this->bitMatrix->getHeight(); - $formatInfoBits2 = 0; - $jMin = $dimension - 7; - for ($j = $dimension - 1; $j >= $jMin; $j--) { - $formatInfoBits2 = $this->copyBit(8, $j, $formatInfoBits2); - } - for ($i = $dimension - 8; $i < $dimension; $i++) { - $formatInfoBits2 = $this->copyBit($i, 8, $formatInfoBits2); - } - - $parsedFormatInfo = FormatInformation::decodeFormatInformation($formatInfoBits1, $formatInfoBits2); - if ($parsedFormatInfo != null) { - return $parsedFormatInfo; - } - throw FormatException::getFormatInstance(); - } - - private function copyBit($i, $j, $versionBits) - { - $bit = $this->mirror ? $this->bitMatrix->get($j, $i) : $this->bitMatrix->get($i, $j); - - return $bit ? ($versionBits << 1) | 0x1 : $versionBits << 1; - } - - /** - *Reads version information from one of its two locations within the QR Code.
- * - * @return {@link Version} encapsulating the QR Code's version - * @throws FormatException if both version information locations cannot be parsed as - * the valid encoding of version information - */ - public function readVersion() - { - - if ($this->parsedVersion != null) { - return $this->parsedVersion; - } - - $dimension = $this->bitMatrix->getHeight(); - - $provisionalVersion = ($dimension - 17) / 4; - if ($provisionalVersion <= 6) { - return Version::getVersionForNumber($provisionalVersion); - } - - // Read top-right version info: 3 wide by 6 tall - $versionBits = 0; - $ijMin = $dimension - 11; - for ($j = 5; $j >= 0; $j--) { - for ($i = $dimension - 9; $i >= $ijMin; $i--) { - $versionBits = $this->copyBit($i, $j, $versionBits); - } - } - - $theParsedVersion = Version::decodeVersionInformation($versionBits); - if ($theParsedVersion != null && $theParsedVersion->getDimensionForVersion() == $dimension) { - $this->parsedVersion = $theParsedVersion; - - return $theParsedVersion; - } - - // Hmm, failed. Try bottom left: 6 wide by 3 tall - $versionBits = 0; - for ($i = 5; $i >= 0; $i--) { - for ($j = $dimension - 9; $j >= $ijMin; $j--) { - $versionBits = $this->copyBit($i, $j, $versionBits); - } - } - - $theParsedVersion = Version::decodeVersionInformation($versionBits); - if ($theParsedVersion != null && $theParsedVersion->getDimensionForVersion() == $dimension) { - $this->parsedVersion = $theParsedVersion; - - return $theParsedVersion; - } - throw FormatException::getFormatInstance(); - } - - /** - * Revert the mask removal done while reading the code words. The bit matrix should revert to its original state. - */ - public function remask() - { - if ($this->parsedFormatInfo == null) { - return; // We have no format information, and have no data mask - } - $dataMask = DataMask::forReference($this->parsedFormatInfo->getDataMask()); - $dimension = $this->bitMatrix->getHeight(); - $dataMask->unmaskBitMatrix($this->bitMatrix, $dimension); - } - - /** - * Prepare the parser for a mirrored operation. - * This flag has effect only on the {@link #readFormatInformation()} and the - * {@link #readVersion()}. Before proceeding with {@link #readCodewords()} the - * {@link #mirror()} method should be called. - * - * @param mirror Whether to read version and format information mirrored. - */ - public function setMirror($mirror) - { - $parsedVersion = null; - $parsedFormatInfo = null; - $this->mirror = $mirror; - } - - /** Mirror the bit matrix in order to attempt a second reading. */ - public function mirror() - { - for ($x = 0; $x < $this->bitMatrix->getWidth(); $x++) { - for ($y = $x + 1; $y < $this->bitMatrix->getHeight(); $y++) { - if ($this->bitMatrix->get($x, $y) != $this->bitMatrix->get($y, $x)) { - $this->bitMatrix->flip($y, $x); - $this->bitMatrix->flip($x, $y); - } - } - } - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataBlock.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataBlock.php deleted file mode 100644 index c845247e..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataBlock.php +++ /dev/null @@ -1,129 +0,0 @@ -Encapsulates a block of data within a QR Code. QR Codes may split their data into - * multiple blocks, each of which is a unit of data and error-correction codewords. Each - * is represented by an instance of this class. - * - * @author Sean Owen - */ -final class DataBlock -{ - private $numDataCodewords; - private $codewords; //byte[] - - private function __construct($numDataCodewords, $codewords) - { - $this->numDataCodewords = $numDataCodewords; - $this->codewords = $codewords; - } - - /** - *When QR Codes use multiple data blocks, they are actually interleaved. - * That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This - * method will separate the data into original blocks.
- * - * @param rawCodewords bytes as read directly from the QR Code - * @param version version of the QR Code - * @param ecLevel error-correction level of the QR Code - * - * @return array DataBlocks containing original bytes, "de-interleaved" from representation in the - * QR Code - */ - public static function getDataBlocks($rawCodewords, - $version, - $ecLevel) - { - - if (count($rawCodewords) != $version->getTotalCodewords()) { - throw new \InvalidArgumentException(); - } - - // Figure out the number and size of data blocks used by this version and - // error correction level - $ecBlocks = $version->getECBlocksForLevel($ecLevel); - - // First count the total number of data blocks - $totalBlocks = 0; - $ecBlockArray = $ecBlocks->getECBlocks(); - foreach ($ecBlockArray as $ecBlock) { - $totalBlocks += $ecBlock->getCount(); - } - - // Now establish DataBlocks of the appropriate size and number of data codewords - $result = [];//new DataBlock[$totalBlocks]; - $numResultBlocks = 0; - foreach ($ecBlockArray as $ecBlock) { - $ecBlockCount = $ecBlock->getCount(); - for ($i = 0; $i < $ecBlockCount; $i++) { - $numDataCodewords = $ecBlock->getDataCodewords(); - $numBlockCodewords = $ecBlocks->getECCodewordsPerBlock() + $numDataCodewords; - $result[$numResultBlocks++] = new DataBlock($numDataCodewords, fill_array(0, $numBlockCodewords, 0)); - } - } - - // All blocks have the same amount of data, except that the last n - // (where n may be 0) have 1 more byte. Figure out where these start. - $shorterBlocksTotalCodewords = count($result[0]->codewords); - $longerBlocksStartAt = count($result) - 1; - while ($longerBlocksStartAt >= 0) { - $numCodewords = count($result[$longerBlocksStartAt]->codewords); - if ($numCodewords == $shorterBlocksTotalCodewords) { - break; - } - $longerBlocksStartAt--; - } - $longerBlocksStartAt++; - - $shorterBlocksNumDataCodewords = $shorterBlocksTotalCodewords - $ecBlocks->getECCodewordsPerBlock(); - // The last elements of result may be 1 element longer; - // first fill out as many elements as all of them have - $rawCodewordsOffset = 0; - for ($i = 0; $i < $shorterBlocksNumDataCodewords; $i++) { - for ($j = 0; $j < $numResultBlocks; $j++) { - $result[$j]->codewords[$i] = $rawCodewords[$rawCodewordsOffset++]; - } - } - // Fill out the last data block in the longer ones - for ($j = $longerBlocksStartAt; $j < $numResultBlocks; $j++) { - $result[$j]->codewords[$shorterBlocksNumDataCodewords] = $rawCodewords[$rawCodewordsOffset++]; - } - // Now add in error correction blocks - $max = count($result[0]->codewords); - for ($i = $shorterBlocksNumDataCodewords; $i < $max; $i++) { - for ($j = 0; $j < $numResultBlocks; $j++) { - $iOffset = $j < $longerBlocksStartAt ? $i : $i + 1; - $result[$j]->codewords[$iOffset] = $rawCodewords[$rawCodewordsOffset++]; - } - } - - return $result; - } - - public function getNumDataCodewords() - { - return $this->numDataCodewords; - } - - public function getCodewords() - { - return $this->codewords; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataMask.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataMask.php deleted file mode 100644 index 5fa2098e..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataMask.php +++ /dev/null @@ -1,196 +0,0 @@ -Encapsulates data masks for the data bits in a QR code, per ISO 18004:2006 6.8. Implementations - * of this class can un-mask a raw BitMatrix. For simplicity, they will unmask the entire BitMatrix, - * including areas used for finder patterns, timing patterns, etc. These areas should be unused - * after the point they are unmasked anyway. - * - *Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position - * and j is row position. In fact, as the text says, i is row position and j is column position.
- * - * @author Sean Owen - */ -abstract class DataMask -{ - - /** - * See ISO 18004:2006 6.8.1 - */ - private static $DATA_MASKS = []; - - public function __construct() - { - - } - - public static function Init() - { - self::$DATA_MASKS = [ - new DataMask000(), - new DataMask001(), - new DataMask010(), - new DataMask011(), - new DataMask100(), - new DataMask101(), - new DataMask110(), - new DataMask111(), - ]; - } - - /** - * @param reference a value between 0 and 7 indicating one of the eight possible - * data mask patterns a QR Code may use - * - * @return DataMask encapsulating the data mask pattern - */ - public static function forReference($reference) - { - if ($reference < 0 || $reference > 7) { - throw new \InvalidArgumentException(); - } - - return self::$DATA_MASKS[$reference]; - } - - /** - *Implementations of this method reverse the data masking process applied to a QR Code and - * make its bits ready to read.
- * - * @param bits representation of QR Code bits - * @param dimension dimension of QR Code, represented by bits, being unmasked - */ - final public function unmaskBitMatrix($bits, $dimension) - { - for ($i = 0; $i < $dimension; $i++) { - for ($j = 0; $j < $dimension; $j++) { - if ($this->isMasked($i, $j)) { - $bits->flip($j, $i); - } - } - } - } - - abstract public function isMasked($i, $j); -} - -DataMask::Init(); - -/** - * 000: mask bits for which (x + y) mod 2 == 0 - */ -final class DataMask000 extends DataMask -{ - // @Override - public function isMasked($i, $j) - { - return (($i + $j) & 0x01) == 0; - } -} - -/** - * 001: mask bits for which x mod 2 == 0 - */ -final class DataMask001 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - return ($i & 0x01) == 0; - } -} - -/** - * 010: mask bits for which y mod 3 == 0 - */ -final class DataMask010 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - return $j % 3 == 0; - } -} - -/** - * 011: mask bits for which (x + y) mod 3 == 0 - */ -final class DataMask011 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - return ($i + $j) % 3 == 0; - } -} - -/** - * 100: mask bits for which (x/2 + y/3) mod 2 == 0 - */ -final class DataMask100 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - return (int)(((int)($i / 2) + (int)($j / 3)) & 0x01) == 0; - } -} - -/** - * 101: mask bits for which xy mod 2 + xy mod 3 == 0 - */ -final class DataMask101 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - $temp = $i * $j; - - return ($temp & 0x01) + ($temp % 3) == 0; - } -} - -/** - * 110: mask bits for which (xy mod 2 + xy mod 3) mod 2 == 0 - */ -final class DataMask110 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - $temp = $i * $j; - - return ((($temp & 0x01) + ($temp % 3)) & 0x01) == 0; - } -} - -/** - * 111: mask bits for which ((x+y)mod 2 + xy mod 3) mod 2 == 0 - */ -final class DataMask111 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - return (((($i + $j) & 0x01) + (($i * $j) % 3)) & 0x01) == 0; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DecodedBitStreamParser.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DecodedBitStreamParser.php deleted file mode 100644 index 75e59420..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DecodedBitStreamParser.php +++ /dev/null @@ -1,355 +0,0 @@ -QR Codes can encode text as bits in one of several modes, and can use multiple modes - * in one QR Code. This class decodes the bits back into text. - * - *See ISO 18004:2006, 6.4.3 - 6.4.7
- * - * @author Sean Owen - */ -final class DecodedBitStreamParser -{ - - /** - * See ISO 18004:2006, 6.4.4 Table 5 - */ - private static $ALPHANUMERIC_CHARS = [ - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', - 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', - 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - ' ', '$', '%', '*', '+', '-', '.', '/', ':', - ]; - private static $GB2312_SUBSET = 1; - - public static function decode($bytes, - $version, - $ecLevel, - $hints) - { - $bits = new BitSource($bytes); - $result = '';//new StringBuilder(50); - $byteSegments = []; - $symbolSequence = -1; - $parityData = -1; - - try { - $currentCharacterSetECI = null; - $fc1InEffect = false; - $mode = ''; - do { - // While still another segment to read... - if ($bits->available() < 4) { - // OK, assume we're done. Really, a TERMINATOR mode should have been recorded here - $mode = Mode::$TERMINATOR; - } else { - $mode = Mode::forBits($bits->readBits(4)); // mode is encoded by 4 bits - } - if ($mode != Mode::$TERMINATOR) { - if ($mode == Mode::$FNC1_FIRST_POSITION || $mode == Mode::$FNC1_SECOND_POSITION) { - // We do little with FNC1 except alter the parsed result a bit according to the spec - $fc1InEffect = true; - } else if ($mode == Mode::$STRUCTURED_APPEND) { - if ($bits->available() < 16) { - throw FormatException::getFormatInstance(); - } - // sequence number and parity is added later to the result metadata - // Read next 8 bits (symbol sequence #) and 8 bits (parity data), then continue - $symbolSequence = $bits->readBits(8); - $parityData = $bits->readBits(8); - } else if ($mode == Mode::$ECI) { - // Count doesn't apply to ECI - $value = self::parseECIValue($bits); - $currentCharacterSetECI = CharacterSetECI::getCharacterSetECIByValue($value); - if ($currentCharacterSetECI == null) { - throw FormatException::getFormatInstance(); - } - } else { - // First handle Hanzi mode which does not start with character count - if ($mode == Mode::$HANZI) { - //chinese mode contains a sub set indicator right after mode indicator - $subset = $bits->readBits(4); - $countHanzi = $bits->readBits($mode->getCharacterCountBits($version)); - if ($subset == self::$GB2312_SUBSET) { - self::decodeHanziSegment($bits, $result, $countHanzi); - } - } else { - // "Normal" QR code modes: - // How many characters will follow, encoded in this mode? - $count = $bits->readBits($mode->getCharacterCountBits($version)); - if ($mode == Mode::$NUMERIC) { - self::decodeNumericSegment($bits, $result, $count); - } else if ($mode == Mode::$ALPHANUMERIC) { - self::decodeAlphanumericSegment($bits, $result, $count, $fc1InEffect); - } else if ($mode == Mode::$BYTE) { - self::decodeByteSegment($bits, $result, $count, $currentCharacterSetECI, $byteSegments, $hints); - } else if ($mode == Mode::$KANJI) { - self::decodeKanjiSegment($bits, $result, $count); - } else { - throw FormatException::getFormatInstance(); - } - } - } - } - } while ($mode != Mode::$TERMINATOR); - } catch (\InvalidArgumentException $iae) { - // from readBits() calls - throw FormatException::getFormatInstance(); - } - - return new DecoderResult($bytes, - $result, - empty($byteSegments) ? null : $byteSegments, - $ecLevel == null ? null : 'L',//ErrorCorrectionLevel::toString($ecLevel), - $symbolSequence, - $parityData); - } - - private static function parseECIValue($bits) - { - $firstByte = $bits->readBits(8); - if (($firstByte & 0x80) == 0) { - // just one byte - return $firstByte & 0x7F; - } - if (($firstByte & 0xC0) == 0x80) { - // two bytes - $secondByte = $bits->readBits(8); - - return (($firstByte & 0x3F) << 8) | $secondByte; - } - if (($firstByte & 0xE0) == 0xC0) { - // three bytes - $secondThirdBytes = $bits->readBits(16); - - return (($firstByte & 0x1F) << 16) | $secondThirdBytes; - } - throw FormatException::getFormatInstance(); - } - - /** - * See specification GBT 18284-2000 - */ - private static function decodeHanziSegment($bits, - &$result, - $count) - { - // Don't crash trying to read more bits than we have available. - if ($count * 13 > $bits->available()) { - throw FormatException::getFormatInstance(); - } - - // Each character will require 2 bytes. Read the characters as 2-byte pairs - // and decode as GB2312 afterwards - $buffer = fill_array(0, 2 * $count, 0); - $offset = 0; - while ($count > 0) { - // Each 13 bits encodes a 2-byte character - $twoBytes = $bits->readBits(13); - $assembledTwoBytes = (($twoBytes / 0x060) << 8) | ($twoBytes % 0x060); - if ($assembledTwoBytes < 0x003BF) { - // In the 0xA1A1 to 0xAAFE range - $assembledTwoBytes += 0x0A1A1; - } else { - // In the 0xB0A1 to 0xFAFE range - $assembledTwoBytes += 0x0A6A1; - } - $buffer[$offset] = (($assembledTwoBytes >> 8) & 0xFF);//(byte) - $buffer[$offset + 1] = ($assembledTwoBytes & 0xFF);//(byte) - $offset += 2; - $count--; - } - $result .= iconv('GB2312', 'UTF-8', implode($buffer)); - } - - private static function decodeNumericSegment($bits, - &$result, - $count) - { - // Read three digits at a time - while ($count >= 3) { - // Each 10 bits encodes three digits - if ($bits->available() < 10) { - throw FormatException::getFormatInstance(); - } - $threeDigitsBits = $bits->readBits(10); - if ($threeDigitsBits >= 1000) { - throw FormatException::getFormatInstance(); - } - $result .= (self::toAlphaNumericChar($threeDigitsBits / 100)); - $result .= (self::toAlphaNumericChar(($threeDigitsBits / 10) % 10)); - $result .= (self::toAlphaNumericChar($threeDigitsBits % 10)); - $count -= 3; - } - if ($count == 2) { - // Two digits left over to read, encoded in 7 bits - if ($bits->available() < 7) { - throw FormatException::getFormatInstance(); - } - $twoDigitsBits = $bits->readBits(7); - if ($twoDigitsBits >= 100) { - throw FormatException::getFormatInstance(); - } - $result .= (self::toAlphaNumericChar($twoDigitsBits / 10)); - $result .= (self::toAlphaNumericChar($twoDigitsBits % 10)); - } else if ($count == 1) { - // One digit left over to read - if ($bits->available() < 4) { - throw FormatException::getFormatInstance(); - } - $digitBits = $bits->readBits(4); - if ($digitBits >= 10) { - throw FormatException::getFormatInstance(); - } - $result .= (self::toAlphaNumericChar($digitBits)); - } - } - - private static function toAlphaNumericChar($value) - { - if ($value >= count(self::$ALPHANUMERIC_CHARS)) { - throw FormatException::getFormatInstance(); - } - - return self::$ALPHANUMERIC_CHARS[$value]; - } - - private static function decodeAlphanumericSegment($bits, - &$result, - $count, - $fc1InEffect) - { - // Read two characters at a time - $start = strlen($result); - while ($count > 1) { - if ($bits->available() < 11) { - throw FormatException::getFormatInstance(); - } - $nextTwoCharsBits = $bits->readBits(11); - $result .= (self::toAlphaNumericChar($nextTwoCharsBits / 45)); - $result .= (self::toAlphaNumericChar($nextTwoCharsBits % 45)); - $count -= 2; - } - if ($count == 1) { - // special case: one character left - if ($bits->available() < 6) { - throw FormatException::getFormatInstance(); - } - $result .= self::toAlphaNumericChar($bits->readBits(6)); - } - // See section 6.4.8.1, 6.4.8.2 - if ($fc1InEffect) { - // We need to massage the result a bit if in an FNC1 mode: - for ($i = $start; $i < strlen($result); $i++) { - if ($result{$i} == '%') { - if ($i < strlen($result) - 1 && $result{$i + 1} == '%') { - // %% is rendered as % - $result = substr_replace($result, '', $i + 1, 1);//deleteCharAt(i + 1); - } else { - // In alpha mode, % should be converted to FNC1 separator 0x1D - $result . setCharAt($i, chr(0x1D)); - } - } - } - } - } - - private static function decodeByteSegment($bits, - &$result, - $count, - $currentCharacterSetECI, - &$byteSegments, - $hints) - { - // Don't crash trying to read more bits than we have available. - if (8 * $count > $bits->available()) { - throw FormatException::getFormatInstance(); - } - - $readBytes = fill_array(0, $count, 0); - for ($i = 0; $i < $count; $i++) { - $readBytes[$i] = $bits->readBits(8);//(byte) - } - $text = implode(array_map('chr', $readBytes)); - $encoding = ''; - if ($currentCharacterSetECI == null) { - // The spec isn't clear on this mode; see - // section 6.4.5: t does not say which encoding to assuming - // upon decoding. I have seen ISO-8859-1 used as well as - // Shift_JIS -- without anything like an ECI designator to - // give a hint. - - $encoding = mb_detect_encoding($text, $hints); - } else { - $encoding = $currentCharacterSetECI->name(); - } - // $result.= mb_convert_encoding($text ,$encoding);//(new String(readBytes, encoding)); - $result .= $text;//(new String(readBytes, encoding)); - - $byteSegments = array_merge($byteSegments, $readBytes); - } - - private static function decodeKanjiSegment($bits, - &$result, - $count) - { - // Don't crash trying to read more bits than we have available. - if ($count * 13 > $bits->available()) { - throw FormatException::getFormatInstance(); - } - - // Each character will require 2 bytes. Read the characters as 2-byte pairs - // and decode as Shift_JIS afterwards - $buffer = [0, 2 * $count, 0]; - $offset = 0; - while ($count > 0) { - // Each 13 bits encodes a 2-byte character - $twoBytes = $bits->readBits(13); - $assembledTwoBytes = (($twoBytes / 0x0C0) << 8) | ($twoBytes % 0x0C0); - if ($assembledTwoBytes < 0x01F00) { - // In the 0x8140 to 0x9FFC range - $assembledTwoBytes += 0x08140; - } else { - // In the 0xE040 to 0xEBBF range - $assembledTwoBytes += 0x0C140; - } - $buffer[$offset] = ($assembledTwoBytes >> 8);//(byte) - $buffer[$offset + 1] = $assembledTwoBytes; //(byte) - $offset += 2; - $count--; - } - // Shift_JIS may not be supported in some environments: - - $result .= iconv('shift-jis', 'utf-8', implode($buffer)); - } - - private function DecodedBitStreamParser() - { - - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Decoder.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Decoder.php deleted file mode 100644 index ff181ec8..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Decoder.php +++ /dev/null @@ -1,213 +0,0 @@ -The main class which implements QR Code decoding -- as opposed to locating and extracting - * the QR Code from an image. - * - * @author Sean Owen - */ -final class Decoder -{ - - private $rsDecoder; - - public function __construct() - { - $this->rsDecoder = new ReedSolomonDecoder(GenericGF::$QR_CODE_FIELD_256); - } - - public function decode($variable, $hints = null) - { - if (is_array($variable)) { - return $this->decodeImage($variable, $hints); - } elseif ($variable instanceof BitMatrix) { - return $this->decodeBits($variable, $hints); - } elseif ($variable instanceof BitMatrixParser) { - return $this->decodeParser($variable, $hints); - } - die('decode error Decoder.php'); - } - - /** - *Convenience method that can decode a QR Code represented as a 2D array of booleans. - * "true" is taken to mean a black module.
- * - * @param array $image booleans representing white/black QR Code modules - * @param hints decoding hints that should be used to influence decoding - * - * @return text and bytes encoded within the QR Code - * @throws FormatException if the QR Code cannot be decoded - * @throws ChecksumException if error correction fails - */ - public function decodeImage($image, $hints = null) - { - $dimension = count($image); - $bits = new BitMatrix($dimension); - for ($i = 0; $i < $dimension; $i++) { - for ($j = 0; $j < $dimension; $j++) { - if ($image[$i][$j]) { - $bits->set($j, $i); - } - } - } - - return $this->decode($bits, $hints); - } - - - /** - *Decodes a QR Code represented as a {@link BitMatrix}. A 1 or "true" is taken to mean a black module.
- * - * @param BitMatrix $bits booleans representing white/black QR Code modules - * @param hints decoding hints that should be used to influence decoding - * - * @return text and bytes encoded within the QR Code - * @throws FormatException if the QR Code cannot be decoded - * @throws ChecksumException if error correction fails - */ - public function decodeBits($bits, $hints = null) - { - -// Construct a parser and read version, error-correction level - $parser = new BitMatrixParser($bits); - $fe = null; - $ce = null; - try { - return $this->decode($parser, $hints); - } catch (FormatException $e) { - $fe = $e; - } catch (ChecksumException $e) { - $ce = $e; - } - - try { - - // Revert the bit matrix - $parser->remask(); - - // Will be attempting a mirrored reading of the version and format info. - $parser->setMirror(true); - - // Preemptively read the version. - $parser->readVersion(); - - // Preemptively read the format information. - $parser->readFormatInformation(); - - /* - * Since we're here, this means we have successfully detected some kind - * of version and format information when mirrored. This is a good sign, - * that the QR code may be mirrored, and we should try once more with a - * mirrored content. - */ - // Prepare for a mirrored reading. - $parser->mirror(); - - $result = $this->decode($parser, $hints); - - // Success! Notify the caller that the code was mirrored. - $result->setOther(new QRCodeDecoderMetaData(true)); - - return $result; - - } catch (FormatException $e) {// catch (FormatException | ChecksumException e) { - // Throw the exception from the original reading - if ($fe != null) { - throw $fe; - } - if ($ce != null) { - throw $ce; - } - throw $e; - - } - } - - private function decodeParser($parser, $hints = null) - { - $version = $parser->readVersion(); - $ecLevel = $parser->readFormatInformation()->getErrorCorrectionLevel(); - -// Read codewords - $codewords = $parser->readCodewords(); -// Separate into data blocks - $dataBlocks = DataBlock::getDataBlocks($codewords, $version, $ecLevel); - -// Count total number of data bytes - $totalBytes = 0; - foreach ($dataBlocks as $dataBlock) { - $totalBytes += $dataBlock->getNumDataCodewords(); - } - $resultBytes = fill_array(0, $totalBytes, 0); - $resultOffset = 0; - -// Error-correct and copy data blocks together into a stream of bytes - foreach ($dataBlocks as $dataBlock) { - $codewordBytes = $dataBlock->getCodewords(); - $numDataCodewords = $dataBlock->getNumDataCodewords(); - $this->correctErrors($codewordBytes, $numDataCodewords); - for ($i = 0; $i < $numDataCodewords; $i++) { - $resultBytes[$resultOffset++] = $codewordBytes[$i]; - } - } - -// Decode the contents of that stream of bytes - return DecodedBitStreamParser::decode($resultBytes, $version, $ecLevel, $hints); - } - - /** - *Given data and error-correction codewords received, possibly corrupted by errors, attempts to - * correct the errors in-place using Reed-Solomon error correction.
- * - * @param codewordBytes data and error correction codewords - * @param numDataCodewords number of codewords that are data bytes - * - * @throws ChecksumException if error correction fails - */ - private function correctErrors(&$codewordBytes, $numDataCodewords) - { - $numCodewords = count($codewordBytes); -// First read into an array of ints - $codewordsInts = fill_array(0, $numCodewords, 0); - for ($i = 0; $i < $numCodewords; $i++) { - $codewordsInts[$i] = $codewordBytes[$i] & 0xFF; - } - $numECCodewords = count($codewordBytes) - $numDataCodewords; - try { - $this->rsDecoder->decode($codewordsInts, $numECCodewords); - } catch (ReedSolomonException $ignored) { - throw ChecksumException::getChecksumInstance(); - } -// Copy back into array of bytes -- only need to worry about the bytes that were data -// We don't care about errors in the error-correction codewords - for ($i = 0; $i < $numDataCodewords; $i++) { - $codewordBytes[$i] = $codewordsInts[$i]; - } - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/ErrorCorrectionLevel.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/ErrorCorrectionLevel.php deleted file mode 100644 index 38ae6a66..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/ErrorCorrectionLevel.php +++ /dev/null @@ -1,91 +0,0 @@ -See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels - * defined by the QR code standard. - * - * @author Sean Owen - */ -class ErrorCorrectionLevel -{ - private static $FOR_BITS; - private $bits; - private $ordinal; - - public function __construct($bits, $ordinal = 0) - { - $this->bits = $bits; - $this->ordinal = $ordinal; - } - - public static function Init() - { - self::$FOR_BITS = [ - - - new ErrorCorrectionLevel(0x00, 1), //M - new ErrorCorrectionLevel(0x01, 0), //L - new ErrorCorrectionLevel(0x02, 3), //H - new ErrorCorrectionLevel(0x03, 2), //Q - - ]; - } - /** L = ~7% correction */ - // self::$L = new ErrorCorrectionLevel(0x01); - /** M = ~15% correction */ - //self::$M = new ErrorCorrectionLevel(0x00); - /** Q = ~25% correction */ - //self::$Q = new ErrorCorrectionLevel(0x03); - /** H = ~30% correction */ - //self::$H = new ErrorCorrectionLevel(0x02); - /** - * @param bits int containing the two bits encoding a QR Code's error correction level - * - * @return ErrorCorrectionLevel representing the encoded error correction level - */ - public static function forBits($bits) - { - if ($bits < 0 || $bits >= count(self::$FOR_BITS)) { - throw new \InvalidArgumentException(); - } - $level = self::$FOR_BITS[$bits]; - - // $lev = self::$$bit; - return $level; - } - - - public function getBits() - { - return $this->bits; - } - - public function toString() - { - return $this->bits; - } - - public function getOrdinal() - { - return $this->ordinal; - } -} - -ErrorCorrectionLevel::Init(); diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/FormatInformation.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/FormatInformation.php deleted file mode 100644 index fedcb638..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/FormatInformation.php +++ /dev/null @@ -1,190 +0,0 @@ -Encapsulates a QR Code's format information, including the data mask used and - * error correction level. - * - * @author Sean Owen - * @see DataMask - * @see ErrorCorrectionLevel - */ -final class FormatInformation -{ - public static $FORMAT_INFO_MASK_QR; - - /** - * See ISO 18004:2006, Annex C, Table C.1 - */ - public static $FORMAT_INFO_DECODE_LOOKUP; - /** - * Offset i holds the number of 1 bits in the binary representation of i - */ - private static $BITS_SET_IN_HALF_BYTE; - - private $errorCorrectionLevel; - private $dataMask; - - private function __construct($formatInfo) - { - // Bits 3,4 - $this->errorCorrectionLevel = ErrorCorrectionLevel::forBits(($formatInfo >> 3) & 0x03); - // Bottom 3 bits - $this->dataMask = ($formatInfo & 0x07);//(byte) - } - - public static function Init() - { - self::$FORMAT_INFO_MASK_QR = 0x5412; - self::$BITS_SET_IN_HALF_BYTE = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4]; - self::$FORMAT_INFO_DECODE_LOOKUP = [ - [0x5412, 0x00], - [0x5125, 0x01], - [0x5E7C, 0x02], - [0x5B4B, 0x03], - [0x45F9, 0x04], - [0x40CE, 0x05], - [0x4F97, 0x06], - [0x4AA0, 0x07], - [0x77C4, 0x08], - [0x72F3, 0x09], - [0x7DAA, 0x0A], - [0x789D, 0x0B], - [0x662F, 0x0C], - [0x6318, 0x0D], - [0x6C41, 0x0E], - [0x6976, 0x0F], - [0x1689, 0x10], - [0x13BE, 0x11], - [0x1CE7, 0x12], - [0x19D0, 0x13], - [0x0762, 0x14], - [0x0255, 0x15], - [0x0D0C, 0x16], - [0x083B, 0x17], - [0x355F, 0x18], - [0x3068, 0x19], - [0x3F31, 0x1A], - [0x3A06, 0x1B], - [0x24B4, 0x1C], - [0x2183, 0x1D], - [0x2EDA, 0x1E], - [0x2BED, 0x1F], - ]; - } - - /** - * @param maskedFormatInfo1 ; format info indicator, with mask still applied - * @param maskedFormatInfo2 ; second copy of same info; both are checked at the same time - * to establish best match - * - * @return information about the format it specifies, or {@code null} - * if doesn't seem to match any known pattern - */ - public static function decodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2) - { - $formatInfo = self::doDecodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2); - if ($formatInfo != null) { - return $formatInfo; - } - // Should return null, but, some QR codes apparently - // do not mask this info. Try again by actually masking the pattern - // first - return self::doDecodeFormatInformation($maskedFormatInfo1 ^ self::$FORMAT_INFO_MASK_QR, - $maskedFormatInfo2 ^ self::$FORMAT_INFO_MASK_QR); - } - - private static function doDecodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2) - { - // Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing - $bestDifference = PHP_INT_MAX; - $bestFormatInfo = 0; - foreach (self::$FORMAT_INFO_DECODE_LOOKUP as $decodeInfo) { - $targetInfo = $decodeInfo[0]; - if ($targetInfo == $maskedFormatInfo1 || $targetInfo == $maskedFormatInfo2) { - // Found an exact match - return new FormatInformation($decodeInfo[1]); - } - $bitsDifference = self::numBitsDiffering($maskedFormatInfo1, $targetInfo); - if ($bitsDifference < $bestDifference) { - $bestFormatInfo = $decodeInfo[1]; - $bestDifference = $bitsDifference; - } - if ($maskedFormatInfo1 != $maskedFormatInfo2) { - // also try the other option - $bitsDifference = self::numBitsDiffering($maskedFormatInfo2, $targetInfo); - if ($bitsDifference < $bestDifference) { - $bestFormatInfo = $decodeInfo[1]; - $bestDifference = $bitsDifference; - } - } - } - // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits - // differing means we found a match - if ($bestDifference <= 3) { - return new FormatInformation($bestFormatInfo); - } - - return null; - } - - public static function numBitsDiffering($a, $b) - { - $a ^= $b; // a now has a 1 bit exactly where its bit differs with b's - // Count bits set quickly with a series of lookups: - return self::$BITS_SET_IN_HALF_BYTE[$a & 0x0F] + - self::$BITS_SET_IN_HALF_BYTE[(int)(uRShift($a, 4) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 8) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 12) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 16) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 20) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 24) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 28) & 0x0F)]; - } - - public function getErrorCorrectionLevel() - { - return $this->errorCorrectionLevel; - } - - public function getDataMask() - { - return $this->dataMask; - } - - //@Override - public function hashCode() - { - return ($this->errorCorrectionLevel->ordinal() << 3) | (int)($this->dataMask); - } - - //@Override - public function equals($o) - { - if (!($o instanceof FormatInformation)) { - return false; - } - $other = $o; - - return $this->errorCorrectionLevel == $other->errorCorrectionLevel && - $this->dataMask == $other->dataMask; - } -} - -FormatInformation::Init(); diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Mode.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Mode.php deleted file mode 100644 index 5047279d..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Mode.php +++ /dev/null @@ -1,128 +0,0 @@ -See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which - * data can be encoded to bits in the QR code standard. - * - * @author Sean Owen - */ -class Mode -{ - public static $TERMINATOR; - public static $NUMERIC; - public static $ALPHANUMERIC; - public static $STRUCTURED_APPEND; - public static $BYTE; - public static $ECI; - public static $KANJI; - public static $FNC1_FIRST_POSITION; - public static $FNC1_SECOND_POSITION; - public static $HANZI; - - private $characterCountBitsForVersions; - private $bits; - - public function __construct($characterCountBitsForVersions, $bits) - { - $this->characterCountBitsForVersions = $characterCountBitsForVersions; - $this->bits = $bits; - } - - public static function Init() - { - - - self::$TERMINATOR = new Mode([0, 0, 0], 0x00); // Not really a mode... - self::$NUMERIC = new Mode([10, 12, 14], 0x01); - self::$ALPHANUMERIC = new Mode([9, 11, 13], 0x02); - self::$STRUCTURED_APPEND = new Mode([0, 0, 0], 0x03); // Not supported - self::$BYTE = new Mode([8, 16, 16], 0x04); - self::$ECI = new Mode([0, 0, 0], 0x07); // character counts don't apply - self::$KANJI = new Mode([8, 10, 12], 0x08); - self::$FNC1_FIRST_POSITION = new Mode([0, 0, 0], 0x05); - self::$FNC1_SECOND_POSITION = new Mode([0, 0, 0], 0x09); - /** See GBT 18284-2000; "Hanzi" is a transliteration of this mode name. */ - self::$HANZI = new Mode([8, 10, 12], 0x0D); - } - - /** - * @param bits four bits encoding a QR Code data mode - * - * @return Mode encoded by these bits - * @throws IllegalArgumentException if bits do not correspond to a known mode - */ - public static function forBits($bits) - { - switch ($bits) { - case 0x0: - return self::$TERMINATOR; - case 0x1: - return self::$NUMERIC; - case 0x2: - return self::$ALPHANUMERIC; - case 0x3: - return self::$STRUCTURED_APPEND; - case 0x4: - return self::$BYTE; - case 0x5: - return self::$FNC1_FIRST_POSITION; - case 0x7: - return self::$ECI; - case 0x8: - return self::$KANJI; - case 0x9: - return self::$FNC1_SECOND_POSITION; - case 0xD: - // 0xD is defined in GBT 18284-2000, may not be supported in foreign country - return self::$HANZI; - default: - throw new \InvalidArgumentException(); - } - } - - /** - * @param version version in question - * - * @return number of bits used, in this QR Code symbol {@link Version}, to encode the - * count of characters that will follow encoded in this Mode - */ - public function getCharacterCountBits($version) - { - $number = $version->getVersionNumber(); - $offset = 0; - if ($number <= 9) { - $offset = 0; - } else if ($number <= 26) { - $offset = 1; - } else { - $offset = 2; - } - - return $this->characterCountBitsForVersions[$offset]; - } - - public function getBits() - { - return $this->bits; - } - -} - -Mode::Init(); \ No newline at end of file diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Version.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Version.php deleted file mode 100644 index a3cc03f3..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Version.php +++ /dev/null @@ -1,619 +0,0 @@ -versionNumber = $versionNumber; - $this->alignmentPatternCenters = $alignmentPatternCenters; - $this->ecBlocks = $ecBlocks; - $total = 0; - if(is_array($ecBlocks)) { - $ecCodewords = $ecBlocks[0]->getECCodewordsPerBlock(); - $ecbArray = $ecBlocks[0]->getECBlocks(); - }else{ - $ecCodewords = $ecBlocks->getECCodewordsPerBlock(); - $ecbArray = $ecBlocks->getECBlocks(); - } - foreach ($ecbArray as $ecBlock) { - $total += $ecBlock->getCount() * ($ecBlock->getDataCodewords() + $ecCodewords); - } - $this->totalCodewords = $total; - } - public function getVersionNumber() - { - return $this->versionNumber; - } - - public function getAlignmentPatternCenters() - { - return $this->alignmentPatternCenters; - } - - public function getTotalCodewords() - { - return $this->totalCodewords; - } - - public function getDimensionForVersion() - { - return 17 + 4 * $this->versionNumber; - } - - public function getECBlocksForLevel($ecLevel) - { - return $this->ecBlocks[$ecLevel->getOrdinal()]; - } - - /** - *Deduces version information purely from QR Code dimensions.
- * - * @param dimension dimension in modules - * @return Version for a QR Code of that dimension - * @throws FormatException if dimension is not 1 mod 4 - */ - public static function getProvisionalVersionForDimension($dimension) - { - if ($dimension % 4 != 1) { - throw FormatException::getFormatInstance(); - } - try { - return self::getVersionForNumber(($dimension - 17) / 4); - } catch (InvalidArgumentException $ignored) { - throw FormatException::getFormatInstance(); - } - } - - public static function getVersionForNumber($versionNumber) - { - if ($versionNumber < 1 || $versionNumber > 40) { - throw new \InvalidArgumentException(); - } - if(!self::$VERSIONS){ - - self::$VERSIONS = self::buildVersions(); - - } - return self::$VERSIONS[$versionNumber - 1]; - } - - static function decodeVersionInformation($versionBits) - { - $bestDifference = PHP_INT_MAX; - $bestVersion = 0; - for ($i = 0; $i < count(self::$VERSION_DECODE_INFO); $i++) { - $targetVersion = self::$VERSION_DECODE_INFO[$i]; -// Do the version info bits match exactly? done. - if ($targetVersion == $versionBits) { - return self::getVersionForNumber($i + 7); - } -// Otherwise see if this is the closest to a real version info bit string -// we have seen so far - $bitsDifference = FormatInformation::numBitsDiffering($versionBits, $targetVersion); - if ($bitsDifference < $bestDifference) { - $bestVersion = $i + 7; - $bestDifference = $bitsDifference; - } - } -// We can tolerate up to 3 bits of error since no two version info codewords will -// differ in less than 8 bits. - if ($bestDifference <= 3) { - return self::getVersionForNumber($bestVersion); - } -// If we didn't find a close enough match, fail - return null; - } - - /** - * See ISO 18004:2006 Annex E - */ - function buildFunctionPattern() - { - $dimension = self::getDimensionForVersion(); - $bitMatrix = new BitMatrix($dimension); - -// Top left finder pattern + separator + format - $bitMatrix->setRegion(0, 0, 9, 9); -// Top right finder pattern + separator + format - $bitMatrix->setRegion($dimension - 8, 0, 8, 9); -// Bottom left finder pattern + separator + format - $bitMatrix->setRegion(0, $dimension - 8, 9, 8); - -// Alignment patterns - $max = count($this->alignmentPatternCenters); - for ($x = 0; $x < $max; $x++) { - $i = $this->alignmentPatternCenters[$x] - 2; - for ($y = 0; $y < $max; $y++) { - if (($x == 0 && ($y == 0 || $y == $max - 1)) || ($x == $max - 1 && $y == 0)) { -// No alignment patterns near the three finder paterns - continue; - } - $bitMatrix->setRegion($this->alignmentPatternCenters[$y] - 2, $i, 5, 5); - } - } - -// Vertical timing pattern - $bitMatrix->setRegion(6, 9, 1, $dimension - 17); -// Horizontal timing pattern - $bitMatrix->setRegion(9, 6, $dimension - 17, 1); - - if ($this->versionNumber > 6) { -// Version info, top right - $bitMatrix->setRegion($dimension - 11, 0, 3, 6); -// Version info, bottom left - $bitMatrix->setRegion(0, $dimension - 11, 6, 3); - } - - return $bitMatrix; - } - /** - * See ISO 18004:2006 6.5.1 Table 9 - */ - private static function buildVersions() - { - - - return array( - new Version(1, array(), - array(new ECBlocks(7, array(new ECB(1, 19))), - new ECBlocks(10, array(new ECB(1, 16))), - new ECBlocks(13, array(new ECB(1, 13))), - new ECBlocks(17, array(new ECB(1, 9))))), - new Version(2, array(6, 18), - array(new ECBlocks(10, array(new ECB(1, 34))), - new ECBlocks(16, array(new ECB(1, 28))), - new ECBlocks(22, array(new ECB(1, 22))), - new ECBlocks(28, array(new ECB(1, 16))))), - new Version(3, array(6, 22), - array( new ECBlocks(15, array(new ECB(1, 55))), - new ECBlocks(26, array(new ECB(1, 44))), - new ECBlocks(18, array(new ECB(2, 17))), - new ECBlocks(22, array(new ECB(2, 13))))), - new Version(4, array(6, 26), - array(new ECBlocks(20, array(new ECB(1, 80))), - new ECBlocks(18, array(new ECB(2, 32))), - new ECBlocks(26, array(new ECB(2, 24))), - new ECBlocks(16, array(new ECB(4, 9))))), - new Version(5, array(6, 30), - array(new ECBlocks(26, array(new ECB(1, 108))), - new ECBlocks(24, array(new ECB(2, 43))), - new ECBlocks(18, array(new ECB(2, 15), - new ECB(2, 16))), - new ECBlocks(22, array(new ECB(2, 11), - new ECB(2, 12))))), - new Version(6, array(6, 34), - array(new ECBlocks(18, array(new ECB(2, 68))), - new ECBlocks(16, array(new ECB(4, 27))), - new ECBlocks(24, array(new ECB(4, 19))), - new ECBlocks(28, array(new ECB(4, 15))))), - new Version(7, array(6, 22, 38), - array(new ECBlocks(20, array(new ECB(2, 78))), - new ECBlocks(18, array(new ECB(4, 31))), - new ECBlocks(18, array(new ECB(2, 14), - new ECB(4, 15))), - new ECBlocks(26, array(new ECB(4, 13), - new ECB(1, 14))))), - new Version(8, array(6, 24, 42), - array(new ECBlocks(24, array(new ECB(2, 97))), - new ECBlocks(22, array(new ECB(2, 38), - new ECB(2, 39))), - new ECBlocks(22, array(new ECB(4, 18), - new ECB(2, 19))), - new ECBlocks(26, array(new ECB(4, 14), - new ECB(2, 15))))), - new Version(9, array(6, 26, 46), - array(new ECBlocks(30, array(new ECB(2, 116))), - new ECBlocks(22, array(new ECB(3, 36), - new ECB(2, 37))), - new ECBlocks(20, array(new ECB(4, 16), - new ECB(4, 17))), - new ECBlocks(24, array(new ECB(4, 12), - new ECB(4, 13))))), - new Version(10, array(6, 28, 50), - array(new ECBlocks(18, array(new ECB(2, 68), - new ECB(2, 69))), - new ECBlocks(26, array(new ECB(4, 43), - new ECB(1, 44))), - new ECBlocks(24, array(new ECB(6, 19), - new ECB(2, 20))), - new ECBlocks(28, array(new ECB(6, 15), - new ECB(2, 16))))), - new Version(11, array(6, 30, 54), - array(new ECBlocks(20, array(new ECB(4, 81))), - new ECBlocks(30, array(new ECB(1, 50), - new ECB(4, 51))), - new ECBlocks(28, array(new ECB(4, 22), - new ECB(4, 23))), - new ECBlocks(24, array(new ECB(3, 12), - new ECB(8, 13))))), - new Version(12, array(6, 32, 58), - array(new ECBlocks(24, array(new ECB(2, 92), - new ECB(2, 93))), - new ECBlocks(22, array(new ECB(6, 36), - new ECB(2, 37))), - new ECBlocks(26, array(new ECB(4, 20), - new ECB(6, 21))), - new ECBlocks(28, array(new ECB(7, 14), - new ECB(4, 15))))), - new Version(13, array(6, 34, 62), - array(new ECBlocks(26, array(new ECB(4, 107))), - new ECBlocks(22, array(new ECB(8, 37), - new ECB(1, 38))), - new ECBlocks(24, array(new ECB(8, 20), - new ECB(4, 21))), - new ECBlocks(22, array(new ECB(12, 11), - new ECB(4, 12))))), - new Version(14, array(6, 26, 46, 66), - array(new ECBlocks(30, array(new ECB(3, 115), - new ECB(1, 116))), - new ECBlocks(24, array(new ECB(4, 40), - new ECB(5, 41))), - new ECBlocks(20, array(new ECB(11, 16), - new ECB(5, 17))), - new ECBlocks(24, array(new ECB(11, 12), - new ECB(5, 13))))), - new Version(15, array(6, 26, 48, 70), - array(new ECBlocks(22, array(new ECB(5, 87), - new ECB(1, 88))), - new ECBlocks(24, array(new ECB(5, 41), - new ECB(5, 42))), - new ECBlocks(30, array(new ECB(5, 24), - new ECB(7, 25))), - new ECBlocks(24, array(new ECB(11, 12), - new ECB(7, 13))))), - new Version(16, array(6, 26, 50, 74), - array(new ECBlocks(24, array(new ECB(5, 98), - new ECB(1, 99))), - new ECBlocks(28, array(new ECB(7, 45), - new ECB(3, 46))), - new ECBlocks(24, array(new ECB(15, 19), - new ECB(2, 20))), - new ECBlocks(30, array(new ECB(3, 15), - new ECB(13, 16))))), - new Version(17, array(6, 30, 54, 78), - array(new ECBlocks(28, array(new ECB(1, 107), - new ECB(5, 108))), - new ECBlocks(28, array(new ECB(10, 46), - new ECB(1, 47))), - new ECBlocks(28, array(new ECB(1, 22), - new ECB(15, 23))), - new ECBlocks(28, array(new ECB(2, 14), - new ECB(17, 15))))), - new Version(18, array(6, 30, 56, 82), - array(new ECBlocks(30, array(new ECB(5, 120), - new ECB(1, 121))), - new ECBlocks(26, array(new ECB(9, 43), - new ECB(4, 44))), - new ECBlocks(28, array(new ECB(17, 22), - new ECB(1, 23))), - new ECBlocks(28, array(new ECB(2, 14), - new ECB(19, 15))))), - new Version(19, array(6, 30, 58, 86), - array(new ECBlocks(28, array(new ECB(3, 113), - new ECB(4, 114))), - new ECBlocks(26, array(new ECB(3, 44), - new ECB(11, 45))), - new ECBlocks(26, array(new ECB(17, 21), - new ECB(4, 22))), - new ECBlocks(26, array(new ECB(9, 13), - new ECB(16, 14))))), - new Version(20, array(6, 34, 62, 90), - array(new ECBlocks(28, array(new ECB(3, 107), - new ECB(5, 108))), - new ECBlocks(26, array(new ECB(3, 41), - new ECB(13, 42))), - new ECBlocks(30, array(new ECB(15, 24), - new ECB(5, 25))), - new ECBlocks(28, array(new ECB(15, 15), - new ECB(10, 16))))), - new Version(21, array(6, 28, 50, 72, 94), - array( new ECBlocks(28, array(new ECB(4, 116), - new ECB(4, 117))), - new ECBlocks(26, array(new ECB(17, 42))), - new ECBlocks(28, array(new ECB(17, 22), - new ECB(6, 23))), - new ECBlocks(30, array(new ECB(19, 16), - new ECB(6, 17))))), - new Version(22, array(6, 26, 50, 74, 98), - array(new ECBlocks(28, array(new ECB(2, 111), - new ECB(7, 112))), - new ECBlocks(28, array(new ECB(17, 46))), - new ECBlocks(30, array(new ECB(7, 24), - new ECB(16, 25))), - new ECBlocks(24, array(new ECB(34, 13))))), - new Version(23, array(6, 30, 54, 78, 102), - new ECBlocks(30, array(new ECB(4, 121), - new ECB(5, 122))), - new ECBlocks(28, array(new ECB(4, 47), - new ECB(14, 48))), - new ECBlocks(30, array(new ECB(11, 24), - new ECB(14, 25))), - new ECBlocks(30, array(new ECB(16, 15), - new ECB(14, 16)))), - new Version(24, array(6, 28, 54, 80, 106), - array(new ECBlocks(30, array(new ECB(6, 117), - new ECB(4, 118))), - new ECBlocks(28, array(new ECB(6, 45), - new ECB(14, 46))), - new ECBlocks(30, array(new ECB(11, 24), - new ECB(16, 25))), - new ECBlocks(30, array(new ECB(30, 16), - new ECB(2, 17))))), - new Version(25, array(6, 32, 58, 84, 110), - array(new ECBlocks(26, array(new ECB(8, 106), - new ECB(4, 107))), - new ECBlocks(28, array(new ECB(8, 47), - new ECB(13, 48))), - new ECBlocks(30, array(new ECB(7, 24), - new ECB(22, 25))), - new ECBlocks(30, array(new ECB(22, 15), - new ECB(13, 16))))), - new Version(26, array(6, 30, 58, 86, 114), - array(new ECBlocks(28, array(new ECB(10, 114), - new ECB(2, 115))), - new ECBlocks(28, array(new ECB(19, 46), - new ECB(4, 47))), - new ECBlocks(28, array(new ECB(28, 22), - new ECB(6, 23))), - new ECBlocks(30, array(new ECB(33, 16), - new ECB(4, 17))))), - new Version(27, array(6, 34, 62, 90, 118), - array(new ECBlocks(30, array(new ECB(8, 122), - new ECB(4, 123))), - new ECBlocks(28, array(new ECB(22, 45), - new ECB(3, 46))), - new ECBlocks(30, array(new ECB(8, 23), - new ECB(26, 24))), - new ECBlocks(30, array(new ECB(12, 15), - new ECB(28, 16))))), - new Version(28, array(6, 26, 50, 74, 98, 122), - array(new ECBlocks(30, array(new ECB(3, 117), - new ECB(10, 118))), - new ECBlocks(28, array(new ECB(3, 45), - new ECB(23, 46))), - new ECBlocks(30, array(new ECB(4, 24), - new ECB(31, 25))), - new ECBlocks(30, array(new ECB(11, 15), - new ECB(31, 16))))), - new Version(29, array(6, 30, 54, 78, 102, 126), - array(new ECBlocks(30, array(new ECB(7, 116), - new ECB(7, 117))), - new ECBlocks(28, array(new ECB(21, 45), - new ECB(7, 46))), - new ECBlocks(30, array(new ECB(1, 23), - new ECB(37, 24))), - new ECBlocks(30, array(new ECB(19, 15), - new ECB(26, 16))))), - new Version(30, array(6, 26, 52, 78, 104, 130), - array(new ECBlocks(30, array(new ECB(5, 115), - new ECB(10, 116))), - new ECBlocks(28, array(new ECB(19, 47), - new ECB(10, 48))), - new ECBlocks(30, array(new ECB(15, 24), - new ECB(25, 25))), - new ECBlocks(30, array(new ECB(23, 15), - new ECB(25, 16))))), - new Version(31, array(6, 30, 56, 82, 108, 134), - array(new ECBlocks(30, array(new ECB(13, 115), - new ECB(3, 116))), - new ECBlocks(28, array(new ECB(2, 46), - new ECB(29, 47))), - new ECBlocks(30, array(new ECB(42, 24), - new ECB(1, 25))), - new ECBlocks(30, array(new ECB(23, 15), - new ECB(28, 16))))), - new Version(32, array(6, 34, 60, 86, 112, 138), - array(new ECBlocks(30, array(new ECB(17, 115))), - new ECBlocks(28, array(new ECB(10, 46), - new ECB(23, 47))), - new ECBlocks(30, array(new ECB(10, 24), - new ECB(35, 25))), - new ECBlocks(30, array(new ECB(19, 15), - new ECB(35, 16))))), - new Version(33, array(6, 30, 58, 86, 114, 142), - array(new ECBlocks(30, array(new ECB(17, 115), - new ECB(1, 116))), - new ECBlocks(28, array(new ECB(14, 46), - new ECB(21, 47))), - new ECBlocks(30, array(new ECB(29, 24), - new ECB(19, 25))), - new ECBlocks(30, array(new ECB(11, 15), - new ECB(46, 16))))), - new Version(34, array(6, 34, 62, 90, 118, 146), - array(new ECBlocks(30, array(new ECB(13, 115), - new ECB(6, 116))), - new ECBlocks(28, array(new ECB(14, 46), - new ECB(23, 47))), - new ECBlocks(30, array(new ECB(44, 24), - new ECB(7, 25))), - new ECBlocks(30, array(new ECB(59, 16), - new ECB(1, 17))))), - new Version(35, array(6, 30, 54, 78, 102, 126, 150), - array(new ECBlocks(30, array(new ECB(12, 121), - new ECB(7, 122))), - new ECBlocks(28, array(new ECB(12, 47), - new ECB(26, 48))), - new ECBlocks(30, array(new ECB(39, 24), - new ECB(14, 25))), - new ECBlocks(30, array(new ECB(22, 15), - new ECB(41, 16))))), - new Version(36, array(6, 24, 50, 76, 102, 128, 154), - array(new ECBlocks(30, array(new ECB(6, 121), - new ECB(14, 122))), - new ECBlocks(28, array(new ECB(6, 47), - new ECB(34, 48))), - new ECBlocks(30, array(new ECB(46, 24), - new ECB(10, 25))), - new ECBlocks(30, array(new ECB(2, 15), - new ECB(64, 16))))), - new Version(37, array(6, 28, 54, 80, 106, 132, 158), - array(new ECBlocks(30, array(new ECB(17, 122), - new ECB(4, 123))), - new ECBlocks(28, array(new ECB(29, 46), - new ECB(14, 47))), - new ECBlocks(30, array(new ECB(49, 24), - new ECB(10, 25))), - new ECBlocks(30, array(new ECB(24, 15), - new ECB(46, 16))))), - new Version(38, array(6, 32, 58, 84, 110, 136, 162), - array(new ECBlocks(30, array(new ECB(4, 122), - new ECB(18, 123))), - new ECBlocks(28, array(new ECB(13, 46), - new ECB(32, 47))), - new ECBlocks(30, array(new ECB(48, 24), - new ECB(14, 25))), - new ECBlocks(30, array(new ECB(42, 15), - new ECB(32, 16))))), - new Version(39, array(6, 26, 54, 82, 110, 138, 166), - array(new ECBlocks(30, array(new ECB(20, 117), - new ECB(4, 118))), - new ECBlocks(28, array(new ECB(40, 47), - new ECB(7, 48))), - new ECBlocks(30, array(new ECB(43, 24), - new ECB(22, 25))), - new ECBlocks(30, array(new ECB(10, 15), - new ECB(67, 16))))), - new Version(40, array(6, 30, 58, 86, 114, 142, 170), - array(new ECBlocks(30, array(new ECB(19, 118), - new ECB(6, 119))), - new ECBlocks(28, array(new ECB(18, 47), - new ECB(31, 48))), - new ECBlocks(30, array(new ECB(34, 24), - new ECB(34, 25))), - new ECBlocks(30, array(new ECB(20, 15), - new ECB(61, 16))))) - ); - } -} - -/** - *Encapsulates a set of error-correction blocks in one symbol version. Most versions will - * use blocks of differing sizes within one version, so, this encapsulates the parameters for - * each set of blocks. It also holds the number of error-correction codewords per block since it - * will be the same across all blocks within one version.
- */ -final class ECBlocks -{ - private $ecCodewordsPerBlock; - private $ecBlocks; - - function __construct($ecCodewordsPerBlock, $ecBlocks) - { - $this->ecCodewordsPerBlock = $ecCodewordsPerBlock; - $this->ecBlocks = $ecBlocks; - } - - public function getECCodewordsPerBlock() - { - return $this->ecCodewordsPerBlock; - } - - public function getNumBlocks() - { - $total = 0; - foreach ($this->ecBlocks as $ecBlock) { - $total += $ecBlock->getCount(); - } - return $total; - } - - public function getTotalECCodewords() - { - return $this->ecCodewordsPerBlock * $this->getNumBlocks(); - } - - public function getECBlocks() - { - return $this->ecBlocks; - } -} - -/** - *Encapsualtes the parameters for one error-correction block in one symbol version. - * This includes the number of data codewords, and the number of times a block with these - * parameters is used consecutively in the QR code version's format.
- */ -final class ECB -{ - private $count; - private $dataCodewords; - - function __construct($count, $dataCodewords) - { - $this->count = $count; - $this->dataCodewords = $dataCodewords; - } - - public function getCount() - { - return $this->count; - } - - public function getDataCodewords() - { - return $this->dataCodewords; - } - - -//@Override - public function toString() - { - die('Version ECB toString()'); - // return parent::$versionNumber; - } - - -} - - diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPattern.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPattern.php deleted file mode 100644 index 9c3091ac..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPattern.php +++ /dev/null @@ -1,65 +0,0 @@ -Encapsulates an alignment pattern, which are the smaller square patterns found in - * all but the simplest QR Codes. - * - * @author Sean Owen - */ -final class AlignmentPattern extends ResultPoint -{ - private $estimatedModuleSize; - - public function __construct($posX, $posY, $estimatedModuleSize) - { - parent::__construct($posX, $posY); - $this->estimatedModuleSize = $estimatedModuleSize; - } - - /** - *Determines if this alignment pattern "about equals" an alignment pattern at the stated - * position and size -- meaning, it is at nearly the same center with nearly the same size.
- */ - public function aboutEquals($moduleSize, $i, $j) - { - if (abs($i - $this->getY()) <= $moduleSize && abs($j - $this->getX()) <= $moduleSize) { - $moduleSizeDiff = abs($moduleSize - $this->estimatedModuleSize); - - return $moduleSizeDiff <= 1.0 || $moduleSizeDiff <= $this->estimatedModuleSize; - } - - return false; - } - - /** - * Combines this object's current estimate of a finder pattern position and module size - * with a new estimate. It returns a new {@code FinderPattern} containing an average of the two. - */ - public function combineEstimate($i, $j, $newModuleSize) - { - $combinedX = ($this->getX() + $j) / 2.0; - $combinedY = ($this->getY() + $i) / 2.0; - $combinedModuleSize = ($this->estimatedModuleSize + $newModuleSize) / 2.0; - - return new AlignmentPattern($combinedX, $combinedY, $combinedModuleSize); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPatternFinder.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPatternFinder.php deleted file mode 100644 index 499c6b41..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPatternFinder.php +++ /dev/null @@ -1,286 +0,0 @@ -This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder - * patterns but are smaller and appear at regular intervals throughout the image. - * - *At the moment this only looks for the bottom-right alignment pattern.
- * - *This is mostly a simplified copy of {@link FinderPatternFinder}. It is copied, - * pasted and stripped down here for maximum performance but does unfortunately duplicate - * some code.
- * - *This class is thread-safe but not reentrant. Each thread must allocate its own object.
- * - * @author Sean Owen - */ -final class AlignmentPatternFinder -{ - private $image; - private $possibleCenters; - private $startX; - private $startY; - private $width; - private $height; - private $moduleSize; - private $crossCheckStateCount; - private $resultPointCallback; - - /** - *Creates a finder that will look in a portion of the whole image.
- * - * @param image image to search - * @param startX left column from which to start searching - * @param startY top row from which to start searching - * @param width width of region to search - * @param height height of region to search - * @param moduleSize estimated module size so far - */ - public function __construct($image, - $startX, - $startY, - $width, - $height, - $moduleSize, - $resultPointCallback) - { - $this->image = $image; - $this->possibleCenters = []; - $this->startX = $startX; - $this->startY = $startY; - $this->width = $width; - $this->height = $height; - $this->moduleSize = $moduleSize; - $this->crossCheckStateCount = []; - $this->resultPointCallback = $resultPointCallback; - } - - /** - *This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since - * it's pretty performance-critical and so is written to be fast foremost.
- * - * @return {@link AlignmentPattern} if found - * @throws NotFoundException if not found - */ - public function find() - { - $startX = $this->startX; - $height = $this->height; - $maxJ = $startX + $this->width; - $middleI = $this->startY + ($height / 2); - // We are looking for black/white/black modules in 1:1:1 ratio; - // this tracks the number of black/white/black modules seen so far - $stateCount = []; - for ($iGen = 0; $iGen < $height; $iGen++) { - // Search from middle outwards - $i = $middleI + (($iGen & 0x01) == 0 ? ($iGen + 1) / 2 : -(($iGen + 1) / 2)); - $i = (int)($i); - $stateCount[0] = 0; - $stateCount[1] = 0; - $stateCount[2] = 0; - $j = $startX; - // Burn off leading white pixels before anything else; if we start in the middle of - // a white run, it doesn't make sense to count its length, since we don't know if the - // white run continued to the left of the start point - while ($j < $maxJ && !$this->image->get($j, $i)) { - $j++; - } - $currentState = 0; - while ($j < $maxJ) { - if ($this->image->get($j, $i)) { - // Black pixel - if ($currentState == 1) { // Counting black pixels - $stateCount[$currentState]++; - } else { // Counting white pixels - if ($currentState == 2) { // A winner? - if ($this->foundPatternCross($stateCount)) { // Yes - $confirmed = $this->handlePossibleCenter($stateCount, $i, $j); - if ($confirmed != null) { - return $confirmed; - } - } - $stateCount[0] = $stateCount[2]; - $stateCount[1] = 1; - $stateCount[2] = 0; - $currentState = 1; - } else { - $stateCount[++$currentState]++; - } - } - } else { // White pixel - if ($currentState == 1) { // Counting black pixels - $currentState++; - } - $stateCount[$currentState]++; - } - $j++; - } - if ($this->foundPatternCross($stateCount)) { - $confirmed = $this->handlePossibleCenter($stateCount, $i, $maxJ); - if ($confirmed != null) { - return $confirmed; - } - } - - } - - // Hmm, nothing we saw was observed and confirmed twice. If we had - // any guess at all, return it. - if (count($this->possibleCenters)) { - return $this->possibleCenters[0]; - } - - throw NotFoundException::getNotFoundInstance(); - } - - /** - * @param stateCount count of black/white/black pixels just read - * - * @return true iff the proportions of the counts is close enough to the 1/1/1 ratios - * used by alignment patterns to be considered a match - */ - private function foundPatternCross($stateCount) - { - $moduleSize = $this->moduleSize; - $maxVariance = $moduleSize / 2.0; - for ($i = 0; $i < 3; $i++) { - if (abs($moduleSize - $stateCount[$i]) >= $maxVariance) { - return false; - } - } - - return true; - } - - /** - *This is called when a horizontal scan finds a possible alignment pattern. It will - * cross check with a vertical scan, and if successful, will see if this pattern had been - * found on a previous horizontal scan. If so, we consider it confirmed and conclude we have - * found the alignment pattern.
- * - * @param stateCount reading state module counts from horizontal scan - * @param i row where alignment pattern may be found - * @param j end of possible alignment pattern in row - * - * @return {@link AlignmentPattern} if we have found the same pattern twice, or null if not - */ - private function handlePossibleCenter($stateCount, $i, $j) - { - $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2]; - $centerJ = $this->centerFromEnd($stateCount, $j); - $centerI = $this->crossCheckVertical($i, (int)$centerJ, 2 * $stateCount[1], $stateCountTotal); - if (!is_nan($centerI)) { - $estimatedModuleSize = (float)($stateCount[0] + $stateCount[1] + $stateCount[2]) / 3.0; - foreach ($this->possibleCenters as $center) { - // Look for about the same center and module size: - if ($center->aboutEquals($estimatedModuleSize, $centerI, $centerJ)) { - return $center->combineEstimate($centerI, $centerJ, $estimatedModuleSize); - } - } - // Hadn't found this before; save it - $point = new AlignmentPattern($centerJ, $centerI, $estimatedModuleSize); - $this->possibleCenters[] = $point; - if ($this->resultPointCallback != null) { - $this->resultPointCallback->foundPossibleResultPoint($point); - } - } - - return null; - } - - /** - * Given a count of black/white/black pixels just seen and an end position, - * figures the location of the center of this black/white/black run. - */ - private static function centerFromEnd($stateCount, $end) - { - return (float)($end - $stateCount[2]) - $stateCount[1] / 2.0; - } - - /** - *After a horizontal scan finds a potential alignment pattern, this method - * "cross-checks" by scanning down vertically through the center of the possible - * alignment pattern to see if the same proportion is detected.
- * - * @param startI row where an alignment pattern was detected - * @param centerJ center of the section that appears to cross an alignment pattern - * @param maxCount maximum reasonable number of modules that should be - * observed in any reading state, based on the results of the horizontal scan - * - * @return vertical center of alignment pattern, or {@link Float#NaN} if not found - */ - private function crossCheckVertical($startI, $centerJ, $maxCount, - $originalStateCountTotal) - { - $image = $this->image; - - $maxI = $image->getHeight(); - $stateCount = $this->crossCheckStateCount; - $stateCount[0] = 0; - $stateCount[1] = 0; - $stateCount[2] = 0; - - // Start counting up from center - $i = $startI; - while ($i >= 0 && $image->get($centerJ, $i) && $stateCount[1] <= $maxCount) { - $stateCount[1]++; - $i--; - } - // If already too many modules in this state or ran off the edge: - if ($i < 0 || $stateCount[1] > $maxCount) { - return NAN; - } - while ($i >= 0 && !$image->get($centerJ, $i) && $stateCount[0] <= $maxCount) { - $stateCount[0]++; - $i--; - } - if ($stateCount[0] > $maxCount) { - return NAN; - } - - // Now also count down from center - $i = $startI + 1; - while ($i < $maxI && $image->get($centerJ, $i) && $stateCount[1] <= $maxCount) { - $stateCount[1]++; - $i++; - } - if ($i == $maxI || $stateCount[1] > $maxCount) { - return NAN; - } - while ($i < $maxI && !$image->get($centerJ, $i) && $stateCount[2] <= $maxCount) { - $stateCount[2]++; - $i++; - } - if ($stateCount[2] > $maxCount) { - return NAN; - } - - $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2]; - if (5 * abs($stateCountTotal - $originalStateCountTotal) >= 2 * $originalStateCountTotal) { - return NAN; - } - - return $this->foundPatternCross($stateCount) ? $this->centerFromEnd($stateCount, $i) : NAN; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/Detector.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/Detector.php deleted file mode 100644 index 897dbb2c..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/Detector.php +++ /dev/null @@ -1,420 +0,0 @@ -Encapsulates logic that can detect a QR Code in an image, even if the QR Code - * is rotated or skewed, or partially obscured. - * - * @author Sean Owen - */ -class Detector -{ - - private $image; - private $resultPointCallback; - - public function __construct($image) - { - $this->image = $image; - } - - /** - *Detects a QR Code in an image.
- * - * @param hints optional hints to detector - * - * @return {@link DetectorResult} encapsulating results of detecting a QR Code - * @throws NotFoundException if QR Code cannot be found - * @throws FormatException if a QR Code cannot be decoded - */ - public final function detect($hints = null) - {/*MapDetects a QR Code in an image.
- * - * @return {@link DetectorResult} encapsulating results of detecting a QR Code - * @throws NotFoundException if QR Code cannot be found - * @throws FormatException if a QR Code cannot be decoded - */ - - /** - *Computes an average estimated module size based on estimated derived from the positions - * of the three finder patterns.
- * - * @param topLeft detected top-left finder pattern center - * @param topRight detected top-right finder pattern center - * @param bottomLeft detected bottom-left finder pattern center - * - * @return estimated module size - */ - protected final function calculateModuleSize($topLeft, $topRight, $bottomLeft) - { -// Take the average - return ($this->calculateModuleSizeOneWay($topLeft, $topRight) + - $this->calculateModuleSizeOneWay($topLeft, $bottomLeft)) / 2.0; - } - - /** - *Estimates module size based on two finder patterns -- it uses - * {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the - * width of each, measuring along the axis between their centers.
- */ - private function calculateModuleSizeOneWay($pattern, $otherPattern) - { - $moduleSizeEst1 = $this->sizeOfBlackWhiteBlackRunBothWays($pattern->getX(), - (int)$pattern->getY(), - (int)$otherPattern->getX(), - (int)$otherPattern->getY()); - $moduleSizeEst2 = $this->sizeOfBlackWhiteBlackRunBothWays((int)$otherPattern->getX(), - (int)$otherPattern->getY(), - (int)$pattern->getX(), - (int)$pattern->getY()); - if (is_nan($moduleSizeEst1)) { - return $moduleSizeEst2 / 7.0; - } - if (is_nan($moduleSizeEst2)) { - return $moduleSizeEst1 / 7.0; - } -// Average them, and divide by 7 since we've counted the width of 3 black modules, -// and 1 white and 1 black module on either side. Ergo, divide sum by 14. - return ($moduleSizeEst1 + $moduleSizeEst2) / 14.0; - } - - /** - * See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of - * a finder pattern by looking for a black-white-black run from the center in the direction - * of another po$(another finder pattern center), and in the opposite direction too. - */ - private function sizeOfBlackWhiteBlackRunBothWays($fromX, $fromY, $toX, $toY) - { - - $result = $this->sizeOfBlackWhiteBlackRun($fromX, $fromY, $toX, $toY); - -// Now count other way -- don't run off image though of course - $scale = 1.0; - $otherToX = $fromX - ($toX - $fromX); - if ($otherToX < 0) { - $scale = (float)$fromX / (float)($fromX - $otherToX); - $otherToX = 0; - } else if ($otherToX >= $this->image->getWidth()) { - $scale = (float)($this->image->getWidth() - 1 - $fromX) / (float)($otherToX - $fromX); - $otherToX = $this->image->getWidth() - 1; - } - $otherToY = (int)($fromY - ($toY - $fromY) * $scale); - - $scale = 1.0; - if ($otherToY < 0) { - $scale = (float)$fromY / (float)($fromY - $otherToY); - $otherToY = 0; - } else if ($otherToY >= $this->image->getHeight()) { - $scale = (float)($this->image->getHeight() - 1 - $fromY) / (float)($otherToY - $fromY); - $otherToY = $this->image->getHeight() - 1; - } - $otherToX = (int)($fromX + ($otherToX - $fromX) * $scale); - - $result += $this->sizeOfBlackWhiteBlackRun($fromX, $fromY, $otherToX, $otherToY); - -// Middle pixel is double-counted this way; subtract 1 - return $result - 1.0; - } - - /** - *This method traces a line from a po$in the image, in the direction towards another point. - * It begins in a black region, and keeps going until it finds white, then black, then white again. - * It reports the distance from the start to this point.
- * - *This is used when figuring out how wide a finder pattern is, when the finder pattern - * may be skewed or rotated.
- */ - private function sizeOfBlackWhiteBlackRun($fromX, $fromY, $toX, $toY) - { -// Mild variant of Bresenham's algorithm; -// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm - $steep = abs($toY - $fromY) > abs($toX - $fromX); - if ($steep) { - $temp = $fromX; - $fromX = $fromY; - $fromY = $temp; - $temp = $toX; - $toX = $toY; - $toY = $temp; - } - - $dx = abs($toX - $fromX); - $dy = abs($toY - $fromY); - $error = -$dx / 2; - $xstep = $fromX < $toX ? 1 : -1; - $ystep = $fromY < $toY ? 1 : -1; - -// In black pixels, looking for white, first or second time. - $state = 0; -// Loop up until x == toX, but not beyond - $xLimit = $toX + $xstep; - for ($x = $fromX, $y = $fromY; $x != $xLimit; $x += $xstep) { - $realX = $steep ? $y : $x; - $realY = $steep ? $x : $y; - -// Does current pixel mean we have moved white to black or vice versa? -// Scanning black in state 0,2 and white in state 1, so if we find the wrong -// color, advance to next state or end if we are in state 2 already - if (($state == 1) == $this->image->get($realX, $realY)) { - if ($state == 2) { - return MathUtils::distance($x, $y, $fromX, $fromY); - } - $state++; - } - - $error += $dy; - if ($error > 0) { - if ($y == $toY) { - break; - } - $y += $ystep; - $error -= $dx; - } - } -// Found black-white-black; give the benefit of the doubt that the next pixel outside the image -// is "white" so this last po$at (toX+xStep,toY) is the right ending. This is really a -// small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this. - if ($state == 2) { - return MathUtils::distance($toX + $xstep, $toY, $fromX, $fromY); - } - -// else we didn't find even black-white-black; no estimate is really possible - return NAN; - } - - /** - *Computes the dimension (number of modules on a size) of the QR Code based on the position - * of the finder patterns and estimated module size.
- */ - private static function computeDimension($topLeft, - $topRight, - $bottomLeft, - $moduleSize) - { - $tltrCentersDimension = MathUtils::round(ResultPoint::distance($topLeft, $topRight) / $moduleSize); - $tlblCentersDimension = MathUtils::round(ResultPoint::distance($topLeft, $bottomLeft) / $moduleSize); - $dimension = (($tltrCentersDimension + $tlblCentersDimension) / 2) + 7; - switch ($dimension & 0x03) { // mod 4 - case 0: - $dimension++; - break; -// 1? do nothing - case 2: - $dimension--; - break; - case 3: - throw NotFoundException::getNotFoundInstance(); - } - - return $dimension; - } - - /** - *Attempts to locate an alignment pattern in a limited region of the image, which is - * guessed to contain it. This method uses {@link AlignmentPattern}.
- * - * @param overallEstModuleSize estimated module size so far - * @param estAlignmentX x coordinate of center of area probably containing alignment pattern - * @param estAlignmentY y coordinate of above - * @param allowanceFactor number of pixels in all directions to search from the center - * - * @return {@link AlignmentPattern} if found, or null otherwise - * @throws NotFoundException if an unexpected error occurs during detection - */ - protected final function findAlignmentInRegion($overallEstModuleSize, - $estAlignmentX, - $estAlignmentY, - $allowanceFactor) - { -// Look for an alignment pattern (3 modules in size) around where it -// should be - $allowance = (int)($allowanceFactor * $overallEstModuleSize); - $alignmentAreaLeftX = max(0, $estAlignmentX - $allowance); - $alignmentAreaRightX = min($this->image->getWidth() - 1, $estAlignmentX + $allowance); - if ($alignmentAreaRightX - $alignmentAreaLeftX < $overallEstModuleSize * 3) { - throw NotFoundException::getNotFoundInstance(); - } - - $alignmentAreaTopY = max(0, $estAlignmentY - $allowance); - $alignmentAreaBottomY = min($this->image->getHeight() - 1, $estAlignmentY + $allowance); - if ($alignmentAreaBottomY - $alignmentAreaTopY < $overallEstModuleSize * 3) { - throw NotFoundException::getNotFoundInstance(); - } - - $alignmentFinder = - new AlignmentPatternFinder( - $this->image, - $alignmentAreaLeftX, - $alignmentAreaTopY, - $alignmentAreaRightX - $alignmentAreaLeftX, - $alignmentAreaBottomY - $alignmentAreaTopY, - $overallEstModuleSize, - $this->resultPointCallback); - - return $alignmentFinder->find(); - } - - private static function createTransform($topLeft, - $topRight, - $bottomLeft, - $alignmentPattern, - $dimension) - { - $dimMinusThree = (float)$dimension - 3.5; - $bottomRightX = 0.0; - $bottomRightY = 0.0; - $sourceBottomRightX = 0.0; - $sourceBottomRightY = 0.0; - if ($alignmentPattern != null) { - $bottomRightX = $alignmentPattern->getX(); - $bottomRightY = $alignmentPattern->getY(); - $sourceBottomRightX = $dimMinusThree - 3.0; - $sourceBottomRightY = $sourceBottomRightX; - } else { -// Don't have an alignment pattern, just make up the bottom-right point - $bottomRightX = ($topRight->getX() - $topLeft->getX()) + $bottomLeft->getX(); - $bottomRightY = ($topRight->getY() - $topLeft->getY()) + $bottomLeft->getY(); - $sourceBottomRightX = $dimMinusThree; - $sourceBottomRightY = $dimMinusThree; - } - - return PerspectiveTransform::quadrilateralToQuadrilateral( - 3.5, - 3.5, - $dimMinusThree, - 3.5, - $sourceBottomRightX, - $sourceBottomRightY, - 3.5, - $dimMinusThree, - $topLeft->getX(), - $topLeft->getY(), - $topRight->getX(), - $topRight->getY(), - $bottomRightX, - $bottomRightY, - $bottomLeft->getX(), - $bottomLeft->getY()); - } - - private static function sampleGrid($image, $transform, - $dimension) - { - $sampler = GridSampler::getInstance(); - - return $sampler->sampleGrid_($image, $dimension, $dimension, $transform); - } - - protected final function getImage() - { - return $this->image; - } - - protected final function getResultPointCallback() - { - return $this->resultPointCallback; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPattern.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPattern.php deleted file mode 100644 index ac93d386..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPattern.php +++ /dev/null @@ -1,86 +0,0 @@ -Encapsulates a finder pattern, which are the three square patterns found in - * the corners of QR Codes. It also encapsulates a count of similar finder patterns, - * as a convenience to the finder's bookkeeping. - * - * @author Sean Owen - */ -final class FinderPattern extends ResultPoint -{ - private $estimatedModuleSize; - private $count; - - public function __construct($posX, $posY, $estimatedModuleSize, $count = 1) - { - parent::__construct($posX, $posY); - $this->estimatedModuleSize = $estimatedModuleSize; - $this->count = $count; - } - - public function getEstimatedModuleSize() - { - return $this->estimatedModuleSize; - } - - public function getCount() - { - return $this->count; - } - - /* - void incrementCount() { - this.count++; - } - */ - - /** - *Determines if this finder pattern "about equals" a finder pattern at the stated - * position and size -- meaning, it is at nearly the same center with nearly the same size.
- */ - public function aboutEquals($moduleSize, $i, $j) - { - if (abs($i - $this->getY()) <= $moduleSize && abs($j - $this->getX()) <= $moduleSize) { - $moduleSizeDiff = abs($moduleSize - $this->estimatedModuleSize); - - return $moduleSizeDiff <= 1.0 || $moduleSizeDiff <= $this->estimatedModuleSize; - } - - return false; - } - - /** - * Combines this object's current estimate of a finder pattern position and module size - * with a new estimate. It returns a new {@code FinderPattern} containing a weighted average - * based on count. - */ - public function combineEstimate($i, $j, $newModuleSize) - { - $combinedCount = $this->count + 1; - $combinedX = ($this->count * $this->getX() + $j) / $combinedCount; - $combinedY = ($this->count * $this->getY() + $i) / $combinedCount; - $combinedModuleSize = ($this->count * $this->estimatedModuleSize + $newModuleSize) / $combinedCount; - - return new FinderPattern($combinedX, $combinedY, $combinedModuleSize, $combinedCount); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPatternFinder.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPatternFinder.php deleted file mode 100644 index 1fe030fb..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPatternFinder.php +++ /dev/null @@ -1,699 +0,0 @@ -This class attempts to find finder patterns in a QR Code. Finder patterns are the square - * markers at three corners of a QR Code. - * - *This class is thread-safe but not reentrant. Each thread must allocate its own object.
- *
- * @author Sean Owen
- */
-class FinderPatternFinder
-{
- protected static $MIN_SKIP = 3;
- protected static $MAX_MODULES = 57; // 1 pixel/module times 3 modules/center
- private static $CENTER_QUORUM = 2; // support up to version 10 for mobile clients
- private $image;
- private $average;
- private $possibleCenters; //private final List Creates a finder that will search the image for three finder patterns. This is called when a horizontal scan finds a possible alignment pattern. It will
- * cross check with a vertical scan, and if successful, will, ah, cross-cross-check
- * with another horizontal scan. This is needed primarily to locate the real horizontal
- * center of the pattern in cases of extreme skew.
- * And then we cross-cross-cross check with another diagonal scan. If that succeeds the finder pattern location is added to a list that tracks
- * the number of times each location has been nearly-matched as a finder pattern.
- * Each additional find is more evidence that the location is in fact a finder
- * pattern center
- *
- * @param $stateCount reading state module counts from horizontal scan
- * @param i row where finder pattern may be found
- * @param j end of possible finder pattern in row
- * @param pureBarcode true if in "pure barcode" mode
- *
- * @return true if a finder pattern candidate was found this time
- */
- protected final function handlePossibleCenter($stateCount, $i, $j, $pureBarcode)
- {
- $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2] + $stateCount[3] +
- $stateCount[4];
- $centerJ = $this->centerFromEnd($stateCount, $j);
- $centerI = $this->crossCheckVertical($i, (int)($centerJ), $stateCount[2], $stateCountTotal);
- if (!is_nan($centerI)) {
- // Re-cross check
- $centerJ = $this->crossCheckHorizontal((int)($centerJ), (int)($centerI), $stateCount[2], $stateCountTotal);
- if (!is_nan($centerJ) &&
- (!$pureBarcode || $this->crossCheckDiagonal((int)($centerI), (int)($centerJ), $stateCount[2], $stateCountTotal))
- ) {
- $estimatedModuleSize = (float)$stateCountTotal / 7.0;
- $found = false;
- for ($index = 0; $index < count($this->possibleCenters); $index++) {
- $center = $this->possibleCenters[$index];
- // Look for about the same center and module size:
- if ($center->aboutEquals($estimatedModuleSize, $centerI, $centerJ)) {
- $this->possibleCenters[$index] = $center->combineEstimate($centerI, $centerJ, $estimatedModuleSize);
- $found = true;
- break;
- }
- }
- if (!$found) {
- $point = new FinderPattern($centerJ, $centerI, $estimatedModuleSize);
- $this->possibleCenters[] = $point;
- if ($this->resultPointCallback != null) {
- $this->resultPointCallback->foundPossibleResultPoint($point);
- }
- }
-
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Given a count of black/white/black/white/black pixels just seen and an end position,
- * figures the location of the center of this run.
- */
- private static function centerFromEnd($stateCount, $end)
- {
- return (float)($end - $stateCount[4] - $stateCount[3]) - $stateCount[2] / 2.0;
- }
-
- /**
- * After a horizontal scan finds a potential finder pattern, this method
- * "cross-checks" by scanning down vertically through the center of the possible
- * finder pattern to see if the same proportion is detected. Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical,
- * except it reads horizontally instead of vertically. This is used to cross-cross
- * check a vertical cross check and locate the real center of the alignment pattern. Orders by furthest from average Orders by {@link FinderPattern#getCount()}, descending.
If you are not automatically redirected, please go to the latest stable API documentation.
' > build/index.html - deploy: - provider: pages - skip-cleanup: true - local-dir: build - github-token: $GITHUB_TOKEN - on: - all_branches: true - condition: $TRAVIS_BRANCH =~ ^master|develop$ diff --git a/vendor/phpoffice/phpspreadsheet/CHANGELOG.PHPExcel.md b/vendor/phpoffice/phpspreadsheet/CHANGELOG.PHPExcel.md deleted file mode 100644 index a32f78b5..00000000 --- a/vendor/phpoffice/phpspreadsheet/CHANGELOG.PHPExcel.md +++ /dev/null @@ -1,1593 +0,0 @@ -# Changelog for PHPExcel - -This is the historic changelog of the project when it was still called PHPExcel. -It exists only for historical purposes and versions mentioned here should not be -confused with PhpSpreadsheet versions. - -## [1.8.1] - 2015-04-30 - -### Bugfixes - -- Fix for Writing an Open Document cell with non-numeric formula - @goncons [#397](https://github.com/PHPOffice/PHPExcel/issues/397) -- Avoid potential divide by zero in basedrawing - @sarciszewski [#329](https://github.com/PHPOffice/PHPExcel/issues/329) -- XML External Entity (XXE) Processing, different behaviour between simplexml_load_string() and simplexml_load_file(). - @ymaerschalck [#405](https://github.com/PHPOffice/PHPExcel/issues/405) -- Fix to ensure that current cell is maintained when executing formula calculations - @MarkBaker -- Keep/set the value on Reader _loadSheetsOnly as NULL, courtesy of Restless-ET - @MarkBaker [#350](https://github.com/PHPOffice/PHPExcel/issues/350) -- Loading an Excel 2007 spreadsheet throws an "Autofilter must be set on a range of cells" exception - @MarkBaker [CodePlex #18105](https://phpexcel.codeplex.com/workitem/18105) -- Fix to autoloader registration for backward compatibility with PHP 5.2.0 not accepting the prepend flag - @MarkBaker [#388](https://github.com/PHPOffice/PHPExcel/issues/388) -- DOM loadHTMLFile() failing with options flags when using PHP < 5.4.0 - @MarkBaker [#384](https://github.com/PHPOffice/PHPExcel/issues/384) -- Fix for percentage operator in formulae for BIFF Writer - @MarkBaker -- Fix to getStyle() call for cell object - @MarkBaker -- Discard Autofilters in Excel2007 Reader when filter range isn't a valid range - @MarkBaker -- Fix invalid NA return in VLOOKUP - @frozenstupidity [#423](https://github.com/PHPOffice/PHPExcel/issues/423) -- "No Impact" conditional formatting fix for NumberFormat - @wiseloren [CodePlex #21454](https://phpexcel.codeplex.com/workitem/21454) -- Bug in Excel2003XML reader, parsing merged cells - @bobwitlox [#467](https://github.com/PHPOffice/PHPExcel/issues/467) -- Fix for CEIL() and FLOOR() when number argument is zero - @MarkBaker [#302](https://github.com/PHPOffice/PHPExcel/issues/302) - -### General - -- Remove cells cleanly when calling RemoveRow() or RemoveColumn() - @MarkBaker -- Small performance improvement for autosize columns - @MarkBaker -- Change the getter/setter for zeroHeight to camel case - @frost-nzcr4 [#379](https://github.com/PHPOffice/PHPExcel/issues/379) -- DefaultValueBinder is too much aggressive when converting string to numeric - @MarkBaker [#394](https://github.com/PHPOffice/PHPExcel/issues/394) -- Default precalculate formulas to false for writers - @MarkBaker -- Set default Cyclic Reference behaviour to 1 to eliminate exception when using a single cyclic iteration in formulae - @MarkBaker - -### Features - -- Some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE - @MarkBaker [#396](https://github.com/PHPOffice/PHPExcel/issues/396) -- Methods to manage most of the existing options for Chart Axis, Major Grid-lines and Minor Grid-lines - @WiktrzGE [#404](https://github.com/PHPOffice/PHPExcel/issues/404) -- ODS read/write comments in the cell - @frost-nzcr4 [#403](https://github.com/PHPOffice/PHPExcel/issues/403) -- Additional Mac CJK codepage definitions - @CQD [#389](https://github.com/PHPOffice/PHPExcel/issues/389) -- Update Worksheet.php getStyleByColumnAndRow() to allow a range of cells rather than just a single cell - @bolovincev [#269](https://github.com/PHPOffice/PHPExcel/issues/269) -- New methods added for testing cell status within merge groups - @MarkBaker -- Handling merge cells in HTML Reader - @cifren/MBaker [#205](https://github.com/PHPOffice/PHPExcel/issues/205) -- Helper to convert basic HTML markup to a Rich Text object - @MarkBaker -- Improved Iterators - @MarkBaker - - New Column Iterator - - Support for row and column ranges - - Improved handling for next/prev - -### Security - -- XML filescan in XML-based Readers to prevent XML Entity Expansion (XEE) - @MarkBaker - - (see http://projects.webappsec.org/w/page/13247002/XML%20Entity%20Expansion for an explanation of XEE injection) attacks - - Reference CVE-2015-3542 - Identification of problem courtesy of Dawid Golunski (Pentest Ltd.) - -## [1.8.0] - 2014-03-02 - -### Bugfixes - -- Undefined variable: fileHandle in CSV Reader - @MarkBaker [CodePlex #19830](https://phpexcel.codeplex.com/workitem/19830) -- Out of memory in style/supervisor.php - @MarkBaker [CodePlex #19968](https://phpexcel.codeplex.com/workitem/19968) -- Style error with merged cells in PDF Writer - @MarkBaker -- Problem with cloning worksheets - @MarkBaker -- Bug fix reading Open Office files - @tavoarcila [#259](https://github.com/PHPOffice/PHPExcel/issues/259) -- Serious bug in absolute cell reference used in shared formula - @MarkBaker [CodePlex #20397](https://phpexcel.codeplex.com/workitem/20397) - - Would also have affected insert/delete column/row- CHOOSE() returns "#VALUE!" if the 1st entry is chosen - @RomanSyroeshko [#267](https://github.com/PHPOffice/PHPExcel/issues/267) -- When duplicating styles, styles shifted by one column to the right - @Gemorroj [#268](https://github.com/PHPOffice/PHPExcel/issues/268) - - Fix also applied to duplicating conditional styles- Fix for formulae that reference a sheet whose name begins with a digit: - @IndrekHaav [#212](https://github.com/PHPOffice/PHPExcel/issues/212) - - these were erroneously identified as numeric values, causing the parser to throw an undefined variable error.- Fixed undefined variable error due to $styleArray being used before it's initialised - @IndrekHaav [CodePlex #16208](https://phpexcel.codeplex.com/workitem/16208) -- ISTEXT() return wrong result if referencing an empty but formatted cell - @PowerKiKi [#273](https://github.com/PHPOffice/PHPExcel/issues/273) -- Binary comparison of strings are case insensitive - @PowerKiKi [#270](https://github.com/PHPOffice/PHPExcel/issues/270), [#31](https://github.com/PHPOffice/PHPExcel/issues/31) -- Insert New Row/Column Before is not correctly updating formula references - @MarkBaker [#275](https://github.com/PHPOffice/PHPExcel/issues/275) -- Passing an array of cells to _generateRow() in the HTML/PDF Writer causes caching problems with last cell in the range - @MarkBaker [#257](https://github.com/PHPOffice/PHPExcel/issues/257) -- Fix to empty worksheet garbage collection when using cell caching - @MarkBaker [#193](https://github.com/PHPOffice/PHPExcel/issues/193) -- Excel2007 does not correctly mark rows as hidden - @Jazzo [#248](https://github.com/PHPOffice/PHPExcel/issues/248) -- Fixed typo in Chart/Layout set/getYMode() - @Roy Shahbazian [#299](https://github.com/PHPOffice/PHPExcel/issues/299) -- Fatal error: Call to a member function cellExists() line: 3327 in calculation.php if referenced worksheet doesn't exist - @EliuFlorez [#279](https://github.com/PHPOffice/PHPExcel/issues/279) -- AdvancedValueBinder "Division by zero"-error - @MarkBaker [#290](https://github.com/PHPOffice/PHPExcel/issues/290) -- Adding Sheet to Workbook Bug - @MarkBaker [CodePlex #20604](https://phpexcel.codeplex.com/workitem/20604) -- Calculation engine incorrectly evaluates empty cells as #VALUE - @MarkBaker [CodePlex #20703](https://phpexcel.codeplex.com/workitem/20703) -- Formula references to cell on another sheet in ODS files - @MarkBaker [CodePlex #20760](https://phpexcel.codeplex.com/workitem/20760) - -### Features - -- LibreOffice created XLSX files results in an empty file. - @MarkBaker [#321](https://github.com/PHPOffice/PHPExcel/issues/321), [#158](https://github.com/PHPOffice/PHPExcel/issues/158), [CodePlex #17824](https://phpexcel.codeplex.com/workitem/17824) -- Implementation of the Excel HLOOKUP() function - @amerov -- Added "Quote Prefix" to style settings (Excel2007 Reader and Writer only) - @MarkBaker -- Added Horizontal FILL alignment for Excel5 and Excel2007 Readers/Writers, and Horizontal DISTRIBUTED alignment for Excel2007 Reader/Writer - @MarkBaker -- Add support for reading protected (RC4 encrypted) .xls files - @trvrnrth [#261](https://github.com/PHPOffice/PHPExcel/issues/261) - -### General - -- Adding support for macros, Ribbon in Excel 2007 - @LWol [#252](https://github.com/PHPOffice/PHPExcel/issues/252) -- Remove array_shift in ReferenceHelper::insertNewBefore improves column or row delete speed - @cdhutch [CodePlex #20055](https://phpexcel.codeplex.com/workitem/20055) -- Improve stock chart handling and rendering, with help from Swashata Ghosh - @MarkBaker -- Fix to calculation properties for Excel2007 so that the opening application will only recalculate on load if it's actually required - @MarkBaker -- Modified Excel2007 Writer to default preCalculateFormulas to false - @MarkBaker - - Note that autosize columns will still recalculate affected formulae internally- Functionality to getHighestRow() for a specified column, and getHighestColumn() for a specified row - @dresenhista [#242](https://github.com/PHPOffice/PHPExcel/issues/242) -- Modify PHPExcel_Reader_Excel2007 to use zipClass from PHPExcel_Settings::getZipClass() - @adamriyadi [#247](https://github.com/PHPOffice/PHPExcel/issues/247) - - This allows the use of PCLZip when reading for people that don't have access to ZipArchive -### Security - -- Convert properties to string in OOCalc reader - @infojunkie [#276](https://github.com/PHPOffice/PHPExcel/issues/276) -- Disable libxml external entity loading by default. - @maartenba [#322](https://github.com/PHPOffice/PHPExcel/issues/322) - - This is to prevent XML External Entity Processing (XXE) injection attacks (see http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html for an explanation of XXE injection). - - Reference CVE-2014-2054 - -## [1.7.9] - 2013-06-02 - -### Features - -- Include charts option for HTML Writer - @MarkBaker -- Added composer file - @MarkBaker -- cache_in_memory_gzip "eats" last worksheet line, cache_in_memory doesn't - @MarkBaker [CodePlex #18844](https://phpexcel.codeplex.com/workitem/18844) -- echo statements in HTML.php - @MarkBaker [#104](https://github.com/PHPOffice/PHPExcel/issues/104) - -### Bugfixes - -- Added getStyle() method to Cell object - @MarkBaker -- Error in PHPEXCEL/Calculation.php script on line 2976 (stack pop check) - @Asker [CodePlex #18777](https://phpexcel.codeplex.com/workitem/18777) -- CSV files without a file extension being identified as HTML - @MarkBaker [CodePlex #18794](https://phpexcel.codeplex.com/workitem/18794) -- Wrong check for maximum number of rows in Excel5 Writer - @AndreKR [#66](https://github.com/PHPOffice/PHPExcel/issues/66) -- Cache directory for DiscISAM cache storage cannot be set - @MarkBaker [#67](https://github.com/PHPOffice/PHPExcel/issues/67) -- Fix to Excel2007 Reader for hyperlinks with an anchor fragment (following a #), otherwise they were treated as sheet references - @MarkBaker [CodePlex #17976](https://phpexcel.codeplex.com/workitem/17976) -- getSheetNames() fails on numeric (floating point style) names with trailing zeroes - @MarkBaker [CodePlex #18963](https://phpexcel.codeplex.com/workitem/18963) -- Modify cell's getCalculatedValue() method to return the content of RichText objects rather than the RichText object itself - @MarkBaker -- Fixed formula/formatting bug when removing rows - @techhead [#70](https://github.com/PHPOffice/PHPExcel/issues/70) -- Fix to cellExists for non-existent namedRanges - @alexgann [#63](https://github.com/PHPOffice/PHPExcel/issues/63) -- Sheet View in Excel5 Writer - @Progi1984 [#22](https://github.com/PHPOffice/PHPExcel/issues/22) -- PHPExcel_Worksheet::getCellCollection() may not return last cached cell - @amironov [#82](https://github.com/PHPOffice/PHPExcel/issues/82) -- Rich Text containing UTF-8 characters creating unreadable content with Excel5 Writer - @teso [CodePlex #18551](https://phpexcel.codeplex.com/workitem/18551) -- Work item GH-8/CP11704 : Conditional formatting in Excel 5 Writer - @Progi1984 -- canRead() Error for GoogleDocs ODS files: in ODS files from Google Docs there is no mimetype file - @MarkBaker [#113](https://github.com/PHPOffice/PHPExcel/issues/113) -- "Sheet index is out of bounds." Exception - @MarkBaker [#80](https://github.com/PHPOffice/PHPExcel/issues/80) -- Fixed number format fatal error - @ccorliss [#105](https://github.com/PHPOffice/PHPExcel/issues/105) -- Add DROP TABLE in destructor for SQLite and SQLite3 cache controllers - @MarkBaker -- Fix merged-cell borders on HTML/PDF output - @alexgann [#154](https://github.com/PHPOffice/PHPExcel/issues/154) -- Fix: Hyperlinks break when removing rows - @Shanto [#161](https://github.com/PHPOffice/PHPExcel/issues/161) -- Fix Extra Table Row From Images and Charts - @neclimdul [#166](https://github.com/PHPOffice/PHPExcel/issues/166) - -### General - -- Single cell print area - @MarkBaker [#130](https://github.com/PHPOffice/PHPExcel/issues/130) -- Improved AdvancedValueBinder for currency - @kea [#69](https://github.com/PHPOffice/PHPExcel/issues/69) -- Fix for environments where there is no access to /tmp but to upload_tmp_dir - @MarkBaker - - Provided an option to set the sys_get_temp_dir() call to use the upload_tmp_dir; though by default the standard temp directory will still be used- Search style by identity in PHPExcel_Worksheet::duplicateStyle() - @amironov [#84](https://github.com/PHPOffice/PHPExcel/issues/84) -- Fill SheetView IO in Excel5 - @karak [#85](https://github.com/PHPOffice/PHPExcel/issues/85) -- Memory and Speed improvements in PHPExcel_Reader_Excel5 - @cfhay [CodePlex #18958](https://phpexcel.codeplex.com/workitem/18958) -- Modify listWorksheetNames() and listWorksheetInfo to use XMLReader with streamed XML rather than SimpleXML - @MarkBaker [#78](https://github.com/PHPOffice/PHPExcel/issues/78) -- Restructuring of PHPExcel Exceptions - @dbonsch -- Refactor Calculation Engine from singleton to a Multiton - @MarkBaker - - Ensures that calculation cache is maintained independently for different workbooks - -## [1.7.8] - 2012-10-12 - -### Features - -- Phar builder script to add phar file as a distribution option - @kkamkou -- Refactor PDF Writer to allow use with a choice of PDF Rendering library - @MarkBaker - - rather than restricting to tcPDF - - Current options are tcPDF, mPDF, DomPDF - - tcPDF Library has now been removed from the deployment bundle- Initial version of HTML Reader - @MarkBaker -- Implement support for AutoFilter in PHPExcel_Writer_Excel5 - @Progi1984 -- Modified ERF and ERFC Engineering functions to accept Excel 2010's modified acceptance of negative arguments - @MarkBaker -- Support SheetView `view` attribute (Excel2007) - @k1LoW -- Excel compatibility option added for writing CSV files - @MarkBaker - - While Excel 2010 can read CSV files with a simple UTF-8 BOM, Excel2007 and earlier require UTF-16LE encoded tab-separated files. - - The new setExcelCompatibility(TRUE) option for the CSV Writer will generate files with this formatting for easy import into Excel2007 and below.- Language implementations for Turkish (tr) - @MarkBaker -- Added fraction tests to advanced value binder - @MarkBaker - -### General - -- Allow call to font setUnderline() for underline format to specify a simple boolean for UNDERLINE_NONE or UNDERLINE_SINGLE - @MarkBaker -- Add Currency detection to the Advanced Value Binder - @alexgann -- setCellValueExplicitByColumnAndRow() do not return PHPExcel_Worksheet - @MarkBaker [CodePlex #18404](https://phpexcel.codeplex.com/workitem/18404) -- Reader factory doesn't read anymore XLTX and XLT files - @MarkBaker [CodePlex #18324](https://phpexcel.codeplex.com/workitem/18324) -- Magic __toString() method added to Cell object to return raw data value as a string - @MarkBaker -- Add cell indent to html rendering - @alexgann - -### Bugfixes - -- ZeroHeight for rows in sheet format - @Raghav1981 -- OOCalc cells containing| - | Readers | -Writers | -Methods | -||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| - | XLS | -XLSX | -Excel2003XML | -Ods | -Gnumeric | -CSV | -SYLK | -XLS | -XLSX | -Ods | -CSV | -HTML | -Getters | -Setters | -|
| Reader Options | -✔ | -✔ | -● | -● | -✔ | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -- | - |
| Read Data Only (no formatting) | -✔ | -✔ | -✖ | -✖ | -✔ | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -$reader->getReadDataOnly() | -$reader->setReadDataOnly() | -
| Read Only Specified Worksheets | -✔ | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -$reader->getLoadSheetsOnly() | -$reader->setLoadSheetsOnly() $reader->setLoadAllSheets() |
-
| Read Only Specified Cells | -✔ | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -N/A | -$reader->getReadFilter() | -$reader->setReadFilter() | -
| Document Properties | -● | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -● | -✔ | -✔ | -N/A | -N/A | -● | -- | - |
| Standard Properties | -✔ | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -✔ | -✔ | -● | -N/A | -N/A | -● | -- | - |
| Creator | -✔ | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -✔ | -✔ | -✔ | -N/A | -✔ | -✔ | -$spreadsheet->getProperties()->getCreator() | -$spreadsheet->getProperties()->setCreator() | -
| Creation Date/Time | -✔ | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -✔ | -✔ | -✔ | -N/A | -N/A | -✖ | -$spreadsheet->getProperties()->getCreated() | -$spreadsheet->getProperties()->setCreated() | -
| Modifier | -✔ | -✔ | -✔ | -N/A | -N/A | -N/A | -N/A | -✔ | -✔ | -✖ | -N/A | -N/A | -✖ | -$spreadsheet->getProperties()->getLastModifiedBy() | -$spreadsheet->getProperties()->setLastModifiedBy() | -
| Modified Date/Time | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -N/A | -✔ | -✔ | -✖ | -N/A | -N/A | -✖ | -$spreadsheet->getProperties()->getModified() | -$spreadsheet->getProperties()->setModified() | -
| Title | -✔ | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -✔ | -✔ | -✔ | -N/A | -✔ | -✔ | -$spreadsheet->getProperties()->getTitle() | -$spreadsheet->getProperties()->setTitle() | -
| Description | -✔ | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -✔ | -✔ | -✔ | -N/A | -N/A | -✖ | -$spreadsheet->getProperties()->getDescription() | -$spreadsheet->getProperties()->setDescription() | -
| Subject | -✔ | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -✔ | -✔ | -✔ | -N/A | -✔ | -✔ | -$spreadsheet->getProperties()->getSubject() | -$spreadsheet->getProperties()->setSubject() | -
| Keywords | -✔ | -✔ | -✔ | -✔ | -✔ | -N/A | -N/A | -✔ | -✔ | -✔ | -N/A | -✔ | -✔ | -$spreadsheet->getProperties()->getKeywords() | -$spreadsheet->getProperties()->setKeywords() | -
| Extended Properties | -✔ | -✔ | -✔ | -N/A | -✔ | -N/A | -N/A | -- | ✔ | -● | -N/A | -N/A | -- | - | - |
| Category | -✔ | -✔ | -✔ | -N/A | -✔ | -N/A | -N/A | -- | ✔ | -✔ | -N/A | -N/A | -- | $spreadsheet->getProperties()->getCategory() | -$spreadsheet->getProperties()->setCategory() | -
| Company | -✔ | -✔ | -✔ | -N/A | -✔ | -N/A | -N/A | -- | ✔ | -✔ | -N/A | -N/A | -- | $spreadsheet->getProperties()->getCompany() | -$spreadsheet->getProperties()->setCompany() | -
| Manager | -✔ | -✔ | -✔ | -N/A | -✔ | -N/A | -N/A | -- | ✔ | -✖ | -N/A | -N/A | -- | $spreadsheet->getProperties()->getManager() | -$spreadsheet->getProperties()->setManager() | -
| User-Defined (Custom) Properties | -✖ | -✔ | -✔ | -✔ | -N/A | -N/A | -N/A | -- | ✔ | -✖ | -N/A | -N/A | -- | $spreadsheet->getProperties()->getCustomProperties() $spreadsheet->getProperties()->isCustomPropertySet() $spreadsheet->getProperties()->getCustomPropertyValue() $spreadsheet->getProperties()->getCustomPropertyType() |
- $spreadsheet->getProperties()->setCustomProperty() | -
| Text Properties | -✖ | -✔ | -✔ | -✔ | -N/A | -N/A | -N/A | -- | ✔ | -✖ | -N/A | -N/A | -- | - | - |
| Number Properties | -✖ | -✔ | -✔ | -✔ | -N/A | -N/A | -N/A | -- | ✔ | -✖ | -N/A | -N/A | -- | - | - |
| Date Properties | -✖ | -✔ | -✔ | -✔ | -N/A | -N/A | -N/A | -- | ✔ | -✖ | -N/A | -N/A | -- | - | - |
| Yes/No (Boolean) Properties | -✖ | -✔ | -✔ | -✔ | -N/A | -N/A | -N/A | -- | ✔ | -✖ | -N/A | -N/A | -- | - | - |
| Cell Data Types | -- | - | - | - | ● | -- | - | ● | -- | - | - | - | - | - | - |
| Empty/NULL | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Boolean | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Integer | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Floating Point | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| String | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Error | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Formula | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Array | -- | - | - | - | ✖ | -- | - | - | - | - | - | - | - | - | - |
| Rich Text | -✔ | -✔ | -- | - | ✖ | -N/A | -- | ✖ | -✔ | -- | N/A | -- | - | - | - |
| Conditional Formatting | -✖ | -✔ | -- | - | - | N/A | -- | ✖ | -✔ | -N/A | -- | - | - | - | - |
| Rows and Column Properties | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Row Height/Column Width | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Hidden | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Worksheet Properties | -- | - | - | - | ✖ | -- | - | - | - | - | - | - | - | - | - |
| Frozen Panes | -- | - | - | - | ✖ | -- | - | - | - | - | - | - | - | - | - |
| Coloured Tabs | -- | - | - | - | N/A | -- | - | - | - | - | - | - | - | - | - |
| Drawing hyperlink | -- | ✔ | -- | - | - | - | - | - | ✔ | -- | - | - | - | $drawing->getHyperlink()->getUrl() | -$drawing->setHyperlink()->setUrl($url) | -
| Cell Formatting | -- | - | - | - | ● | -- | - | - | - | - | - | - | - | - | - |
| Number Format Mask | -✔ | -✔ | -- | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Alignment | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Horizontal | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Vertical | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Wrapping | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Shring-to-Fit | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Indent | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Background Colour | -- | - | - | - | ✔ | -- | - | - | - | - | - | ● | -- | - | - |
| Patterned | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Font Attributes | -- | - | - | - | ✔ | -- | - | - | - | ● | -- | - | - | - | - |
| Font Face | -- | - | - | - | ✔ | -- | - | - | - | ✔ | -- | - | - | - | - |
| Font Size | -- | - | - | - | ✔ | -- | - | - | - | ✔ | -- | - | - | - | - |
| Bold | -- | - | - | - | ✔ | -- | - | - | - | ✔ | -- | - | - | - | - |
| Italic | -- | - | - | - | ✔ | -- | - | - | - | ✔ | -- | - | - | - | - |
| Strikethrough | -- | - | - | - | ✔ | -- | - | - | - | ✖ | -- | - | - | - | - |
| Underline | -- | - | - | - | ✔ | -- | - | - | - | ✔ | -- | - | - | - | - |
| Superscript | -- | - | - | - | ✔ | -- | - | - | - | ✖ | -- | - | - | - | - |
| Subscript | -- | - | - | - | ✔ | -- | - | - | - | ✖ | -- | - | - | - | - |
| Borders | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Line Style | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Position | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Diagonal | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Hyperlinks | -✔ | -✔ | -✔ | -✔ | -✖ | -✖ | -✖ | -✔ | -✔ | -✖ | -✖ | -✔ | -✖ | -$cell->getHyperlink()->getUrl($url) | -$cell->getHyperlink()->setUrl($url) | -
| http | -- | - | - | - | ✖ | -- | - | - | - | - | - | - | - | - | - |
| Merged Cells | -- | - | - | - | ✔ | -- | - | - | - | - | - | - | - | - | - |
| Cell Comments | -● | -● | -● | -● | -✔ | -N/A | -N/A | -✖ | -● | -● | -N/A | -● 1 | -N/A | -- | - |
| Rich Text | -✖ 2 | -✔ | -✖ | -✖ | -N/A | -N/A | -N/A | -✖ | -✔ | -✖ | -N/A | -- | N/A | -- | - |
| Alignment | -✖ 3 | -✖ | -✖ | -✖ | -N/A | -N/A | -N/A | -✖ | -✖ | -✖ | -N/A | -- | N/A | -- | - |
| Cell Validation | -✔ | -✔ | -✖ | -✖ | -✖ | -N/A | -N/A | -✔ | -✔ | -✖ | -N/A | -N/A | -N/A | -$cell->getDataValidation() | -$cell->setDataValidation() | -
| AutoFilters | -● | -● | -- | - | - | - | - | ● | -● | -- | - | - | - | $sheet->getAutoFilter() | -$sheet->setAutoFilter() | -
| AutoFilter Expressions | -✖ | -● | -- | - | - | - | - | ✖ | -● | -- | - | - | - | - | - |
| Filter | -✖ | -✔ | -- | - | - | - | - | ✖ | -✔ | -- | - | - | - | - | - |
| Custom Filter | -✖ | -✔ | -- | - | - | - | - | ✖ | -✔ | -- | - | - | - | - | - |
| DateGroup Filter | -✖ | -✔ | -- | - | - | - | - | ✖ | -✔ | -- | - | - | - | - | - |
| Dynamic Filter | -✖ | -✔ | -- | - | - | - | - | ✖ | -✔ | -- | - | - | - | - | - |
| Colour Filter | -✖ | -✖ | -- | - | - | - | - | ✖ | -✖ | -- | - | - | - | - | - |
| Icon Filter | -✖ | -✖ | -- | - | - | - | - | ✖ | -✖ | -- | - | - | - | - | - |
| Top 10 Filter | -✖ | -✔ | -- | - | - | - | - | ✖ | -✔ | -- | - | - | - | - | - |
| Macros | -✖ | -✔ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✔ | -✖ | -✖ | -✖ | -✖ | -$spreadsheet->getMacrosCode(); | -$spreadsheet->setMacrosCode(); | -
| Form Controls | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -
| Security | -● | -● | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -
| Protection (prevent editing) | -✔ | -✔ | -✖ | -✖ | -✖ | -✖ | -✖ | -✔ | -✔ | -✖ | -✖ | -✖ | -✖ | -$sheet->getProtection() | -$sheet->getProtection()->setSheet(true) | -
| Encryption (prevent viewing) | -✔ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -✖ | -- | - |
| - | XLS | -XLSX | -Excel2003XML | -Ods | -Gnumeric | -CSV | -SYLK | -XLS | -XLSX | -Ods | -CSV | -HTML | -Getters | -Setters | -|
| - | Readers | -Writers | -Methods | -||||||||||||
| ' . - $cell->getValue() . - ' | ' . PHP_EOL; - } - echo '
| ' . $value . ' | ' . PHP_EOL; - } - echo '
| ' . - $worksheet->getCell($col . $row) - ->getValue() . - ' | ' . PHP_EOL; - } - echo '
- ```
-
-You might want to see:
-
-``` html
-
-```
-
-You can use the following code to achieve this result:
-
-``` php
-$writer->setImagesRoot('http://www.example.com');
-```
-
-#### Formula pre-calculation
-
-By default, this writer pre-calculates all formulas in the spreadsheet.
-This can be slow on large spreadsheets, and maybe even unwanted. You can
-however disable formula pre-calculation:
-
-``` php
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet);
-$writer->setPreCalculateFormulas(false);
-
-$writer->save("05featuredemo.htm");
-```
-
-#### Embedding generated HTML in a web page
-
-There might be a situation where you want to embed the generated HTML in
-an existing website. \PhpOffice\PhpSpreadsheet\Writer\Html provides
-support to generate only specific parts of the HTML code, which allows
-you to use these parts in your website.
-
-Supported methods:
-
-- `generateHTMLHeader()`
-- `generateStyles()`
-- `generateSheetData()`
-- `generateHTMLFooter()`
-
-Here's an example which retrieves all parts independently and merges
-them into a resulting HTML page:
-
-``` php
-generateHTMLHeader();
-?>
-
-
-?>
-
--->
-
-
-generateSheetData();
-echo $writer->generateHTMLFooter();
-?>
-```
-
-#### Writing UTF-8 HTML files
-
-A HTML file can be marked as UTF-8 by writing a BOM file header. This
-can be enabled by using the following code:
-
-``` php
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet);
-$writer->setUseBOM(true);
-
-$writer->save("05featuredemo.htm");
-```
-
-#### Decimal and thousands separators
-
-See section `\PhpOffice\PhpSpreadsheet\Writer\Csv` how to control the
-appearance of these.
-
-## PDF
-
-PhpSpreadsheet allows you to write a spreadsheet into PDF format, for
-fast distribution of represented data.
-
-**PDF limitations** Please note that PDF file format has some limits
-regarding to styling cells, number formatting, ...
-
-### \PhpOffice\PhpSpreadsheet\Writer\Pdf
-
-PhpSpreadsheet’s PDF Writer is a wrapper for a 3rd-Party PDF Rendering
-library such as TCPDF, mPDF or Dompdf. You must now install a PDF
-rendering library yourself; but PhpSpreadsheet will work with a number
-of different libraries.
-
-Currently, the following libraries are supported:
-
-Library | Downloadable from | PhpSpreadsheet writer
---------|-------------------------------------|----------------------
-TCPDF | https://github.com/tecnickcom/tcpdf | Tcpdf
-mPDF | https://github.com/mpdf/mpdf | Mpdf
-Dompdf | https://github.com/dompdf/dompdf | Dompdf
-
-The different libraries have different strengths and weaknesses. Some
-generate better formatted output than others, some are faster or use
-less memory than others, while some generate smaller .pdf files. It is
-the developers choice which one they wish to use, appropriate to their
-own circumstances.
-
-You can instantiate a writer with its specific name, like so:
-
-``` php
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Mpdf');
-```
-
-Or you can register which writer you are using with a more generic name,
-so you don't need to remember which library you chose, only that you want
-to write PDF files:
-
-``` php
-$class = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class;
-\PhpOffice\PhpSpreadsheet\IOFactory::registerWriter('Pdf', $class);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Pdf');
-```
-
-Or you can instantiate directly the writer of your choice like so:
-
-``` php
-$writer = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet);
-```
-
-#### Custom implementation or configuration
-
-If you need a custom implementation, or custom configuration, of a supported
-PDF library. You can extends the PDF library, and the PDF writer like so:
-
-``` php
-class My_Custom_TCPDF extends TCPDF
-{
- // ...
-}
-
-class My_Custom_TCPDF_Writer extends \PhpOffice\PhpSpreadsheet\Writer\Pdf\Tcpdf
-{
- protected function createExternalWriterInstance($orientation, $unit, $paperSize)
- {
- $instance = new My_Custom_TCPDF($orientation, $unit, $paperSize);
-
- // more configuration of $instance
-
- return $instance;
- }
-}
-
-\PhpOffice\PhpSpreadsheet\IOFactory::registerWriter('Pdf', MY_TCPDF_WRITER::class);
-```
-
-#### Writing a spreadsheet
-
-Once you have identified the Renderer that you wish to use for PDF
-generation, you can write a .pdf file using the following code:
-
-``` php
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet);
-$writer->save("05featuredemo.pdf");
-```
-
-Please note that `\PhpOffice\PhpSpreadsheet\Writer\Pdf` only outputs the
-first worksheet by default.
-
-#### Write all worksheets
-
-PDF files can contain one or more worksheets. If you want to write all
-sheets into a single PDF file, use the following code:
-
-``` php
-$writer->writeAllSheets();
-```
-
-#### Write a specific worksheet
-
-PDF files can contain one or more worksheets. Therefore, you can specify
-which sheet to write to PDF:
-
-``` php
-$writer->setSheetIndex(0);
-```
-
-#### Formula pre-calculation
-
-By default, this writer pre-calculates all formulas in the spreadsheet.
-This can be slow on large spreadsheets, and maybe even unwanted. You can
-however disable formula pre-calculation:
-
-``` php
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet);
-$writer->setPreCalculateFormulas(false);
-
-$writer->save("05featuredemo.pdf");
-```
-
-#### Decimal and thousands separators
-
-See section `\PhpOffice\PhpSpreadsheet\Writer\Csv` how to control the
-appearance of these.
-
-## Generating Excel files from templates (read, modify, write)
-
-Readers and writers are the tools that allow you to generate Excel files
-from templates. This requires less coding effort than generating the
-Excel file from scratch, especially if your template has many styles,
-page setup properties, headers etc.
-
-Here is an example how to open a template file, fill in a couple of
-fields and save it again:
-
-``` php
-$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('template.xlsx');
-
-$worksheet = $spreadsheet->getActiveSheet();
-
-$worksheet->getCell('A1')->setValue('John');
-$worksheet->getCell('A2')->setValue('Smith');
-
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
-$writer->save('write.xls');
-```
-
-Notice that it is ok to load an xlsx file and generate an xls file.
diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/reading-files.md b/vendor/phpoffice/phpspreadsheet/docs/topics/reading-files.md
deleted file mode 100644
index 779082dc..00000000
--- a/vendor/phpoffice/phpspreadsheet/docs/topics/reading-files.md
+++ /dev/null
@@ -1,689 +0,0 @@
-# Reading Files
-
-## Security
-
-XML-based formats such as OfficeOpen XML, Excel2003 XML, OASIS and
-Gnumeric are susceptible to XML External Entity Processing (XXE)
-injection attacks when reading spreadsheet files. This can lead to:
-
-- Disclosure whether a file is existent
-- Server Side Request Forgery
-- Command Execution (depending on the installed PHP wrappers)
-
-To prevent this, by default every XML-based Reader looks for XML
-entities declared inside the DOCTYPE and if any is found an exception
-is raised.
-
-Read more [about of XXE injection](https://websec.io/2012/08/27/Preventing-XXE-in-PHP.html).
-
-## Loading a Spreadsheet File
-
-The simplest way to load a workbook file is to let PhpSpreadsheet's IO
-Factory identify the file type and load it, calling the static `load()`
-method of the `\PhpOffice\PhpSpreadsheet\IOFactory` class.
-
-``` php
-$inputFileName = './sampleData/example1.xls';
-
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
-```
-
-See `samples/Reader/01_Simple_file_reader_using_IOFactory.php` for a working
-example of this code.
-
-The `load()` method will attempt to identify the file type, and
-instantiate a loader for that file type; using it to load the file and
-store the data and any formatting in a `Spreadsheet` object.
-
-The method makes an initial guess at the loader to instantiate based on
-the file extension; but will test the file before actually executing the
-load: so if (for example) the file is actually a CSV file or contains
-HTML markup, but that has been given a .xls extension (quite a common
-practise), it will reject the Xls loader that it would normally use for
-a .xls file; and test the file using the other loaders until it finds
-the appropriate loader, and then use that to read the file.
-
-While easy to implement in your code, and you don't need to worry about
-the file type; this isn't the most efficient method to load a file; and
-it lacks the flexibility to configure the loader in any way before
-actually reading the file into a `Spreadsheet` object.
-
-## Creating a Reader and Loading a Spreadsheet File
-
-If you know the file type of the spreadsheet file that you need to load,
-you can instantiate a new reader object for that file type, then use the
-reader's `load()` method to read the file to a `Spreadsheet` object. It is
-possible to instantiate the reader objects for each of the different
-supported filetype by name. However, you may get unpredictable results
-if the file isn't of the right type (e.g. it is a CSV with an extension
-of .xls), although this type of exception should normally be trapped.
-
-``` php
-$inputFileName = './sampleData/example1.xls';
-
-/** Create a new Xls Reader **/
-$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Ods();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Gnumeric();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv();
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
-```
-
-See `samples/Reader/02_Simple_file_reader_using_a_specified_reader.php`
-for a working example of this code.
-
-Alternatively, you can use the IO Factory's `createReader()` method to
-instantiate the reader object for you, simply telling it the file type
-of the reader that you want instantiating.
-
-``` php
-$inputFileType = 'Xls';
-// $inputFileType = 'Xlsx';
-// $inputFileType = 'Xml';
-// $inputFileType = 'Ods';
-// $inputFileType = 'Slk';
-// $inputFileType = 'Gnumeric';
-// $inputFileType = 'Csv';
-$inputFileName = './sampleData/example1.xls';
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
-```
-
-See `samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php`
-for a working example of this code.
-
-If you're uncertain of the filetype, you can use the `IOFactory::identify()`
-method to identify the reader that you need, before using the
-`createReader()` method to instantiate the reader object.
-
-``` php
-$inputFileName = './sampleData/example1.xls';
-
-/** Identify the type of $inputFileName **/
-$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($inputFileName);
-/** Create a new Reader of the type that has been identified **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
-```
-
-See `samples/Reader/04_Simple_file_reader_using_the_IOFactory_to_identify_a_reader_to_use.php`
-for a working example of this code.
-
-## Spreadsheet Reader Options
-
-Once you have created a reader object for the workbook that you want to
-load, you have the opportunity to set additional options before
-executing the `load()` method.
-
-### Reading Only Data from a Spreadsheet File
-
-If you're only interested in the cell values in a workbook, but don't
-need any of the cell formatting information, then you can set the reader
-to read only the data values and any formulae from each cell using the
-`setReadDataOnly()` method.
-
-``` php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example1.xls';
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Advise the Reader that we only want to load cell data **/
-$reader->setReadDataOnly(true);
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
-```
-
-See `samples/Reader/05_Simple_file_reader_using_the_read_data_only_option.php`
-for a working example of this code.
-
-It is important to note that Workbooks (and PhpSpreadsheet) store dates
-and times as simple numeric values: they can only be distinguished from
-other numeric values by the format mask that is applied to that cell.
-When setting read data only to true, PhpSpreadsheet doesn't read the
-cell format masks, so it is not possible to differentiate between
-dates/times and numbers.
-
-The Gnumeric loader has been written to read the format masks for date
-values even when read data only has been set to true, so it can
-differentiate between dates/times and numbers; but this change hasn't
-yet been implemented for the other readers.
-
-Reading Only Data from a Spreadsheet File applies to Readers:
-
-Reader | Y/N |Reader | Y/N |Reader | Y/N |
-----------|:---:|--------|:---:|--------------|:---:|
-Xlsx | YES | Xls | YES | Xml | YES |
-Ods | YES | SYLK | NO | Gnumeric | YES |
-CSV | NO | HTML | NO
-
-### Reading Only Named WorkSheets from a File
-
-If your workbook contains a number of worksheets, but you are only
-interested in reading some of those, then you can use the
-`setLoadSheetsOnly()` method to identify those sheets you are interested
-in reading.
-
-To read a single sheet, you can pass that sheet name as a parameter to
-the `setLoadSheetsOnly()` method.
-
-``` php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example1.xls';
-$sheetname = 'Data Sheet #2';
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Advise the Reader of which WorkSheets we want to load **/
-$reader->setLoadSheetsOnly($sheetname);
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
-```
-
-See `samples/Reader/07_Simple_file_reader_loading_a_single_named_worksheet.php`
-for a working example of this code.
-
-If you want to read more than just a single sheet, you can pass a list
-of sheet names as an array parameter to the `setLoadSheetsOnly()` method.
-
-``` php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example1.xls';
-$sheetnames = ['Data Sheet #1','Data Sheet #3'];
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Advise the Reader of which WorkSheets we want to load **/
-$reader->setLoadSheetsOnly($sheetnames);
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
-```
-
-See `samples/Reader/08_Simple_file_reader_loading_several_named_worksheets.php`
-for a working example of this code.
-
-To reset this option to the default, you can call the `setLoadAllSheets()`
-method.
-
-``` php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example1.xls';
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Advise the Reader to load all Worksheets **/
-$reader->setLoadAllSheets();
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
-```
-
-See `samples/Reader/06_Simple_file_reader_loading_all_worksheets.php` for a
-working example of this code.
-
-Reading Only Named WorkSheets from a File applies to Readers:
-
-Reader | Y/N |Reader | Y/N |Reader | Y/N |
-----------|:---:|--------|:---:|--------------|:---:|
-Xlsx | YES | Xls | YES | Xml | YES |
-Ods | YES | SYLK | NO | Gnumeric | YES |
-CSV | NO | HTML | NO
-
-### Reading Only Specific Columns and Rows from a File (Read Filters)
-
-If you are only interested in reading part of a worksheet, then you can
-write a filter class that identifies whether or not individual cells
-should be read by the loader. A read filter must implement the
-`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter` interface, and contain a
-`readCell()` method that accepts arguments of `$column`, `$row` and
-`$worksheetName`, and return a boolean true or false that indicates
-whether a workbook cell identified by those arguments should be read or
-not.
-
-``` php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example1.xls';
-$sheetname = 'Data Sheet #3';
-
-/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
-class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
-{
- public function readCell($column, $row, $worksheetName = '') {
- // Read rows 1 to 7 and columns A to E only
- if ($row >= 1 && $row <= 7) {
- if (in_array($column,range('A','E'))) {
- return true;
- }
- }
- return false;
- }
-}
-
-/** Create an Instance of our Read Filter **/
-$filterSubset = new MyReadFilter();
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Tell the Reader that we want to use the Read Filter **/
-$reader->setReadFilter($filterSubset);
-/** Load only the rows and columns that match our filter to Spreadsheet **/
-$spreadsheet = $reader->load($inputFileName);
-```
-
-See `samples/Reader/09_Simple_file_reader_using_a_read_filter.php` for a
-working example of this code.
-
-This example is not particularly useful, because it can only be used in
-a very specific circumstance (when you only want cells in the range
-A1:E7 from your worksheet. A generic Read Filter would probably be more
-useful:
-
-``` php
-/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
-class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
-{
- private $startRow = 0;
- private $endRow = 0;
- private $columns = [];
-
- /** Get the list of rows and columns to read */
- public function __construct($startRow, $endRow, $columns) {
- $this->startRow = $startRow;
- $this->endRow = $endRow;
- $this->columns = $columns;
- }
-
- public function readCell($column, $row, $worksheetName = '') {
- // Only read the rows and columns that were configured
- if ($row >= $this->startRow && $row <= $this->endRow) {
- if (in_array($column,$this->columns)) {
- return true;
- }
- }
- return false;
- }
-}
-
-/** Create an Instance of our Read Filter, passing in the cell range **/
-$filterSubset = new MyReadFilter(9,15,range('G','K'));
-```
-
-See `samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php`
-for a working example of this code.
-
-This can be particularly useful for conserving memory, by allowing you
-to read and process a large workbook in "chunks": an example of this
-usage might be when transferring data from an Excel worksheet to a
-database.
-
-``` php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example2.xls';
-
-/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
-class ChunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
-{
- private $startRow = 0;
- private $endRow = 0;
-
- /** Set the list of rows that we want to read */
- public function setRows($startRow, $chunkSize) {
- $this->startRow = $startRow;
- $this->endRow = $startRow + $chunkSize;
- }
-
- public function readCell($column, $row, $worksheetName = '') {
- // Only read the heading row, and the configured rows
- if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) {
- return true;
- }
- return false;
- }
-}
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-
-/** Define how many rows we want to read for each "chunk" **/
-$chunkSize = 2048;
-/** Create a new Instance of our Read Filter **/
-$chunkFilter = new ChunkReadFilter();
-
-/** Tell the Reader that we want to use the Read Filter **/
-$reader->setReadFilter($chunkFilter);
-
-/** Loop to read our worksheet in "chunk size" blocks **/
-for ($startRow = 2; $startRow <= 65536; $startRow += $chunkSize) {
- /** Tell the Read Filter which rows we want this iteration **/
- $chunkFilter->setRows($startRow,$chunkSize);
- /** Load only the rows that match our filter **/
- $spreadsheet = $reader->load($inputFileName);
- // Do some processing here
-}
-```
-
-See `samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_`
-for a working example of this code.
-
-Using Read Filters applies to:
-
-Reader | Y/N |Reader | Y/N |Reader | Y/N |
-----------|:---:|--------|:---:|--------------|:---:|
-Xlsx | YES | Xls | YES | Xml | YES |
-Ods | YES | SYLK | NO | Gnumeric | YES |
-CSV | YES | HTML | NO | | |
-
-### Combining Multiple Files into a Single Spreadsheet Object
-
-While you can limit the number of worksheets that are read from a
-workbook file using the `setLoadSheetsOnly()` method, certain readers also
-allow you to combine several individual "sheets" from different files
-into a single `Spreadsheet` object, where each individual file is a
-single worksheet within that workbook. For each file that you read, you
-need to indicate which worksheet index it should be loaded into using
-the `setSheetIndex()` method of the `$reader`, then use the
-`loadIntoExisting()` method rather than the `load()` method to actually read
-the file into that worksheet.
-
-``` php
-$inputFileType = 'Csv';
-$inputFileNames = [
- './sampleData/example1.csv',
- './sampleData/example2.csv'
- './sampleData/example3.csv'
-];
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-
-/** Extract the first named file from the array list **/
-$inputFileName = array_shift($inputFileNames);
-/** Load the initial file to the first worksheet in a `Spreadsheet` Object **/
-$spreadsheet = $reader->load($inputFileName);
-/** Set the worksheet title (to the filename that we've loaded) **/
-$spreadsheet->getActiveSheet()
- ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
-
-/** Loop through all the remaining files in the list **/
-foreach($inputFileNames as $sheet => $inputFileName) {
- /** Increment the worksheet index pointer for the Reader **/
- $reader->setSheetIndex($sheet+1);
- /** Load the current file into a new worksheet in Spreadsheet **/
- $reader->loadIntoExisting($inputFileName,$spreadsheet);
- /** Set the worksheet title (to the filename that we've loaded) **/
- $spreadsheet->getActiveSheet()
- ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
-}
-```
-
-See `samples/Reader/13_Simple_file_reader_for_multiple_CSV_files.php` for a
-working example of this code.
-
-Note that using the same sheet index for multiple sheets won't append
-files into the same sheet, but overwrite the results of the previous
-load. You cannot load multiple CSV files into the same worksheet.
-
-Combining Multiple Files into a Single Spreadsheet Object applies to:
-
-Reader | Y/N |Reader | Y/N |Reader | Y/N |
-----------|:---:|--------|:---:|--------------|:---:|
-Xlsx | NO | Xls | NO | Xml | NO |
-Ods | NO | SYLK | YES | Gnumeric | NO |
-CSV | YES | HTML | NO
-
-### Combining Read Filters with the `setSheetIndex()` method to split a large CSV file across multiple Worksheets
-
-An Xls BIFF .xls file is limited to 65536 rows in a worksheet, while the
-Xlsx Microsoft Office Open XML SpreadsheetML .xlsx file is limited to
-1,048,576 rows in a worksheet; but a CSV file is not limited other than
-by available disk space. This means that we wouldn’t ordinarily be able
-to read all the rows from a very large CSV file that exceeded those
-limits, and save it as an Xls or Xlsx file. However, by using Read
-Filters to read the CSV file in "chunks" (using the ChunkReadFilter
-Class that we defined in [the above section](#reading-only-specific-columns-and-rows-from-a-file-read-filters),
-and the `setSheetIndex()` method of the `$reader`, we can split the CSV
-file across several individual worksheets.
-
-``` php
-$inputFileType = 'Csv';
-$inputFileName = './sampleData/example2.csv';
-
-echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'- -This block contains an italicized word; -while this block uses an underline. - -
-
-I want to eat healthy food pizza.
-
-';
-
-$html2 = '
-
- 100°C is a hot temperature
-
-
-
- 10°F is cold
-
-