Skip to content

Commit

Permalink
Merge pull request #51 from 2amigos/feature/refactor_to_support_bacon…
Browse files Browse the repository at this point in the history
…_barcode_2

Feature/refactor to support bacon barcode 2
  • Loading branch information
sJonatas authored Aug 19, 2023
2 parents 6ffc3f7 + f0d8636 commit ca17260
Show file tree
Hide file tree
Showing 135 changed files with 2,026 additions and 1,570 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: tests
on: [push]

jobs:
test:
name: PHPUnit
runs-on: ubuntu-latest

steps:
- name: checkout repo
uses: actions/checkout@v3

- name: setup enviroment
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'

- name: Install dependencies
run: composer install

- name: Run unit tests
run: ./vendor/bin/codecept run --coverage --coverage-xml ./coverage.xml

#- name: Upload coverage reports to Codacy
# uses: codacy/codacy-coverage-reporter-action@v1
# with:
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# coverage-reports: ./tests/_output/coverage.xml
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ tests/_output/*
codeception.yml

# Code Style Checkers and Mess Detectors
/phpcs.xml
/.php_cs.cache
/.php_cs

Expand All @@ -55,3 +54,6 @@ codeception.yml

# composer.lock
composer.lock

/xdebug
/tools
1 change: 1 addition & 0 deletions .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"8.1.6","version":"3.23.0:v3.23.0#35af3cbbacfa91e164b252a28ec0b644f1ed4e78","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_typehint":true,"curly_braces_position":{"allow_single_line_empty_anonymous_classes":true},"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"strict_param":true,"array_syntax":{"syntax":"short"}},"hashes":{"src\\Action\\QrCodeAction.php":"ef123ab6a58232f90dc272594d5745cc","src\\Component\\QrCodeComponent.php":"8f3721ea5781622c792cfe4d0f70ca59","src\\Contracts\\ErrorCorrectionLevelInterface.php":"07241d9c8d89736f62df8bb7a8bea2f9","src\\Contracts\\FormatInterface.php":"b03028ecc9f4ed971e527e77c8856f30","src\\Contracts\\LabelInterface.php":"8f435e17a0f5c42dfc0d0c56a3566b8c","src\\Contracts\\QrCodeInterface.php":"7a88281c3ab503c201f6f9090ffa0c6a","src\\Contracts\\WriterInterface.php":"14619c748d753532c170309d2eac89d4","src\\Exception\\BadMethodCallException.php":"845b5c0e21a150daa4714d4255b246fd","src\\Exception\\Exception.php":"528a5f2abf50f2068401b4413d586825","src\\Exception\\InvalidCallException.php":"a3e1f90df08c54f6302087ee9f038716","src\\Exception\\InvalidConfigException.php":"8963341ec4f5578dca37e60dd8a02e20","src\\Exception\\InvalidPathException.php":"f1925e364b8eb48c7eeeac344d1c5d6d","src\\Exception\\UnknownMethodException.php":"d66e8937d55fdff573d79f0330344a73","src\\Exception\\UnknownPropertyException.php":"bb89494f619543b41cccc2dbd1053a0f","src\\Exception\\UnknownWriterException.php":"809b314c9eab12257df1841da4cad9a0","src\\Exception\\ValidationException.php":"314ef7fb79197c751c19a067b0a38410","src\\Factory\\WriterFactory.php":"d8c1ebfddfd8a0798d5eafb16ffeb92c","src\\Format\\AbstractFormat.php":"315b4ca59f950b508f278891a2a15d9e","src\\Format\\BookMarkFormat.php":"b61b23e02f73b49c2d201812ff22474a","src\\Format\\BtcFormat.php":"cac350377fa10599c737cc3eab433171","src\\Format\\GeoFormat.php":"61ecb2cd8a5350276d5d647cf46ce508","src\\Format\\iCalFormat.php":"5ce2add8f753d722027a38804deb05bb","src\\Format\\MailMessageFormat.php":"df59ca1f8c70e6bc9c1840fa82b74da6","src\\Format\\MailToFormat.php":"8ffd2abad885029de85a8332978439b6","src\\Format\\MeCardFormat.php":"dd17e0ccb06231855bf7b9a2b45327dc","src\\Format\\MmsFormat.php":"cfc1ce131510fe813de0152020b3efde","src\\Format\\PhoneFormat.php":"6fc60b3b3d78ac2b49bdad3d4a2c2310","src\\Format\\SmsFormat.php":"34a7ac23163cb9d9379e7d4ac9e1c216","src\\Format\\vCardFormat.php":"7e0d1b8713c8df44ec9b0a7d941e0ae4","src\\Format\\WifiFormat.php":"3cea15d37ccfbe205d7840d54163fb51","src\\Format\\YoutubeFormat.php":"b12a3b9cd4fd92148bb1de19e80d66d5","src\\Label.php":"63a9e611a42c100351e44446e998fc44","src\\QrCode.php":"835a25cb70d070804d4df180466df9e8","src\\Traits\\EmailTrait.php":"d5fe1fff3b672eb870c75e68b0b97c26","src\\Traits\\ImageTrait.php":"1d5d0e2409067ee285f37fc6f6cb0da1","src\\Traits\\UrlTrait.php":"dd407abfa0be96aa9723b9b953f6f1e0","src\\Writer\\AbstractWriter.php":"67779e8cb0278c4f4211fd5fc9bed211","src\\Writer\\EpsWriter.php":"92cdeafb621136f7b8f51339c0102383","src\\Writer\\JpgWriter.php":"c7d9b2075e4dcd3bc5b0cd5f0de667f2","src\\Writer\\PngWriter.php":"4b3dfde0c7444e7276d7d34b6b0f2bd1","src\\Writer\\SvgWriter.php":"f760475571b52495bf53db117c4fe0d3"}}
19 changes: 19 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('tests')
->exclude('tools')
->exclude('docs')
->exclude('resources')
->exclude('.github')
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
->in(__DIR__)
;

$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
'strict_param' => true,
'array_syntax' => ['syntax' => 'short'],
])
->setFinder($finder);
10 changes: 5 additions & 5 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
$header = <<<'EOF'
This file is part of the 2amigos/yii2-qrcode-component project.
This file is part of the 2amigos/qrcode-library project.
(c) 2amigOS! <http://2amigos.us/>
(c) 2amigOS! <http://2am.tech/>
For the full copyright and license information, please view
the LICENSE file that was distributed with this source code.
Expand All @@ -15,13 +15,13 @@ $finder = PhpCsFixer\Finder::create()
'temp',
'tests',
'vendor',
'xdebug',
])
->in(__DIR__);

return PhpCsFixer\Config::create()
->setRules(array(
'@PSR1' => true,
'@PSR2' => true,
'@PSR12' => true,
'header_comment' => ['header' => $header],
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
Expand All @@ -42,7 +42,7 @@ $finder = PhpCsFixer\Finder::create()
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'phpdoc_align' => true
'phpdoc_align' => false

))
->setFinder($finder);
39 changes: 29 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,44 @@
# faster builds on new travis setup not using sudo
sudo: false

language: php

php:
- 5.6
- 7.0
- 7.1
- 7.3

env:
- COMPOSER_MEMORY_LIMIT=-1
cache:
directories:
- vendor
- $HOME/.composer/cache

install:
- composer self-update
- composer global require "fxp/composer-asset-plugin:^1.3"
- composer install
- travis_retry composer self-update && composer --version
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- travis_retry composer install --prefer-dist --no-interaction

before_script:
- travis_retry composer self-update
- travis_retry composer install --no-interaction --prefer-source --dev
- php -r "echo INTL_ICU_VERSION . \"\n\";"
- php -r "echo INTL_ICU_DATA_VERSION . \"\n\";"

# enable code coverage on PHP 7.3, only one PHP version needs to generate coverage data
- |
if [ $TRAVIS_PHP_VERSION = '7.3' ]; then
CODECEPTION_FLAGS="--coverage-xml"
fi
script:
- phpunit --coverage-text --coverage-clover=coverage.clover
- composer validate --no-check-lock
- vendor/bin/codecept run $CODECEPTION_FLAGS

notifications:
email:
- [email protected]

after_script:
- php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
- |
if [ $TRAVIS_PHP_VERSION = '7.3' ]; then
travis_retry wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml
fi
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# CHANGELOG

## 1.1.1 - Work in progress
## 1.1.3 - Work in progress
- Fix #24: MeCard does not allow line breaks (Thoulah)

## 1.1.1-2 - August 25, 2017
- Enh: Ported PHPUnit tests to Codeception (tonydspaniard)
- Enh: Remove Yii2 dependencies for all classes but those made for Yii2 (tonydspaniard)

## 1.1.0 - August 24, 2017
- Enh #18: Initial new release. Total refactor (tonydspaniard)
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ We accept contributions via Pull Requests on [Github](https://github.com/2amigos

## Pull Requests

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
- **[PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.

- **Create feature branches** - Don't ask us to pull from your master branch.
- **Create feature branches** - Don't ask us to pull from your master branch.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.


## Running Tests

``` bash
$ phpunit
$ ./vendor/bin/codecept run
```


Expand Down
20 changes: 10 additions & 10 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Copyright (c) 2013-2015, 2amigOS! Consulting Group LLC.
> contributors may be used to endorse or promote products derived from
> this software without specific prior written permission.
>
>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 HOLDER 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.
> 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 HOLDER 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.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ QrCode Library

[![Latest Version](https://img.shields.io/github/tag/2amigos/qrcode-library.svg?style=flat-square&label=release)](https://github.com/2amigos/qrcode-library/tags)
[![Software License](https://img.shields.io/badge/license-BSD-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/2amigos/qrcode-library/master.svg?style=flat-square)](https://travis-ci.org/2amigos/qrcode-library)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/2amigos/qrcode-library.svg?style=flat-square)](https://scrutinizer-ci.com/g/2amigos/qrcode-library/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/2amigos/qrcode-library.svg?style=flat-square)](https://scrutinizer-ci.com/g/2amigos/qrcode-library)
[![Total Downloads](https://img.shields.io/packagist/dt/2amigos/qrcode-library.svg?style=flat-square)](https://packagist.org/packages/2amigos/qrcode-library)
[![tests](https://github.com/2amigos/qrcode-library/actions/workflows/ci.yml/badge.svg)](https://github.com/2amigos/qrcode-library/actions/workflows/ci.yml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/b61a5b723c0d4799aedbb9150d4d544c)](https://app.codacy.com/gh/2amigos/qrcode-library/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[![Total Downloads](https://img.shields.io/packagist/dt/2amigos/qrcode-library.svg)](https://packagist.org/packages/2amigos/qrcode-library)


This library allows developers to generate QR codes with ease. It works standalone and also provides Yii2 components for
its use on the framework.
Expand All @@ -32,7 +32,7 @@ Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
The BSD License (BSD). Please see [License File](LICENSE.md) for more information.


> [![2amigOS!](http://www.gravatar.com/avatar/55363394d72945ff7ed312556ec041e0.png)](http://www.2amigos.us)
> [![2amigOS!](http://www.gravatar.com/avatar/55363394d72945ff7ed312556ec041e0.png)](https://2amigos.us)
<i>Web development has never been so fun!</i>
[www.2amigos.us](http://www.2amigos.us)
[www.2am.tech](https://2am.tech)
24 changes: 24 additions & 0 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
bootstrap: _bootstrap.php
settings:
colors: true
memory_limit: 1024M
actor_suffix: Tester
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
Yii2:
configFile: 'tests/_app/config/test.php'
cleanup: false
coverage:
enabled: true
whitelist:
include:
- src/*
39 changes: 28 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,56 @@
{
"name": "2amigos/qrcode-library",
"description": "QrCode Generator",
"type": "yii2-extension",
"type": "library",
"keywords": [
"2amigos",
"yii",
"yii2",
"yii 2",
"extension",
"component",
"qrcode",
"qr"
],
"homepage": "http://www.2amigos.us/open-source/details/qrcode-library",
"homepage": "https://2am.tech/our-work/open-source/qrcode-library",
"license": "BSD-3-Clause",
"authors": [
{
"name": "2amigOS! Consulting Group",
"email": "[email protected]",
"homepage": "http://2amigos.us",
"homepage": "https://2am.tech",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/2amigos/qrcode-library/issues",
"source": "https://github.com/2amigos/qrcode-library"
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=5.6",
"php": ">=7.3",
"ext-gd": "*",
"bacon/bacon-qr-code": "^1.0",
"ext-simplexml": "*",
"bacon/bacon-qr-code": "^2.0",
"khanamiryan/qrcode-detector-decoder": "^1.0"
},
"require-dev": {
"yiisoft/yii2": "*",
"phpunit/phpunit": "5.*",
"roave/security-advisories": "dev-master",
"friendsofphp/php-cs-fixer": "^2.3",
"scrutinizer/ocular": "~1.1"
"scrutinizer/ocular": "~1.1",
"squizlabs/php_codesniffer": "*",
"phpmd/phpmd": "@stable",
"codeception/specify": "^0.4.3",
"codeception/verify": "^0.3.1",
"codeception/codeception": "*",
"yiisoft/yii2": "^2.0",
"codeception/module-filesystem": "^1.0",
"codeception/module-yii2": "^1.0",
"codeception/module-asserts": "^1.1"
},
"autoload": {
"psr-4": {
Expand All @@ -49,5 +61,10 @@
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"config": {
"allow-plugins": {
"yiisoft/yii2-composer": true
}
}
}
2 changes: 1 addition & 1 deletion docs/contributing/clean-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ We are using `PHPUnit` for testing the module. Do the following:
- Run `./vendor/bin/phpunit`


© [2amigos](http://www.2amigos.us/) 2013-2017
© [2amigos](https://2am.tech/) 2013-2023
2 changes: 1 addition & 1 deletion docs/contributing/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ All contributions should follow our [templates guidelines](https://github.com/2a
- Follow the guidelines at [Clean Code](clean-code.md)


© [2amigos](http://www.2amigos.us/) 2013-2017
© [2amigos](https://2am.tech/) 2013-2023
2 changes: 1 addition & 1 deletion docs/formats/bitcoin.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ echo $qrCode->writeString();

```

© [2amigos](http://www.2amigos.us/) 2013-2017
© [2amigos](https://2am.tech/) 2013-2023
Loading

0 comments on commit ca17260

Please sign in to comment.