From 2769aae5c9789c55576a60ba5c81dd55ff13d811 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 11:59:19 +0200 Subject: [PATCH 01/10] Renamed README.md --- Readme.md => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Readme.md => README.md (100%) diff --git a/Readme.md b/README.md similarity index 100% rename from Readme.md rename to README.md From 693dc13c9fdb421655f3b1fcbc912d86b75ea6de Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 12:03:57 +0200 Subject: [PATCH 02/10] Added dependabot --- .github/dependabot.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e1818d4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 + target-branch: dev +- package-ecosystem: composer + directory: "/" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 + target-branch: dev From 51cd501ed5ccb4a3629a8d8d9214a0693c7ccb93 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 12:04:14 +0200 Subject: [PATCH 03/10] Added template for PR --- .github/PULL_REQUEST_TEMPLATE.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..fffa067 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,19 @@ + + +| Questions | Answers +| ------------- | ------------------------------------------------------- +| Description? | Please be specific when describing the PR.
Every detail helps: versions, browser/server configuration, specific module/theme, etc. Feel free to add more information below this table. +| Type? | bug fix / improvement / new feature / refacto / critical +| BC breaks? | yes / no +| Deprecations? | yes / no +| Fixed ticket? | Fixes PrestaShop/PrestaShop#{issue number here}. +| How to test? | Please indicate how to best verify that this PR is correct. + + From 9634eeb4808778ee3004c01c8229fabf9a69f973 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 12:04:34 +0200 Subject: [PATCH 04/10] Improved Release Drafter --- .github/release-drafter.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index d41a75e..7209621 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,9 +1,15 @@ -change-template: '- $TITLE (#$NUMBER)' +branches: + - master +name-template: v$NEXT_PATCH_VERSION +tag-template: v$NEXT_PATCH_VERSION +categories: + - title: 🚀 Improvements + label: enhancement + - title: 🐛 Bug Fixes + label: bug +change-template: '- #$NUMBER: $TITLE by @$AUTHOR' template: | - ## Changelog + # Changes - $CHANGES - - ### Contributors - - $CONTRIBUTORS + $CHANGES + From 50b086c3c092c71aed0c69f3d2ed4dd3ee9f9968 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 12:14:52 +0200 Subject: [PATCH 05/10] Added Workflow Build Release --- .github/workflows/build-release.yml | 62 +++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/build-release.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..39247cd --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,62 @@ +name: Build +on: [push, pull_request] + +jobs: + deploy: + name: build dependencies & create artifact + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Install composer dependencies + run: composer install --no-dev -o + - name: Clean-up project + uses: PrestaShopCorp/github-action-clean-before-deploy@v1.0 + - name: Prepare auto-index tool + run: | + composer global require prestashop/autoindex + - name: Generate index.php + run: | + ~/.composer/vendor/bin/autoindex + - name: Create & upload artifact + uses: actions/upload-artifact@v1 + with: + name: ${{ github.event.repository.name }} + path: ../ + update_release_draft: + runs-on: ubuntu-latest + needs: [deploy] + if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' + steps: + - name: Download artifact + uses: actions/download-artifact@v1 + with: + name: ${{ github.event.repository.name }} + - id: release_info + uses: toolmantim/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Prepare for Release + run: | + cd ${{ github.event.repository.name }} + zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }} + - name: Clean existing assets + shell: bash + run: | + curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 + assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'` + for asset in $assets + do + bin/hub api -X DELETE $asset + done + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish to GitHub Release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.release_info.outputs.upload_url }} + asset_path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}.zip + asset_name: ${{ github.event.repository.name }}.zip + asset_content_type: application/zip \ No newline at end of file From c0acbd0cbf31169f2c312daa995b7c5fa32802cd Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 12:24:33 +0200 Subject: [PATCH 06/10] Improved Composer --- composer.json | 13 +- composer.lock | 1067 ++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 840 insertions(+), 240 deletions(-) diff --git a/composer.json b/composer.json index 35b4e3c..06761ca 100644 --- a/composer.json +++ b/composer.json @@ -14,21 +14,24 @@ "ext-json": "*" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.12", + "prestashop/php-dev-tools": "^3.4", "phpunit/phpunit": "~5.7", "mockery/mockery": "^1.2", "symfony/phpunit-bridge": "^3.4", "symfony/debug": "^3.4" }, "config": { + "preferred-install": "dist", + "classmap-authoritative": true, + "optimize-autoloader": true, + "prepend-autoloader": false, "platform": { "php": "5.6.0" - }, - "preferred-install": "dist" + } }, "scripts": { - "cs-fix": "@php ./vendor/bin/php-cs-fixer fix .", - "cs-fix-test": "@php ./vendor/bin/php-cs-fixer fix --diff --dry-run --stop-on-violation --show-progress=dot .", + "cs-fix": "@php ./vendor/bin/php-cs-fixer fix", + "cs-fix-test": "@php ./vendor/bin/php-cs-fixer fix --diff --dry-run --stop-on-violation --show-progress=dot", "test": "SYMFONY_PHPUNIT_VERSION=5.7 php ./vendor/bin/simple-phpunit" }, "type": "prestashop-module" diff --git a/composer.lock b/composer.lock index ecd1ecc..4df42fb 100644 --- a/composer.lock +++ b/composer.lock @@ -1,37 +1,37 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "131b28f9d268824ab29ea416d459c213", + "content-hash": "1a261d9b4b09a001dd7997341f50a442", "packages": [], "packages-dev": [ { "name": "composer/semver", - "version": "1.5.0", + "version": "3.2.4", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" + "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", + "url": "https://api.github.com/repos/composer/semver/zipball/a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", + "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + "phpstan/phpstan": "^0.12.54", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -67,28 +67,48 @@ "validation", "versioning" ], - "time": "2019-03-19T17:25:45+00:00" + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.2.4" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-11-13T08:59:24+00:00" }, { "name": "composer/xdebug-handler", - "version": "1.3.3", + "version": "1.4.6", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f" + "reference": "f27e06cd9675801df441b3656569b328e04aa37c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/46867cbf8ca9fb8d60c506895449eb799db1184f", - "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f27e06cd9675801df441b3656569b328e04aa37c", + "reference": "f27e06cd9675801df441b3656569b328e04aa37c", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0", + "php": "^5.3.2 || ^7.0 || ^8.0", "psr/log": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpstan/phpstan": "^0.12.55", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "autoload": { @@ -106,12 +126,31 @@ "email": "john-stevenson@blueyonder.co.uk" } ], - "description": "Restarts a process without xdebug.", + "description": "Restarts a process without Xdebug.", "keywords": [ "Xdebug", "performance" ], - "time": "2019-05-27T17:52:04+00:00" + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/1.4.6" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2021-03-25T17:01:18+00:00" }, { "name": "doctrine/annotations", @@ -179,6 +218,10 @@ "docblock", "parser" ], + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/v1.4.0" + }, "time": "2017-02-24T16:22:25+00:00" }, { @@ -233,6 +276,10 @@ "constructor", "instantiate" ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/master" + }, "time": "2015-06-14T21:17:01+00:00" }, { @@ -293,31 +340,35 @@ "parser", "php" ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/1.0.2" + }, "time": "2019-06-08T11:03:04+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.16.4", + "version": "v2.18.4", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "1023c3458137ab052f6ff1e09621a721bfdeca13" + "reference": "06f764e3cb6d60822d8f5135205f9d32b5508a31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/1023c3458137ab052f6ff1e09621a721bfdeca13", - "reference": "1023c3458137ab052f6ff1e09621a721bfdeca13", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/06f764e3cb6d60822d8f5135205f9d32b5508a31", + "reference": "06f764e3cb6d60822d8f5135205f9d32b5508a31", "shasum": "" }, "require": { - "composer/semver": "^1.4", + "composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/xdebug-handler": "^1.2", "doctrine/annotations": "^1.2", "ext-json": "*", "ext-tokenizer": "*", - "php": "^5.6 || ^7.0", + "php": "^5.6 || ^7.0 || ^8.0", "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "symfony/console": "^3.4.43 || ^4.1.6 || ^5.0", "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", "symfony/finder": "^3.0 || ^4.0 || ^5.0", @@ -328,17 +379,19 @@ "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" }, "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.2", + "keradus/cli-executor": "^1.4", "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.1", + "php-coveralls/php-coveralls": "^2.4.2", "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", - "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^5.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpspec/prophecy-phpunit": "^1.1 || ^2.0", + "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.13 || ^9.5", + "phpunitgoodpractices/polyfill": "^1.5", + "phpunitgoodpractices/traits": "^1.9.1", + "sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1", + "symfony/phpunit-bridge": "^5.2.1", "symfony/yaml": "^3.0 || ^4.0 || ^5.0" }, "suggest": { @@ -366,6 +419,7 @@ "tests/Test/IntegrationCaseFactoryInterface.php", "tests/Test/InternalIntegrationCaseFactory.php", "tests/Test/IsIdenticalConstraint.php", + "tests/Test/TokensWithObservedTransformers.php", "tests/TestCase.php" ] }, @@ -384,24 +438,34 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2020-06-27T23:57:46+00:00" + "support": { + "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.4" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2021-03-20T14:52:33+00:00" }, { "name": "hamcrest/hamcrest-php", - "version": "v2.0.0", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad" + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad", - "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", "shasum": "" }, "require": { - "php": "^5.3|^7.0" + "php": "^5.3|^7.0|^8.0" }, "replace": { "cordoval/hamcrest-php": "*", @@ -409,14 +473,13 @@ "kodova/hamcrest-php": "*" }, "require-dev": { - "phpunit/php-file-iterator": "1.3.3", - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "^1.0" + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -426,40 +489,44 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD" + "BSD-3-Clause" ], "description": "This is the PHP port of Hamcrest Matchers", "keywords": [ "test" ], - "time": "2016-01-20T08:20:44+00:00" + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" + }, + "time": "2020-07-09T08:09:16+00:00" }, { "name": "mockery/mockery", - "version": "1.2.2", + "version": "1.3.4", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2" + "reference": "31467aeb3ca3188158613322d66df81cedd86626" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", - "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", + "url": "https://api.github.com/repos/mockery/mockery/zipball/31467aeb3ca3188158613322d66df81cedd86626", + "reference": "31467aeb3ca3188158613322d66df81cedd86626", "shasum": "" }, "require": { - "hamcrest/hamcrest-php": "~2.0", + "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" + "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -497,7 +564,11 @@ "test double", "testing" ], - "time": "2019-02-13T09:37:52+00:00" + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/1.3.4" + }, + "time": "2021-02-24T09:51:00+00:00" }, { "name": "myclabs/deep-copy", @@ -542,20 +613,79 @@ "object", "object graph" ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.x" + }, "time": "2017-10-19T19:58:43+00:00" }, + { + "name": "nikic/php-parser", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v3.1.5" + }, + "time": "2018-02-28T20:30:58+00:00" + }, { "name": "paragonie/random_compat", - "version": "v2.0.18", + "version": "v2.0.19", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db" + "reference": "446fc9faa5c2a9ddf65eb7121c0af7e857295241" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", - "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/446fc9faa5c2a9ddf65eb7121c0af7e857295241", + "reference": "446fc9faa5c2a9ddf65eb7121c0af7e857295241", "shasum": "" }, "require": { @@ -591,27 +721,32 @@ "pseudorandom", "random" ], - "time": "2019-01-03T20:59:08+00:00" + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "time": "2020-10-15T10:06:57+00:00" }, { "name": "php-cs-fixer/diff", - "version": "v1.3.0", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" + "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/dbd31aeb251639ac0b9e7e29405c1441907f5759", + "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^5.6 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0", "symfony/process": "^3.3" }, "type": "library", @@ -625,14 +760,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, { "name": "SpacePossum" } @@ -642,7 +777,11 @@ "keywords": [ "diff" ], - "time": "2018-02-15T16:58:55+00:00" + "support": { + "issues": "https://github.com/PHP-CS-Fixer/diff/issues", + "source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1" + }, + "time": "2020-10-14T08:39:05+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -696,6 +835,10 @@ "reflection", "static analysis" ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master" + }, "time": "2017-09-11T18:02:19+00:00" }, { @@ -741,6 +884,10 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/3.x" + }, "time": "2017-11-10T14:09:06+00:00" }, { @@ -788,37 +935,41 @@ "email": "me@mikevanriel.com" } ], + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/master" + }, "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", - "version": "1.8.1", + "version": "v1.10.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" + "reference": "451c3cd1418cf640de218914901e51b064abb093" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", + "phpspec/phpspec": "^2.5 || ^3.2", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -851,7 +1002,11 @@ "spy", "stub" ], - "time": "2019-06-13T12:50:23+00:00" + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.10.3" + }, + "time": "2020-03-05T15:02:03+00:00" }, { "name": "phpunit/php-code-coverage", @@ -914,6 +1069,11 @@ "testing", "xunit" ], + "support": { + "irc": "irc://irc.freenode.net/phpunit", + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/4.0" + }, "time": "2017-04-02T07:44:40+00:00" }, { @@ -961,6 +1121,11 @@ "filesystem", "iterator" ], + "support": { + "irc": "irc://irc.freenode.net/phpunit", + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5" + }, "time": "2017-11-27T13:52:08+00:00" }, { @@ -1002,6 +1167,10 @@ "keywords": [ "template" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, "time": "2015-06-21T13:50:34+00:00" }, { @@ -1051,6 +1220,10 @@ "keywords": [ "timer" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/master" + }, "time": "2017-02-26T11:10:40+00:00" }, { @@ -1100,6 +1273,11 @@ "keywords": [ "tokenizer" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/1.4" + }, + "abandoned": true, "time": "2017-12-04T08:55:13+00:00" }, { @@ -1182,6 +1360,10 @@ "testing", "xunit" ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/5.7.27" + }, "time": "2018-02-01T05:50:59+00:00" }, { @@ -1241,21 +1423,121 @@ "mock", "xunit" ], + "support": { + "irc": "irc://irc.freenode.net/phpunit", + "issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues", + "source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/3.4" + }, "abandoned": true, "time": "2017-06-30T09:13:00+00:00" }, + { + "name": "prestashop/header-stamp", + "version": "v1.7", + "source": { + "type": "git", + "url": "https://github.com/PrestaShopCorp/header-stamp.git", + "reference": "d77ce6d0a7f066670a4774be88f05e5f07b4b6fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShopCorp/header-stamp/zipball/d77ce6d0a7f066670a4774be88f05e5f07b4b6fc", + "reference": "d77ce6d0a7f066670a4774be88f05e5f07b4b6fc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^3.1", + "php": ">=5.6", + "symfony/console": "^3.4 || ~4.0 || ~5.0", + "symfony/finder": "^3.4 || ~4.0 || ~5.0" + }, + "require-dev": { + "prestashop/php-dev-tools": "1.*" + }, + "bin": [ + "bin/header-stamp" + ], + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\HeaderStamp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AFL-3.0" + ], + "authors": [ + { + "name": "PrestaShop SA", + "email": "contact@prestashop.com" + } + ], + "description": "Rewrite your file headers to add the license or to make them up-to-date", + "homepage": "https://github.com/PrestaShopCorp/header-stamp", + "support": { + "issues": "https://github.com/PrestaShopCorp/header-stamp/issues", + "source": "https://github.com/PrestaShopCorp/header-stamp/tree/v1.7" + }, + "time": "2020-12-09T16:40:38+00:00" + }, + { + "name": "prestashop/php-dev-tools", + "version": "v3.15", + "source": { + "type": "git", + "url": "https://github.com/PrestaShop/php-dev-tools.git", + "reference": "1570fd43b0f5a8cfa105e6f2211c818c902951f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShop/php-dev-tools/zipball/1570fd43b0f5a8cfa105e6f2211c818c902951f0", + "reference": "1570fd43b0f5a8cfa105e6f2211c818c902951f0", + "shasum": "" + }, + "require": { + "friendsofphp/php-cs-fixer": "^2.14", + "php": ">=5.6.0", + "prestashop/header-stamp": "^1.0", + "squizlabs/php_codesniffer": "^3.4", + "symfony/console": "~3.2 || ~4.0 || ~5.0", + "symfony/filesystem": "~3.2 || ~4.0 || ~5.0" + }, + "conflict": { + "friendsofphp/php-cs-fixer": "2.18.3" + }, + "bin": [ + "bin/prestashop-coding-standards" + ], + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\CodingStandards\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PrestaShop coding standards", + "support": { + "issues": "https://github.com/PrestaShop/php-dev-tools/issues", + "source": "https://github.com/PrestaShop/php-dev-tools/tree/v3.15" + }, + "time": "2021-03-11T15:36:18+00:00" + }, { "name": "psr/log", - "version": "1.1.0", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, "require": { @@ -1264,7 +1546,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -1289,27 +1571,30 @@ "psr", "psr-3" ], - "time": "2018-11-20T15:27:04+00:00" + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.3" + }, + "time": "2020-03-23T09:12:05+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -1334,7 +1619,17 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:15:22+00:00" }, { "name": "sebastian/comparator", @@ -1398,6 +1693,10 @@ "compare", "equality" ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/1.2" + }, "time": "2017-01-29T09:50:25+00:00" }, { @@ -1450,6 +1749,10 @@ "keywords": [ "diff" ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/1.4" + }, "time": "2017-05-22T07:24:03+00:00" }, { @@ -1500,6 +1803,10 @@ "environment", "hhvm" ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/master" + }, "time": "2016-11-26T07:53:53+00:00" }, { @@ -1567,6 +1874,10 @@ "export", "exporter" ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/master" + }, "time": "2016-11-19T08:54:04+00:00" }, { @@ -1618,6 +1929,10 @@ "keywords": [ "global state" ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/1.1.1" + }, "time": "2015-10-12T03:26:01+00:00" }, { @@ -1664,6 +1979,10 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/master" + }, "time": "2017-02-18T15:18:39+00:00" }, { @@ -1717,6 +2036,10 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/master" + }, "time": "2016-11-19T07:33:16+00:00" }, { @@ -1759,6 +2082,10 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/master" + }, "time": "2015-07-28T20:34:47+00:00" }, { @@ -1802,20 +2129,80 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/master" + }, "time": "2016-10-03T07:35:21+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.5.8", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "9d583721a7157ee997f235f327de038e7ea6dac4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", + "reference": "9d583721a7157ee997f235f327de038e7ea6dac4", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2020-10-23T02:01:07+00:00" + }, { "name": "symfony/console", - "version": "v3.4.28", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6" + "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6", - "reference": "8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6", + "url": "https://api.github.com/repos/symfony/console/zipball/a10b1da6fc93080c180bba7219b5ff5b7518fe81", + "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81", "shasum": "" }, "require": { @@ -1845,11 +2232,6 @@ "symfony/process": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -1874,20 +2256,37 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-05-09T08:42:51+00:00" + "support": { + "source": "https://github.com/symfony/console/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/debug", - "version": "v3.4.28", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "671fc55bd14800668b1d0a3708c3714940e30a8c" + "reference": "ab42889de57fdfcfcc0759ab102e2fd4ea72dcae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/671fc55bd14800668b1d0a3708c3714940e30a8c", - "reference": "671fc55bd14800668b1d0a3708c3714940e30a8c", + "url": "https://api.github.com/repos/symfony/debug/zipball/ab42889de57fdfcfcc0759ab102e2fd4ea72dcae", + "reference": "ab42889de57fdfcfcc0759ab102e2fd4ea72dcae", "shasum": "" }, "require": { @@ -1901,11 +2300,6 @@ "symfony/http-kernel": "~2.8|~3.0|~4.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Debug\\": "" @@ -1930,20 +2324,37 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2019-05-18T13:32:47+00:00" + "support": { + "source": "https://github.com/symfony/debug/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.4.28", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a088aafcefb4eef2520a290ed82e4374092a6dff" + "reference": "31fde73757b6bad247c54597beef974919ec6860" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a088aafcefb4eef2520a290ed82e4374092a6dff", - "reference": "a088aafcefb4eef2520a290ed82e4374092a6dff", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/31fde73757b6bad247c54597beef974919ec6860", + "reference": "31fde73757b6bad247c54597beef974919ec6860", "shasum": "" }, "require": { @@ -1955,6 +2366,7 @@ "require-dev": { "psr/log": "~1.0", "symfony/config": "~2.8|~3.0|~4.0", + "symfony/debug": "~3.4|~4.4", "symfony/dependency-injection": "~3.3|~4.0", "symfony/expression-language": "~2.8|~3.0|~4.0", "symfony/stopwatch": "~2.8|~3.0|~4.0" @@ -1964,11 +2376,6 @@ "symfony/http-kernel": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" @@ -1993,20 +2400,37 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-04-02T08:51:52+00:00" + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.28", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "acf99758b1df8e9295e6b85aa69f294565c9fedb" + "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/acf99758b1df8e9295e6b85aa69f294565c9fedb", - "reference": "acf99758b1df8e9295e6b85aa69f294565c9fedb", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e58d7841cddfed6e846829040dca2cca0ebbbbb3", + "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3", "shasum": "" }, "require": { @@ -2014,11 +2438,6 @@ "symfony/polyfill-ctype": "~1.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" @@ -2043,31 +2462,43 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-02-04T21:34:32+00:00" + "support": { + "source": "https://github.com/symfony/filesystem/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/finder", - "version": "v3.4.28", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "fa5d962a71f2169dfe1cbae217fa5a2799859f6c" + "reference": "b6b6ad3db3edb1b4b1c1896b1975fb684994de6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/fa5d962a71f2169dfe1cbae217fa5a2799859f6c", - "reference": "fa5d962a71f2169dfe1cbae217fa5a2799859f6c", + "url": "https://api.github.com/repos/symfony/finder/zipball/b6b6ad3db3edb1b4b1c1896b1975fb684994de6e", + "reference": "b6b6ad3db3edb1b4b1c1896b1975fb684994de6e", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Finder\\": "" @@ -2092,31 +2523,43 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-05-24T12:25:55+00:00" + "support": { + "source": "https://github.com/symfony/finder/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-11-16T17:02:08+00:00" }, { "name": "symfony/options-resolver", - "version": "v3.4.28", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "ed3b397f9c07c8ca388b2a1ef744403b4d4ecc44" + "reference": "c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/ed3b397f9c07c8ca388b2a1ef744403b4d4ecc44", - "reference": "ed3b397f9c07c8ca388b2a1ef744403b4d4ecc44", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744", + "reference": "c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" @@ -2146,27 +2589,44 @@ "configuration", "options" ], - "time": "2019-04-10T16:00:48+00:00" + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/phpunit-bridge", - "version": "v3.4.28", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "a43a2f6c465a2d99635fea0addbebddc3864ad97" + "reference": "120273ad5d03a8deee08ca9260e2598f288f2bac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/a43a2f6c465a2d99635fea0addbebddc3864ad97", - "reference": "a43a2f6c465a2d99635fea0addbebddc3864ad97", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/120273ad5d03a8deee08ca9260e2598f288f2bac", + "reference": "120273ad5d03a8deee08ca9260e2598f288f2bac", "shasum": "" }, "require": { "php": ">=5.3.3" }, "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0|<6.4,>=6.0|9.1.2" }, "suggest": { "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" @@ -2176,9 +2636,6 @@ ], "type": "symfony-bridge", "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - }, "thanks": { "name": "phpunit/phpunit", "url": "https://github.com/sebastianbergmann/phpunit" @@ -2211,20 +2668,37 @@ ], "description": "Symfony PHPUnit Bridge", "homepage": "https://symfony.com", - "time": "2019-04-16T09:03:16+00:00" + "support": { + "source": "https://github.com/symfony/phpunit-bridge/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-11-13T16:28:59+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.11.0", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "82ebae02209c21113908c229e9883c419720738a" + "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", - "reference": "82ebae02209c21113908c229e9883c419720738a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b", + "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b", "shasum": "" }, "require": { @@ -2236,7 +2710,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -2252,13 +2730,13 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, { "name": "Gert de Pagter", "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", @@ -2269,20 +2747,37 @@ "polyfill", "portable" ], - "time": "2019-02-06T07:57:58+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T09:01:57+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.11.0", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" + "reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", - "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b5f7b932ee6fa802fc792eabd77c4c88084517ce", + "reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce", "shasum": "" }, "require": { @@ -2294,7 +2789,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -2328,20 +2827,37 @@ "portable", "shim" ], - "time": "2019-02-06T07:57:58+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.19.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T09:01:57+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.11.0", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "bc4858fb611bda58719124ca079baff854149c89" + "reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/bc4858fb611bda58719124ca079baff854149c89", - "reference": "bc4858fb611bda58719124ca079baff854149c89", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/3fe414077251a81a1b15b1c709faf5c2fbae3d4e", + "reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e", "shasum": "" }, "require": { @@ -2351,7 +2867,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -2387,20 +2907,37 @@ "portable", "shim" ], - "time": "2019-02-06T07:57:58+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-php70/tree/v1.19.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T09:01:57+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.11.0", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c" + "reference": "beecef6b463b06954638f02378f52496cb84bacc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/ab50dcf166d5f577978419edd37aa2bb8eabce0c", - "reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/beecef6b463b06954638f02378f52496cb84bacc", + "reference": "beecef6b463b06954638f02378f52496cb84bacc", "shasum": "" }, "require": { @@ -2409,7 +2946,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -2442,31 +2983,43 @@ "portable", "shim" ], - "time": "2019-02-06T07:57:58+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.19.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T09:01:57+00:00" }, { "name": "symfony/process", - "version": "v3.4.28", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "afe411c2a6084f25cff55a01d0d4e1474c97ff13" + "reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/afe411c2a6084f25cff55a01d0d4e1474c97ff13", - "reference": "afe411c2a6084f25cff55a01d0d4e1474c97ff13", + "url": "https://api.github.com/repos/symfony/process/zipball/b8648cf1d5af12a44a51d07ef9bf980921f15fca", + "reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Process\\": "" @@ -2491,31 +3044,43 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-05-22T12:54:11+00:00" + "support": { + "source": "https://github.com/symfony/process/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.4.28", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "2a651c2645c10bbedd21170771f122d935e0dd58" + "reference": "298b81faad4ce60e94466226b2abbb8c9bca7462" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/2a651c2645c10bbedd21170771f122d935e0dd58", - "reference": "2a651c2645c10bbedd21170771f122d935e0dd58", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/298b81faad4ce60e94466226b2abbb8c9bca7462", + "reference": "298b81faad4ce60e94466226b2abbb8c9bca7462", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Stopwatch\\": "" @@ -2540,20 +3105,37 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2019-01-16T09:39:14+00:00" + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.28", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "212a27b731e5bfb735679d1ffaac82bd6a1dc996" + "reference": "88289caa3c166321883f67fe5130188ebbb47094" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/212a27b731e5bfb735679d1ffaac82bd6a1dc996", - "reference": "212a27b731e5bfb735679d1ffaac82bd6a1dc996", + "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", + "reference": "88289caa3c166321883f67fe5130188ebbb47094", "shasum": "" }, "require": { @@ -2570,11 +3152,6 @@ "symfony/console": "For validating YAML files using the lint command" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" @@ -2599,36 +3176,51 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-03-25T07:48:46+00:00" + "support": { + "source": "https://github.com/symfony/yaml/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-24T10:57:07+00:00" }, { "name": "webmozart/assert", - "version": "1.4.0", + "version": "1.9.1", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + "url": "https://github.com/webmozarts/assert.git", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" + }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -2650,7 +3242,11 @@ "check", "validate" ], - "time": "2018-12-25T11:19:39+00:00" + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.9.1" + }, + "time": "2020-07-08T17:02:28+00:00" } ], "aliases": [], @@ -2665,5 +3261,6 @@ "platform-dev": [], "platform-overrides": { "php": "5.6.0" - } + }, + "plugin-api-version": "2.0.0" } From bc5e37dfa629d6899e6951944bcb4ee28beacc18 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 12:24:51 +0200 Subject: [PATCH 07/10] Added Workflow PHP --- .github/workflows/php.yml | 118 +++++++++++++++++++++++++++++ .php_cs.dist | 11 +++ tests/phpstan.sh | 28 +++++++ tests/phpstan/phpstan-1.7.1.2.neon | 2 + tests/phpstan/phpstan-1.7.2.5.neon | 2 + tests/phpstan/phpstan-1.7.3.4.neon | 2 + tests/phpstan/phpstan-1.7.4.4.neon | 2 + tests/phpstan/phpstan-1.7.5.1.neon | 2 + tests/phpstan/phpstan-1.7.6.9.neon | 2 + tests/phpstan/phpstan-1.7.7.3.neon | 2 + tests/phpstan/phpstan-latest.neon | 2 + tests/phpstan/phpstan.neon | 16 ++++ 12 files changed, 189 insertions(+) create mode 100644 .github/workflows/php.yml create mode 100644 .php_cs.dist create mode 100755 tests/phpstan.sh create mode 100644 tests/phpstan/phpstan-1.7.1.2.neon create mode 100644 tests/phpstan/phpstan-1.7.2.5.neon create mode 100644 tests/phpstan/phpstan-1.7.3.4.neon create mode 100644 tests/phpstan/phpstan-1.7.4.4.neon create mode 100644 tests/phpstan/phpstan-1.7.5.1.neon create mode 100644 tests/phpstan/phpstan-1.7.6.9.neon create mode 100644 tests/phpstan/phpstan-1.7.7.3.neon create mode 100644 tests/phpstan/phpstan-latest.neon create mode 100644 tests/phpstan/phpstan.neon diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..11e7002 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,118 @@ +name: PHP tests +on: [push, pull_request] +jobs: + # Check there is no syntax errors in the project + php-linter: + name: PHP Syntax check 5.6|7.2|7.3 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2.0.0 + + - name: PHP syntax checker 5.6 + uses: prestashop/github-action-php-lint/5.6@master + + - name: PHP syntax checker 7.2 + uses: prestashop/github-action-php-lint/7.2@master + + - name: PHP syntax checker 7.3 + uses: prestashop/github-action-php-lint/7.3@master + + # Check the PHP code follow the coding standards + php-cs-fixer: + name: PHP-CS-Fixer + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + + - name: Checkout + uses: actions/checkout@v2.0.0 + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: vendor + key: php-${{ hashFiles('composer.lock') }} + + - name: Install dependencies + run: composer install + + - name: Run PHP-CS-Fixer + run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --using-cache=no --diff-format udiff + + # Run PHPStan against the module and a PrestaShop release + phpstan: + name: PHPStan + runs-on: ubuntu-latest + strategy: + matrix: + presta-versions: ['1.7.1.2', '1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6.9', '1.7.7.3', 'latest'] + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + + - name: Checkout + uses: actions/checkout@v2.0.0 + + # Add vendor folder in cache to make next builds faster + - name: Cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: php-${{ hashFiles('composer.lock') }} + + # Add composer local folder in cache to make next builds faster + - name: Cache composer folder + uses: actions/cache@v1 + with: + path: ~/.composer/cache + key: php-composer-cache + + - run: composer install + + # Docker images prestashop/prestashop may be used, even if the shop remains uninstalled + - name: Execute PHPStan on PrestaShop (Tag ${{ matrix.presta-versions }}) + run: ./tests/phpstan.sh ${{ matrix.presta-versions }} + + phpunit: + name: PHPUnit + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + coverage: xdebug + + - name: Checkout + uses: actions/checkout@v2.0.0 + + # Add vendor folder in cache to make next builds faster + - name: Cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: php-${{ hashFiles('composer.lock') }} + + # Add composer local folder in cache to make next builds faster + - name: Cache composer folder + uses: actions/cache@v1 + with: + path: ~/.composer/cache + key: php-composer-cache + + - run: composer install + - run: composer run test + + - name: Upload coverage results to Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar + chmod +x php-coveralls.phar + php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv \ No newline at end of file diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 0000000..9830d6d --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,11 @@ +setUsingCache(true) + ->getFinder() + ->in(__DIR__) + ->exclude('vendor'); + +return $config; diff --git a/tests/phpstan.sh b/tests/phpstan.sh new file mode 100755 index 0000000..9896162 --- /dev/null +++ b/tests/phpstan.sh @@ -0,0 +1,28 @@ +#!/bin/bash +PS_VERSION=$1 + +set -e + +# Docker images prestashop/prestashop may be used, even if the shop remains uninstalled +echo "Pull PrestaShop files (Tag ${PS_VERSION})" + +docker rm -f temp-ps || true +docker volume rm -f ps-volume || true + +docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:$PS_VERSION + +# Clear previous instance of the module in the PrestaShop volume +echo "Clear previous module" + +docker exec -t temp-ps rm -rf /var/www/html/modules/gamification + +# Run a container for PHPStan, having access to the module content and PrestaShop sources. +# This tool is outside the composer.json because of the compatibility with PHP 5.6 +echo "Run PHPStan using phpstan-${PS_VERSION}.neon file" + +docker run --rm --volumes-from temp-ps \ + -v $PWD:/var/www/html/modules/gamification \ + -e _PS_ROOT_DIR_=/var/www/html \ + --workdir=/var/www/html/modules/gamification phpstan/phpstan:0.12 \ + analyse \ + --configuration=/var/www/html/modules/gamification/tests/phpstan/phpstan-$PS_VERSION.neon \ No newline at end of file diff --git a/tests/phpstan/phpstan-1.7.1.2.neon b/tests/phpstan/phpstan-1.7.1.2.neon new file mode 100644 index 0000000..c604f7c --- /dev/null +++ b/tests/phpstan/phpstan-1.7.1.2.neon @@ -0,0 +1,2 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon diff --git a/tests/phpstan/phpstan-1.7.2.5.neon b/tests/phpstan/phpstan-1.7.2.5.neon new file mode 100644 index 0000000..c604f7c --- /dev/null +++ b/tests/phpstan/phpstan-1.7.2.5.neon @@ -0,0 +1,2 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon diff --git a/tests/phpstan/phpstan-1.7.3.4.neon b/tests/phpstan/phpstan-1.7.3.4.neon new file mode 100644 index 0000000..c604f7c --- /dev/null +++ b/tests/phpstan/phpstan-1.7.3.4.neon @@ -0,0 +1,2 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon diff --git a/tests/phpstan/phpstan-1.7.4.4.neon b/tests/phpstan/phpstan-1.7.4.4.neon new file mode 100644 index 0000000..c604f7c --- /dev/null +++ b/tests/phpstan/phpstan-1.7.4.4.neon @@ -0,0 +1,2 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon diff --git a/tests/phpstan/phpstan-1.7.5.1.neon b/tests/phpstan/phpstan-1.7.5.1.neon new file mode 100644 index 0000000..c604f7c --- /dev/null +++ b/tests/phpstan/phpstan-1.7.5.1.neon @@ -0,0 +1,2 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon diff --git a/tests/phpstan/phpstan-1.7.6.9.neon b/tests/phpstan/phpstan-1.7.6.9.neon new file mode 100644 index 0000000..c604f7c --- /dev/null +++ b/tests/phpstan/phpstan-1.7.6.9.neon @@ -0,0 +1,2 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon diff --git a/tests/phpstan/phpstan-1.7.7.3.neon b/tests/phpstan/phpstan-1.7.7.3.neon new file mode 100644 index 0000000..c604f7c --- /dev/null +++ b/tests/phpstan/phpstan-1.7.7.3.neon @@ -0,0 +1,2 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon diff --git a/tests/phpstan/phpstan-latest.neon b/tests/phpstan/phpstan-latest.neon new file mode 100644 index 0000000..c604f7c --- /dev/null +++ b/tests/phpstan/phpstan-latest.neon @@ -0,0 +1,2 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon diff --git a/tests/phpstan/phpstan.neon b/tests/phpstan/phpstan.neon new file mode 100644 index 0000000..23ead80 --- /dev/null +++ b/tests/phpstan/phpstan.neon @@ -0,0 +1,16 @@ +includes: + - %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon + +parameters: + paths: + # From PHPStan 0.12, paths to check are relative to the neon file + - ../../gamification.php + - ../../sql_install.php + - ../../classes/ + - ../../controllers/ + - ../../data/ + - ../../tests/ + - ../../translations/ + - ../../upgrade/ + reportUnmatchedIgnoredErrors: false + level: 5 \ No newline at end of file From 5fc4b5cb6e236e252e5e16310b2f8d311cb5ade1 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 12:27:31 +0200 Subject: [PATCH 08/10] Removed Travis CI --- .travis.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9ba5f04..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -sudo: required -dist: trusty - -php: - - '5.6' - - '7.1' - - '7.2' - -env: - global: - - SYMFONY_DEPRECATIONS_HELPER=disabled - - SYMFONY_PHPUNIT_VERSION=5.7.27 - - allow_failures: - - php: 7.2 - -script: - - composer install - - composer cs-fix-test - - composer test - -notifications: - email: - on_success: never - on_failure: always From 1e7ba1415f981770d5ae056e0a23fee35d8d6fce Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 12:28:28 +0200 Subject: [PATCH 09/10] Fixed PHPCS --- classes/Advice.php | 57 +++--- classes/Badge.php | 42 ++-- classes/Condition.php | 176 ++++++++--------- classes/GamificationTools.php | 8 +- .../admin/AdminGamificationController.php | 119 ++++++------ controllers/index.php | 2 +- data/index.php | 8 +- de.php | 2 +- fr.php | 2 +- gamification.php | 179 +++++++++--------- index.php | 8 +- sql_install.php | 34 ++-- translations/cs.php | 2 +- translations/de.php | 2 +- translations/es.php | 2 +- translations/fr.php | 2 +- translations/index.php | 8 +- translations/it.php | 2 +- translations/pl.php | 2 +- translations/ru.php | 2 +- upgrade/install-1.4.9.php | 4 +- upgrade/install-1.6.6.php | 2 +- upgrade/install-1.7.3.php | 2 +- upgrade/install-1.7.7.php | 20 +- upgrade/install-1.8.9.php | 4 +- upgrade/install-2.3.2.php | 5 +- 26 files changed, 348 insertions(+), 348 deletions(-) diff --git a/classes/Advice.php b/classes/Advice.php index a9f10b6..f54bd0c 100644 --- a/classes/Advice.php +++ b/classes/Advice.php @@ -51,33 +51,33 @@ class Advice extends ObjectModel /** * @see ObjectModel::$definition */ - public static $definition = array( + public static $definition = [ 'table' => 'advice', 'primary' => 'id_advice', 'multilang' => true, - 'fields' => array( - 'id_ps_advice' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), - 'id_tab' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), - 'selector' => array('type' => self::TYPE_STRING), - 'location' => array('type' => self::TYPE_STRING), - 'validated' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), - 'start_day' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), - 'stop_day' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), - 'weight' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), + 'fields' => [ + 'id_ps_advice' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], + 'id_tab' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], + 'selector' => ['type' => self::TYPE_STRING], + 'location' => ['type' => self::TYPE_STRING], + 'validated' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'], + 'start_day' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], + 'stop_day' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], + 'weight' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], // Lang fields - 'html' => array('type' => self::TYPE_HTML, 'lang' => true, 'required' => true, 'validate' => 'isString'), - ), - ); + 'html' => ['type' => self::TYPE_HTML, 'lang' => true, 'required' => true, 'validate' => 'isString'], + ], + ]; public static function getIdByIdPs($id_ps_advice) { $query = new DbQuery(); $query->select('id_advice'); $query->from('advice', 'b'); - $query->where('`id_ps_advice` = '.(int)$id_ps_advice); + $query->where('`id_ps_advice` = ' . (int) $id_ps_advice); - return (int)Db::getInstance()->getValue($query); + return (int) Db::getInstance()->getValue($query); } /** @@ -86,6 +86,7 @@ public static function getIdByIdPs($id_ps_advice) * @param bool $includeAddons [default=false] True to include Addons as well * * @return array[] + * * @throws PrestaShopDatabaseException */ public static function getValidatedByIdTab($idTab, $includePremium = false, $includeAddons = false) @@ -94,11 +95,11 @@ public static function getValidatedByIdTab($idTab, $includePremium = false, $inc $query->select('a.`id_ps_advice`, a.`selector`, a.`location`, al.`html`, a.`weight`'); $query->from('advice', 'a'); $query->join(' - LEFT JOIN `'._DB_PREFIX_.'advice_lang` al ON al.`id_advice` = a.`id_advice` - LEFT JOIN `'._DB_PREFIX_.'tab_advice` at ON at.`id_advice` = a.`id_advice` + LEFT JOIN `' . _DB_PREFIX_ . 'advice_lang` al ON al.`id_advice` = a.`id_advice` + LEFT JOIN `' . _DB_PREFIX_ . 'tab_advice` at ON at.`id_advice` = a.`id_advice` '); - $selectorsToExclude = array(); + $selectorsToExclude = []; if (!$includePremium) { $selectorsToExclude[] = '#dashtrends'; } @@ -127,16 +128,16 @@ public static function getValidatedByIdTab($idTab, $includePremium = false, $inc )); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); - $advices = array(); + $advices = []; if (is_array($result)) { foreach ($result as $res) { - $advices[] = array( + $advices[] = [ 'selector' => $res['selector'], 'location' => $res['location'], 'html' => $res['html'], 'id_ps_advice' => $res['id_ps_advice'], - 'weight' => $res['weight'] - ); + 'weight' => $res['weight'], + ]; } } @@ -170,13 +171,13 @@ public static function getValidatedAddonsOnlyByIdTab($id_tab) public static function getIdsAdviceToValidate() { - $ids = array(); + $ids = []; $query = new DbQuery(); $query->select('a.`id_advice`'); $query->from('advice', 'a'); $query->join(' - LEFT JOIN `'._DB_PREFIX_.'condition_advice` ca ON ca.`id_advice` = a.`id_advice` AND ca.`display` = 1 - LEFT JOIN `'._DB_PREFIX_.'condition` c ON c.`id_condition` = ca.`id_condition` AND c.`validated` = 1'); + LEFT JOIN `' . _DB_PREFIX_ . 'condition_advice` ca ON ca.`id_advice` = a.`id_advice` AND ca.`display` = 1 + LEFT JOIN `' . _DB_PREFIX_ . 'condition` c ON c.`id_condition` = ca.`id_condition` AND c.`validated` = 1'); $query->where('a.`validated` = 0'); $query->groupBy('a.`id_advice`'); $query->having('count(*) = SUM(c.`validated`)'); @@ -194,13 +195,13 @@ public static function getIdsAdviceToValidate() public static function getIdsAdviceToUnvalidate() { - $ids = array(); + $ids = []; $query = new DbQuery(); $query->select('a.`id_advice`'); $query->from('advice', 'a'); $query->join(' - LEFT JOIN `'._DB_PREFIX_.'condition_advice` ca ON ca.`id_advice` = a.`id_advice` AND ca.`display` = 0 - LEFT JOIN `'._DB_PREFIX_.'condition` c ON c.`id_condition` = ca.`id_condition` AND c.`validated` = 1'); + LEFT JOIN `' . _DB_PREFIX_ . 'condition_advice` ca ON ca.`id_advice` = a.`id_advice` AND ca.`display` = 0 + LEFT JOIN `' . _DB_PREFIX_ . 'condition` c ON c.`id_condition` = ca.`id_condition` AND c.`validated` = 1'); $query->where('a.`validated` = 1'); $query->groupBy('a.`id_advice`'); $query->having('count(*) = SUM(c.`validated`)'); diff --git a/classes/Badge.php b/classes/Badge.php index 0a9f6d0..40d1064 100644 --- a/classes/Badge.php +++ b/classes/Badge.php @@ -53,29 +53,29 @@ class Badge extends ObjectModel /** * @see ObjectModel::$definition */ - public static $definition = array( + public static $definition = [ 'table' => 'badge', 'primary' => 'id_badge', 'multilang' => true, - 'fields' => array( - 'id_ps_badge' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), - 'type' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 32), - 'id_group' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 32), - 'group_position' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), - 'scoring' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), - 'validated' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), - 'awb' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'fields' => [ + 'id_ps_badge' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], + 'type' => ['type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 32], + 'id_group' => ['type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 32], + 'group_position' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], + 'scoring' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], + 'validated' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'], + 'awb' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'], // Lang fields - 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64), - 'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 255), - 'group_name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 255), - ), - ); + 'name' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64], + 'description' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 255], + 'group_name' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 255], + ], + ]; public function getBadgeImgUrl() { - return self::BAGDE_IMG_URL . (int)$this->id_ps_badge.'_'. (int)$this->validated.'.png'; + return self::BAGDE_IMG_URL . (int) $this->id_ps_badge . '_' . (int) $this->validated . '.png'; } public function validate() @@ -91,20 +91,20 @@ public static function getIdByIdPs($id_ps_badge) $query = new DbQuery(); $query->select('id_badge'); $query->from('badge', 'b'); - $query->where('`id_ps_badge` = '.(int)$id_ps_badge); + $query->where('`id_ps_badge` = ' . (int) $id_ps_badge); - return (int)Db::getInstance()->getValue($query); + return (int) Db::getInstance()->getValue($query); } public static function getIdsBadgesToValidate() { - $ids = array(); + $ids = []; $query = new DbQuery(); $query->select('b.`id_badge`'); $query->from('badge', 'b'); $query->join(' - LEFT JOIN `'._DB_PREFIX_.'condition_badge` cb ON cb.`id_badge` = b.`id_badge` - LEFT JOIN `'._DB_PREFIX_.'condition` c ON c.`id_condition` = cb.`id_condition` AND c.`validated` = 1'); + LEFT JOIN `' . _DB_PREFIX_ . 'condition_badge` cb ON cb.`id_badge` = b.`id_badge` + LEFT JOIN `' . _DB_PREFIX_ . 'condition` c ON c.`id_condition` = cb.`id_condition` AND c.`validated` = 1'); $query->where('b.validated = 0'); $query->groupBy('b.`id_badge`'); $query->having('count(*) = SUM(c.validated)'); @@ -123,7 +123,7 @@ public function getNextBadgeId() $query = new DbQuery(); $query->select('b.`id_badge`'); $query->from('badge', 'b'); - $query->where('b.id_group = \''.pSQL($this->id_group).'\' AND b.validated = 0'); + $query->where('b.id_group = \'' . pSQL($this->id_group) . '\' AND b.validated = 0'); $query->orderBy('b.group_position'); return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); diff --git a/classes/Condition.php b/classes/Condition.php index 2c3dd07..085be06 100644 --- a/classes/Condition.php +++ b/classes/Condition.php @@ -27,67 +27,67 @@ class Condition extends ObjectModel { public $id; - + public $id_ps_condition; - + public $type; - + public $request; - + public $operator; - + public $value; - + public $result; - + public $calculation_type; - + public $calculation_detail; - + public $validated; - + public $date_add; public $date_upd; - - public static $unauthorized = array('DELETE', 'DROP'); - + + public static $unauthorized = ['DELETE', 'DROP']; + /** * @see ObjectModel::$definition */ - public static $definition = array( + public static $definition = [ 'table' => 'condition', 'primary' => 'id_condition', - 'fields' => array( - 'id_ps_condition' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), - 'type' => array('type' => self::TYPE_STRING, 'size' => 32), - 'request' => array('type' => self::TYPE_STRING), - 'operator' => array('type' => self::TYPE_NOTHING), - 'value' => array('type' => self::TYPE_STRING), - 'result' => array('type' => self::TYPE_STRING), - 'calculation_type' => array('type' => self::TYPE_STRING), - 'calculation_detail' => array('type' => self::TYPE_STRING), - 'validated' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), - 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat'), - 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat'), - ), - ); - + 'fields' => [ + 'id_ps_condition' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], + 'type' => ['type' => self::TYPE_STRING, 'size' => 32], + 'request' => ['type' => self::TYPE_STRING], + 'operator' => ['type' => self::TYPE_NOTHING], + 'value' => ['type' => self::TYPE_STRING], + 'result' => ['type' => self::TYPE_STRING], + 'calculation_type' => ['type' => self::TYPE_STRING], + 'calculation_detail' => ['type' => self::TYPE_STRING], + 'validated' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'], + 'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDateFormat'], + 'date_upd' => ['type' => self::TYPE_DATE, 'validate' => 'isDateFormat'], + ], + ]; + public static function getIdByIdPs($id_ps_condition) { $query = new DbQuery(); $query->select('id_condition'); $query->from('condition', 'c'); - $query->where('`id_ps_condition` = '.(int)$id_ps_condition); - - return (int)Db::getInstance()->getValue($query); + $query->where('`id_ps_condition` = ' . (int) $id_ps_condition); + + return (int) Db::getInstance()->getValue($query); } - + public static function getIdsByHookCalculation($hook_name) { - $ids = array(); - $in = array(); - + $ids = []; + $in = []; + $sub_query = new DbQuery(); $sub_query->select('id_badge'); $sub_query->from('badge', 'b'); @@ -102,12 +102,12 @@ public static function getIdsByHookCalculation($hook_name) $query = new DbQuery(); $query->select('c.`id_condition`'); $query->from('condition', 'c'); - $query->join('LEFT JOIN `'._DB_PREFIX_.'condition_badge` cb ON cb.`id_condition` = c.`id_condition`'); + $query->join('LEFT JOIN `' . _DB_PREFIX_ . 'condition_badge` cb ON cb.`id_condition` = c.`id_condition`'); $query->where('c.`calculation_type` = \'hook\''); - $query->where('c.`calculation_detail` = \''.pSQL($hook_name).'\''); + $query->where('c.`calculation_detail` = \'' . pSQL($hook_name) . '\''); $query->where('c.`validated` = 0'); if (count($in)) { - $query->where('cb.`id_badge` IN ('.implode(',', $in).')'); + $query->where('cb.`id_badge` IN (' . implode(',', $in) . ')'); } $query->groupBy('c.`id_condition`'); @@ -116,43 +116,43 @@ public static function getIdsByHookCalculation($hook_name) foreach ($result as $r) { $ids[] = $r['id_condition']; } - + $sub_query = new DbQuery(); $sub_query->select('id_advice'); $sub_query->from('advice', 'a'); $sub_results = Db::getInstance()->executeS($sub_query); - $in = array(); + $in = []; foreach ($sub_results as $sub_result) { $in[] = $sub_result['id_advice']; } - + $query = new DbQuery(); $query->select('c.`id_condition`'); $query->from('condition', 'c'); - $query->join('LEFT JOIN `'._DB_PREFIX_.'condition_advice` ca ON ca.`id_condition` = c.`id_condition`'); + $query->join('LEFT JOIN `' . _DB_PREFIX_ . 'condition_advice` ca ON ca.`id_condition` = c.`id_condition`'); $query->where('c.`calculation_type` = \'hook\''); - $query->where('c.`calculation_detail` = \''.pSQL($hook_name).'\''); + $query->where('c.`calculation_detail` = \'' . pSQL($hook_name) . '\''); $query->where('c.`validated` = 0'); if (count($in)) { - $query->where('ca.`id_advice` IN ('.implode(',', $in).')'); + $query->where('ca.`id_advice` IN (' . implode(',', $in) . ')'); } $query->groupBy('c.`id_condition`'); $result = Db::getInstance()->executeS($query); - + foreach ($result as $r) { $ids[] = $r['id_condition']; } - + return array_unique($ids); } - + public static function getIdsDailyCalculation() { - $ids = array(); - $in = array(); + $ids = []; + $in = []; //badges conditions validation $sub_query = new DbQuery(); @@ -168,21 +168,21 @@ public static function getIdsDailyCalculation() $query = new DbQuery(); $query->select('c.`id_condition`'); $query->from('condition', 'c'); - $query->join('LEFT JOIN `'._DB_PREFIX_.'condition_badge` cb ON cb.`id_condition` = c.`id_condition`'); + $query->join('LEFT JOIN `' . _DB_PREFIX_ . 'condition_badge` cb ON cb.`id_condition` = c.`id_condition`'); $query->where('c.`calculation_type` = \'time\''); $query->where('DATEDIFF(NOW(), `date_upd`) >= `calculation_detail`'); $query->where('c.`validated` = 0'); if (count($in)) { - $query->where('cb.`id_badge` IN ('.implode(',', $in).')'); + $query->where('cb.`id_badge` IN (' . implode(',', $in) . ')'); } $query->groupBy('c.`id_condition`'); - + $result = Db::getInstance()->executeS($query); foreach ($result as $r) { $ids[] = $r['id_condition']; } - + //advice conditions validation $sub_query = new DbQuery(); $sub_query->select('id_advice'); @@ -190,51 +190,51 @@ public static function getIdsDailyCalculation() $sub_results = Db::getInstance()->executeS($sub_query); - $in = array(); + $in = []; foreach ($sub_results as $sub_result) { $in[] = $sub_result['id_advice']; } - + $query = new DbQuery(); $query->select('c.`id_condition`'); $query->from('condition', 'c'); - $query->join('LEFT JOIN `'._DB_PREFIX_.'condition_advice` ca ON ca.`id_condition` = c.`id_condition`'); + $query->join('LEFT JOIN `' . _DB_PREFIX_ . 'condition_advice` ca ON ca.`id_condition` = c.`id_condition`'); $query->where('c.`calculation_type` = \'time\''); $query->where('DATEDIFF(NOW(), `date_upd`) >= `calculation_detail`'); $query->where('c.`validated` = 0'); if (count($in)) { - $query->where('ca.`id_advice` IN ('.implode(',', $in).')'); + $query->where('ca.`id_advice` IN (' . implode(',', $in) . ')'); } $query->groupBy('c.`id_condition`'); - + $result = Db::getInstance()->executeS($query); foreach ($result as $r) { $ids[] = $r['id_condition']; } - + return array_unique($ids); } - + public static function getIdsByBadgeGroupPosition($badge_group_position) { - $ids = array(); - + $ids = []; + $sub_query = new DbQuery(); $sub_query->select('id_badge'); $sub_query->from('badge', 'b'); - $sub_query->where('b.`group_position` = '.(int)$badge_group_position); + $sub_query->where('b.`group_position` = ' . (int) $badge_group_position); $sub_query->where('b.`validated` = 0'); $sub_query->groupBy('b.`id_group`'); - + $query = new DbQuery(); $query->select('c.`id_condition`'); $query->from('condition', 'c'); - $query->join('LEFT JOIN `'._DB_PREFIX_.'condition_badge` cb ON cb.`id_condition` = c.`id_condition`'); + $query->join('LEFT JOIN `' . _DB_PREFIX_ . 'condition_badge` cb ON cb.`id_condition` = c.`id_condition`'); $query->where('c.`validated` = 0'); - $query->where('cb.`id_badge` IN ('.$sub_query.')'); + $query->where('cb.`id_badge` IN (' . $sub_query . ')'); $query->groupBy('c.`id_condition`'); - + $result = Db::getInstance()->executeS($query); foreach ($result as $r) { $ids[] = $r['id_condition']; @@ -242,26 +242,26 @@ public static function getIdsByBadgeGroupPosition($badge_group_position) return $ids; } - + public static function getIdsByBadgeGroup($badge_group) { - $ids = array(); - + $ids = []; + $sub_query = new DbQuery(); $sub_query->select('id_badge'); $sub_query->from('badge', 'b'); - $sub_query->where('b.`id_group` = '.(int)$badge_group); + $sub_query->where('b.`id_group` = ' . (int) $badge_group); $sub_query->where('b.`validated` = 0'); $sub_query->groupBy('b.`id_group`'); - + $query = new DbQuery(); $query->select('c.`id_condition`'); $query->from('condition', 'c'); - $query->join('LEFT JOIN `'._DB_PREFIX_.'condition_badge` cb ON cb.`id_condition` = c.`id_condition`'); + $query->join('LEFT JOIN `' . _DB_PREFIX_ . 'condition_badge` cb ON cb.`id_condition` = c.`id_condition`'); $query->where('c.`validated` = 0'); - $query->where('cb.`id_badge` IN ('.$sub_query.')'); + $query->where('cb.`id_badge` IN (' . $sub_query . ')'); $query->groupBy('c.`id_condition`'); - + $result = Db::getInstance()->executeS($query); foreach ($result as $r) { $ids[] = $r['id_condition']; @@ -269,7 +269,7 @@ public static function getIdsByBadgeGroup($badge_group) return $ids; } - + public function processCalculation() { switch ($this->type) { @@ -284,25 +284,25 @@ public function processCalculation() break; } } - + protected function processSql() { - if (preg_match('/'.implode('|', self::$unauthorized).'/', $this->request)) { + if (preg_match('/' . implode('|', self::$unauthorized) . '/', $this->request)) { return false; } - + try { - $this->result = (int)Db::getInstance()->getValue(GamificationTools::parseMetaData($this->request)); + $this->result = (int) Db::getInstance()->getValue(GamificationTools::parseMetaData($this->request)); } catch (Exception $e) { return false; } - + if ($this->makeCalculation($this->operator, $this->result, $this->value)) { $this->validated = 1; } $this->save(); } - + protected function processConfiguration() { $this->result = Configuration::get($this->request); @@ -311,11 +311,11 @@ protected function processConfiguration() } $this->save(); } - + protected function processInstall() { - $install = strtotime(_PS_CREATION_DATE_.' 00:00:00'); - $value = strtotime('+ '.(int)$this->value.' day', $install); + $install = strtotime(_PS_CREATION_DATE_ . ' 00:00:00'); + $value = strtotime('+ ' . (int) $this->value . ' day', $install); $this->result = $this->makeCalculation($this->operator, (time() - $install), $value - $install); if ($this->result) { $this->validated = 1; @@ -323,7 +323,7 @@ protected function processInstall() $this->save(); } - + protected function makeCalculation($operator, $arg1, $arg2) { $result = false; @@ -349,6 +349,6 @@ protected function makeCalculation($operator, $arg1, $arg2) break; } - return (bool)$result; + return (bool) $result; } } diff --git a/classes/GamificationTools.php b/classes/GamificationTools.php index b80cac2..3d8db6e 100644 --- a/classes/GamificationTools.php +++ b/classes/GamificationTools.php @@ -28,12 +28,12 @@ class GamificationTools { public static function parseMetaData($content) { - $meta_data = array( + $meta_data = [ 'PREFIX_' => _DB_PREFIX_, - ); + ]; //replace define $content = str_replace(array_keys($meta_data), array_values($meta_data), $content); - + //replace meta data $content = preg_replace_callback('#\{config\}([a-zA-Z0-9_-]*)\{/config\}#', function ($matches) { return Configuration::get($matches[1]); @@ -50,7 +50,7 @@ public static function parseMetaData($content) $content = preg_replace_callback('#\{country\}(.*)\{/country\}#', function ($matches) { return Context::getContext()->country->$matches[1]; }, $content); - + return $content; } diff --git a/controllers/admin/AdminGamificationController.php b/controllers/admin/AdminGamificationController.php index c4463eb..c7486b7 100644 --- a/controllers/admin/AdminGamificationController.php +++ b/controllers/admin/AdminGamificationController.php @@ -1,6 +1,6 @@ bootstrap = true; @@ -26,16 +25,16 @@ public function setMedia($isNewTheme = false) parent::setMedia($isNewTheme); $this->addJqueryUI('ui.progressbar'); - $this->addJS(_MODULE_DIR_.$this->module->name.'/views/js/bubble-popup.js'); + $this->addJS(_MODULE_DIR_ . $this->module->name . '/views/js/bubble-popup.js'); if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) { - $this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/gamification_bt.js'); + $this->addJs(_MODULE_DIR_ . $this->module->name . '/views/js/gamification_bt.js'); } else { - $this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/gamification.js'); + $this->addJs(_MODULE_DIR_ . $this->module->name . '/views/js/gamification.js'); } - $this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/jquery.isotope.js'); - $this->addCSS(array(_MODULE_DIR_.$this->module->name.'/views/css/bubble-popup.css', _MODULE_DIR_.$this->module->name.'/views/css/isotope.css')); + $this->addJs(_MODULE_DIR_ . $this->module->name . '/views/js/jquery.isotope.js'); + $this->addCSS([_MODULE_DIR_ . $this->module->name . '/views/css/bubble-popup.css', _MODULE_DIR_ . $this->module->name . '/views/css/isotope.css']); } public function initToolBarTitle() @@ -68,41 +67,41 @@ public function renderView() $badges_international->orderBy('id_group'); $badges_international->orderBy('group_position'); - $groups = array(); + $groups = []; $query = new DbQuery(); $query->select('DISTINCT(b.`id_group`), bl.group_name, b.type'); $query->from('badge', 'b'); $query->join(' - LEFT JOIN `'._DB_PREFIX_.'badge_lang` bl ON bl.`id_badge` = b.`id_badge`'); - $query->where('bl.id_lang = '.(int)$this->context->language->id); + LEFT JOIN `' . _DB_PREFIX_ . 'badge_lang` bl ON bl.`id_badge` = b.`id_badge`'); + $query->where('bl.id_lang = ' . (int) $this->context->language->id); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); foreach ($result as $res) { - $groups['badges_'.$res['type']][$res['id_group']] = $res['group_name']; + $groups['badges_' . $res['type']][$res['id_group']] = $res['group_name']; } - $badges_type = array( - 'badges_feature' => array('name' => $this->l('Features'), 'badges' => $badges_feature), - 'badges_achievement' => array('name' => $this->l('Achievements'), 'badges' => $badges_achievement), - 'badges_international' => array('name' => $this->l('International'), 'badges' => $badges_international), - ); + $badges_type = [ + 'badges_feature' => ['name' => $this->l('Features'), 'badges' => $badges_feature], + 'badges_achievement' => ['name' => $this->l('Achievements'), 'badges' => $badges_achievement], + 'badges_international' => ['name' => $this->l('International'), 'badges' => $badges_international], + ]; - $levels = array( + $levels = [ 1 => $this->l('1. Beginner'), 2 => $this->l('2. Pro'), 3 => $this->l('3. Expert'), 4 => $this->l('4. Wizard'), 5 => $this->l('5. Guru'), 6 => $this->l('6. Legend'), - ); + ]; - $this->tpl_view_vars = array( + $this->tpl_view_vars = [ 'badges_type' => $badges_type, - 'current_level_percent' => (int)Configuration::get('GF_CURRENT_LEVEL_PERCENT'), - 'current_level' => (int)Configuration::get('GF_CURRENT_LEVEL'), + 'current_level_percent' => (int) Configuration::get('GF_CURRENT_LEVEL_PERCENT'), + 'current_level' => (int) Configuration::get('GF_CURRENT_LEVEL'), 'groups' => $groups, 'levels' => $levels, - ); + ]; if (version_compare(_PS_VERSION_, '1.5.6.0', '>')) { $this->base_tpl_view = 'view_bt.tpl'; @@ -124,42 +123,42 @@ public function ajaxProcessGamificationTasks() Configuration::updateGlobalValue('GF_INSTALL_CALC', 1); } - $return = array( + $return = [ 'refresh_data' => $this->processRefreshData(), 'daily_calculation' => $this->processMakeDailyCalculation(), - 'advice_validation' => $this->processAdviceValidation() - ); + 'advice_validation' => $this->processAdviceValidation(), + ]; $return['advices_to_display'] = $this->processGetAdvicesToDisplay(); //get only one random advice by tab if (count($return['advices_to_display']['advices']) > 1) { - $rand = mt_rand(0, count($return['advices_to_display']['advices'])-1); - $return['advices_to_display']['advices'] = array($return['advices_to_display']['advices'][$rand]); + $rand = mt_rand(0, count($return['advices_to_display']['advices']) - 1); + $return['advices_to_display']['advices'] = [$return['advices_to_display']['advices'][$rand]]; } if (Tab::getIdFromClassName('AdminDashboard') == Tools::getValue('id_tab')) { $return['advices_premium_to_display'] = $this->processGetAdvicesToDisplay(true); if (count($return['advices_premium_to_display']['advices']) >= 2) { - $weighted_advices_array = array(); + $weighted_advices_array = []; foreach ($return['advices_premium_to_display']['advices'] as $prem_advice) { - $loop_flag = (int)$prem_advice['weight']; + $loop_flag = (int) $prem_advice['weight']; if ($loop_flag) { - for ($i = 0; $i != $loop_flag; $i++) { + for ($i = 0; $i != $loop_flag; ++$i) { $weighted_advices_array[] = $prem_advice; } } else { $weighted_advices_array[] = $prem_advice; } } - $rand = mt_rand(0, count($weighted_advices_array)-1); + $rand = mt_rand(0, count($weighted_advices_array) - 1); do { - $rand2 = mt_rand(0, count($weighted_advices_array)-1); + $rand2 = mt_rand(0, count($weighted_advices_array) - 1); } while ($rand == $rand2); - $return['advices_premium_to_display']['advices'] = array($weighted_advices_array[$rand], $weighted_advices_array[$rand2]); + $return['advices_premium_to_display']['advices'] = [$weighted_advices_array[$rand], $weighted_advices_array[$rand2]]; } elseif (count($return['advices_premium_to_display']['advices']) > 0) { - $addons = Advice::getValidatedAddonsOnlyByIdTab((int)Tools::getValue('id_tab')); + $addons = Advice::getValidatedAddonsOnlyByIdTab((int) Tools::getValue('id_tab')); $return['advices_premium_to_display']['advices'][] = array_shift($addons); } } @@ -179,9 +178,9 @@ public function processRefreshData() public function processGetAdvicesToDisplay($only_premium = false) { - $return = array('advices' => array()); + $return = ['advices' => []]; - $id_tab = (int)Tools::getValue('id_tab'); + $id_tab = (int) Tools::getValue('id_tab'); if ($only_premium) { $advices = Advice::getValidatedPremiumOnlyByIdTab($id_tab); @@ -190,12 +189,12 @@ public function processGetAdvicesToDisplay($only_premium = false) } foreach ($advices as $advice) { - $return['advices'][] = array( + $return['advices'][] = [ 'selector' => $advice['selector'], 'html' => GamificationTools::parseMetaData($advice['html']), 'location' => $advice['location'], - 'weight' => (int)$advice['weight'] - ); + 'weight' => (int) $advice['weight'], + ]; } return $return; @@ -206,7 +205,7 @@ public function processMakeDailyCalculation() $return = true; $condition_ids = Condition::getIdsDailyCalculation(); foreach ($condition_ids as $id) { - $cond = new Condition((int)$id); + $cond = new Condition((int) $id); $return &= $cond->processCalculation(); } @@ -220,13 +219,13 @@ public function processAdviceValidation() $advices_to_unvalidate = Advice::getIdsAdviceToUnvalidate(); foreach ($advices_to_validate as $id) { - $advice = new Advice((int)$id); + $advice = new Advice((int) $id); $advice->validated = 1; $return &= $advice->save(); } foreach ($advices_to_unvalidate as $id) { - $advice = new Advice((int)$id); + $advice = new Advice((int) $id); $advice->validated = 0; $return &= $advice->save(); } @@ -237,20 +236,20 @@ public function processAdviceValidation() public function processLevelAndBadgeValidation($ids_badge) { $return = true; - $current_level = (int)Configuration::get('GF_CURRENT_LEVEL'); - $current_level_percent = (int)Configuration::get('GF_CURRENT_LEVEL_PERCENT'); + $current_level = (int) Configuration::get('GF_CURRENT_LEVEL'); + $current_level_percent = (int) Configuration::get('GF_CURRENT_LEVEL_PERCENT'); $not_viewed_badge = explode('|', ltrim(Configuration::get('GF_NOT_VIEWED_BADGE', ''), '')); $nbr_notif = Configuration::get('GF_NOTIFICATION', 0); if (count($ids_badge)) { - $not_viewed_badge = array(); + $not_viewed_badge = []; } //reset the last badge only if there is new badge to validate foreach ($ids_badge as $id) { - $badge = new Badge((int)$id); + $badge = new Badge((int) $id); if (($badge->scoring + $current_level_percent) >= 100) { - $current_level++; + ++$current_level; $current_level_percent = $badge->scoring + $current_level_percent - 100; } else { $current_level_percent += $badge->scoring; @@ -260,7 +259,7 @@ public function processLevelAndBadgeValidation($ids_badge) $condition_ids = Condition::getIdsByBadgeGroup($badge->id_group); if (is_array($condition_ids) && count($condition_ids)) { foreach ($condition_ids as $id) { - $cond = new Condition((int)$id); + $cond = new Condition((int) $id); $cond->processCalculation(); unset($cond); } @@ -268,14 +267,14 @@ public function processLevelAndBadgeValidation($ids_badge) $this->processLevelAndBadgeValidation($new_ids_badge); } - $nbr_notif++; + ++$nbr_notif; $not_viewed_badge[] = $badge->id; } - Configuration::updateGlobalValue('GF_NOTIFICATION', (int)$nbr_notif); + Configuration::updateGlobalValue('GF_NOTIFICATION', (int) $nbr_notif); Configuration::updateGlobalValue('GF_NOT_VIEWED_BADGE', implode('|', array_unique($not_viewed_badge))); - Configuration::updateGlobalValue('GF_CURRENT_LEVEL', (int)$current_level); - Configuration::updateGlobalValue('GF_CURRENT_LEVEL_PERCENT', (int)$current_level_percent); + Configuration::updateGlobalValue('GF_CURRENT_LEVEL', (int) $current_level); + Configuration::updateGlobalValue('GF_CURRENT_LEVEL_PERCENT', (int) $current_level_percent); return $return; } @@ -286,11 +285,11 @@ public function processInstallCalculation() do { $condition_ids = Condition::getIdsByBadgeGroupPosition($group_position); foreach ($condition_ids as $id) { - $cond = new Condition((int)$id); + $cond = new Condition((int) $id); $cond->processCalculation(); unset($cond); } - $group_position++; + ++$group_position; } while (count($condition_ids)); } @@ -298,18 +297,18 @@ public function ajaxProcessSavePreactivationRequest() { $isoUser = Context::getContext()->language->iso_code; $isoCountry = Context::getContext()->country->iso_code; - $employee = new Employee((int)Context::getContext()->cookie->id_employee); + $employee = new Employee((int) Context::getContext()->cookie->id_employee); $firstname = $employee->firstname; $lastname = $employee->lastname; $email = $employee->email; - $return = @Tools::file_get_contents('http://api.prestashop.com/partner/premium/set_request.php?iso_country='.strtoupper($isoCountry).'&iso_lang='.strtolower($isoUser).'&host='.urlencode($_SERVER['HTTP_HOST']).'&ps_version='._PS_VERSION_.'&ps_creation='._PS_CREATION_DATE_.'&partner='.htmlentities(Tools::getValue('module')).'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&email='.urlencode($email).'&firstname='.urlencode($firstname).'&lastname='.urlencode($lastname).'&type=home'); - die($return); + $return = @Tools::file_get_contents('http://api.prestashop.com/partner/premium/set_request.php?iso_country=' . strtoupper($isoCountry) . '&iso_lang=' . strtolower($isoUser) . '&host=' . urlencode($_SERVER['HTTP_HOST']) . '&ps_version=' . _PS_VERSION_ . '&ps_creation=' . _PS_CREATION_DATE_ . '&partner=' . htmlentities(Tools::getValue('module')) . '&shop=' . urlencode(Configuration::get('PS_SHOP_NAME')) . '&email=' . urlencode($email) . '&firstname=' . urlencode($firstname) . '&lastname=' . urlencode($lastname) . '&type=home'); + exit($return); } public function ajaxProcessCloseAdvice() { - $id_advice = Advice::getIdByIdPs((int)Tools::getValue('id_advice')); - Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'advice` SET `hide` = \'1\' WHERE `id_advice` = '.(int)$id_advice.';'); - die(); + $id_advice = Advice::getIdByIdPs((int) Tools::getValue('id_advice')); + Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'advice` SET `hide` = \'1\' WHERE `id_advice` = ' . (int) $id_advice . ';'); + exit(); } } diff --git a/controllers/index.php b/controllers/index.php index dee45bf..ceb411b 100644 --- a/controllers/index.php +++ b/controllers/index.php @@ -25,7 +25,7 @@ */ header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); diff --git a/data/index.php b/data/index.php index 1d9e487..e33fa24 100755 --- a/data/index.php +++ b/data/index.php @@ -23,13 +23,13 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); - + header('Location: ../'); exit; diff --git a/de.php b/de.php index 4f1bfa2..48fffd3 100644 --- a/de.php +++ b/de.php @@ -1,7 +1,7 @@ gamification_3d4aafb2eedeba2fbf92e852f0af745a'] = 'Handelserfolg'; $_MODULE['<{gamification}prestashop>gamification_bacc1bf300527bad9c6ac2d3b875a8d8'] = 'E-Commerce-Experte im Handumdrehn!'; diff --git a/fr.php b/fr.php index 91c0ab4..c5e3da5 100644 --- a/fr.php +++ b/fr.php @@ -1,7 +1,7 @@ gamification_3d4aafb2eedeba2fbf92e852f0af745a'] = 'Expertise PrestaShop'; $_MODULE['<{gamification}prestashop>gamification_bacc1bf300527bad9c6ac2d3b875a8d8'] = 'Devenez un marchand accompli à pas de géant !'; diff --git a/gamification.php b/gamification.php index 8af5ddd..d0c161e 100644 --- a/gamification.php +++ b/gamification.php @@ -28,10 +28,10 @@ exit; } -include_once __DIR__.'/classes/Badge.php'; -include_once __DIR__.'/classes/Advice.php'; -include_once __DIR__.'/classes/Condition.php'; -include_once __DIR__.'/classes/GamificationTools.php'; +include_once __DIR__ . '/classes/Badge.php'; +include_once __DIR__ . '/classes/Advice.php'; +include_once __DIR__ . '/classes/Condition.php'; +include_once __DIR__ . '/classes/GamificationTools.php'; class gamification extends Module { @@ -48,16 +48,16 @@ public function __construct() $this->tab = 'administration'; $this->version = '2.3.2'; $this->author = 'PrestaShop'; - $this->ps_versions_compliancy = array( + $this->ps_versions_compliancy = [ 'min' => '1.6.1.0', - ); + ]; parent::__construct(); - $this->displayName = $this->trans('Merchant Expertise', array(), 'Modules.Merchantexpertise.Admin'); - $this->description = $this->trans('Check your completion rate and unblock all badges to become an e-commerce expert within the blink of an eye!', array(), 'Modules.Merchantexpertise.Admin'); + $this->displayName = $this->trans('Merchant Expertise', [], 'Modules.Merchantexpertise.Admin'); + $this->description = $this->trans('Check your completion rate and unblock all badges to become an e-commerce expert within the blink of an eye!', [], 'Modules.Merchantexpertise.Admin'); - $this->cache_data = __DIR__.'/data/'; + $this->cache_data = __DIR__ . '/data/'; if (self::TEST_MODE === true) { $this->url_data .= 'test/'; } @@ -65,13 +65,13 @@ public function __construct() public function install() { - if (Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE name =\''.pSQL($this->name).'\'')) { + if (Db::getInstance()->getValue('SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module` WHERE name =\'' . pSQL($this->name) . '\'')) { return true; } Tools::deleteDirectory($this->cache_data, false); - return ( + return $this->installDb() && $this->installTab() && Configuration::updateGlobalValue('GF_INSTALL_CALC', 0) @@ -81,7 +81,7 @@ public function install() && parent::install() && $this->registerHook('actionAdminControllerSetMedia') && $this->registerHook('displayBackOfficeHeader') - ); + ; } public function uninstall() @@ -100,7 +100,7 @@ public function uninstall() public function installDb() { $return = true; - include __DIR__.'/sql_install.php'; + include __DIR__ . '/sql_install.php'; foreach ($sql as $s) { $return &= Db::getInstance()->execute($s); } @@ -110,9 +110,9 @@ public function installDb() public function uninstallDb() { - include __DIR__.'/sql_install.php'; + include __DIR__ . '/sql_install.php'; foreach ($sql as $name => $v) { - Db::getInstance()->execute('DROP TABLE '.$name); + Db::getInstance()->execute('DROP TABLE ' . $name); } return true; @@ -123,22 +123,22 @@ public function installTab() $tab = new Tab(); $tab->active = 1; $tab->class_name = 'AdminGamification'; - $tab->name = array(); + $tab->name = []; foreach (Language::getLanguages(true) as $lang) { $tab->name[$lang['id_lang']] = 'Merchant Expertise'; } if (version_compare(_PS_VERSION_, '1.7.0.0', '>=')) { //AdminPreferences - $tab->id_parent = (int)Db::getInstance(_PS_USE_SQL_SLAVE_) + $tab->id_parent = (int) Db::getInstance(_PS_USE_SQL_SLAVE_) ->getValue( 'SELECT MIN(id_tab) - FROM `'._DB_PREFIX_.'tab` - WHERE `class_name` = "'.pSQL('ShopParameters').'"' + FROM `' . _DB_PREFIX_ . 'tab` + WHERE `class_name` = "' . pSQL('ShopParameters') . '"' ); } else { // AdminAdmin - $tab->id_parent = (int)Tab::getIdFromClassName('AdminAdmin'); + $tab->id_parent = (int) Tab::getIdFromClassName('AdminAdmin'); } $tab->module = $this->name; @@ -148,7 +148,7 @@ public function installTab() public function uninstallTab() { - $id_tab = (int)Tab::getIdFromClassName('AdminGamification'); + $id_tab = (int) Tab::getIdFromClassName('AdminGamification'); if ($id_tab) { $tab = new Tab($id_tab); @@ -176,7 +176,7 @@ public function getContent() public function __call($name, $arguments) { if (!empty(self::$_batch_mode)) { - self::$_defered_func_call[__CLASS__.'::__call_'.$name] = array(array($this, '__call'), array($name, $arguments)); + self::$_defered_func_call[__CLASS__ . '::__call_' . $name] = [[$this, '__call'], [$name, $arguments]]; } else { if (!Validate::isHookName($name)) { return false; @@ -184,13 +184,13 @@ public function __call($name, $arguments) $name = str_replace('hook', '', $name); - if ($retro_name = Db::getInstance()->getValue('SELECT `name` FROM `'._DB_PREFIX_.'hook_alias` WHERE `alias` = \''.pSQL($name).'\'')) { + if ($retro_name = Db::getInstance()->getValue('SELECT `name` FROM `' . _DB_PREFIX_ . 'hook_alias` WHERE `alias` = \'' . pSQL($name) . '\'')) { $name = $retro_name; } $condition_ids = Condition::getIdsByHookCalculation($name); foreach ($condition_ids as $id) { - $cond = new Condition((int)$id); + $cond = new Condition((int) $id); $cond->processCalculation(); } } @@ -198,14 +198,11 @@ public function __call($name, $arguments) public function isUpdating() { - $db_version = Db::getInstance()->getValue('SELECT `version` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($this->name).'\''); + $db_version = Db::getInstance()->getValue('SELECT `version` FROM `' . _DB_PREFIX_ . 'module` WHERE `name` = \'' . pSQL($this->name) . '\''); return version_compare($this->version, $db_version, '>'); } - /** - * - */ public function hookActionAdminControllerSetMedia() { if ($this->isUpdating() || !Module::isEnabled($this->name)) { @@ -253,29 +250,29 @@ public function renderHeaderNotification() return false; } - $current_level = (int)Configuration::get('GF_CURRENT_LEVEL'); - $current_level_percent = (int)Configuration::get('GF_CURRENT_LEVEL_PERCENT'); + $current_level = (int) Configuration::get('GF_CURRENT_LEVEL'); + $current_level_percent = (int) Configuration::get('GF_CURRENT_LEVEL_PERCENT'); - $badges_to_display = array(); //retro compat - $unlock_badges = array(); - $next_badges = array(); + $badges_to_display = []; //retro compat + $unlock_badges = []; + $next_badges = []; $not_viewed_badge = explode('|', Configuration::get('GF_NOT_VIEWED_BADGE', '')); foreach ($not_viewed_badge as $id) { - $unlock_badges[] = $badges_to_display[] = new Badge((int)$id, (int)$this->context->language->id); - $next_badges[] = $badges_to_display[] = new Badge(end($badges_to_display)->getNextBadgeId(), (int)$this->context->language->id); + $unlock_badges[] = $badges_to_display[] = new Badge((int) $id, (int) $this->context->language->id); + $next_badges[] = $badges_to_display[] = new Badge(end($badges_to_display)->getNextBadgeId(), (int) $this->context->language->id); } - $this->context->smarty->assign(array( + $this->context->smarty->assign([ 'link' => $this->context->link, 'current_level_percent' => $current_level_percent, 'current_level' => $current_level, 'badges_to_display' => $badges_to_display, 'unlock_badges' => $unlock_badges, 'next_badges' => $next_badges, - 'current_id_tab' => (int)$this->context->controller->id, - 'notification' => (int)Configuration::get('GF_NOTIFICATION'), + 'current_id_tab' => (int) $this->context->controller->id, + 'notification' => (int) Configuration::get('GF_NOTIFICATION'), 'advice_hide_url' => 'https://gamification.prestashop.com/api/AdviceHide/', - )); + ]); if (version_compare(_PS_VERSION_, '1.6.0', '>=')) { return $this->display(__FILE__, 'notification_bt.tpl'); @@ -290,7 +287,7 @@ public function refreshDatas($iso_lang = null) $iso_lang = $this->context->language->iso_code; } - $default_iso_lang = Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')); + $default_iso_lang = Language::getIsoById((int) Configuration::get('PS_LANG_DEFAULT')); $id_lang = Language::getIdByIso($iso_lang); $iso_country = $this->context->country->iso_code; @@ -300,7 +297,7 @@ public function refreshDatas($iso_lang = null) $this->refreshDatas($default_iso_lang); } - $cache_file = $this->cache_data.'data_'.strtoupper($iso_lang).'_'.strtoupper($iso_currency).'_'.strtoupper($iso_country).'.json'; + $cache_file = $this->cache_data . 'data_' . strtoupper($iso_lang) . '_' . strtoupper($iso_currency) . '_' . strtoupper($iso_country) . '.json'; if (!$this->isFresh($cache_file, 86400)) { if ($this->getData($iso_lang)) { @@ -312,7 +309,7 @@ public function refreshDatas($iso_lang = null) $this->processCleanAdvices(); if (function_exists('openssl_verify') && self::TEST_MODE === false) { - if (!openssl_verify(json_encode(array($data->conditions, $data->advices_lang)), base64_decode($data->signature), file_get_contents(__DIR__.'/prestashop.pub'))) { + if (!openssl_verify(json_encode([$data->conditions, $data->advices_lang]), base64_decode($data->signature), file_get_contents(__DIR__ . '/prestashop.pub'))) { return false; } } @@ -331,7 +328,7 @@ public function refreshDatas($iso_lang = null) } if (function_exists('openssl_verify') && self::TEST_MODE === false) { - if (!openssl_verify(json_encode(array($data->advices_lang_16)), base64_decode($data->signature_16), file_get_contents(__DIR__.'/prestashop.pub'))) { + if (!openssl_verify(json_encode([$data->advices_lang_16]), base64_decode($data->signature_16), file_get_contents(__DIR__ . '/prestashop.pub'))) { return false; } } @@ -350,25 +347,25 @@ public function getData($iso_lang = null) } $iso_country = $this->context->country->iso_code; $iso_currency = $this->context->currency->iso_code; - $file_name = 'data_'.strtoupper($iso_lang).'_'.strtoupper($iso_currency).'_'.strtoupper($iso_country).'.json'; - $versioning = '?v='.$this->version.'&ps_version='._PS_VERSION_; - $data = GamificationTools::retrieveJsonApiFile($this->url_data.$file_name.$versioning); + $file_name = 'data_' . strtoupper($iso_lang) . '_' . strtoupper($iso_currency) . '_' . strtoupper($iso_country) . '.json'; + $versioning = '?v=' . $this->version . '&ps_version=' . _PS_VERSION_; + $data = GamificationTools::retrieveJsonApiFile($this->url_data . $file_name . $versioning); - return (bool) file_put_contents($this->cache_data.'data_'.strtoupper($iso_lang).'_'.strtoupper($iso_currency).'_'.strtoupper($iso_country).'.json', $data, FILE_USE_INCLUDE_PATH); + return (bool) file_put_contents($this->cache_data . 'data_' . strtoupper($iso_lang) . '_' . strtoupper($iso_currency) . '_' . strtoupper($iso_country) . '.json', $data, FILE_USE_INCLUDE_PATH); } public function processCleanAdvices() { - $current_advices = array(); - $result = Db::getInstance()->ExecuteS('SELECT `id_advice`, `id_ps_advice` FROM `'._DB_PREFIX_.'advice`'); + $current_advices = []; + $result = Db::getInstance()->ExecuteS('SELECT `id_advice`, `id_ps_advice` FROM `' . _DB_PREFIX_ . 'advice`'); foreach ($result as $row) { - $current_advices[(int)$row['id_ps_advice']] = (int)$row['id_advice']; + $current_advices[(int) $row['id_ps_advice']] = (int) $row['id_advice']; } // Delete advices that are not in the file anymore foreach ($current_advices as $id_advice) { // Check that the advice is used in this language - $html = Db::getInstance()->getValue('SELECT `html` FROM `'._DB_PREFIX_.'advice_lang` WHERE id_advice = '.(int)$id_advice.' AND id_lang = '.(int)$this->context->language->id); + $html = Db::getInstance()->getValue('SELECT `html` FROM `' . _DB_PREFIX_ . 'advice_lang` WHERE id_advice = ' . (int) $id_advice . ' AND id_lang = ' . (int) $this->context->language->id); if (!$html) { continue; } @@ -379,11 +376,11 @@ public function processCleanAdvices() public function processImportConditions($conditions, $id_lang) { - $current_conditions = array(); - $result = Db::getInstance()->ExecuteS('SELECT `id_ps_condition` FROM `'._DB_PREFIX_.'condition`'); + $current_conditions = []; + $result = Db::getInstance()->ExecuteS('SELECT `id_ps_condition` FROM `' . _DB_PREFIX_ . 'condition`'); foreach ($result as $row) { - $current_conditions[] = (int)$row['id_ps_condition']; + $current_conditions[] = (int) $row['id_ps_condition']; } if (is_array($conditions) || is_object($conditions)) { @@ -395,12 +392,12 @@ public function processImportConditions($conditions, $id_lang) $cond = new Condition(); if (in_array($condition->id_ps_condition, $current_conditions)) { $cond = new Condition(Condition::getIdByIdPs($condition->id_ps_condition)); - unset($current_conditions[(int)array_search($condition->id_ps_condition, $current_conditions)]); + unset($current_conditions[(int) array_search($condition->id_ps_condition, $current_conditions)]); } - $cond->hydrate((array)$condition, (int)$id_lang); + $cond->hydrate((array) $condition, (int) $id_lang); - $cond->date_upd = date('Y-m-d H:i:s', strtotime('-'.(int)$cond->calculation_detail.'DAY')); + $cond->date_upd = date('Y-m-d H:i:s', strtotime('-' . (int) $cond->calculation_detail . 'DAY')); $cond->date_add = date('Y-m-d H:i:s'); $condition->calculation_detail = trim($condition->calculation_detail); $cond->save(false, false); @@ -417,25 +414,25 @@ public function processImportConditions($conditions, $id_lang) // Delete conditions that are not in the file anymore foreach ($current_conditions as $id_ps_condition) { - $cond = new Condition(Condition::getIdByIdPs((int)$id_ps_condition)); + $cond = new Condition(Condition::getIdByIdPs((int) $id_ps_condition)); $cond->delete(); } } public function processImportBadges($badges, $badges_lang, $id_lang) { - $formated_badges_lang = array(); + $formated_badges_lang = []; foreach ($badges_lang as $lang) { - $formated_badges_lang[$lang->id_ps_badge] = array( - 'name' => array($id_lang => $lang->name), - 'description' => array($id_lang => $lang->description), - 'group_name' => array($id_lang => $lang->group_name)); + $formated_badges_lang[$lang->id_ps_badge] = [ + 'name' => [$id_lang => $lang->name], + 'description' => [$id_lang => $lang->description], + 'group_name' => [$id_lang => $lang->group_name], ]; } - $current_badges = array(); - $result = Db::getInstance()->ExecuteS('SELECT `id_ps_badge` FROM `'._DB_PREFIX_.'badge`'); + $current_badges = []; + $result = Db::getInstance()->ExecuteS('SELECT `id_ps_badge` FROM `' . _DB_PREFIX_ . 'badge`'); foreach ($result as $row) { - $current_badges[] = (int)$row['id_ps_badge']; + $current_badges[] = (int) $row['id_ps_badge']; } $cond_ids = $this->getFormatedConditionsIds(); @@ -443,21 +440,21 @@ public function processImportBadges($badges, $badges_lang, $id_lang) foreach ($badges as $badge) { try { //if badge already exist we update language data - if (in_array((int)$badge->id_ps_badge, $current_badges)) { - $bdg = new Badge(Badge::getIdByIdPs((int)$badge->id_ps_badge)); + if (in_array((int) $badge->id_ps_badge, $current_badges)) { + $bdg = new Badge(Badge::getIdByIdPs((int) $badge->id_ps_badge)); $bdg->name[$id_lang] = $formated_badges_lang[$badge->id_ps_badge]['name'][$id_lang]; $bdg->description[$id_lang] = $formated_badges_lang[$badge->id_ps_badge]['description'][$id_lang]; $bdg->group_name[$id_lang] = $formated_badges_lang[$badge->id_ps_badge]['group_name'][$id_lang]; $bdg->update(); - unset($current_badges[(int)array_search($badge->id_ps_badge, $current_badges)]); + unset($current_badges[(int) array_search($badge->id_ps_badge, $current_badges)]); } else { - $badge_data = array_merge((array)$badge, $formated_badges_lang[$badge->id_ps_badge]); + $badge_data = array_merge((array) $badge, $formated_badges_lang[$badge->id_ps_badge]); $bdg = new Badge(); - $bdg->hydrate($badge_data, (int)$id_lang); + $bdg->hydrate($badge_data, (int) $id_lang); $bdg->add(); foreach ($badge->conditions as $cond) { - Db::getInstance()->insert('condition_badge', array('id_condition' => $cond_ids[$cond], 'id_badge' => $bdg->id)); + Db::getInstance()->insert('condition_badge', ['id_condition' => $cond_ids[$cond], 'id_badge' => $bdg->id]); } } unset($bdg); @@ -468,22 +465,22 @@ public function processImportBadges($badges, $badges_lang, $id_lang) // Delete badges that are not in the file anymore foreach ($current_badges as $id_ps_badge) { - $bdg = new Badge(Badge::getIdByIdPs((int)$id_ps_badge)); + $bdg = new Badge(Badge::getIdByIdPs((int) $id_ps_badge)); $bdg->delete(); } } public function processImportAdvices($advices, $advices_lang, $id_lang) { - $formated_advices_lang = array(); + $formated_advices_lang = []; foreach ($advices_lang as $lang) { - $formated_advices_lang[$lang->id_ps_advice] = array('html' => array($id_lang => $lang->html)); + $formated_advices_lang[$lang->id_ps_advice] = ['html' => [$id_lang => $lang->html]]; } - $current_advices = array(); - $result = Db::getInstance()->ExecuteS('SELECT `id_advice`, `id_ps_advice` FROM `'._DB_PREFIX_.'advice`'); + $current_advices = []; + $result = Db::getInstance()->ExecuteS('SELECT `id_advice`, `id_ps_advice` FROM `' . _DB_PREFIX_ . 'advice`'); foreach ($result as $row) { - $current_advices[(int)$row['id_ps_advice']] = (int)$row['id_advice']; + $current_advices[(int) $row['id_ps_advice']] = (int) $row['id_advice']; } $cond_ids = $this->getFormatedConditionsIds(); @@ -497,10 +494,10 @@ public function processImportAdvices($advices, $advices_lang, $id_lang) $this->processAdviceAsso($adv->id, $advice->display_conditions, $advice->hide_conditions, $advice->tabs, $cond_ids); unset($current_advices[$advice->id_ps_advice]); } else { - $advice_data = array_merge((array)$advice, $formated_advices_lang[$advice->id_ps_advice]); + $advice_data = array_merge((array) $advice, $formated_advices_lang[$advice->id_ps_advice]); $adv = new Advice(); - $adv->hydrate($advice_data, (int)$id_lang); - $adv->id_tab = (int)Tab::getIdFromClassName($advice->tab); + $adv->hydrate($advice_data, (int) $id_lang); + $adv->id_tab = (int) Tab::getIdFromClassName($advice->tab); $adv->add(); @@ -515,13 +512,13 @@ public function processImportAdvices($advices, $advices_lang, $id_lang) public function processAdviceAsso($id_advice, $display_conditions, $hide_conditions, $tabs, $cond_ids) { - Db::getInstance()->delete('condition_advice', 'id_advice='.(int)$id_advice); + Db::getInstance()->delete('condition_advice', 'id_advice=' . (int) $id_advice); if (is_array($display_conditions)) { foreach ($display_conditions as $cond) { Db::getInstance()->insert( 'condition_advice', - array( - 'id_condition' => (int) $cond_ids[$cond], 'id_advice' => (int) $id_advice, 'display' => 1) + [ + 'id_condition' => (int) $cond_ids[$cond], 'id_advice' => (int) $id_advice, 'display' => 1, ] ); } } @@ -530,19 +527,19 @@ public function processAdviceAsso($id_advice, $display_conditions, $hide_conditi foreach ($hide_conditions as $cond) { Db::getInstance()->insert( 'condition_advice', - array( - 'id_condition' => (int) $cond_ids[$cond], 'id_advice' => (int) $id_advice, 'display' => 0) + [ + 'id_condition' => (int) $cond_ids[$cond], 'id_advice' => (int) $id_advice, 'display' => 0, ] ); } } - Db::getInstance()->delete('tab_advice', 'id_advice='.(int)$id_advice); + Db::getInstance()->delete('tab_advice', 'id_advice=' . (int) $id_advice); if (isset($tabs) && is_array($tabs) && count($tabs)) { foreach ($tabs as $tab) { Db::getInstance()->insert( 'tab_advice', - array( - 'id_tab' => (int)Tab::getIdFromClassName($tab), 'id_advice' => (int) $id_advice) + [ + 'id_tab' => (int) Tab::getIdFromClassName($tab), 'id_advice' => (int) $id_advice, ] ); } } @@ -550,8 +547,8 @@ public function processAdviceAsso($id_advice, $display_conditions, $hide_conditi public function getFormatedConditionsIds() { - $cond_ids = array(); - $result = Db::getInstance()->executeS('SELECT `id_condition`, `id_ps_condition` FROM `'._DB_PREFIX_.'condition`'); + $cond_ids = []; + $result = Db::getInstance()->executeS('SELECT `id_condition`, `id_ps_condition` FROM `' . _DB_PREFIX_ . 'condition`'); foreach ($result as $res) { $cond_ids[$res['id_ps_condition']] = $res['id_condition']; diff --git a/index.php b/index.php index 1d9e487..e33fa24 100644 --- a/index.php +++ b/index.php @@ -23,13 +23,13 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); - + header('Location: ../'); exit; diff --git a/sql_install.php b/sql_install.php index 8b562ea..f44746e 100644 --- a/sql_install.php +++ b/sql_install.php @@ -24,8 +24,8 @@ * International Registered Trademark & Property of PrestaShop SA */ -$sql = array(); -$sql[_DB_PREFIX_.'badge'] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'badge` ( +$sql = []; +$sql[_DB_PREFIX_ . 'badge'] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'badge` ( `id_badge` int(11) NOT NULL AUTO_INCREMENT, `id_ps_badge` int(11) NOT NULL, `type` varchar(32) NOT NULL, @@ -35,18 +35,18 @@ `awb` INT NULL DEFAULT \'0\', `validated` tinyint(1) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id_badge`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; -$sql[_DB_PREFIX_.'badge_lang'] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'badge_lang` ( +$sql[_DB_PREFIX_ . 'badge_lang'] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'badge_lang` ( `id_badge` int(11) NOT NULL, `id_lang` int(11) NOT NULL, `name` varchar(64), `description` varchar(255), `group_name` varchar(255), PRIMARY KEY (`id_badge`, `id_lang`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; -$sql[_DB_PREFIX_.'condition'] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'condition` ( +$sql[_DB_PREFIX_ . 'condition'] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'condition` ( `id_condition` int(11) NOT NULL AUTO_INCREMENT, `id_ps_condition` int(11) NOT NULL, `type` enum(\'configuration\', \'install\', \'sql\') NOT NULL, @@ -60,15 +60,15 @@ `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, PRIMARY KEY (`id_condition`, `id_ps_condition`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; -$sql[_DB_PREFIX_.'condition_badge'] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'condition_badge` ( +$sql[_DB_PREFIX_ . 'condition_badge'] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'condition_badge` ( `id_condition` int(11) NOT NULL, `id_badge` int(11) NOT NULL, PRIMARY KEY (`id_condition`, `id_badge`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; -$sql[_DB_PREFIX_.'advice'] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'advice` ( +$sql[_DB_PREFIX_ . 'advice'] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'advice` ( `id_advice` int(11) NOT NULL AUTO_INCREMENT, `id_ps_advice` int(11) NOT NULL, `id_tab` int(11) NOT NULL, @@ -81,24 +81,24 @@ `stop_day` int(11) NOT NULL DEFAULT 0, `weight` int(11) NULL DEFAULT \'1\', PRIMARY KEY (`id_advice`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; -$sql[_DB_PREFIX_.'advice_lang'] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'advice_lang` ( +$sql[_DB_PREFIX_ . 'advice_lang'] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'advice_lang` ( `id_advice` int(11) NOT NULL, `id_lang` int(11) NOT NULL, `html` TEXT, PRIMARY KEY (`id_advice`, `id_lang`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; -$sql[_DB_PREFIX_.'condition_advice'] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'condition_advice` ( +$sql[_DB_PREFIX_ . 'condition_advice'] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'condition_advice` ( `id_condition` int(11) NOT NULL, `id_advice` int(11) NOT NULL, `display` tinyint(1) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id_condition`, `id_advice`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; -$sql[_DB_PREFIX_.'tab_advice'] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'tab_advice` ( +$sql[_DB_PREFIX_ . 'tab_advice'] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'tab_advice` ( `id_tab` int(11) NOT NULL, `id_advice` int(11) NOT NULL, PRIMARY KEY (`id_tab`, `id_advice`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; diff --git a/translations/cs.php b/translations/cs.php index 6b2f713..3f36460 100644 --- a/translations/cs.php +++ b/translations/cs.php @@ -1,7 +1,7 @@ gamification_3d4aafb2eedeba2fbf92e852f0af745a'] = 'Obchodní znalosti'; $_MODULE['<{gamification}prestashop>gamification_bacc1bf300527bad9c6ac2d3b875a8d8'] = 'Staňte se e-commerce expertem mrknutím oka!'; diff --git a/translations/de.php b/translations/de.php index 735a973..68b9c7e 100644 --- a/translations/de.php +++ b/translations/de.php @@ -1,7 +1,7 @@ gamification_3d4aafb2eedeba2fbf92e852f0af745a'] = 'Handelserfolg'; $_MODULE['<{gamification}prestashop>gamification_bacc1bf300527bad9c6ac2d3b875a8d8'] = 'E-Commerce-Experte im Handumdrehn!'; diff --git a/translations/es.php b/translations/es.php index 96b20ce..d67f049 100644 --- a/translations/es.php +++ b/translations/es.php @@ -1,7 +1,7 @@ gamification_3d4aafb2eedeba2fbf92e852f0af745a'] = 'Experiencia minorista'; $_MODULE['<{gamification}prestashop>gamification_bacc1bf300527bad9c6ac2d3b875a8d8'] = '¡ Conviértase en un experto en e-commerce en un abrir y cerrar de ojos!'; diff --git a/translations/fr.php b/translations/fr.php index a04ae5b..cab60d6 100644 --- a/translations/fr.php +++ b/translations/fr.php @@ -1,7 +1,7 @@ gamification_3d4aafb2eedeba2fbf92e852f0af745a'] = 'Expertise PrestaShop'; $_MODULE['<{gamification}prestashop>gamification_bacc1bf300527bad9c6ac2d3b875a8d8'] = 'Devenez un marchand accompli à pas de géant !'; diff --git a/translations/index.php b/translations/index.php index 1d9e487..e33fa24 100644 --- a/translations/index.php +++ b/translations/index.php @@ -23,13 +23,13 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); - + header('Location: ../'); exit; diff --git a/translations/it.php b/translations/it.php index f23438c..dd40370 100644 --- a/translations/it.php +++ b/translations/it.php @@ -1,7 +1,7 @@ gamification_3d4aafb2eedeba2fbf92e852f0af745a'] = 'Esperienza Commerciante'; $_MODULE['<{gamification}prestashop>gamification_bacc1bf300527bad9c6ac2d3b875a8d8'] = 'Diventa un esperto di e-commerce in un batter d\'occhio!'; diff --git a/translations/pl.php b/translations/pl.php index 0621144..0bc4a82 100644 --- a/translations/pl.php +++ b/translations/pl.php @@ -1,7 +1,7 @@ gamification_3d4aafb2eedeba2fbf92e852f0af745a'] = 'Umiejętności sprzedawcy'; $_MODULE['<{gamification}prestashop>gamification_bacc1bf300527bad9c6ac2d3b875a8d8'] = 'Zostań ekspertem e-commerce w mgnieniu oka!'; diff --git a/translations/ru.php b/translations/ru.php index 1ea6685..17a3839 100644 --- a/translations/ru.php +++ b/translations/ru.php @@ -1,7 +1,7 @@ gamification_3d4aafb2eedeba2fbf92e852f0af745a'] = 'Опыт продавца'; $_MODULE['<{gamification}prestashop>gamification_bacc1bf300527bad9c6ac2d3b875a8d8'] = 'Станьте экспертом в области электронной коммерции в мгновение ока!'; diff --git a/upgrade/install-1.4.9.php b/upgrade/install-1.4.9.php index 4fc9883..f7cec67 100644 --- a/upgrade/install-1.4.9.php +++ b/upgrade/install-1.4.9.php @@ -31,10 +31,10 @@ function upgrade_module_1_4_9($object) { return Db::getInstance()->execute( - 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'tab_advice` ( + 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'tab_advice` ( `id_tab` int(11) NOT NULL, `id_advice` int(11) NOT NULL, PRIMARY KEY (`id_tab`, `id_advice`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;' + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;' ); } diff --git a/upgrade/install-1.6.6.php b/upgrade/install-1.6.6.php index 746a676..f363a70 100644 --- a/upgrade/install-1.6.6.php +++ b/upgrade/install-1.6.6.php @@ -30,5 +30,5 @@ function upgrade_module_1_6_6($object) { - return Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'advice` ADD `start_day` INT NULL DEFAULT 0 , ADD `stop_day` INT NULL DEFAULT 0'); + return Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'advice` ADD `start_day` INT NULL DEFAULT 0 , ADD `stop_day` INT NULL DEFAULT 0'); } diff --git a/upgrade/install-1.7.3.php b/upgrade/install-1.7.3.php index d9d534f..21924b9 100644 --- a/upgrade/install-1.7.3.php +++ b/upgrade/install-1.7.3.php @@ -30,5 +30,5 @@ function upgrade_module_1_7_3($object) { - return Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'advice` ADD `hide` TINYINT NOT NULL DEFAULT \'0\' AFTER `validated`'); + return Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'advice` ADD `hide` TINYINT NOT NULL DEFAULT \'0\' AFTER `validated`'); } diff --git a/upgrade/install-1.7.7.php b/upgrade/install-1.7.7.php index 3ad69db..9ee6f24 100644 --- a/upgrade/install-1.7.7.php +++ b/upgrade/install-1.7.7.php @@ -30,22 +30,22 @@ function upgrade_module_1_7_7($object) { - $cols = array( - 'start_day' => array('exist' => false, 'sql' => 'ALTER TABLE `'._DB_PREFIX_.'advice` ADD `start_day` INT NULL DEFAULT 0 '), - 'stop_day' => array('exist' => false, 'sql' => 'ALTER TABLE `'._DB_PREFIX_.'advice` ADD `stop_day` INT NULL DEFAULT 0 '), - 'start_date' => array('exist' => false, 'sql' => 'ALTER TABLE `'._DB_PREFIX_.'advice` DROP `start_date`'), - 'stop_date' => array('exist' => false, 'sql' => 'ALTER TABLE `'._DB_PREFIX_.'advice` DROP `stop_date`'), - ); - - $columns = Db::getInstance()->executeS('SHOW COLUMNS FROM `'._DB_PREFIX_.'advice` '); + $cols = [ + 'start_day' => ['exist' => false, 'sql' => 'ALTER TABLE `' . _DB_PREFIX_ . 'advice` ADD `start_day` INT NULL DEFAULT 0 '], + 'stop_day' => ['exist' => false, 'sql' => 'ALTER TABLE `' . _DB_PREFIX_ . 'advice` ADD `stop_day` INT NULL DEFAULT 0 '], + 'start_date' => ['exist' => false, 'sql' => 'ALTER TABLE `' . _DB_PREFIX_ . 'advice` DROP `start_date`'], + 'stop_date' => ['exist' => false, 'sql' => 'ALTER TABLE `' . _DB_PREFIX_ . 'advice` DROP `stop_date`'], + ]; + + $columns = Db::getInstance()->executeS('SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'advice` '); foreach ($columns as $c) { if (in_array($c['Field'], array_keys($cols))) { $cols[$c['Field']]['exist'] = true; } } - + foreach ($cols as $name => $co) { - if (in_array($name, array('start_day', 'stop_day'))) { + if (in_array($name, ['start_day', 'stop_day'])) { if (!$co['exist']) { Db::getInstance()->execute($co['sql']); } diff --git a/upgrade/install-1.8.9.php b/upgrade/install-1.8.9.php index 59faf72..7d8f291 100644 --- a/upgrade/install-1.8.9.php +++ b/upgrade/install-1.8.9.php @@ -30,8 +30,8 @@ function upgrade_module_1_8_9($object) { - Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'advice` ADD `weight` INT NULL DEFAULT \'1\''); - Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'badge` ADD `awb` INT NULL DEFAULT \'0\''); + Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'advice` ADD `weight` INT NULL DEFAULT \'1\''); + Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'badge` ADD `awb` INT NULL DEFAULT \'0\''); return true; } diff --git a/upgrade/install-2.3.2.php b/upgrade/install-2.3.2.php index b82fd64..f10444c 100644 --- a/upgrade/install-2.3.2.php +++ b/upgrade/install-2.3.2.php @@ -48,6 +48,7 @@ function removeGamificationPhpUnitFromFsDuringUpgrade(array $files) return 'Deletion of file ' . $file . 'failed'; } } + return true; } /** @@ -59,11 +60,13 @@ function upgrade_module_2_3_2($module) { $path = __DIR__ . '/../vendor/phpunit'; if (file_exists($path)) { - $result = removeGamificationPhpUnitFromFsDuringUpgrade(array($path)); + $result = removeGamificationPhpUnitFromFsDuringUpgrade([$path]); if ($result !== true) { PrestaShopLogger::addLog('Could not delete PHPUnit from module. ' . $result, 3); + return false; } } + return true; } From a1b90a5c0a65b04d22e9f9d8a9d6299bc33bd14b Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 12:35:35 +0200 Subject: [PATCH 10/10] Fixed PHPStan & PHPUnit --- classes/Advice.php | 6 +-- classes/Badge.php | 4 +- classes/Condition.php | 1 - .../admin/AdminGamificationController.php | 10 ++-- gamification.php | 53 ++++++++++++------- phpunit.xml | 10 ++++ sql_install.php | 2 + .../CallToGamificationServerTest.php | 2 +- tests/phpstan/phpstan-1.7.1.2.neon | 13 +++++ tests/phpstan/phpstan-1.7.2.5.neon | 13 +++++ tests/phpstan/phpstan-1.7.3.4.neon | 13 +++++ tests/phpstan/phpstan-1.7.4.4.neon | 13 +++++ tests/phpstan/phpstan-1.7.5.1.neon | 13 +++++ tests/phpstan/phpstan-1.7.6.9.neon | 13 +++++ tests/phpstan/phpstan-1.7.7.3.neon | 13 +++++ tests/phpstan/phpstan-latest.neon | 13 +++++ tests/unit/AdviceTest.php | 2 +- upgrade/install-2.3.2.php | 2 +- 18 files changed, 164 insertions(+), 32 deletions(-) diff --git a/classes/Advice.php b/classes/Advice.php index f54bd0c..d499219 100644 --- a/classes/Advice.php +++ b/classes/Advice.php @@ -127,7 +127,7 @@ public static function getValidatedByIdTab($idTab, $includePremium = false, $inc date('d') )); - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); + $result = Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS($query); $advices = []; if (is_array($result)) { foreach ($result as $res) { @@ -182,7 +182,7 @@ public static function getIdsAdviceToValidate() $query->groupBy('a.`id_advice`'); $query->having('count(*) = SUM(c.`validated`)'); - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); + $result = Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS($query); if (is_array($result)) { foreach ($result as $advice) { @@ -206,7 +206,7 @@ public static function getIdsAdviceToUnvalidate() $query->groupBy('a.`id_advice`'); $query->having('count(*) = SUM(c.`validated`)'); - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); + $result = Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS($query); if (is_array($result)) { foreach ($result as $advice) { diff --git a/classes/Badge.php b/classes/Badge.php index 40d1064..1e8a202 100644 --- a/classes/Badge.php +++ b/classes/Badge.php @@ -109,7 +109,7 @@ public static function getIdsBadgesToValidate() $query->groupBy('b.`id_badge`'); $query->having('count(*) = SUM(c.validated)'); - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); + $result = Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS($query); foreach ($result as $badge) { $ids[] = $badge['id_badge']; @@ -126,6 +126,6 @@ public function getNextBadgeId() $query->where('b.id_group = \'' . pSQL($this->id_group) . '\' AND b.validated = 0'); $query->orderBy('b.group_position'); - return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); + return Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->getValue($query); } } diff --git a/classes/Condition.php b/classes/Condition.php index 085be06..3b75859 100644 --- a/classes/Condition.php +++ b/classes/Condition.php @@ -346,7 +346,6 @@ protected function makeCalculation($operator, $arg1, $arg2) case '!=': $result = $arg1 != $arg2; break; - break; } return (bool) $result; diff --git a/controllers/admin/AdminGamificationController.php b/controllers/admin/AdminGamificationController.php index c7486b7..3e5ac20 100644 --- a/controllers/admin/AdminGamificationController.php +++ b/controllers/admin/AdminGamificationController.php @@ -74,7 +74,7 @@ public function renderView() $query->join(' LEFT JOIN `' . _DB_PREFIX_ . 'badge_lang` bl ON bl.`id_badge` = b.`id_badge`'); $query->where('bl.id_lang = ' . (int) $this->context->language->id); - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); + $result = Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS($query); foreach ($result as $res) { $groups['badges_' . $res['type']][$res['id_group']] = $res['group_name']; @@ -205,8 +205,8 @@ public function processMakeDailyCalculation() $return = true; $condition_ids = Condition::getIdsDailyCalculation(); foreach ($condition_ids as $id) { - $cond = new Condition((int) $id); - $return &= $cond->processCalculation(); + $condition = new Condition((int) $id); + $return &= $condition->processCalculation(); } return $return; @@ -239,8 +239,8 @@ public function processLevelAndBadgeValidation($ids_badge) $current_level = (int) Configuration::get('GF_CURRENT_LEVEL'); $current_level_percent = (int) Configuration::get('GF_CURRENT_LEVEL_PERCENT'); - $not_viewed_badge = explode('|', ltrim(Configuration::get('GF_NOT_VIEWED_BADGE', ''), '')); - $nbr_notif = Configuration::get('GF_NOTIFICATION', 0); + $not_viewed_badge = explode('|', ltrim(Configuration::get('GF_NOT_VIEWED_BADGE', null, null, null, ''), '')); + $nbr_notif = Configuration::get('GF_NOTIFICATION', null, null, null, 0); if (count($ids_badge)) { $not_viewed_badge = []; diff --git a/gamification.php b/gamification.php index d0c161e..c1935dc 100644 --- a/gamification.php +++ b/gamification.php @@ -58,6 +58,7 @@ public function __construct() $this->description = $this->trans('Check your completion rate and unblock all badges to become an e-commerce expert within the blink of an eye!', [], 'Modules.Merchantexpertise.Admin'); $this->cache_data = __DIR__ . '/data/'; + // @phpstan-ignore-next-line if (self::TEST_MODE === true) { $this->url_data .= 'test/'; } @@ -100,7 +101,7 @@ public function uninstall() public function installDb() { $return = true; - include __DIR__ . '/sql_install.php'; + $sql = include __DIR__ . '/sql_install.php'; foreach ($sql as $s) { $return &= Db::getInstance()->execute($s); } @@ -110,7 +111,7 @@ public function installDb() public function uninstallDb() { - include __DIR__ . '/sql_install.php'; + $sql = include __DIR__ . '/sql_install.php'; foreach ($sql as $name => $v) { Db::getInstance()->execute('DROP TABLE ' . $name); } @@ -121,7 +122,7 @@ public function uninstallDb() public function installTab() { $tab = new Tab(); - $tab->active = 1; + $tab->active = true; $tab->class_name = 'AdminGamification'; $tab->name = []; foreach (Language::getLanguages(true) as $lang) { @@ -130,7 +131,7 @@ public function installTab() if (version_compare(_PS_VERSION_, '1.7.0.0', '>=')) { //AdminPreferences - $tab->id_parent = (int) Db::getInstance(_PS_USE_SQL_SLAVE_) + $tab->id_parent = (int) Db::getInstance((bool) _PS_USE_SQL_SLAVE_) ->getValue( 'SELECT MIN(id_tab) FROM `' . _DB_PREFIX_ . 'tab` @@ -256,7 +257,7 @@ public function renderHeaderNotification() $badges_to_display = []; //retro compat $unlock_badges = []; $next_badges = []; - $not_viewed_badge = explode('|', Configuration::get('GF_NOT_VIEWED_BADGE', '')); + $not_viewed_badge = explode('|', Configuration::get('GF_NOT_VIEWED_BADGE')); foreach ($not_viewed_badge as $id) { $unlock_badges[] = $badges_to_display[] = new Badge((int) $id, (int) $this->context->language->id); $next_badges[] = $badges_to_display[] = new Badge(end($badges_to_display)->getNextBadgeId(), (int) $this->context->language->id); @@ -308,33 +309,49 @@ public function refreshDatas($iso_lang = null) $this->processCleanAdvices(); - if (function_exists('openssl_verify') && self::TEST_MODE === false) { - if (!openssl_verify(json_encode([$data->conditions, $data->advices_lang]), base64_decode($data->signature), file_get_contents(__DIR__ . '/prestashop.pub'))) { + $public_key = file_get_contents(__DIR__ . '/prestashop.pub'); + $signature = isset($data->signature) ? base64_decode($data->signature) : ''; + + if (isset($data->conditions)) { + if ( + function_exists('openssl_verify') + && self::TEST_MODE === false + && isset($data->advices_lang) + && !openssl_verify(json_encode([$data->conditions, $data->advices_lang]), $signature, $public_key) + ) { return false; } - } - if (isset($data->conditions)) { $this->processImportConditions($data->conditions, $id_lang); } - if ((isset($data->badges) && isset($data->badges_lang)) && (!isset($data->badges_only_visible_awb) && !isset($data->badges_only_visible_lang_awb))) { - $this->processImportBadges($data->badges, $data->badges_lang, $id_lang); - } else { - $this->processImportBadges(array_merge($data->badges_only_visible_awb, $data->badges), array_merge($data->badges_only_visible_lang_awb, $data->badges_lang), $id_lang); + if (isset($data->badges) && isset($data->badges_lang)) { + if (!isset($data->badges_only_visible_awb) && !isset($data->badges_only_visible_lang_awb)) { + $this->processImportBadges($data->badges, $data->badges_lang, $id_lang); + } else { + $this->processImportBadges( + array_merge($data->badges_only_visible_awb, $data->badges), + array_merge($data->badges_only_visible_lang_awb, $data->badges_lang), + $id_lang + ); + } } if (isset($data->advices) && isset($data->advices_lang)) { $this->processImportAdvices($data->advices, $data->advices_lang, $id_lang); } - if (function_exists('openssl_verify') && self::TEST_MODE === false) { - if (!openssl_verify(json_encode([$data->advices_lang_16]), base64_decode($data->signature_16), file_get_contents(__DIR__ . '/prestashop.pub'))) { + if (isset($data->advices_lang_16)) { + if ( + function_exists('openssl_verify') + && self::TEST_MODE === false + && !openssl_verify(json_encode([$data->advices_lang_16]), $signature, $public_key) + ) { return false; } - } - if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true && isset($data->advices_16) && isset($data->advices_lang_16)) { - $this->processImportAdvices($data->advices_16, $data->advices_lang_16, $id_lang); + if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true && isset($data->advices_16)) { + $this->processImportAdvices($data->advices_16, $data->advices_lang_16, $id_lang); + } } } } diff --git a/phpunit.xml b/phpunit.xml index dbe832c..f5242c6 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -11,4 +11,14 @@ tests/functional/ + + + + classes + + + + + + diff --git a/sql_install.php b/sql_install.php index f44746e..05591c1 100644 --- a/sql_install.php +++ b/sql_install.php @@ -102,3 +102,5 @@ `id_advice` int(11) NOT NULL, PRIMARY KEY (`id_tab`, `id_advice`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; + +return $sql; diff --git a/tests/functional/CallToGamificationServerTest.php b/tests/functional/CallToGamificationServerTest.php index aed4d93..ca39295 100644 --- a/tests/functional/CallToGamificationServerTest.php +++ b/tests/functional/CallToGamificationServerTest.php @@ -9,6 +9,6 @@ public function testContentIsGzipped() $workingCallUrl = 'https://gamification.prestashop.com/json/data_EN_IDR_ID.json'; $response = GamificationTools::retrieveJsonApiFile($workingCallUrl, true); - $this->assertContains('Content-Encoding: gzip', $response); + $this->assertContains('content-encoding: gzip', $response); } } diff --git a/tests/phpstan/phpstan-1.7.1.2.neon b/tests/phpstan/phpstan-1.7.1.2.neon index c604f7c..e448470 100644 --- a/tests/phpstan/phpstan-1.7.1.2.neon +++ b/tests/phpstan/phpstan-1.7.1.2.neon @@ -1,2 +1,15 @@ includes: - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Access to an undefined property Cookie::\$id_employee.#' + - '#Call to private method add\(\) of parent class ObjectModel.#' + - '#Call to private method delete\(\) of parent class ObjectModel.#' + - '#Call to private method hydrate\(\) of parent class ObjectModel.#' + - '#Call to private method update\(\) of parent class ObjectModel.#' + - '#Call to private method save\(\) of parent class ObjectModel.#' + - '#Class Advice does not have a constructor and must be instantiated without any parameters.#' + - '#Class Badge does not have a constructor and must be instantiated without any parameters.#' + - '#Class Condition does not have a constructor and must be instantiated without any parameters.#' + - '#Constant _PS_CREATION_DATE_ not found.#' diff --git a/tests/phpstan/phpstan-1.7.2.5.neon b/tests/phpstan/phpstan-1.7.2.5.neon index c604f7c..e448470 100644 --- a/tests/phpstan/phpstan-1.7.2.5.neon +++ b/tests/phpstan/phpstan-1.7.2.5.neon @@ -1,2 +1,15 @@ includes: - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Access to an undefined property Cookie::\$id_employee.#' + - '#Call to private method add\(\) of parent class ObjectModel.#' + - '#Call to private method delete\(\) of parent class ObjectModel.#' + - '#Call to private method hydrate\(\) of parent class ObjectModel.#' + - '#Call to private method update\(\) of parent class ObjectModel.#' + - '#Call to private method save\(\) of parent class ObjectModel.#' + - '#Class Advice does not have a constructor and must be instantiated without any parameters.#' + - '#Class Badge does not have a constructor and must be instantiated without any parameters.#' + - '#Class Condition does not have a constructor and must be instantiated without any parameters.#' + - '#Constant _PS_CREATION_DATE_ not found.#' diff --git a/tests/phpstan/phpstan-1.7.3.4.neon b/tests/phpstan/phpstan-1.7.3.4.neon index c604f7c..e448470 100644 --- a/tests/phpstan/phpstan-1.7.3.4.neon +++ b/tests/phpstan/phpstan-1.7.3.4.neon @@ -1,2 +1,15 @@ includes: - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Access to an undefined property Cookie::\$id_employee.#' + - '#Call to private method add\(\) of parent class ObjectModel.#' + - '#Call to private method delete\(\) of parent class ObjectModel.#' + - '#Call to private method hydrate\(\) of parent class ObjectModel.#' + - '#Call to private method update\(\) of parent class ObjectModel.#' + - '#Call to private method save\(\) of parent class ObjectModel.#' + - '#Class Advice does not have a constructor and must be instantiated without any parameters.#' + - '#Class Badge does not have a constructor and must be instantiated without any parameters.#' + - '#Class Condition does not have a constructor and must be instantiated without any parameters.#' + - '#Constant _PS_CREATION_DATE_ not found.#' diff --git a/tests/phpstan/phpstan-1.7.4.4.neon b/tests/phpstan/phpstan-1.7.4.4.neon index c604f7c..e448470 100644 --- a/tests/phpstan/phpstan-1.7.4.4.neon +++ b/tests/phpstan/phpstan-1.7.4.4.neon @@ -1,2 +1,15 @@ includes: - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Access to an undefined property Cookie::\$id_employee.#' + - '#Call to private method add\(\) of parent class ObjectModel.#' + - '#Call to private method delete\(\) of parent class ObjectModel.#' + - '#Call to private method hydrate\(\) of parent class ObjectModel.#' + - '#Call to private method update\(\) of parent class ObjectModel.#' + - '#Call to private method save\(\) of parent class ObjectModel.#' + - '#Class Advice does not have a constructor and must be instantiated without any parameters.#' + - '#Class Badge does not have a constructor and must be instantiated without any parameters.#' + - '#Class Condition does not have a constructor and must be instantiated without any parameters.#' + - '#Constant _PS_CREATION_DATE_ not found.#' diff --git a/tests/phpstan/phpstan-1.7.5.1.neon b/tests/phpstan/phpstan-1.7.5.1.neon index c604f7c..e448470 100644 --- a/tests/phpstan/phpstan-1.7.5.1.neon +++ b/tests/phpstan/phpstan-1.7.5.1.neon @@ -1,2 +1,15 @@ includes: - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Access to an undefined property Cookie::\$id_employee.#' + - '#Call to private method add\(\) of parent class ObjectModel.#' + - '#Call to private method delete\(\) of parent class ObjectModel.#' + - '#Call to private method hydrate\(\) of parent class ObjectModel.#' + - '#Call to private method update\(\) of parent class ObjectModel.#' + - '#Call to private method save\(\) of parent class ObjectModel.#' + - '#Class Advice does not have a constructor and must be instantiated without any parameters.#' + - '#Class Badge does not have a constructor and must be instantiated without any parameters.#' + - '#Class Condition does not have a constructor and must be instantiated without any parameters.#' + - '#Constant _PS_CREATION_DATE_ not found.#' diff --git a/tests/phpstan/phpstan-1.7.6.9.neon b/tests/phpstan/phpstan-1.7.6.9.neon index c604f7c..e448470 100644 --- a/tests/phpstan/phpstan-1.7.6.9.neon +++ b/tests/phpstan/phpstan-1.7.6.9.neon @@ -1,2 +1,15 @@ includes: - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Access to an undefined property Cookie::\$id_employee.#' + - '#Call to private method add\(\) of parent class ObjectModel.#' + - '#Call to private method delete\(\) of parent class ObjectModel.#' + - '#Call to private method hydrate\(\) of parent class ObjectModel.#' + - '#Call to private method update\(\) of parent class ObjectModel.#' + - '#Call to private method save\(\) of parent class ObjectModel.#' + - '#Class Advice does not have a constructor and must be instantiated without any parameters.#' + - '#Class Badge does not have a constructor and must be instantiated without any parameters.#' + - '#Class Condition does not have a constructor and must be instantiated without any parameters.#' + - '#Constant _PS_CREATION_DATE_ not found.#' diff --git a/tests/phpstan/phpstan-1.7.7.3.neon b/tests/phpstan/phpstan-1.7.7.3.neon index c604f7c..e448470 100644 --- a/tests/phpstan/phpstan-1.7.7.3.neon +++ b/tests/phpstan/phpstan-1.7.7.3.neon @@ -1,2 +1,15 @@ includes: - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Access to an undefined property Cookie::\$id_employee.#' + - '#Call to private method add\(\) of parent class ObjectModel.#' + - '#Call to private method delete\(\) of parent class ObjectModel.#' + - '#Call to private method hydrate\(\) of parent class ObjectModel.#' + - '#Call to private method update\(\) of parent class ObjectModel.#' + - '#Call to private method save\(\) of parent class ObjectModel.#' + - '#Class Advice does not have a constructor and must be instantiated without any parameters.#' + - '#Class Badge does not have a constructor and must be instantiated without any parameters.#' + - '#Class Condition does not have a constructor and must be instantiated without any parameters.#' + - '#Constant _PS_CREATION_DATE_ not found.#' diff --git a/tests/phpstan/phpstan-latest.neon b/tests/phpstan/phpstan-latest.neon index c604f7c..e448470 100644 --- a/tests/phpstan/phpstan-latest.neon +++ b/tests/phpstan/phpstan-latest.neon @@ -1,2 +1,15 @@ includes: - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Access to an undefined property Cookie::\$id_employee.#' + - '#Call to private method add\(\) of parent class ObjectModel.#' + - '#Call to private method delete\(\) of parent class ObjectModel.#' + - '#Call to private method hydrate\(\) of parent class ObjectModel.#' + - '#Call to private method update\(\) of parent class ObjectModel.#' + - '#Call to private method save\(\) of parent class ObjectModel.#' + - '#Class Advice does not have a constructor and must be instantiated without any parameters.#' + - '#Class Badge does not have a constructor and must be instantiated without any parameters.#' + - '#Class Condition does not have a constructor and must be instantiated without any parameters.#' + - '#Constant _PS_CREATION_DATE_ not found.#' diff --git a/tests/unit/AdviceTest.php b/tests/unit/AdviceTest.php index 2651c09..ba3d4b3 100644 --- a/tests/unit/AdviceTest.php +++ b/tests/unit/AdviceTest.php @@ -30,7 +30,7 @@ class AdviceTest extends TestCase ]; /** - * @var array the Advice + * @var Advice */ private $advice; diff --git a/upgrade/install-2.3.2.php b/upgrade/install-2.3.2.php index f10444c..68f4f63 100644 --- a/upgrade/install-2.3.2.php +++ b/upgrade/install-2.3.2.php @@ -54,7 +54,7 @@ function removeGamificationPhpUnitFromFsDuringUpgrade(array $files) /** * This upgrade file removes the folder vendor/phpunit, when added from a previous release installed on the shop. * - * @return true|array + * @return bool */ function upgrade_module_2_3_2($module) {