diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml new file mode 100644 index 00000000..f1595d30 --- /dev/null +++ b/.github/workflows/action.yml @@ -0,0 +1,196 @@ +name: PHP CI + +on: [push] + +jobs: + + phpcs: + name: Code Sniffer + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + ############################################################################ + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.3' + tools: composer, prestissimo + extensions: ast + coverage: none + + #https://github.com/actions/cache/blob/master/examples.md#php---composer + - name: Cache composer packages + id: composer-cache + run: | + composer config cache-files-dir + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Update project dependencies + run: | + composer install --prefer-dist --no-progress --no-suggest + composer dump-autoload --optimize + ############################################################################ + + - name: Run the sniffer + run: | + ./vendor/bin/phpcs --config-set ignore_errors_on_exit 1 + ./vendor/bin/phpcs --config-set ignore_warnings_on_exit 1 + ./vendor/bin/phpcs --standard=ruleset.xml --severity=10 --report=checkstyle --report-file=chkphpcs.xml . + + - name: Archive code sniffing results + uses: actions/upload-artifact@v1 + with: + name: phpcs-xml-result + path: chkphpcs.xml + + - name: Report annotations + id: report-annotations + run: ./vendor/bin/cs2pr chkphpcs.xml + + phpmd: + name: Mess Detect + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + ############################################################################ + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.3' + tools: composer, prestissimo + extensions: ast + coverage: none + + #https://github.com/actions/cache/blob/master/examples.md#php---composer + - name: Cache composer packages + id: composer-cache + run: | + composer config cache-files-dir + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Update project dependencies + run: | + composer install --prefer-dist --no-progress --no-suggest + composer dump-autoload --optimize + ############################################################################ + + - name: Run the mess detector + run: ./vendor/bin/phpmd . xml codesize,naming,unusedcode,controversial,design --exclude vendor,var,build,tests,.phan --reportfile pmdphpmd.xml --ignore-violations-on-exit + + - name: Archive mess detection results + uses: actions/upload-artifact@v1 + with: + name: phpmd-xml-result + path: pmdphpmd.xml + + - name: Report annotations + id: report-annotations + run: ./vendor/bin/pmd2pr --graceful-warnings pmdphpmd.xml + + phpcpd: + name: Copy-Paste Detect + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + ############################################################################ + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.3' + tools: composer, prestissimo + extensions: ast + coverage: none + + #https://github.com/actions/cache/blob/master/examples.md#php---composer + - name: Cache composer packages + id: composer-cache + run: | + composer config cache-files-dir + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Update project dependencies + run: | + composer install --prefer-dist --no-progress --no-suggest + composer dump-autoload --optimize + ############################################################################ + + #https://github.com/sebastianbergmann/phpcpd/issues/148 + - name: Run the copy-paste detector + run: ./vendor/bin/phpcpd --exclude=vendor --exclude=build --log-pmd=phdpcpd.xml . + continue-on-error: true + + - name: Archive copy-paste detection results + uses: actions/upload-artifact@v1 + with: + name: phdpcpd-xml-result + path: phdpcpd.xml + + - name: Report annotations + id: report-annotations + run: | + composer require mridang/cpd-annotations + ./vendor/bin/cpd2pr phdpcpd.xml + + package: + name: Package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + ############################################################################ + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.3' + tools: composer, prestissimo + extensions: ast + coverage: none + + #https://github.com/actions/cache/blob/master/examples.md#php---composer + - name: Cache composer packages + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Update project dependencies + run: | + composer install --prefer-dist --no-progress --no-suggest + composer dump-autoload --optimize + ############################################################################ + + - name: Build archive using composer + run: composer build-package + + - name: Archive built package + uses: actions/upload-artifact@v1 + with: + name: NostoTagging-X.Y.Z.zip + path: NostoTagging-X.Y.Z.zip + diff --git a/.github/workflows/ide.yml b/.github/workflows/ide.yml new file mode 100644 index 00000000..2d46b712 --- /dev/null +++ b/.github/workflows/ide.yml @@ -0,0 +1,58 @@ +name: PHPStorm + +on: [push] + +jobs: + + ide: + name: IDE Inspection + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + ############################################################################ + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.3' + tools: composer, prestissimo, pecl + coverage: none + + - name: Install AST extension + run: sudo pecl install -f ast + + #https://github.com/actions/cache/blob/master/examples.md#php---composer + - name: Cache composer packages + id: composer-cache + run: | + composer config cache-files-dir + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Update project dependencies + run: | + composer install --prefer-dist --no-progress --no-suggest + composer dump-autoload --optimize + rm -rf vendor/bin build/static/Random.php + ############################################################################ + + - name: Run PHPStorm + uses: mridang/action-phpstorm@master + with: + target: . + profile: ./.idea/inspectionProfiles/CI.xml + output: ./output + verbosity: v2 + scope: Inspection + + - name: Archive inspection results + uses: actions/upload-artifact@v1 + with: + name: inspection-results + path: output diff --git a/.github/workflows/phan.yml b/.github/workflows/phan.yml new file mode 100644 index 00000000..2fcae3dd --- /dev/null +++ b/.github/workflows/phan.yml @@ -0,0 +1,57 @@ +name: Phan + +on: [push] + +jobs: + + phan: + name: Phan Analysis + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + ############################################################################ + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.3' + tools: composer, prestissimo, pecl + coverage: none + + - name: Install AST extension + run: sudo pecl install -f ast + + #https://github.com/actions/cache/blob/master/examples.md#php---composer + - name: Cache composer packages + id: composer-cache + run: | + composer config cache-files-dir + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Update project dependencies + run: | + composer install --prefer-dist --no-progress --no-suggest + composer dump-autoload --optimize + ############################################################################ + + - name: Run Phan analysis + id: phan-analysis + run: ./vendor/bin/phan --config-file=phan.php --output-mode=checkstyle --output=chkphan.xml --processes=4 + continue-on-error: true + + - name: Archive static analysis results + uses: actions/upload-artifact@v1 + with: + name: phan-analysis-results + path: chkphan.xml + + - name: Report annotations + id: report-annotations + run: ./vendor/bin/cs2pr chkphan.xml diff --git a/.gitignore b/.gitignore index aadfc80f..f701eb68 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ vendor build/package build/src .idea +output +.idea/workspace.xml +NostoTagging/ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..c2625a21 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,59 @@ + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..a55e7a17 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/copyright/Nosto.xml b/.idea/copyright/Nosto.xml new file mode 100644 index 00000000..7f6c25c1 --- /dev/null +++ b/.idea/copyright/Nosto.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 00000000..65e4aad6 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/dictionaries/mridang.xml b/.idea/dictionaries/mridang.xml new file mode 100644 index 00000000..e5c21154 --- /dev/null +++ b/.idea/dictionaries/mridang.xml @@ -0,0 +1,11 @@ + + + + enlight + frontpage + notfound + phan + shopware + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 00000000..97626ba4 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/CI.xml b/.idea/inspectionProfiles/CI.xml new file mode 100644 index 00000000..5a54092a --- /dev/null +++ b/.idea/inspectionProfiles/CI.xml @@ -0,0 +1,23 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..0b2813a2 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,15 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..05670d50 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 00000000..164a20af --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/magento2plugin.xml b/.idea/magento2plugin.xml new file mode 100644 index 00000000..6485e055 --- /dev/null +++ b/.idea/magento2plugin.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..49d3a53d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..4f9fb5c6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/phing.xml b/.idea/phing.xml new file mode 100644 index 00000000..80021d01 --- /dev/null +++ b/.idea/phing.xml @@ -0,0 +1,6 @@ + + + + $PROJECT_DIR$/vendor/phing/phing/bin/phing + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 00000000..57ebcc19 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/scopes/Inspection.xml b/.idea/scopes/Inspection.xml new file mode 100644 index 00000000..b3842dae --- /dev/null +++ b/.idea/scopes/Inspection.xml @@ -0,0 +1,3 @@ + + + diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.phan/Shopware/Models/Attribute/Customer.php b/.phan/Shopware/Models/Attribute/Customer.php index d16ef2c1..7500afb3 100644 --- a/.phan/Shopware/Models/Attribute/Customer.php +++ b/.phan/Shopware/Models/Attribute/Customer.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/.phan/Shopware/Models/Attribute/CustomerAttribute.php b/.phan/Shopware/Models/Attribute/CustomerAttribute.php new file mode 100644 index 00000000..04d757e1 --- /dev/null +++ b/.phan/Shopware/Models/Attribute/CustomerAttribute.php @@ -0,0 +1,43 @@ + + * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause + */ + +namespace Shopware\Models\Attribute; + +class CustomerAttribute +{ + +} diff --git a/.phan/Shopware/Models/Attribute/Order.php b/.phan/Shopware/Models/Attribute/Order.php index 39454c2f..7cbecd61 100644 --- a/.phan/Shopware/Models/Attribute/Order.php +++ b/.phan/Shopware/Models/Attribute/Order.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/.phan/Shopware/Models/Attribute/OrderAttribute.php b/.phan/Shopware/Models/Attribute/OrderAttribute.php new file mode 100644 index 00000000..3f8f0c24 --- /dev/null +++ b/.phan/Shopware/Models/Attribute/OrderAttribute.php @@ -0,0 +1,43 @@ + + * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause + */ + +namespace Shopware\Models\Attribute; + +class OrderAttribute +{ + +} diff --git a/.phan/Shopware/Models/Billing/Billing.php b/.phan/Shopware/Models/Billing/Billing.php new file mode 100644 index 00000000..b2fb1b12 --- /dev/null +++ b/.phan/Shopware/Models/Billing/Billing.php @@ -0,0 +1,76 @@ + + * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause + */ + +namespace Shopware\Models\Customer; + +class Billing +{ + /** + * @return string + */ + public function getFirstName() + { + } + + /** + * @return string + */ + public function getLastName() + { + } + + /** + * @return string + */ + public function getZipCode() + { + } + + /** + * @return string + */ + public function getPhone() + { + } + + /** + * @return string + */ + public function getCountryId() + { + } +} diff --git a/Bootstrap.php b/Bootstrap.php index 21cb3db6..c778165c 100644 --- a/Bootstrap.php +++ b/Bootstrap.php @@ -1,6 +1,5 @@ - - * @copyright Copyright (c) 2016 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause - */ - + */ // @codingStandardsIgnoreLine require_once __DIR__ . '/vendor/autoload.php'; +use Shopware\Components\Logger; use Shopware_Plugins_Frontend_NostoTagging_Components_Order_Confirmation as NostoOrderConfirmation; use Shopware_Plugins_Frontend_NostoTagging_Components_Operation_Settings as NostoSettingsOperation; use Shopware_Plugins_Frontend_NostoTagging_Components_Operation_Product as NostoOperationProduct; @@ -56,7 +55,6 @@ use Shopware\CustomModels\Nosto\Setting\Setting; use Nosto\Object\Signup\Account as NostoAccount; use phpseclib\Crypt\Random as NostoCryptRandom; -use Doctrine\ORM\TransactionRequiredException; use Shopware\Components\Model\ModelManager; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\OptimisticLockException; @@ -82,13 +80,13 @@ * * @package Shopware * @subpackage Plugins_Frontend + * @noinspection PhpIllegalPsrClassPathInspection */ class Shopware_Plugins_Frontend_NostoTagging_Bootstrap extends Shopware_Components_Plugin_Bootstrap { const PLATFORM_NAME = 'shopware'; const PLUGIN_VERSION = '2.4.9'; const MENU_PARENT_ID = 23; // Configuration - const NEW_ENTITY_MANAGER_VERSION = '5.0.0'; const NEW_ATTRIBUTE_MANAGER_VERSION = '5.2.0'; const SUPPORT_SHOW_REVIEW_SUB_SHOP_ONLY_VERSION = '5.3.0'; const PLATFORM_UI_VERSION = '1'; @@ -144,6 +142,7 @@ class Shopware_Plugins_Frontend_NostoTagging_Bootstrap extends Shopware_Componen * @inheritdoc * @suppress PhanTypeMismatchArgument * @throws NostoException + * @noinspection PhpUnused */ public function afterInit() { @@ -153,6 +152,7 @@ public function afterInit() /** * @inheritdoc + * @noinspection PhpUnused */ public function getCapabilities() { @@ -165,6 +165,7 @@ public function getCapabilities() /** * @inheritdoc + * @noinspection PhpUnused */ public function getInfo() { @@ -200,8 +201,9 @@ public function getLabel() /** * @inheritdoc - * @throws \Exception + * @throws Exception * @throws ToolsException + * @noinspection PhpUnused */ public function install() { @@ -282,10 +284,10 @@ public function createConfiguration() array(self::CONFIG_MULTI_CURRENCY_EXCHANGE_RATES, 'Exchange Rates'), ), 'description' => 'Set this to "Exchange rates" if your store uses Shopware\'s exchange rates. - If you have a custom pricing handling set this to "Disabled" and Nosto will not + If you have a custom pricing handling set this to "Disabled" and Nosto will not make any currency conversions.', 'required' => true, - 'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP) + 'scope' => Element::SCOPE_SHOP) ); } @@ -382,6 +384,7 @@ private function addMyAttribute(array $attribute) $attribute['type'] ); } else { + /** @noinspection PhpUndefinedMethodInspection */ /** @phan-suppress-next-line PhanUndeclaredMethod */ Shopware()->Models()->addAttribute( $attribute['table'], @@ -452,7 +455,7 @@ protected function createMyMenu() 'class' => 'nosto--icon' ) ); - } catch (\Exception $e) { + } catch (Exception $e) { $this->getLogger()->warning($e->getMessage()); } } @@ -466,7 +469,9 @@ protected function createMyMenu() */ public function getShopwareVersion() { + /** @noinspection PhpUndefinedClassConstantInspection */ if (defined('Shopware::VERSION') && Shopware::VERSION !== null && Shopware::VERSION !== '___VERSION___') { + /** @noinspection PhpUndefinedClassConstantInspection */ return Shopware::VERSION; } if (Shopware()->Container()->getParameter('shopware.release.version')) { @@ -602,12 +607,15 @@ protected function registerMyEvents() * Return all shops from a backend context * * @return array shops + * @noinspection PhpUndefinedClassInspection + * @noinspection PhpUnused */ public function getAllActiveShops() { /** @phan-suppress-next-line UndeclaredTypeInInlineVar */ - /** @var \Shopware_Proxies_ShopwareModelsShopRepositoryProxy $repository */ + /** @var Shopware_Proxies_ShopwareModelsShopRepositoryProxy $repository */ $repository = Shopware()->Container()->get('models')->getRepository('Shopware\Models\Shop\Shop'); + /** @noinspection PhpUndefinedMethodInspection */ return $repository->getActiveShops(); } @@ -617,6 +625,7 @@ public function getAllActiveShops() * * @param Shop $shop * @return array|mixed + * @noinspection PhpUnused */ public function getShopConfig(Shop $shop) { @@ -629,12 +638,15 @@ public function getShopConfig(Shop $shop) * Event that runs on every configuration save * * @param Enlight_Event_EventArgs $args + * @throws NostoException + * @noinspection PhpUnused */ public function afterSaveConfig(Enlight_Event_EventArgs $args) { try { + /** @noinspection PhpUndefinedMethodInspection */ $configValues = $args->getElement()->getValues()->getValues(); - } catch (\Exception $e) { + } catch (Exception $e) { $this->getLogger()->error( 'Could not save backend configuration ' . $e->getMessage() ); @@ -653,6 +665,7 @@ public function afterSaveConfig(Enlight_Event_EventArgs $args) /** * Registers dependencies / autoloader + * @noinspection PhpUnused */ public function registerMyComponents() { @@ -685,7 +698,8 @@ private function clearShopwareCache() /** * @inheritdoc - * @throws \Exception + * @throws Exception + * @noinspection PhpUnused */ public function update($existingVersion) { @@ -699,7 +713,8 @@ public function update($existingVersion) /** * @inheritdoc - * @throws \Exception + * @throws Exception + * @noinspection PhpUnused */ public function uninstall() { @@ -781,6 +796,7 @@ private function removeMyAttribute(array $attribute) $fieldName ); } else { + /** @noinspection PhpUndefinedMethodInspection */ /** @phan-suppress-next-line PhanUndeclaredMethod */ Shopware()->Models()->removeAttribute( $attribute['table'], @@ -805,7 +821,7 @@ private function removeMyAttribute(array $attribute) private function validatePathSource() { // Check that the path is valid - $reflection = new \ReflectionClass($this); + $reflection = new ReflectionClass($this); if ($fileName = $reflection->getFileName()) { $dirName = dirname($fileName) . DIRECTORY_SEPARATOR; if ($this->Path() === $dirName) { @@ -847,7 +863,10 @@ private function updatePluginSource() * e.g. if the backend is loaded as a part of the OAuth cycle. * * @param Enlight_Controller_ActionEventArgs $args the event arguments. + * @throws NostoException + * @throws ORMException * @throws OptimisticLockException + * @noinspection PhpUnused */ public function onPostDispatchBackendIndex(Enlight_Controller_ActionEventArgs $args) { @@ -856,7 +875,7 @@ public function onPostDispatchBackendIndex(Enlight_Controller_ActionEventArgs $a $request = $ctrl->Request(); try { $this->validatePathSource(); - } catch (\Exception $e) { + } catch (Exception $e) { $this->getLogger()->warning( sprintf( "Could not validate extension installation path. Error message was: %s", @@ -928,17 +947,12 @@ protected function validateEvent($controller, $module, $ctrl = null, $action = n $response = $controller->Response(); $view = $controller->View(); - if (!$request->isDispatched() - || $response->isException() - || $request->getModuleName() != $module - || (!is_null($ctrl) && $request->getControllerName() != $ctrl) - || (!is_null($action) && $request->getActionName() != $action) + return !(!$request->isDispatched() || !$view->hasTemplate() - ) { - return false; - } - - return true; + || $response->isException() + || $request->getModuleName() !== $module + || (!is_null($ctrl) && $request->getControllerName() !== $ctrl) + || (!is_null($action) && $request->getActionName() !== $action)); } /** @@ -950,14 +964,12 @@ protected function validateEvent($controller, $module, $ctrl = null, $action = n * * @param Enlight_Controller_ActionEventArgs $args the event arguments. * @throws ORMException - * @throws OptimisticLockException - * @throws TransactionRequiredException - * @throws Enlight_Event_Exception + * @noinspection PhpUnused */ public function onPostDispatchFrontend(Enlight_Controller_ActionEventArgs $args) { - if (!$this->validateEvent($args->getSubject(), 'frontend') - || !$this->shopHasConnectedAccount() + if (!$this->shopHasConnectedAccount() + || !$this->validateEvent($args->getSubject(), 'frontend') ) { return; } @@ -986,7 +998,7 @@ protected function shopHasConnectedAccount() $shop = Shopware()->Shop(); try { return NostoComponentAccount::accountExistsAndIsConnected($shop); - } catch (\Exception $e) { + } catch (Exception $e) { $this->getLogger()->warning($e->getMessage()); } return false; @@ -1015,7 +1027,7 @@ protected function addEmbedScript(Enlight_View_Default $view) Nosto::getEnvVariable('NOSTO_SERVER_URL', 'connect.nosto.com') ); } - } catch (\Exception $e) { + } catch (Exception $e) { $this->getLogger()->warning($e->getMessage()); } } @@ -1028,8 +1040,6 @@ protected function addEmbedScript(Enlight_View_Default $view) * * @throws Enlight_Event_Exception * @throws ORMException - * @throws OptimisticLockException - * @throws TransactionRequiredException * @see Shopware_Controllers_Frontend_NostoTagging::noCacheTaggingAction * @return NostoCustomerModel|null */ @@ -1070,7 +1080,7 @@ public function generateCartTagging() array( 'sessionId' => (Shopware()->Session()->offsetExists('sessionId') ? Shopware()->Session()->offsetGet('sessionId') - : Shopware()->SessionID()) + : Shopware()->SessionID()) // @phan-suppress-current-line PhanDeprecatedFunction ) ); @@ -1082,6 +1092,7 @@ public function generateCartTagging() /** * Adds the hcid tagging for cart and customer. * + * @param Enlight_View_Default $view * @see Shopware_Plugins_Frontend_NostoTagging_Bootstrap::onPostDispatchFrontend */ protected function addHcidTagging(Enlight_View_Default $view) @@ -1110,6 +1121,7 @@ public function generateVariationTagging() * Returns a unique ID for this Shopware installation. * @suppress PhanUndeclaredClassMethod * @return string + * @throws ORMException * @throws OptimisticLockException */ public function getUniqueId() @@ -1122,7 +1134,6 @@ public function getUniqueId() if (is_null($setting)) { $setting = new Setting(); $setting->setName('uniqueId'); - /** @noinspection PhpUndefinedClassInspection */ $setting->setValue(bin2hex(NostoCryptRandom::string(32))); Shopware()->Models()->persist($setting); Shopware()->Models()->flush($setting); @@ -1137,11 +1148,12 @@ public function getUniqueId() * Adds the home page recommendation elements. * * @param Enlight_Controller_ActionEventArgs $args the event arguments. + * @noinspection PhpUnused */ public function onPostDispatchFrontendIndex(Enlight_Controller_ActionEventArgs $args) { - if (!$this->validateEvent($args->getSubject(), 'frontend', 'index', 'index') - || !$this->shopHasConnectedAccount() + if (!$this->shopHasConnectedAccount() + || !$this->validateEvent($args->getSubject(), 'frontend', 'index', 'index') ) { return; } @@ -1175,13 +1187,13 @@ protected function addPageTypeTagging(Enlight_View_Default $view, $pageType) * @param Enlight_Controller_ActionEventArgs $args the event arguments. * @throws OptimisticLockException * @throws ORMException - * @throws TransactionRequiredException * @throws Enlight_Event_Exception + * @noinspection PhpUnused */ public function onPostDispatchFrontendDetail(Enlight_Controller_ActionEventArgs $args) { - if (!$this->validateEvent($args->getSubject(), 'frontend', 'detail', 'index') - || !$this->shopHasConnectedAccount() + if (!$this->shopHasConnectedAccount() + || !$this->validateEvent($args->getSubject(), 'frontend', 'detail', 'index') ) { return; } @@ -1203,7 +1215,6 @@ public function onPostDispatchFrontendDetail(Enlight_Controller_ActionEventArgs * @throws OptimisticLockException * @throws NonUniqueResultException * @throws ORMException - * @throws TransactionRequiredException * @see Shopware_Plugins_Frontend_NostoTagging_Bootstrap::onPostDispatchFrontendDetail */ protected function addProductTagging(Enlight_View_Default $view) @@ -1239,14 +1250,13 @@ protected function addProductTagging(Enlight_View_Default $view) * * @param Enlight_Controller_ActionEventArgs $args the event arguments. * @throws ORMException - * @throws OptimisticLockException - * @throws TransactionRequiredException * @throws Enlight_Event_Exception + * @noinspection PhpUnused */ public function onPostDispatchFrontendListing(Enlight_Controller_ActionEventArgs $args) { - if (!$this->validateEvent($args->getSubject(), 'frontend', 'listing', 'index') - || !$this->shopHasConnectedAccount() + if (!$this->shopHasConnectedAccount() + || !$this->validateEvent($args->getSubject(), 'frontend', 'listing', 'index') ) { return; } @@ -1267,8 +1277,6 @@ public function onPostDispatchFrontendListing(Enlight_Controller_ActionEventArgs * * @throws Enlight_Event_Exception * @throws ORMException - * @throws OptimisticLockException - * @throws TransactionRequiredException * @see Shopware_Plugins_Frontend_NostoTagging_Bootstrap::onPostDispatchFrontendListing */ protected function addCategoryTagging(Enlight_View_Default $view) @@ -1294,6 +1302,7 @@ protected function addCategoryTagging(Enlight_View_Default $view) * Adds the order thank you page tagging. * * @param Enlight_Controller_ActionEventArgs $args the event arguments. + * @noinspection PhpUnused */ public function onPostDispatchFrontendCheckout(Enlight_Controller_ActionEventArgs $args) { @@ -1314,7 +1323,7 @@ public function onPostDispatchFrontendCheckout(Enlight_Controller_ActionEventArg $this->addOrderTagging($view); $this->addPageTypeTagging($view, self::PAGE_TYPE_ORDER); } - } catch (\Exception $e) { + } catch (Exception $e) { $this->getLogger()->warning($e->getMessage()); } } @@ -1327,7 +1336,6 @@ public function onPostDispatchFrontendCheckout(Enlight_Controller_ActionEventArg * @param Enlight_View_Default $view the view. * * @throws Enlight_Event_Exception - * @throws NostoException * @see Shopware_Plugins_Frontend_NostoTagging_Bootstrap::onPostDispatchFrontendCheckout */ protected function addOrderTagging(Enlight_View_Default $view) @@ -1348,7 +1356,7 @@ protected function addOrderTagging(Enlight_View_Default $view) // number was not present in the order variables. // This will be the case for Shopware <= 4.2. $customerId = Shopware()->Session()->offsetGet('sUserId'); - /** @phan-suppress-next-line PhanParamTooMany */ + // @phan-suppress-next-line PhanParamTooMany $order = Shopware() ->Models() ->getRepository('\Shopware\Models\Order\Order') @@ -1376,11 +1384,12 @@ protected function addOrderTagging(Enlight_View_Default $view) * Adds the search page tagging. * * @param Enlight_Controller_ActionEventArgs $args the event arguments. + * @noinspection PhpUnused */ public function onPostDispatchFrontendSearch(Enlight_Controller_ActionEventArgs $args) { - if (!$this->validateEvent($args->getSubject(), 'frontend', 'search', 'defaultSearch') - || !$this->shopHasConnectedAccount() + if (!$this->shopHasConnectedAccount() + || !$this->validateEvent($args->getSubject(), 'frontend', 'search', 'defaultSearch') ) { return; } @@ -1415,6 +1424,7 @@ protected function addSearchTagging(Enlight_View_Default $view) * * @param Enlight_Event_EventArgs $args the event arguments. * @return string the path to the controller file. + * @noinspection PhpUnused */ public function onControllerPathBackend(/** @noinspection PhpUnusedParameterInspection */ Enlight_Event_EventArgs $args @@ -1430,6 +1440,7 @@ public function onControllerPathBackend(/** @noinspection PhpUnusedParameterInsp * * @param Enlight_Event_EventArgs $args the event arguments. * @return string the path to the controller file. + * @noinspection PhpUnused */ public function onControllerPathFrontend(/** @noinspection PhpUnusedParameterInspection */ Enlight_Event_EventArgs $args @@ -1443,6 +1454,7 @@ public function onControllerPathFrontend(/** @noinspection PhpUnusedParameterIns * Adds the recommendation elements for not found pages. * * @param Enlight_Controller_EventArgs | Enlight_Event_EventArgs $args the event arguments. + * @noinspection PhpUnused */ public function onFrontEndErrorGenericError($args) { @@ -1456,19 +1468,16 @@ public function onFrontEndErrorGenericError($args) /** @noinspection PhpUndefinedMethodInspection */ $view = $controller->View(); - /** @noinspection PhpUndefinedMethodInspection */ if (!$request->isDispatched() - || $request->getModuleName() != 'frontend' - || $request->getControllerName() != 'error' - || $response->getHttpResponseCode() != 404 + || $request->getModuleName() !== 'frontend' + || $request->getControllerName() !== 'error' + || (int)$response->getHttpResponseCode() !== 404 || !$view->hasTemplate() ) { return; } - /** @noinspection PhpUndefinedMethodInspection */ $view->addTemplateDir($this->Path() . 'Views/'); - /** @noinspection PhpUndefinedMethodInspection */ $view->extendsTemplate('frontend/plugins/nosto_tagging/notfound/index.tpl'); $this->addPageTypeTagging($view, self::PAGE_TYPE_NOTFOUND); } @@ -1479,8 +1488,10 @@ public function onFrontEndErrorGenericError($args) * Sends an API order confirmation to Nosto. * * @param Enlight_Hook_HookArgs $args the hook arguments. + * @throws ORMException * @throws OptimisticLockException * @suppress PhanUndeclaredMethod + * @noinspection PhpUnused */ public function onOrderSSaveOrderAfter(Enlight_Hook_HookArgs $args) { @@ -1499,7 +1510,6 @@ public function onOrderSSaveOrderAfter(Enlight_Hook_HookArgs $args) ->Models() ->getRepository('\Shopware\Models\Attribute\Order') ->findOneBy(array('orderId' => $order->getId())); - /** @noinspection PhpUndefinedClassInspection */ if ($attribute instanceof OrderAttribute && method_exists($attribute, 'setNostoCustomerId') ) { @@ -1512,7 +1522,7 @@ public function onOrderSSaveOrderAfter(Enlight_Hook_HookArgs $args) try { $orderConfirmation = new NostoOrderConfirmation(); $orderConfirmation->sendOrder($order); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->warning($e->getMessage()); } @@ -1525,6 +1535,7 @@ public function onOrderSSaveOrderAfter(Enlight_Hook_HookArgs $args) * Sends an API order confirmation to Nosto. * * @param Enlight_Event_EventArgs $args + * @noinspection PhpUnused */ public function onPostUpdateOrder(Enlight_Event_EventArgs $args) { @@ -1535,7 +1546,7 @@ public function onPostUpdateOrder(Enlight_Event_EventArgs $args) try { $orderConfirmation = new NostoOrderConfirmation(); $orderConfirmation->sendOrder($order); - } catch (\Exception $e) { + } catch (Exception $e) { $this->getLogger()->warning($e->getMessage()); } } @@ -1547,6 +1558,7 @@ public function onPostUpdateOrder(Enlight_Event_EventArgs $args) * * @param Enlight_Event_EventArgs $args * @throws Exception + * @noinspection PhpUnused */ public function onPostPersistArticle(Enlight_Event_EventArgs $args) { @@ -1554,8 +1566,8 @@ public function onPostPersistArticle(Enlight_Event_EventArgs $args) /** @noinspection PhpUndefinedMethodInspection */ $article = $args->getEntity(); - if (self::$productUpdated == false) { - if ($article instanceof \Shopware\Models\Article\Detail) { + if (self::$productUpdated === false) { + if ($article instanceof Detail) { $article = $article->getArticle(); } $op = new NostoOperationProduct(); @@ -1571,6 +1583,7 @@ public function onPostPersistArticle(Enlight_Event_EventArgs $args) * * @param Enlight_Event_EventArgs $args * @throws Exception + * @noinspection PhpUnused */ public function onPostUpdateArticle(Enlight_Event_EventArgs $args) { @@ -1578,7 +1591,7 @@ public function onPostUpdateArticle(Enlight_Event_EventArgs $args) /** @noinspection PhpUndefinedMethodInspection */ $article = $args->getEntity(); - if (self::$productUpdated == false) { + if (self::$productUpdated === false) { if ($article instanceof Detail) { $article = $article->getArticle(); } @@ -1586,7 +1599,7 @@ public function onPostUpdateArticle(Enlight_Event_EventArgs $args) $op = new NostoOperationProduct(); $op->update($article); self::$productUpdated = true; - } catch (\Exception $e) { + } catch (Exception $e) { $this->getLogger()->warning($e->getMessage()); } } @@ -1598,6 +1611,7 @@ public function onPostUpdateArticle(Enlight_Event_EventArgs $args) * Sends a product `delete` API call to Nosto for the removed article. * * @param Enlight_Event_EventArgs $args + * @noinspection PhpUnused */ public function onPostRemoveArticle(Enlight_Event_EventArgs $args) { @@ -1607,13 +1621,13 @@ public function onPostRemoveArticle(Enlight_Event_EventArgs $args) try { $op = new NostoOperationProduct(); $op->delete($article); - } catch (\Exception $e) { + } catch (Exception $e) { $this->getLogger()->warning($e->getMessage()); } } /** - * @return \Shopware\Components\Logger + * @return Logger */ public function getLogger() { diff --git a/Components/Account.php b/Components/Account.php index bf20f0dc..e08f809e 100644 --- a/Components/Account.php +++ b/Components/Account.php @@ -1,6 +1,8 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as NostoTaggingBootstrap; -use Nosto\Object\Signup\Account as NostoAccount; -use Nosto\Request\Api\Token as NostoApiToken; +use Doctrine\ORM\Mapping as ORM; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; use Nosto\Helper\IframeHelper; use Nosto\NostoException; +use Nosto\Object\Signup\Account as NostoAccount; use Nosto\Operation\AccountSignup; use Nosto\Operation\UninstallAccount; -use Shopware\Models\Shop\Shop; +use Nosto\Request\Api\Token as NostoApiToken; +use Shopware\CustomModels\Nosto\Account\Account as AccountCustomModel; use Shopware\Models\Shop\Locale; +use Shopware\Models\Shop\Shop; +use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as NostoTaggingBootstrap; use Shopware_Plugins_Frontend_NostoTagging_Components_Meta_Account as MetaAccount; -use Shopware\CustomModels\Nosto\Account\Account as AccountCustomModel; use Shopware_Plugins_Frontend_NostoTagging_Components_Meta_Account_Iframe as Iframe; use Shopware_Plugins_Frontend_NostoTagging_Components_User_Builder as UserBuilder; -use Doctrine\ORM\OptimisticLockException; -use Doctrine\ORM\ORMInvalidArgumentException; /** * Account component. Used as a helper to manage Nosto account inside Shopware. @@ -56,6 +59,7 @@ * @package Shopware * @subpackage Plugins_Frontend */ +/** @phan-file-suppress PhanUnreferencedUseNormal */ class Shopware_Plugins_Frontend_NostoTagging_Components_Account { /** @@ -100,7 +104,6 @@ public static function createAccount( } $operation = new AccountSignup($meta); $nostoAccount = $operation->create(); - /** @noinspection PhpParamsInspection */ return self::convertToShopwareAccount($nostoAccount, $shop); } @@ -146,8 +149,9 @@ public static function convertToShopwareAccount( * * @param AccountCustomModel $account the account to remove. * @param $identity + * @throws NostoException * @throws OptimisticLockException - * @throws ORMInvalidArgumentException + * @throws ORMException */ public static function removeAccount(AccountCustomModel $account, $identity) { @@ -159,7 +163,7 @@ public static function removeAccount(AccountCustomModel $account, $identity) $operation = new UninstallAccount($nostoAccount); $user = new UserBuilder(); $operation->delete($user->build($identity)); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } @@ -170,6 +174,7 @@ public static function removeAccount(AccountCustomModel $account, $identity) * * @param AccountCustomModel $account the account model. * @return NostoAccount the nosto account. + * @throws NostoException */ public static function convertToNostoAccount(AccountCustomModel $account) { @@ -193,6 +198,7 @@ public static function convertToNostoAccount(AccountCustomModel $account) * * @param Shop $shop the shop to check the account for. * @return bool true if account exists and is connected to Nosto, false otherwise. + * @throws NostoException */ public static function accountExistsAndIsConnected(Shop $shop) { @@ -213,14 +219,14 @@ public static function accountExistsAndIsConnected(Shop $shop) * @param AccountCustomModel|null $account the account to get the url * @param stdClass|null $identity (optional) user identity. * @param array $params (optional) parameters for the url. - * @suppress PhanUndeclaredMethod * @return string the url. + * @throws NostoException + * @suppress PhanUndeclaredMethod */ public static function buildAccountIframeUrl( Shop $shop, Locale $locale = null, - AccountCustomModel - $account = null, + AccountCustomModel $account = null, $identity = null, array $params = array() ) { diff --git a/Components/Customer.php b/Components/Customer.php index 88c03e58..732cc22b 100644 --- a/Components/Customer.php +++ b/Components/Customer.php @@ -1,6 +1,8 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware\CustomModels\Nosto\Customer\Customer; +use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; +use Shopware\CustomModels\Nosto\Customer\Customer; /** * Customer component. Used as a helper to manage the Nosto user session inside @@ -44,6 +48,7 @@ * @package Shopware * @subpackage Plugins_Frontend */ +/** @phan-file-suppress PhanUnreferencedUseNormal */ class Shopware_Plugins_Frontend_NostoTagging_Components_Customer { /** @@ -70,6 +75,7 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Customer * belonged to. * @suppress PhanDeprecatedFunction * @throws OptimisticLockException + * @throws ORMException */ public static function persistSession() { diff --git a/Components/Helper/CartRestore.php b/Components/Helper/CartRestore.php index 450624a5..e1743a06 100644 --- a/Components/Helper/CartRestore.php +++ b/Components/Helper/CartRestore.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Components_Customer as NostoCustomerComponent; -use Shopware\CustomModels\Nosto\Customer\Customer as CustomerModel; -use Shopware_Plugins_Frontend_NostoTagging_Components_Url as NostoHelperUrl; use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; +use Shopware\CustomModels\Nosto\Customer\Customer as CustomerModel; use Shopware\Models\Order\Basket; +use Shopware_Plugins_Frontend_NostoTagging_Components_Customer as NostoCustomerComponent; +use Shopware_Plugins_Frontend_NostoTagging_Components_Url as NostoHelperUrl; /** * @@ -78,6 +80,7 @@ public function getSessionId() * * @return null|string * @throws OptimisticLockException + * @throws ORMException */ public function generateRestoreToCartLink() { @@ -134,7 +137,7 @@ public function updateBasket($sessionId, $newSessionId) Shopware()->Models()->flush($basketItem); } $this->updateNostoCustomerCartHash($sessionId, $newSessionId); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->warning($e->getMessage()); return false; @@ -148,6 +151,7 @@ public function updateBasket($sessionId, $newSessionId) * @param $sessionId * @param $newSessionId * @throws OptimisticLockException + * @throws ORMException */ private function updateNostoCustomerCartHash($sessionId, $newSessionId) { @@ -171,6 +175,7 @@ private function updateNostoCustomerCartHash($sessionId, $newSessionId) * * @return null|object|CustomerModel * @throws OptimisticLockException + * @throws ORMException */ public function updateNostoId() { @@ -194,7 +199,7 @@ public function updateNostoId() $nostoCustomer->setSessionId($this->getSessionId()); $nostoCustomer->setNostoId($nostoCustomerId); $nostoCustomer->setRestoreCartHash($this->generateRestoreCartHash()); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->warning($e->getMessage()); } diff --git a/Components/Helper/Currency.php b/Components/Helper/Currency.php index 32c38ce7..c95cd18f 100644 --- a/Components/Helper/Currency.php +++ b/Components/Helper/Currency.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; -use Shopware\Models\Shop\Shop; -use Shopware\Models\Shop\Currency; +use Doctrine\Common\Collections\ArrayCollection; use Nosto\Object\Format; +use Shopware\Models\Shop\Currency; +use Shopware\Models\Shop\Shop; +use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; /** * Helper class for Currency @@ -59,7 +61,7 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Currency * If it's a sub shop, returns the parent's currencies * * @param Shop $shop - * @return \Doctrine\Common\Collections\ArrayCollection|Currency[] + * @return ArrayCollection|Currency[] */ public static function getCurrencies(Shop $shop) { @@ -163,7 +165,7 @@ public static function getCurrentCurrencyCode() { return Shopware()->Shop()->getCurrency()->getCurrency(); } - + /** * @param Currency $currency * @return bool|null @@ -172,7 +174,7 @@ public static function getCurrencyBeforeAmount(Currency $currency) { switch ($currency->getSymbolPosition()) { case self::CURRENCY_SYMBOL_LEFT: - // Shopware's default is before the amount + // Shopware's default is before the amount case self::CURRENCY_SYMBOL_DEFAULT: return true; case self::CURRENCY_SYMBOL_RIGHT: diff --git a/Components/Helper/CustomFields.php b/Components/Helper/CustomFields.php index a88d9cac..50de6736 100644 --- a/Components/Helper/CustomFields.php +++ b/Components/Helper/CustomFields.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware\Models\Article\Detail; use Nosto\Helper\SerializationHelper; use Shopware\Models\Article\Configurator\Option; +use Shopware\Models\Article\Detail; /** * Class Shopware_Plugins_Frontend_NostoTagging_Components_Helper_CustomFields @@ -93,7 +94,7 @@ public static function getDetailSettingsCustomFields(Detail $detail) $settingsCustomFields[$config->getGroup()->getName()] = $config->getName(); } } - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->warning($e->getMessage()); } @@ -118,7 +119,6 @@ public static function getDetailSettingsCustomFields(Detail $detail) */ public static function getFreeTextCustomFields(Detail $detail) { - /** @var Detail $detail */ $propertiesAndValues = SerializationHelper::getProperties( $detail->getAttribute() ); diff --git a/Components/Helper/Customer.php b/Components/Helper/Customer.php index a4668d63..fe505d58 100644 --- a/Components/Helper/Customer.php +++ b/Components/Helper/Customer.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/Components/Helper/Email.php b/Components/Helper/Email.php index b687ef86..d993778e 100644 --- a/Components/Helper/Email.php +++ b/Components/Helper/Email.php @@ -1,6 +1,6 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/Components/Helper/ExchangeRates.php b/Components/Helper/ExchangeRates.php index 5bcf6db4..147ba366 100644 --- a/Components/Helper/ExchangeRates.php +++ b/Components/Helper/ExchangeRates.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Currency as CurrencyHelper; -use Nosto\Object\ExchangeRateCollection; use Nosto\Object\ExchangeRate; +use Nosto\Object\ExchangeRateCollection; use Shopware\Models\Shop\Shop; +use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Currency as CurrencyHelper; /** * Helper class for Exchange Rates diff --git a/Components/Helper/Image.php b/Components/Helper/Image.php index 2444eedb..71c30ac6 100644 --- a/Components/Helper/Image.php +++ b/Components/Helper/Image.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ @@ -38,8 +39,8 @@ use Shopware\Models\Article\Article; use Shopware\Models\Article\Detail; use Shopware\Models\Article\Image; -use Shopware\Models\Shop\Shop; use Shopware\Models\Media\Media; +use Shopware\Models\Shop\Shop; /** * Helper class for images @@ -117,7 +118,7 @@ private static function buildUrl( if ($mediaService !== null) { try { $url = $mediaService->getUrl($media->getPath()); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } @@ -153,7 +154,7 @@ private static function getImageUrls(Article $article, Shop $shop) try { /** @var MediaServiceInterface $mediaService */ $mediaService = Shopware()->Container()->get('shopware_media.media_service'); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); $mediaService = null; @@ -203,7 +204,7 @@ public static function getDetailImageUrl(Detail $detail) $imagePath = $detailImage->getParent()->getMedia()->getPath(); return $mediaService->getUrl($imagePath); } - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } @@ -217,7 +218,7 @@ public static function getDetailImageUrl(Detail $detail) $articleImgPath = $detail->getArticle()->getImages()->first()->getMedia()->getPath(); return $articleImgPath ? $mediaService->getUrl($articleImgPath) : ''; } - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } diff --git a/Components/Helper/Price.php b/Components/Helper/Price.php index 6692fcee..83c13b16 100644 --- a/Components/Helper/Price.php +++ b/Components/Helper/Price.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Nosto\Helper\PriceHelper as NostoPriceHelper; use Doctrine\Common\Collections\ArrayCollection; +use Nosto\Helper\PriceHelper as NostoPriceHelper; use Shopware\Models\Article\Article; use Shopware\Models\Article\Detail; -use Shopware\Models\Shop\Shop; use Shopware\Models\Article\Price; use Shopware\Models\Customer\Group; +use Shopware\Models\Shop\Shop; use Shopware\Models\Tax\Tax; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Currency as CurrencyHelper; @@ -186,7 +187,7 @@ public static function applyTaxes( if ($taxRulesApplied === false) { $articleTax = $tax->getTax(); if ($articleTax > 0) { - $priceAfterTaxes= $priceWithoutTax * (1 + ($articleTax / 100)); + $priceAfterTaxes = $priceWithoutTax * (1 + ($articleTax / 100)); } } } @@ -313,7 +314,6 @@ private static function getProductPriceRateAfterDiscountForDetail(Detail $detail $discounts = $detail->getArticle()->getPriceGroup()->getDiscounts(); return self::getProductPriceRateAfterDiscount($discounts, $shop); } - /** @var Group $customerGroup */ $customerGroup = $shop->getCustomerGroup(); return (1 - $customerGroup->getDiscount() / 100); } @@ -331,7 +331,6 @@ private static function getProductPriceRateAfterDiscountForArticle(Article $arti $discounts = $article->getPriceGroup()->getDiscounts(); return self::getProductPriceRateAfterDiscount($discounts, $shop); } - /** @var Group $customerGroup */ $customerGroup = $shop->getCustomerGroup(); return (1 - $customerGroup->getDiscount() / 100); } @@ -346,7 +345,6 @@ private static function getProductPriceRateAfterDiscountForArticle(Article $arti private static function getProductPriceRateAfterDiscount($discounts, Shop $shop) { // Get the customer group discount - /** @var Group $customerGroup */ $customerGroup = $shop->getCustomerGroup(); $priceRate = 1 - $customerGroup->getDiscount() / 100; // Handle the price group @@ -371,6 +369,7 @@ private static function getProductPriceRateAfterDiscount($discounts, Shop $shop) * @return string * @suppress PhanUndeclaredMethod * @deprecated + * @noinspection PhpUnused */ public static function format($price) { diff --git a/Components/Helper/Tag.php b/Components/Helper/Tag.php index c6a615be..3e33fdd6 100644 --- a/Components/Helper/Tag.php +++ b/Components/Helper/Tag.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ @@ -79,7 +80,7 @@ public static function buildProductTags(Article $article, Shop $shop) if ($pricePerUnit) { $tags['tag2'] = array($pricePerUnit); } - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->warning( sprintf( diff --git a/Components/Meta/Account.php b/Components/Meta/Account.php index 88737ea0..d2a24f66 100644 --- a/Components/Meta/Account.php +++ b/Components/Meta/Account.php @@ -1,6 +1,6 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Components_Meta_Account_Owner as NostoAccountOwner; -use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Currency as CurrencyHelper; -use Nosto\Request\Http\HttpRequest as NostoHttpRequest; use Nosto\Object\Signup\Billing; use Nosto\Object\Signup\Signup; -use Shopware\Models\Shop\Shop; +use Nosto\Request\Http\HttpRequest as NostoHttpRequest; use Shopware\Models\Shop\Locale; +use Shopware\Models\Shop\Shop; +use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Currency as CurrencyHelper; +use Shopware_Plugins_Frontend_NostoTagging_Components_Meta_Account_Owner as NostoAccountOwner; /** * Meta-data class for account information sent to Nosto during account create. @@ -118,7 +118,6 @@ public function loadData( if ($locale === null) { $locale = $shop->getLocale(); } - /** @noinspection PhpDeprecationInspection */ $this->title = Shopware()->App() . ' - ' . $shop->getName(); /** @noinspection RandomApiMigrationInspection */ $this->name = substr(sha1(rand()), 0, 8); @@ -346,6 +345,7 @@ public function getCurrencies() /** * @return boolean + * @noinspection PhpUnused */ public function getUseCurrencyExchangeRates() { @@ -354,6 +354,7 @@ public function getUseCurrencyExchangeRates() /** * @return string + * @noinspection PhpUnused */ public function getDefaultVariationId() { diff --git a/Components/Meta/Account/Iframe.php b/Components/Meta/Account/Iframe.php index 5f5efd18..5230bf22 100644 --- a/Components/Meta/Account/Iframe.php +++ b/Components/Meta/Account/Iframe.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Components_Url as NostoComponentUrl; -use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as NostoTaggingBootstrap; -use Shopware\Models\Shop\Shop; -use Shopware\Models\Shop\Locale; use Nosto\Object\Iframe as Iframe; +use Shopware\Models\Shop\Locale; +use Shopware\Models\Shop\Shop; +use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as NostoTaggingBootstrap; +use Shopware_Plugins_Frontend_NostoTagging_Components_Url as NostoComponentUrl; /** * Meta-data class for information included in the plugin configuration iframe. @@ -65,7 +66,6 @@ public function loadData( if ($locale === null) { $locale = $shop->getLocale(); } - /** @noinspection PhpUndefinedMethodInspection */ if ($identity !== null) { list($firstName, $lastName) = explode(' ', $identity->name); $this->setFirstName($firstName); @@ -81,7 +81,6 @@ public function loadData( $this->setPreviewUrlSearch(NostoComponentUrl::getSearchPagePreviewUrl($shop)); $this->setPreviewUrlCart(NostoComponentUrl::getCartPagePreviewUrl($shop)); $this->setPreviewUrlFront(NostoComponentUrl::getFrontPagePreviewUrl($shop)); - /** @noinspection PhpDeprecationInspection */ $this->setShopName(Shopware()->App() . ' - ' . $shop->getName()); $this->setPlatform(NostoTaggingBootstrap::PLATFORM_NAME); } diff --git a/Components/Meta/Account/Owner.php b/Components/Meta/Account/Owner.php index a993120e..2f1955be 100644 --- a/Components/Meta/Account/Owner.php +++ b/Components/Meta/Account/Owner.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ @@ -51,14 +52,12 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Meta_Account_Owner /** * Loads the data for the account owner. * - * @param stdClass $identity|null $identity the user identity. + * @param stdClass $identity |null $identity the user identity. */ public function loadData($identity = null) { if ($identity !== null) { - /** @noinspection PhpUndefinedFieldInspection */ $this->setEmail($identity->email); - /** @noinspection PhpUndefinedFieldInspection */ list($firstName, $lastName) = explode(' ', $identity->name); $this->setFirstName($firstName); $this->setLastName($lastName); diff --git a/Components/Meta/Oauth.php b/Components/Meta/Oauth.php index 5d1817d4..1e527589 100644 --- a/Components/Meta/Oauth.php +++ b/Components/Meta/Oauth.php @@ -1,6 +1,6 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Nosto\Types\OAuthInterface as NostoOAuthClientMetaDataInterface; -use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as NostoBootstrap; -use Nosto\Request\Http\HttpRequest as NostoHttpRequest; use Nosto\Request\Api\Token as NostoApiToken; -use Shopware\Models\Shop\Shop; +use Nosto\Request\Http\HttpRequest as NostoHttpRequest; +use Nosto\Types\OAuthInterface as NostoOAuthClientMetaDataInterface; use Shopware\Models\Shop\Locale; +use Shopware\Models\Shop\Shop; +use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as NostoBootstrap; /** * Meta-data class for handling OAuth 2 requests during account connect. diff --git a/Components/Model/Base.php b/Components/Model/Base.php index c09c11a7..b5a7ecc7 100644 --- a/Components/Model/Base.php +++ b/Components/Model/Base.php @@ -1,6 +1,6 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ @@ -39,6 +39,7 @@ * * @package Shopware * @subpackage Plugins_Frontend + * @noinspection PhpUnused */ abstract class Shopware_Plugins_Frontend_NostoTagging_Components_Model_Base { @@ -50,6 +51,8 @@ abstract class Shopware_Plugins_Frontend_NostoTagging_Components_Model_Base * @param string $name the property name. * @return mixed the property value. * @throws Exception if public getter does not exist. + * @noinspection PhpUnused + * @noinspection MagicMethodsValidityInspection */ public function __get($name) { diff --git a/Components/Model/Cart.php b/Components/Model/Cart.php index 49238a0c..c483998f 100644 --- a/Components/Model/Cart.php +++ b/Components/Model/Cart.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ + use Nosto\Object\Cart\Cart; use Shopware\Models\Order\Basket; use Shopware_Plugins_Frontend_NostoTagging_Components_Customer as NostoComponentCustomer; -use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Cart_LineItem as CartLineItem; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_CartRestore as CartRestore; +use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Cart_LineItem as CartLineItem; /** * Model for shopping cart information. This is used when compiling the info diff --git a/Components/Model/Cart/LineItem.php b/Components/Model/Cart/LineItem.php index d23ac1ed..4368a5d2 100644 --- a/Components/Model/Cart/LineItem.php +++ b/Components/Model/Cart/LineItem.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; +use Doctrine\ORM\ORMInvalidArgumentException; +use Doctrine\ORM\TransactionRequiredException; use Nosto\Helper\PriceHelper as NostoPriceHelper; use Nosto\Object\Cart\LineItem; use Shopware\Models\Article\Article; use Shopware\Models\Article\Detail; -use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; use Shopware\Models\Order\Basket; -use Doctrine\ORM\ORMInvalidArgumentException; -use Doctrine\ORM\ORMException; -use Doctrine\ORM\OptimisticLockException; -use Doctrine\ORM\TransactionRequiredException; +use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; /** * Model for shopping cart line items. This is used when compiling the shopping diff --git a/Components/Model/Category.php b/Components/Model/Category.php index ec5ec180..8def3df0 100644 --- a/Components/Model/Category.php +++ b/Components/Model/Category.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware\Models\Category\Category; use Nosto\Object\Category as NostoCategory; +use Shopware\Models\Category\Category; /** * Model for product category information. This is used when compiling the info @@ -48,10 +49,6 @@ */ class Shopware_Plugins_Frontend_NostoTagging_Components_Model_Category { - /** - * @var string the full category path with categories separated by a `/` sign. - */ - protected $categoryPath; /** * Loads the category data from a category model. diff --git a/Components/Model/Customer.php b/Components/Model/Customer.php index 28e1d0bd..a11fd704 100644 --- a/Components/Model/Customer.php +++ b/Components/Model/Customer.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as NostoBootstrap; -use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Customer as CustomerHelper; -use Nosto\Object\Customer; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; +use Doctrine\ORM\ORMInvalidArgumentException; use Nosto\NostoException; -use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Email as EmailHelper; -use Shopware\Models\Customer\Address; +use Nosto\Object\Customer; use Shopware\Models\Attribute\Customer as CustomerAttribute; +use Shopware\Models\Customer\Address; use Shopware\Models\Customer\Customer as CustomerModel; -use Doctrine\ORM\ORMInvalidArgumentException; -use Doctrine\ORM\OptimisticLockException; -use Doctrine\ORM\ORMException; +use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as NostoBootstrap; +use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Customer as CustomerHelper; +use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Email as EmailHelper; /** * Model for customer information. This is used when compiling the info about @@ -102,11 +103,11 @@ public function loadData(CustomerModel $customer) * * @param CustomerModel $customer * - * @throws NostoException if customer reference cannot be fetched or created + * @return void * @throws ORMInvalidArgumentException * @throws OptimisticLockException * @throws ORMException - * @return void + * @throws NostoException if customer reference cannot be fetched or created */ public function populateCustomerReference(CustomerModel $customer) { diff --git a/Components/Model/Order.php b/Components/Model/Order.php index e39db0ef..413a0643 100644 --- a/Components/Model/Order.php +++ b/Components/Model/Order.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ use Nosto\Object\Order\Order as NostoOrder; +use Shopware\Models\Order\Detail; use Shopware\Models\Order\Order; -use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order_Status as OrderStatus; use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order_Buyer as OrderBuyer; use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order_LineItem as OrderLineItem; -use Nosto\NostoException; -use Shopware\Models\Order\Detail; +use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order_Status as OrderStatus; /** * Model for order information. This is used when compiling the info about an @@ -62,7 +62,6 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order extends Nost * * @param Order $order the order model. * @throws Enlight_Event_Exception - * @throws NostoException */ public function loadData(Order $order) { diff --git a/Components/Model/Order/Buyer.php b/Components/Model/Order/Buyer.php index 1be115ac..604b903a 100644 --- a/Components/Model/Order/Buyer.php +++ b/Components/Model/Order/Buyer.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ use Nosto\Object\Order\Buyer as NostoOrderBuyer; -use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Email as EmailHelper; -use Shopware\Models\Customer\Customer; +use Shopware\Models\Country\Country; use Shopware\Models\Customer\Address; +use Shopware\Models\Customer\Billing; +use Shopware\Models\Customer\Customer; use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; -use Shopware\Models\Country\Country; -use /** @noinspection PhpDeprecationInspection */ Shopware\Models\Customer\Billing; +use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Email as EmailHelper; /** * Model for order buyer information. This is used when compiling the info about @@ -61,7 +62,6 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order_Buyer extend * @throws Enlight_Event_Exception * @suppress PhanUndeclaredClassInstanceof * @suppress PhanUndeclaredClassMethod - */ public function loadData(Customer $customer) { @@ -86,9 +86,8 @@ public function loadData(Customer $customer) } else { /** @phan-suppress-next-line UndeclaredTypeInInlineVar */ /** @var Billing $address */ - /** @noinspection PhpDeprecationInspection */ - $address = $customer->getBilling(); /** @phan-suppress-current-line PhanUndeclaredMethod */ - /** @noinspection PhpDeprecationInspection */ + /** @phan-suppress-next-line PhanUndeclaredMethod */ + $address = $customer->getBilling(); if ($address instanceof Billing) { $this->setFirstName($address->getFirstName()); $this->setLastName($address->getLastName()); @@ -101,7 +100,7 @@ public function loadData(Customer $customer) ->getRepository('\Shopware\Models\Country\Country') ->findOneBy(array('id' => $address->getCountryId())); $this->setCountry($country->getName()); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } diff --git a/Components/Model/Order/LineItem.php b/Components/Model/Order/LineItem.php index 1d99ba26..30cdfe6e 100644 --- a/Components/Model/Order/LineItem.php +++ b/Components/Model/Order/LineItem.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Nosto\Object\Cart\LineItem as NostoLineItem; use Nosto\Helper\PriceHelper as NostoPriceHelper; +use Nosto\Object\Cart\LineItem as NostoLineItem; use Shopware\Models\Order\Detail as OrderDetail; /** @@ -71,7 +72,7 @@ public function loadData(OrderDetail $detail) if ($articleDetail !== null) { $this->setProductId($articleDetail->getNumber()); } - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } diff --git a/Components/Model/Order/Status.php b/Components/Model/Order/Status.php index a8420dda..756ddeb0 100644 --- a/Components/Model/Order/Status.php +++ b/Components/Model/Order/Status.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ @@ -62,8 +63,9 @@ public function loadData(Order $order) if (method_exists($status, 'getName')) { $description = $status->getName(); } else { - /** @noinspection PhpDeprecationInspection */ - $description = $status->getDescription(); /** @phan-suppress-current-line PhanUndeclaredMethod */ + /** @noinspection PhpUndefinedMethodInspection */ + /** @phan-suppress-next-line PhanUndeclaredMethod */ + $description = $status->getDescription(); } $this->setCode($this->convertDescriptionToCode($description)); $this->setLabel($description); diff --git a/Components/Model/Product.php b/Components/Model/Product.php index 543e8f05..8f59e7e5 100644 --- a/Components/Model/Product.php +++ b/Components/Model/Product.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ +use Doctrine\ORM\NonUniqueResultException; +use Nosto\NostoException; +use Nosto\Object\Product\Product as NostoProduct; +use Nosto\Object\Product\SkuCollection; +use Nosto\Request\Http\HttpRequest as NostoHttpRequest; use Shopware\Models\Article\Article; use Shopware\Models\Article\Detail; -use Shopware\Models\Shop\Shop; +use Shopware\Models\Article\Supplier; use Shopware\Models\Category\Category; +use Shopware\Models\Shop\Shop; +use Shopware\Models\Translation\Translation; +use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as NostoBootstrap; +use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Currency as CurrencyHelper; +use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_CustomFields as CustomFieldsHelper; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Image as ImageHelper; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Price as PriceHelper; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Tag as TagHelper; use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Category as NostoCategory; -use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_CustomFields as CustomFieldsHelper; -use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Sku as NostoSku; use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Repository_ProductStreams as ProductStreamsRepo; -use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Currency as CurrencyHelper; -use Nosto\Request\Http\HttpRequest as NostoHttpRequest; -use Nosto\Object\Product\Product as NostoProduct; -use Nosto\NostoException; -use Shopware\Models\Article\Supplier; -use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; -use Nosto\Object\Product\SkuCollection; -use Shopware\Models\Translation\Translation; -use Doctrine\ORM\NonUniqueResultException; -use Doctrine\ORM\QueryBuilder; +use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Sku as NostoSku; /** * Model for product information. This is used when compiling the info about a @@ -72,6 +72,7 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Model_Product extends No { const TXT_ARTICLE = 'txtArtikel'; const TXT_LANG_DESCRIPTION = 'txtlangbeschreibung'; + /** * Loads the model data from an article and shop. * @@ -139,7 +140,7 @@ public function loadData(Article $article, Shop $shop = null) $this->setVariationId($baseCurrency->getCurrency()); } } - + /** @noinspection PhpUndefinedMethodInspection */ $skuTaggingAllowed = Shopware() ->Plugins() @@ -195,7 +196,7 @@ protected function amendFreeTextCustomFields(Article $article) } } } - + /** * Add Sku variations to the current article * @@ -246,7 +247,6 @@ public function amendArticleTranslation(Article $article, Shop $shop = null) return; } - /** @var QueryBuilder $builder */ $builder = Shopware()->Models()->createQueryBuilder(); $builder = $builder->select(array('translations')) ->from('\Shopware\Models\Translation\Translation', 'translations') @@ -311,7 +311,7 @@ public function assignId(Article $article) if (!empty($articleDetail)) { $this->setProductId($articleDetail->getNumber()); } - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } @@ -327,6 +327,7 @@ protected function amendRatingsAndReviews(Article $article, Shop $shop) { //From shopware 5.3, it is possible to display product votes only in sub shop where they posted $showSubshopReviewOnly = false; + /** @noinspection PhpUndefinedMethodInspection */ $showSubshopReviewOnlySupported = version_compare( Shopware()->Plugins()->Frontend()->NostoTagging()->getShopwareVersion(), NostoBootstrap::SUPPORT_SHOW_REVIEW_SUB_SHOP_ONLY_VERSION, @@ -340,7 +341,7 @@ protected function amendRatingsAndReviews(Article $article, Shop $shop) $voteSum = 0; foreach ($article->getVotes() as $vote) { if ($showSubshopReviewOnly) { - /** @var \Shopware\Models\Shop\Shop $shopForVote */ + /** @var Shop $shopForVote */ $shopForVote = $vote->getShop(); if ($shopForVote !== null && $shopForVote->getId() !== $shop->getId() diff --git a/Components/Model/Repository/ProductStreams.php b/Components/Model/Repository/ProductStreams.php index d33d5e9e..ae211a18 100644 --- a/Components/Model/Repository/ProductStreams.php +++ b/Components/Model/Repository/ProductStreams.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ +use Doctrine\DBAL\Connection; use Shopware\Models\Article\Article; /** @@ -45,12 +47,13 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Model_Repository_ProductStreams { /** - * @var \Doctrine\DBAL\Connection|mixed + * @var Connection|mixed */ private $conn; /** * Shopware_Plugins_Frontend_NostoTagging_Components_Model_Repository_ProductStreams constructor. + * @noinspection PhpUnused */ public function __construct() { @@ -75,7 +78,7 @@ public function getProductStreamsSelectionName(Article $article) ->setParameter(':articleId', $article->getId()) ->execute() ->fetchAll(); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); return array(); diff --git a/Components/Model/Sku.php b/Components/Model/Sku.php index 707e2b18..72d0db6f 100644 --- a/Components/Model/Sku.php +++ b/Components/Model/Sku.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Price as PriceHelper; -use Shopware\Models\Article\Detail; use Nosto\Object\Product\Sku as NostoSku; +use Shopware\Models\Article\Detail; use Shopware\Models\Shop\Shop; +use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_CustomFields as CustomFieldsHelper; -use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Product as Product; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Image as Image; -use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; +use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Price as PriceHelper; +use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Product as Product; /** * Class Shopware_Plugins_Frontend_NostoTagging_Components_Model_Sku diff --git a/Components/Operation/ExchangeRates.php b/Components/Operation/ExchangeRates.php index f316f790..c90d09ba 100644 --- a/Components/Operation/ExchangeRates.php +++ b/Components/Operation/ExchangeRates.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; -use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_ExchangeRates as ExchangeRatesHelper; -use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; +use Nosto\NostoException; use Nosto\Object\Signup\Account; -use Shopware\Models\Shop\Shop; use Nosto\Operation\SyncRates; +use Shopware\Models\Shop\Shop; +use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; +use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; +use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_ExchangeRates as ExchangeRatesHelper; /** * Exchange Rates operation component. Used for updating exchange rates to Nosto @@ -63,10 +65,10 @@ public function updateCurrencyExchangeRates(Account $account, Shop $shop) $collection = $ratesHelper->buildExchangeRatesCollection($shop); try { return $currencyService->update($collection); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error( - 'Failed to update exchange rates: '. + 'Failed to update exchange rates: ' . $e->getMessage() ); return false; @@ -78,6 +80,8 @@ public function updateCurrencyExchangeRates(Account $account, Shop $shop) * has multi currency enabled * * @return bool + * @throws NostoException + * @throws NostoException */ public function updateExchangeRates() { diff --git a/Components/Operation/Product.php b/Components/Operation/Product.php index 37650f62..1c06c289 100644 --- a/Components/Operation/Product.php +++ b/Components/Operation/Product.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; +use Nosto\NostoException; use Nosto\Object\Signup\Account as NostoAccount; use Nosto\Operation\DeleteProduct; use Nosto\Operation\UpsertProduct; use Shopware\Models\Article\Article; +use Shopware\Models\Category\Category; +use Shopware\Models\Shop\Repository; use Shopware\Models\Shop\Shop; +use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Product as Product; -use Shopware\Models\Shop\Repository; -use Shopware\Models\Category\Category; -use Nosto\NostoException; /** * Product operation component. Used for communicating create/update/delete @@ -76,6 +77,8 @@ public function create(Article $article) * @param Article $article the article model. * @param boolean $allStores if true Nosto accounts from all stores will be returned * @return NostoAccount[] the accounts mapped in the shop IDs. + * @throws NostoException + * @throws NostoException */ protected function getAccounts(Article $article, $allStores = false) { @@ -138,8 +141,17 @@ public function update(Article $article) if ($shop instanceof Shop === false) { continue; } - /** @noinspection PhpDeprecationInspection */ - $shop->registerResources(Shopware()->Bootstrap()); /** @phan-suppress-current-line PhanParamTooMany */ + /** @noinspection PhpUndefinedMethodInspection */ + if (Shopware()->Plugins()->Frontend()->NostoTagging()->getShopwareVersion() < "5.6") { + /** @noinspection PhpDeprecationInspection */ + /** @noinspection PhpMethodParametersCountMismatchInspection */ + /** @phan-suppress-next-line PhanParamTooMany hanTypeMismatchArgument */ + $shop->registerResources(Shopware()->Bootstrap()); + } else { + /** @phan-suppress-next-line PhanTypeMismatchArgument */ + /** @noinspection PhpDeprecationInspection */ + $shop->registerResources(); + } $model = new Product(); $model->loadData($article, $shop); if ($model->getProductId()) { @@ -147,7 +159,7 @@ public function update(Article $article) $op = new UpsertProduct($account); $op->addProduct($model); $op->upsert(); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } @@ -172,7 +184,7 @@ public function delete(Article $article) $op->setProductIds($products); try { $op->delete(); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } diff --git a/Components/Operation/Settings.php b/Components/Operation/Settings.php index 8c86a590..4f9b8ecc 100644 --- a/Components/Operation/Settings.php +++ b/Components/Operation/Settings.php @@ -1,6 +1,8 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware\Models\Shop\Shop; -use Nosto\Operation\UpdateSettings as NostoUpdateSettings; +use Doctrine\ORM\Mapping as ORM; +use Nosto\NostoException; use Nosto\Object\Settings as NostoSettings; -use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; +use Nosto\Operation\UpdateSettings as NostoUpdateSettings; +use Shopware\Models\Shop\Shop; use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as Bootstrap; +use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Currency as CurrencyHelper; use Shopware_Plugins_Frontend_NostoTagging_Components_Operation_ExchangeRates as ExchangeRatesOperation; @@ -48,12 +52,15 @@ * @package Shopware * @subpackage Plugins_Frontend */ +/** @phan-file-suppress PhanUnreferencedUseNormal */ class Shopware_Plugins_Frontend_NostoTagging_Components_Operation_Settings { /** * Send an updated settings object with the currency changes * * @param Shop $shop + * @throws NostoException + * @throws NostoException */ public static function updateCurrencySettings(Shop $shop) { @@ -79,7 +86,7 @@ public static function updateCurrencySettings(Shop $shop) try { $ratesOperation->updateCurrencyExchangeRates($nostoAccount, $shop); $service->update($settings); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->warning($e->getMessage()); } diff --git a/Components/Order/Confirmation.php b/Components/Order/Confirmation.php index 00892373..9e0e80ca 100644 --- a/Components/Order/Confirmation.php +++ b/Components/Order/Confirmation.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; +use Nosto\NostoException; use Nosto\Operation\OrderConfirm as NostoOrderConfirmation; use Shopware\Models\Attribute\Order as OrderAttribute; -use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order as NostoOrderModel; use Shopware\Models\Order\Order as OrderModel; +use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; +use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order as NostoOrderModel; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; /** @@ -54,6 +56,8 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Order_Confirmation * * @param OrderModel $order the order model. * + * @throws NostoException + * @throws NostoException * @see Shopware_Plugins_Frontend_NostoTagging_Bootstrap::onPostUpdateOrder * @suppress PhanUndeclaredMethod */ @@ -65,7 +69,7 @@ public function sendOrder(OrderModel $order) $shop = $order->getShop(); // Shopware throws an exception if service does not exist. // This would be the case when using Shopware API or cli - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); return; @@ -93,7 +97,7 @@ public function sendOrder(OrderModel $order) $model->loadData($order); $orderConfirmation = new NostoOrderConfirmation($nostoAccount); $orderConfirmation->send($model, $customerId); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error( sprintf("Nosto order update upsert failed. Message was: %s", diff --git a/Components/Url.php b/Components/Url.php index e209ee0a..4de4875d 100644 --- a/Components/Url.php +++ b/Components/Url.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ +use Doctrine\ORM\AbstractQuery; use Nosto\Request\Http\HttpRequest as NostoHttpRequest; use Shopware\Models\Shop\Shop; -use Doctrine\ORM\AbstractQuery; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_CartRestore as CartRestore; /** @@ -62,7 +63,7 @@ public static function getProductPagePreviewUrl(Shop $shop) ->setFirstResult(0) ->setMaxResults(1) ->getQuery() - ->getResult(\Doctrine\ORM\AbstractQuery::HYDRATE_ARRAY); + ->getResult(AbstractQuery::HYDRATE_ARRAY); if (empty($result)) { return null; } @@ -183,6 +184,7 @@ public static function getFrontPagePreviewUrl(Shop $shop) /** * Generates a unique URL to restore cart contents * + * @param Shop $shop * @param $hash * @return string */ diff --git a/Components/User/Builder.php b/Components/User/Builder.php index d7d54bcb..81ae537b 100644 --- a/Components/User/Builder.php +++ b/Components/User/Builder.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/Controllers/backend/NostoTagging.php b/Controllers/backend/NostoTagging.php index 105c686d..c1b1352f 100644 --- a/Controllers/backend/NostoTagging.php +++ b/Controllers/backend/NostoTagging.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; -use Nosto\Nosto; +use Doctrine\ORM\AbstractQuery; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; +use Doctrine\ORM\ORMInvalidArgumentException; +use Doctrine\ORM\TransactionRequiredException; use Nosto\Helper\OAuthHelper as NostoOAuthClient; -use Shopware\Models\Shop\Shop; +use Nosto\Nosto; use Shopware\CustomModels\Nosto\Account\Account; -use Shopware_Plugins_Frontend_NostoTagging_Components_Meta_Oauth as MetaOauth; use Shopware\Models\Shop\Repository; -use Doctrine\ORM\TransactionRequiredException; -use Doctrine\ORM\ORMException; -use Doctrine\ORM\ORMInvalidArgumentException; -use Doctrine\ORM\OptimisticLockException; -use Doctrine\ORM\AbstractQuery; +use Shopware\Models\Shop\Shop; +use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; +use Shopware_Plugins_Frontend_NostoTagging_Components_Meta_Oauth as MetaOauth; /** * Main backend controller. Handles account create/connect/delete requests @@ -55,6 +56,7 @@ * * @package Shopware * @subpackage Controllers_Backend + * @noinspection PhpUnused */ class Shopware_Controllers_Backend_NostoTagging extends Shopware_Controllers_Backend_ExtJs { @@ -64,6 +66,8 @@ class Shopware_Controllers_Backend_NostoTagging extends Shopware_Controllers_Bac * Loads the Nosto ExtJS sub-application for configuring Nosto for the shops. * Default action. * @noinspection PhpMissingParentCallCommonInspection + * @noinspection PhpUnused + * @noinspection NullPointerExceptionInspection */ public function indexAction() { @@ -75,6 +79,7 @@ public function indexAction() * * This action should only be accessed by the Main controller in the client * side application. + * @noinspection PhpUnused */ public function loadSettingsAction() { @@ -112,6 +117,7 @@ public function loadSettingsAction() * @throws ORMInvalidArgumentException * @throws OptimisticLockException * @suppress PhanDeprecatedFunction + * @noinspection PhpUnused */ public function getAccountsAction() { @@ -146,11 +152,19 @@ public function getAccountsAction() if ($shop instanceof Shop === false) { continue; } - /** @noinspection PhpDeprecationInspection */ - $shop->registerResources(Shopware()->Bootstrap()); /** @phan-suppress-current-line PhanParamTooMany */ + /** @noinspection PhpUndefinedMethodInspection */ + if (Shopware()->Plugins()->Frontend()->NostoTagging()->getShopwareVersion() < "5.6") { + /** @noinspection PhpDeprecationInspection */ + /** @noinspection PhpMethodParametersCountMismatchInspection */ + /** @phan-suppress-next-line PhanParamTooMany PhanTypeMismatchArgument */ + $shop->registerResources(Shopware()->Bootstrap()); + } else { + /** @phan-suppress-next-line PhanTypeMismatchArgument */ + /** @noinspection PhpDeprecationInspection */ + $shop->registerResources(); + } $account = NostoComponentAccount::findAccount($shop); if (isset($oauthParams[$shop->getId()])) { - /** @noinspection PhpUndefinedVariableInspection */ $params = $oauthParams[$shop->getId()]; } $accountData = array( @@ -185,6 +199,7 @@ public function getAccountsAction() * @throws ORMInvalidArgumentException * @throws Exception * @suppress PhanDeprecatedFunction + * @noinspection PhpUnused */ public function createAccountAction() { @@ -203,8 +218,17 @@ public function createAccountAction() $identity = Shopware()->Auth()->getIdentity(); if ($shop !== null) { - /** @noinspection PhpDeprecationInspection */ - $shop->registerResources(Shopware()->Bootstrap()); + /** @noinspection PhpUndefinedMethodInspection */ + if (Shopware()->Plugins()->Frontend()->NostoTagging()->getShopwareVersion() < "5.6") { + /** @phan-suppress-next-line PhanParamTooMany hanTypeMismatchArgument */ + /** @noinspection PhpDeprecationInspection */ + /** @noinspection PhpMethodParametersCountMismatchInspection */ + $shop->registerResources(Shopware()->Bootstrap()); + } else { + /** @phan-suppress-next-line PhanTypeMismatchArgument */ + /** @noinspection PhpDeprecationInspection */ + $shop->registerResources(); + } /** @noinspection BadExceptionsProcessingInspection */ try { $account = NostoComponentAccount::createAccount( @@ -233,7 +257,7 @@ public function createAccountAction() 'shopId' => $shop->getId(), 'shopName' => $shop->getName() ); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } @@ -254,6 +278,7 @@ public function createAccountAction() * @throws ORMInvalidArgumentException * @throws OptimisticLockException * @suppress PhanDeprecatedFunction + * @noinspection PhpUnused */ public function deleteAccountAction() { @@ -261,7 +286,7 @@ public function deleteAccountAction() $data = array(); $accountId = $this->Request()->getParam('id', null); $shopId = $this->Request()->getParam('shopId', null); - /** @var \Shopware\CustomModels\Nosto\Account\Account $account */ + /** @var Account $account */ $account = Shopware()->Models()->find( '\Shopware\CustomModels\Nosto\Account\Account', $accountId @@ -272,8 +297,17 @@ public function deleteAccountAction() /** @noinspection PhpUndefinedMethodInspection */ $identity = Shopware()->Auth()->getIdentity(); if ($account !== null && $shop !== null) { - /** @noinspection PhpDeprecationInspection */ - $shop->registerResources(Shopware()->Bootstrap()); + /** @noinspection PhpUndefinedMethodInspection */ + if (Shopware()->Plugins()->Frontend()->NostoTagging()->getShopwareVersion() < "5.6") { + /** @phan-suppress-next-line PhanParamTooMany hanTypeMismatchArgument */ + /** @noinspection PhpDeprecationInspection */ + /** @noinspection PhpMethodParametersCountMismatchInspection */ + $shop->registerResources(Shopware()->Bootstrap()); + } else { + /** @phan-suppress-next-line PhanTypeMismatchArgument */ + /** @noinspection PhpDeprecationInspection */ + $shop->registerResources(); + } NostoComponentAccount::removeAccount($account, $identity); $success = true; $data = array( @@ -303,6 +337,7 @@ public function deleteAccountAction() * side application. * @throws Exception * @suppress PhanDeprecatedFunction + * @noinspection PhpUnused */ public function connectAccountAction() { @@ -316,8 +351,17 @@ public function connectAccountAction() $locale = Shopware()->Auth()->getIdentity()->locale; if ($shop !== null) { - /** @noinspection PhpDeprecationInspection */ - $shop->registerResources(Shopware()->Bootstrap()); + /** @noinspection PhpUndefinedMethodInspection */ + if (Shopware()->Plugins()->Frontend()->NostoTagging()->getShopwareVersion() < "5.6") { + /** @phan-suppress-next-line PhanParamTooMany hanTypeMismatchArgument */ + /** @noinspection PhpDeprecationInspection */ + /** @noinspection PhpMethodParametersCountMismatchInspection */ + $shop->registerResources(Shopware()->Bootstrap()); + } else { + /** @phan-suppress-next-line PhanTypeMismatchArgument */ + /** @noinspection PhpDeprecationInspection */ + $shop->registerResources(); + } $meta = new MetaOauth(); $meta->loadData($shop, $locale); $success = true; diff --git a/Controllers/frontend/NostoTagging.php b/Controllers/frontend/NostoTagging.php index 5de2f41b..8e9482e7 100644 --- a/Controllers/frontend/NostoTagging.php +++ b/Controllers/frontend/NostoTagging.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware_Plugins_Frontend_NostoTagging_Models_Account_Repository as AccountRepository; -use Shopware_Plugins_Frontend_NostoTagging_Models_Product_Repository as ProductRepository; -use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; -use Shopware_Plugins_Frontend_NostoTagging_Models_Order_Repository as OrderRepository; -use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Product as ProductModel; -use Shopware_Plugins_Frontend_NostoTagging_Components_Meta_Oauth as MetaOauth; -use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order as NostoOrderModel; -use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_CartRestore as CartRestore; -use Nosto\Request\Http\HttpRequest as NostoHttpRequest; -use Nosto\Object\Signup\Account as NostoAccount; -use Nosto\Request\Api\Token as NostoApiToken; -use Doctrine\ORM\ORMException; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; use Doctrine\ORM\TransactionRequiredException; -use Nosto\Operation\OAuth\AuthorizationCode; -use Nosto\Object\Product\ProductCollection; -use Nosto\Object\Order\OrderCollection; -use Shopware\Models\Shop\DetachedShop; +use Nosto\Exception\Builder as ExceptionBuilder; +use Nosto\Helper\ExportHelper; +use Nosto\Nosto; +use Nosto\NostoException; use Nosto\Object\AbstractCollection; -use Shopware\Models\Article\Article; use Nosto\Object\NostoOAuthToken; +use Nosto\Object\Order\OrderCollection; +use Nosto\Object\Product\ProductCollection; +use Nosto\Object\Signup\Account as NostoAccount; +use Nosto\Operation\OAuth\AuthorizationCode; +use Nosto\Request\Api\Token as NostoApiToken; +use Nosto\Request\Http\HttpRequest as NostoHttpRequest; +use Shopware\Models\Article\Article; use Shopware\Models\Order\Order; -use Nosto\Helper\ExportHelper; -use Nosto\NostoException; -use Nosto\Nosto; -use Nosto\Exception\Builder as ExceptionBuilder; +use Shopware\Models\Shop\DetachedShop; +use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount; +use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_CartRestore as CartRestore; +use Shopware_Plugins_Frontend_NostoTagging_Components_Meta_Oauth as MetaOauth; +use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order as NostoOrderModel; +use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Product as ProductModel; +use Shopware_Plugins_Frontend_NostoTagging_Models_Account_Repository as AccountRepository; +use Shopware_Plugins_Frontend_NostoTagging_Models_Order_Repository as OrderRepository; +use Shopware_Plugins_Frontend_NostoTagging_Models_Product_Repository as ProductRepository; /** * Main frontend controller. Handles account connection via OAuth 2 and data @@ -70,6 +71,7 @@ * * @package Shopware * @subpackage Controllers_Frontend + * @noinspection PhpUnused */ class Shopware_Controllers_Frontend_NostoTagging extends Enlight_Controller_Action { @@ -92,15 +94,16 @@ class Shopware_Controllers_Frontend_NostoTagging extends Enlight_Controller_Acti * Shopware_Controllers_Frontend_NostoTagging constructor. * @param Enlight_Controller_Request_Request|null $request * @param Enlight_Controller_Response_Response|null $response - * @throws Enlight_Event_Exception - * @throws Enlight_Exception + * @noinspection PhpUnused */ public function __construct( Enlight_Controller_Request_Request $request = null, Enlight_Controller_Response_Response $response = null ) { if ($request && $response) { - parent::__construct($request, $response); /** @phan-suppress-current-line PhanParamTooMany */ + /** @noinspection PhpMethodParametersCountMismatchInspection */ + /** @phan-suppress-next-line PhanParamTooMany */ + parent::__construct($request, $response); } $this->productRepository = new ProductRepository(); $this->accountRepository = new AccountRepository(); @@ -114,6 +117,7 @@ public function __construct( * redirects to that domain. * * @throws Exception + * @noinspection PhpUnused */ public function oauthAction() { @@ -198,9 +202,11 @@ public function oauthAction() * * @throws Enlight_Event_Exception * @throws NonUniqueResultException + * @throws NostoException * @throws ORMException * @throws OptimisticLockException * @throws TransactionRequiredException + * @noinspection PhpUnused */ public function exportProductsAction() { @@ -237,6 +243,8 @@ public function exportProductsAction() * Encrypts the export collection and outputs it to the browser. * * @param AbstractCollection $collection the data collection to export. + * @throws NostoException + * @throws NostoException */ protected function export(AbstractCollection $collection) { @@ -256,6 +264,8 @@ protected function export(AbstractCollection $collection) * Exports completed orders from the current shop. * Result can be limited by the `limit` and `offset` GET parameters. * + * @throws NostoException + * @noinspection PhpUnused */ public function exportOrdersAction() { @@ -280,7 +290,7 @@ public function exportOrdersAction() $model->disableSpecialLineItems(); $model->loadData($order); $collection->append($model); - } catch (\Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUndefinedMethodInspection */ Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage()); } @@ -316,13 +326,13 @@ private function getAuthenticatedToken(DetachedShop $shop, $code) /** * @param NostoOAuthToken $token - * @throws NostoException * @return array|stdClass + * @throws NostoException */ private function fireRequest(NostoOAuthToken $token) { $request = new NostoHttpRequest(); - $request->setUrl(Nosto::getOAuthBaseUrl().'/exchange'); + $request->setUrl(Nosto::getOAuthBaseUrl() . '/exchange'); $request->setQueryParams(array('access_token' => $token->getAccessToken())); $response = $request->get(); $result = $response->getJsonResult(true); @@ -342,6 +352,7 @@ private function fireRequest(NostoOAuthToken $token) * @throws Enlight_Exception * @throws Zend_Db_Adapter_Exception * @throws Exception + * @noinspection PhpUnused */ public function cartAction() { diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 1f0746c9..00000000 --- a/Jenkinsfile +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env groovy - -pipeline { - - agent { dockerfile true } - - stages { - stage('Prepare environment') { - steps { - checkout scm - } - } - - stage('Update Dependencies') { - steps { - sh "composer install --no-progress --no-suggest" - sh "composer dump-autoload --optimize" - } - } - - stage('Code Sniffer') { - steps { - catchError { - sh "./vendor/bin/phpcs --standard=ruleset.xml --severity=3 --report=checkstyle --report-file=chkphpcs.xml . || true" - } - archiveArtifacts 'chkphpcs.xml' - } - } - - stage('Copy-Paste Detection') { - steps { - catchError { - sh "./vendor/bin/phpcpd --exclude=vendor --exclude=build --log-pmd=phdpcpd.xml . " - } - archiveArtifacts 'phdpcpd.xml' - } - } - - stage('Package') { - steps { - script { - version = sh(returnStdout: true, script: 'grep "const PLUGIN_VERSION = " Bootstrap.php | cut -d= -f2 | tr "," " "| tr ";" " " | tr "\'" " "').trim() - sh "./vendor/bin/phing -Dversion=${version}" - } - archiveArtifacts "build/package/NostoTagging-${version}.zip" - } - } - - stage('Mess Detection') { - steps { - catchError { - sh "./vendor/bin/phpmd . xml codesize,naming,unusedcode,controversial,design --exclude vendor,var,build,tests --reportfile pmdphpmd.xml || true" - } - archiveArtifacts 'pmdphpmd.xml' - } - } - - stage('Phan Analysis') { - steps { - catchError { - sh "./vendor/bin/phan --config-file=phan.php --output-mode=checkstyle --output=chkphan.xml || true" - } - archiveArtifacts 'chkphan.xml' - } - } - } - - post { - always { - checkstyle pattern: 'chk*.xml', unstableTotalAll:'0' - pmd pattern: 'pmd*.xml', unstableTotalAll:'0' - deleteDir() - } - } -} diff --git a/Models/Account/Repository.php b/Models/Account/Repository.php index 854c9118..b0dbaff2 100644 --- a/Models/Account/Repository.php +++ b/Models/Account/Repository.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/Models/Nosto/Account/Account.php b/Models/Nosto/Account/Account.php index 2e5d2107..258a5ef8 100644 --- a/Models/Nosto/Account/Account.php +++ b/Models/Nosto/Account/Account.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/Models/Nosto/Account/Repository.php b/Models/Nosto/Account/Repository.php index 1d546fb9..837dedac 100644 --- a/Models/Nosto/Account/Repository.php +++ b/Models/Nosto/Account/Repository.php @@ -1,6 +1,8 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/Models/Nosto/Customer/Customer.php b/Models/Nosto/Customer/Customer.php index 5b4a3428..aa80f4f0 100644 --- a/Models/Nosto/Customer/Customer.php +++ b/Models/Nosto/Customer/Customer.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ @@ -94,6 +95,7 @@ class Customer extends ModelEntity /** * @return int + * @noinspection PhpUnused */ public function getId() { diff --git a/Models/Nosto/Customer/Repository.php b/Models/Nosto/Customer/Repository.php index 1945d35e..4a248391 100644 --- a/Models/Nosto/Customer/Repository.php +++ b/Models/Nosto/Customer/Repository.php @@ -1,6 +1,8 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/Models/Nosto/Setting/Repository.php b/Models/Nosto/Setting/Repository.php index f5fec5ec..5bde4610 100644 --- a/Models/Nosto/Setting/Repository.php +++ b/Models/Nosto/Setting/Repository.php @@ -1,6 +1,8 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/Models/Nosto/Setting/Setting.php b/Models/Nosto/Setting/Setting.php index c7aabeea..fa133c1c 100644 --- a/Models/Nosto/Setting/Setting.php +++ b/Models/Nosto/Setting/Setting.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/Models/Order/Repository.php b/Models/Order/Repository.php index 98f3053c..6563b753 100644 --- a/Models/Order/Repository.php +++ b/Models/Order/Repository.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ diff --git a/Models/Product/Repository.php b/Models/Product/Repository.php index 71de06f4..211ee69c 100644 --- a/Models/Product/Repository.php +++ b/Models/Product/Repository.php @@ -1,6 +1,7 @@ - - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -use Shopware\Models\Category\Category; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\Query\Expr\Join; +use Shopware\Models\Category\Category; /** * Class Shopware_Plugins_Frontend_NostoTagging_Models_Product_Repository @@ -78,7 +79,7 @@ public function getActiveArticlesIdsByCategory( // Since the path in the database is saved with || between // the parents ids, we concatenate those and get all child // categories from the given language. - ->setParameter('path', '%|'.(int)$category->getId().'|%'); + ->setParameter('path', '%|' . (int)$category->getId() . '|%'); if (!empty($id)) { $result = $result->andWhere('details.number = :id') ->setParameter('id', $id) diff --git a/Shopware.iml b/Shopware.iml new file mode 100644 index 00000000..db32e6c8 --- /dev/null +++ b/Shopware.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/Views/backend/nosto_start_app/menu.js b/Views/backend/nosto_start_app/menu.js index db38e313..01d12323 100644 --- a/Views/backend/nosto_start_app/menu.js +++ b/Views/backend/nosto_start_app/menu.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Nosto Solutions Ltd + * Copyright (c) 2020, Nosto Solutions Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,29 +29,33 @@ * POSSIBILITY OF SUCH DAMAGE. * * @author Nosto Solutions Ltd - * @copyright Copyright (c) 2016 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ //{block name="backend/index/view/menu" append} -//noinspection JSUnusedGlobalSymbols,JSCheckFunctionSignatures +//noinspection JSUnusedGlobalSymbols,JSCheckFunctionSignatures,JSUnresolvedVariable Ext.define('Shopware.apps.NostoStartApp.Menu', { - override: 'Shopware.apps.Index.view.Menu', + override: 'Shopware.apps.Index.view.Menu', - /** - * @Override - */ - afterRender: function () { - var me = this, - result = me.callParent(arguments); + /** + * @Override + */ + afterRender: function () { + //noinspection JSCheckFunctionSignatures + const me = this; + //noinspection JSUnresolvedFunction + const result = me.callParent(arguments); - if (location.href.search("openNosto") !== -1) { - Shopware.app.Application.addSubApplication({ - name: 'Shopware.apps.NostoTagging' - }); - } - - return result; + if (location.href.search("openNosto") !== -1) { + //noinspection JSUnresolvedFunction,JSUnresolvedVariable + Shopware.app.Application.addSubApplication({ + //noinspection JSUnresolvedVariable + name: 'Shopware.apps.NostoTagging' + }); } + + return result; + } }); //{/block} diff --git a/Views/backend/nosto_tagging/app.js b/Views/backend/nosto_tagging/app.js index 2e56d439..ee360d1b 100644 --- a/Views/backend/nosto_tagging/app.js +++ b/Views/backend/nosto_tagging/app.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Nosto Solutions Ltd + * Copyright (c) 2020, Nosto Solutions Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,23 +29,24 @@ * POSSIBILITY OF SUCH DAMAGE. * * @author Nosto Solutions Ltd - * @copyright Copyright (c) 2016 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -//noinspection JSUnusedGlobalSymbols,JSCheckFunctionSignatures +//noinspection JSUnusedGlobalSymbols,JSCheckFunctionSignatures,JSUnresolvedVariable Ext.define('Shopware.apps.NostoTagging', { - extend: 'Enlight.app.SubApplication', - name: 'Shopware.apps.NostoTagging', - bulkLoad: true, - loadPath: '{url action=load}', - controllers: ['Main'], - stores: ['Account'], - models: ['Account'], - views: ['Main'], - launch: function () { - var me = this, - ctrl = me.getController('Main'); - return ctrl.mainWindow; - } + extend: 'Enlight.app.SubApplication', + name: 'Shopware.apps.NostoTagging', + bulkLoad: true, + loadPath: '{url action=load}', + controllers: ['Main'], + stores: ['Account'], + models: ['Account'], + views: ['Main'], + launch: function () { + const me = this; + //noinspection JSUnresolvedFunction + const ctrl = me.getController('Main'); + return ctrl.mainWindow; + } }); diff --git a/Views/backend/nosto_tagging/controller/main.js b/Views/backend/nosto_tagging/controller/main.js index 4ecacad6..e307fa0a 100644 --- a/Views/backend/nosto_tagging/controller/main.js +++ b/Views/backend/nosto_tagging/controller/main.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Nosto Solutions Ltd + * Copyright (c) 2020, Nosto Solutions Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,191 +29,209 @@ * POSSIBILITY OF SUCH DAMAGE. * * @author Nosto Solutions Ltd - * @copyright Copyright (c) 2016 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -//noinspection JSUnusedGlobalSymbols,JSCheckFunctionSignatures +//noinspection JSUnusedGlobalSymbols,JSCheckFunctionSignatures,JSUnresolvedVariable Ext.define('Shopware.apps.NostoTagging.controller.Main', { - /** - * Extends the Enlight controller. - * @string - */ - extend: 'Enlight.app.Controller', + /** + * Extends the Enlight controller. + * @string + */ + extend: 'Enlight.app.Controller', - /** - * Settings for the controller. - */ - settings: { - postMessageOrigin: null - }, + /** + * Settings for the controller. + */ + settings: { + postMessageOrigin: null + }, - /** - * Initializes the controller. - * - * @return void - */ - init: function () { - var me = this; - me.showWindow(); - me.loadSettings(); - me.postMessageListener(); - }, + /** + * Initializes the controller. + * + * @return void + */ + init: function () { + const me = this; + me.showWindow(); + me.loadSettings(); + me.postMessageListener(); + }, - /** - * Shows the main window. - * - * @return void - */ - showWindow: function () { - var me = this; - me.accountStore = me.getStore('Account'); - me.mainWindow = me.getView('Main').create({ - accountStore: me.accountStore - }); - me.mainWindow.show(); - me.mainWindow.setLoading(true); - //noinspection JSUnusedGlobalSymbols - me.accountStore.load({ - callback: function (records, op, success) { - me.mainWindow.setLoading(false); - if (success) { - me.mainWindow.initAccountTabs(); - } else { - throw new Error('Nosto: failed to load accounts.'); - } - } - }); - }, - - /** - * Loads controller settings. - * - * @return void - */ - loadSettings: function () { - var me = this; - Ext.Ajax.request({ - method: 'GET', - url: '{url controller=NostoTagging action=loadSettings}', - success: function (response) { - var op = Ext.decode(response.responseText); - if (op.success && op.data) { - me.settings = op.data; - } else { - throw new Error('Nosto: failed to load settings.'); - } - } - }); - }, + /** + * Shows the main window. + * + * @return void + */ + showWindow: function () { + const me = this; + //noinspection JSUnresolvedFunction + me.accountStore = me.getStore('Account'); + //noinspection JSUnresolvedFunction + me.mainWindow = me.getView('Main').create({ + accountStore: me.accountStore + }); + me.mainWindow.show(); + //noinspection JSUnresolvedFunction + me.mainWindow.setLoading(true); + //noinspection JSUnusedGlobalSymbols + me.accountStore.load({ + callback: function (records, op, success) { + //noinspection JSUnresolvedFunction + me.mainWindow.setLoading(false); + if (success) { + me.mainWindow.initAccountTabs(); + } else { + throw new Error('Nosto: failed to load accounts.'); + } + } + }); + }, - /** - * Register event handler for window.postMessage() messages from Nosto through which we handle account creation, - * connection and deletion. - * - * @return void - */ - postMessageListener: function () { - var me = this; - window.addEventListener('message', Ext.bind(me.receiveMessage, me), false); - }, + /** + * Loads controller settings. + * + * @return void + */ + loadSettings: function () { + //noinspection JSUnresolvedVariable + const me = this; + //noinspection JSUnresolvedVariable + Ext.Ajax.request({ + method: 'GET', + url: '{url controller=NostoTagging action=loadSettings}', + success: function (response) { + //noinspection JSUnresolvedVariable + const op = Ext.decode(response.responseText); + if (op.success && op.data) { + me.settings = op.data; + } else { + throw new Error('Nosto: failed to load settings.'); + } + } + }); + }, - /** - * Window.postMessage() event handler. - * - * Handles the communication between the iframe and the plugin. - * - * @param event Object - * @return void - */ - receiveMessage: function (event) { - //noinspection JSCheckFunctionSignatures - var me = this, - originRegexp = new RegExp(me.settings.postMessageOrigin), - json, - data, - account, - op, - accountData; + /** + * Register event handler for window.postMessage() messages from Nosto through which we handle account creation, + * connection and deletion. + * + * @return void + */ + postMessageListener: function () { + //noinspection JSUnresolvedVariable + const me = this; + //noinspection JSUnresolvedVariable + window.addEventListener('message', Ext.bind(me.receiveMessage, me), false); + }, - // Check the origin to prevent cross-site scripting. - if (!originRegexp.test(event.origin)) { - return; - } - // If the message does not start with '[Nosto]', then it is not for us. - if (('' + event.data).substr(0, 7) !== '[Nosto]') { - return; - } + /** + * Window.postMessage() event handler. + * + * Handles the communication between the iframe and the plugin. + * + * @param event Object + * @return void + */ + receiveMessage: function (event) { + //noinspection JSCheckFunctionSignatures + const me = this, + originRegexp = new RegExp(me.settings.postMessageOrigin); + let json, + data, + account, + op, + accountData; - json = ('' + event.data).substr(7); - data = Ext.decode(json); - if (typeof data === 'object' && data.type) { - account = me.mainWindow.getActiveAccount(); - if (!account) { - throw new Error('Nosto: failed to determine active account.'); + // Check the origin to prevent cross-site scripting. + //noinspection JSUnresolvedVariable + if (!originRegexp.test(event.origin)) { + return; + } + // If the message does not start with '[Nosto]', then it is not for us. + if (('' + event.data).substr(0, 7) !== '[Nosto]') { + return; + } + //noinspection JSUnresolvedVariable + json = ('' + event.data).substr(7); + //noinspection JSUnresolvedVariable + data = Ext.decode(json); + if (typeof data === 'object' && data.type) { + account = me.mainWindow.getActiveAccount(); + if (!account) { + throw new Error('Nosto: failed to determine active account.'); + } + switch (data.type) { + case 'newAccount': + //noinspection JSUnresolvedVariable + if (data.params && data.params.email) { + account.set('email', data.params.email); + if (data.params.details) { + account.set('details', JSON.stringify(data.params.details)); } - switch (data.type) { - case 'newAccount': - if (data.params && data.params.email) { - account.set('email', data.params.email); - if (data.params.details) { - account.set('details', JSON.stringify(data.params.details)); - } - } - account.save({ - success: function (record, op) { - // why can't we get the model data binding to work? - if (op.resultSet && op.resultSet.records) { - accountData = op.resultSet.records[0].data; - record.set('id', accountData.id); - record.set('name', accountData.name); - record.set('url', accountData.url); - me.mainWindow.reloadIframe(record); - } else { - throw new Error('Nosto: failed to create new account.'); - } - } - }); - break; - - case 'removeAccount': - account.destroy({ - success: function (record, op) { - // why can't we get the model data binding to work? - if (op.resultSet && op.resultSet.records) { - accountData = op.resultSet.records[0].data; - record.set('id', 0); - record.set('name', ''); - record.set('url', accountData.url); - me.mainWindow.reloadIframe(record); - } else { - throw new Error('Nosto: failed to delete account.'); - } - } - }); - break; + } + account.save({ + success: function (record, op) { + // why can't we get the model data binding to work? + //noinspection JSUnresolvedVariable + if (op.resultSet && op.resultSet.records) { + accountData = op.resultSet.records[0].data; + record.set('id', accountData.id); + record.set('name', accountData.name); + record.set('url', accountData.url); + me.mainWindow.reloadIframe(record); + } else { + throw new Error('Nosto: failed to create new account.'); + } + } + }); + break; - case 'connectAccount': - Ext.Ajax.request({ - method: 'POST', - url: '{url controller=NostoTagging action=connectAccount}', - params: { - shopId: account.get('shopId') - }, - success: function (response) { - op = Ext.decode(response.responseText); - if (op.success && op.data.redirect_url) { - window.location.href = op.data.redirect_url; - } else { - throw new Error('Nosto: failed to handle account connection.'); - } - } - }); - break; + case 'removeAccount': + account.destroy({ + success: function (record, op) { + // why can't we get the model data binding to work? + //noinspection JSUnresolvedVariable + if (op.resultSet && op.resultSet.records) { + accountData = op.resultSet.records[0].data; + record.set('id', 0); + record.set('name', ''); + record.set('url', accountData.url); + me.mainWindow.reloadIframe(record); + } else { + throw new Error('Nosto: failed to delete account.'); + } + } + }); + break; - default: - throw new Error('Nosto: invalid postMessage `type`.'); + case 'connectAccount': + //noinspection JSUnresolvedVariable + Ext.Ajax.request({ + method: 'POST', + url: '{url controller=NostoTagging action=connectAccount}', + params: { + shopId: account.get('shopId') + }, + success: function (response) { + //noinspection JSUnresolvedVariable + op = Ext.decode(response.responseText); + //noinspection JSUnresolvedVariable + if (op.success && op.data.redirect_url) { + //noinspection JSUnresolvedVariable + window.location.href = op.data.redirect_url; + } else { + throw new Error('Nosto: failed to handle account connection.'); + } } - } + }); + break; + + default: + throw new Error('Nosto: invalid postMessage `type`.'); + } } + } }); diff --git a/Views/backend/nosto_tagging/model/account.js b/Views/backend/nosto_tagging/model/account.js index ac103953..b2ecbbb1 100644 --- a/Views/backend/nosto_tagging/model/account.js +++ b/Views/backend/nosto_tagging/model/account.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Nosto Solutions Ltd + * Copyright (c) 2020, Nosto Solutions Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,38 +29,38 @@ * POSSIBILITY OF SUCH DAMAGE. * * @author Nosto Solutions Ltd - * @copyright Copyright (c) 2016 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -// noinspection JSCheckFunctionSignatures +// noinspection JSCheckFunctionSignatures,JSUnresolvedVariable Ext.define('Shopware.apps.NostoTagging.model.Account', { - extend: 'Ext.data.Model', - idProperty: 'id', - fields: [ - { name: 'id', type: 'int' }, - { name: 'name', type: 'string' }, - { name: 'url', type: 'string' }, - { name: 'email', type: 'string' }, - { name: 'shopId', type: 'int' }, - { name: 'shopName', type: 'string' }, - { name: 'details', type: 'string' } - ], - proxy: { - type: 'ajax', - api: { - create: '{url action=createAccount}', - update: '{url action=createAccount}', - destroy: '{url action=deleteAccount}' - }, - reader: { - idProperty: 'id', - type: 'json', - root: 'data' - }, - writer: { - type: 'json', - writeAllFields: true - } + extend: 'Ext.data.Model', + idProperty: 'id', + fields: [ + { name: 'id', type: 'int' }, + { name: 'name', type: 'string' }, + { name: 'url', type: 'string' }, + { name: 'email', type: 'string' }, + { name: 'shopId', type: 'int' }, + { name: 'shopName', type: 'string' }, + { name: 'details', type: 'string' } + ], + proxy: { + type: 'ajax', + api: { + create: '{url action=createAccount}', + update: '{url action=createAccount}', + destroy: '{url action=deleteAccount}' + }, + reader: { + idProperty: 'id', + type: 'json', + root: 'data' + }, + writer: { + type: 'json', + writeAllFields: true } + } }); diff --git a/Views/backend/nosto_tagging/store/account.js b/Views/backend/nosto_tagging/store/account.js index 284028b5..cc67c745 100644 --- a/Views/backend/nosto_tagging/store/account.js +++ b/Views/backend/nosto_tagging/store/account.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Nosto Solutions Ltd + * Copyright (c) 2020, Nosto Solutions Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,22 +29,22 @@ * POSSIBILITY OF SUCH DAMAGE. * * @author Nosto Solutions Ltd - * @copyright Copyright (c) 2016 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -// noinspection JSCheckFunctionSignatures +// noinspection JSCheckFunctionSignatures,JSUnresolvedVariable Ext.define('Shopware.apps.NostoTagging.store.Account', { - extend: 'Ext.data.Store', - model: 'Shopware.apps.NostoTagging.model.Account', - autoLoad: false, - proxy: { - type: 'ajax', - url: '{url action=getAccounts}', - reader: { - type: 'json', - root: 'data', - totalProperty: 'total' - } + extend: 'Ext.data.Store', + model: 'Shopware.apps.NostoTagging.model.Account', + autoLoad: false, + proxy: { + type: 'ajax', + url: '{url action=getAccounts}', + reader: { + type: 'json', + root: 'data', + totalProperty: 'total' } + } }); diff --git a/Views/backend/nosto_tagging/view/main.js b/Views/backend/nosto_tagging/view/main.js index 0e96e6dd..53bcb1a9 100644 --- a/Views/backend/nosto_tagging/view/main.js +++ b/Views/backend/nosto_tagging/view/main.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Nosto Solutions Ltd + * Copyright (c) 2020, Nosto Solutions Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,121 +29,128 @@ * POSSIBILITY OF SUCH DAMAGE. * * @author Nosto Solutions Ltd - * @copyright Copyright (c) 2016 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ -//noinspection JSUnusedGlobalSymbols,JSCheckFunctionSignatures +//noinspection JSUnusedGlobalSymbols,JSCheckFunctionSignatures,JSUnresolvedVariable Ext.define('Shopware.apps.NostoTagging.view.Main', { - /** - * Extends the Enlight application window. - * @string - */ - extend: 'Enlight.app.Window', + /** + * Extends the Enlight application window. + * @string + */ + extend: 'Enlight.app.Window', - /** - * Window title. - * @string - */ - title: 'Nosto', + /** + * Window title. + * @string + */ + title: 'Nosto', - /** - * Window layout. - * @string - */ - layout: 'fit', + /** + * Window layout. + * @string + */ + layout: 'fit', - /** - * Window width. - * @integer - */ - width: "70%", + /** + * Window width. + * @integer + */ + width: "70%", - /** - * Window height. - * @integer - */ - height: "90%", + /** + * Window height. + * @integer + */ + height: "90%", - /** - * Initializes the component. - * - * @public - * @return void - */ - initComponent: function () { - var me = this; - me.items = me.tabPanel = Ext.create('Ext.tab.Panel', { - layout: 'fit', - items: [] - }); - me.callParent(arguments); - }, + /** + * Initializes the component. + * + * @public + * @return void + */ + initComponent: function () { + const me = this; + //noinspection JSUnresolvedVariable + me.items = me.tabPanel = Ext.create('Ext.tab.Panel', { + layout: 'fit', + items: [] + }); + //noinspection JSUnresolvedFunction,JSCheckFunctionSignatures + me.callParent(arguments); + }, - /** - * Creates tabs for each account in the account store - * and adds them to the tab panel. - * - * @public - * @return void - */ - initAccountTabs: function () { - var me = this, - i = 0, - tab; + /** + * Creates tabs for each account in the account store + * and adds them to the tab panel. + * + * @public + * @return void + */ + initAccountTabs: function () { + const me = this; + let i = 0, + tab; + //noinspection JSUnresolvedFunction + me.accountStore.each(function (account) { + //noinspection JSUnresolvedExtXType + tab = me.tabPanel.add({ + title: account.get('shopName'), + xtype: 'component', + autoEl: { + 'tag': 'iframe', + 'data-shopId': account.get('shopId'), + 'src': account.get('url') + }, + shopId: account.get('shopId') + }); + if (++i === 1) { + //noinspection JSUnresolvedFunction + me.tabPanel.setActiveTab(tab); + } + }); + }, - me.accountStore.each(function (account) { - // noinspection JSUnresolvedExtXType - tab = me.tabPanel.add({ - title: account.get('shopName'), - xtype: 'component', - autoEl: { - 'tag': 'iframe', - 'data-shopId': account.get('shopId'), - 'src': account.get('url') - }, - shopId: account.get('shopId') - }); - if (++i === 1) { - me.tabPanel.setActiveTab(tab); - } - }); - }, + /** + * Getter for the active account model. + * + * @public + * @return Shopware.apps.NostoTagging.model.Account + */ + getActiveAccount: function () { + const me = this; + //noinspection JSUnresolvedFunction + const activeTab = me.tabPanel.getActiveTab(); + let activeAccount = null; - /** - * Getter for the active account model. - * - * @public - * @return Shopware.apps.NostoTagging.model.Account - */ - getActiveAccount: function () { - var me = this, - activeTab = me.tabPanel.getActiveTab(), - activeAccount = null; + //noinspection JSUnresolvedFunction + me.accountStore.each(function (account) { + if (account.get('shopId') === activeTab.shopId) { + activeAccount = account; + } + }); + return activeAccount; + }, - me.accountStore.each(function (account) { - if (account.get('shopId') === activeTab.shopId) { - activeAccount = account; - } - }); - return activeAccount; - }, + /** + * Reloads the active iframe window with url from account model. + * + * @public + * @param account Shopware.apps.NostoTagging.model.Account + */ + reloadIframe: function (account) { + //noinspection JSUnresolvedVariable + const me = this; + let elements; - /** - * Reloads the active iframe window with url from account model. - * - * @public - * @param account Shopware.apps.NostoTagging.model.Account - */ - reloadIframe: function (account) { - var me = this, - elements; - - elements = Ext.query('#' + me.tabPanel.getId() + ' iframe[data-shopId="' + account.get('shopId') + '"]'); - if (typeof elements[0] !== 'undefined') { - elements[0].src = account.get('url'); - } else { - throw new Error('Nosto: failed to re-load iframe for shop #' + account.get('shopId')); - } + //noinspection JSCheckFunctionSignatures,JSUnresolvedFunction,JSUnresolvedVariable + elements = Ext.query('#' + me.tabPanel.getId() + ' iframe[data-shopId="' + account.get('shopId') + '"]'); + if (typeof elements[0] !== 'undefined') { + elements[0].src = account.get('url'); + } else { + throw new Error('Nosto: failed to re-load iframe for shop #' + account.get('shopId')); } + } }); diff --git a/Views/emotion_components/widgets/emotion/components/nosto_slot.tpl b/Views/emotion_components/widgets/emotion/components/nosto_slot.tpl index 32f03bed..3abfb2c1 100644 --- a/Views/emotion_components/widgets/emotion/components/nosto_slot.tpl +++ b/Views/emotion_components/widgets/emotion/components/nosto_slot.tpl @@ -1,12 +1,13 @@
+ diff --git a/Views/frontend/plugins/nosto_tagging/index.tpl b/Views/frontend/plugins/nosto_tagging/index.tpl index dd876cd9..65a523b4 100644 --- a/Views/frontend/plugins/nosto_tagging/index.tpl +++ b/Views/frontend/plugins/nosto_tagging/index.tpl @@ -44,10 +44,10 @@ @@ -55,74 +55,75 @@ + {/if} {/block} diff --git a/build.xml b/build.xml index d66db610..855223e8 100644 --- a/build.xml +++ b/build.xml @@ -1,5 +1,5 @@ diff --git a/composer.json b/composer.json index 214aa5bf..ccc661f7 100644 --- a/composer.json +++ b/composer.json @@ -7,22 +7,65 @@ "version": "2.4.9", "require": { "php": ">=5.4.0", - "nosto/php-sdk": "3.15.0" + "nosto/php-sdk": "3.15.*", + "ext-json": "*" }, "require-dev": { - "php": ">=7.2.0", - "squizlabs/php_codesniffer": "2.8.1", - "phan/phan": "2.6.*", + "phan/phan": "^2.6", + "squizlabs/php_codesniffer": "^3.5", "phpmd/phpmd": "^2.6", "sebastian/phpcpd": "4.1.0", "phing/phing": "2.*", "shopware/shopware": "~5.6", "wimg/php-compatibility": "^9.0", + "staabm/annotate-pull-request-from-checkstyle": "^1.1", + "mridang/pmd-annotations": "^0.0.2", "drenso/phan-extensions": "^2.5" }, "autoload": { "psr-4": { "Nosto\\": "" } + }, + "scripts": { + "preparePackageFiles": [ + "rm -fr tmpPackageSources", + "mkdir tmpPackageSources", + "rsync -avr --exclude='vendor/' --exclude='build/' --exclude='tmpPackageSources' --exclude='*.zip' * tmpPackageSources", + "composer install -d tmpPackageSources/ --no-dev", + "@removeRedundantPackageFiles" + ], + "removeRedundantPackageFiles": [ + "rm tmpPackageSources/composer.json", + "rm tmpPackageSources/composer.lock", + "rm tmpPackageSources/build.xml", + "rm tmpPackageSources/Dockerfile", + "rm tmpPackageSources/LICENSE", + "rm tmpPackageSources/phan.php", + "rm tmpPackageSources/ruleset.xml", + "rm tmpPackageSources/Shopware.iml", + "rm tmpPackageSources/idea.properties", + "rm tmpPackageSources/vendor/nosto/php-sdk/composer.json", + "rm tmpPackageSources/vendor/nosto/php-sdk/composer.lock", + "rm tmpPackageSources/vendor/nosto/php-sdk/build.xml", + "rm tmpPackageSources/vendor/nosto/php-sdk/Dockerfile", + "rm tmpPackageSources/vendor/nosto/php-sdk/Jenkinsfile", + "rm tmpPackageSources/vendor/nosto/php-sdk/phan.php" + ], + "archivePackageFiles": [ + "rm -fr Frontend", + "mkdir Frontend", + "mv tmpPackageSources Frontend/", + "mv Frontend/tmpPackageSources Frontend/NostoTagging", + "zip -r NostoTagging-X.Y.Z.zip Frontend" + ], + "cleanupPackageFiles": [ + "rm -fr Frontend" + ], + "build-package": [ + "@preparePackageFiles", + "@archivePackageFiles", + "@cleanupPackageFiles" + ] } } diff --git a/composer.lock b/composer.lock index 3dd939c3..75bea110 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "900236d550b95c110001fe2fe55c9aaa", + "content-hash": "0f1ebec9dfdd5a85a36de4ece41c86dc", "packages": [ { "name": "nosto/php-sdk", @@ -110,16 +110,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "2.0.26", + "version": "2.0.27", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "09655fcc1f8bab65727be036b28f6f20311c126c" + "reference": "34620af4df7d1988d8f0d7e91f6c8a3bf931d8dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/09655fcc1f8bab65727be036b28f6f20311c126c", - "reference": "09655fcc1f8bab65727be036b28f6f20311c126c", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/34620af4df7d1988d8f0d7e91f6c8a3bf931d8dc", + "reference": "34620af4df7d1988d8f0d7e91f6c8a3bf931d8dc", "shasum": "" }, "require": { @@ -198,7 +198,7 @@ "x.509", "x509" ], - "time": "2020-03-13T04:15:39+00:00" + "time": "2020-04-04T23:17:33+00:00" }, { "name": "vlucas/phpdotenv", @@ -255,16 +255,16 @@ "packages-dev": [ { "name": "aws/aws-sdk-php", - "version": "3.133.47", + "version": "3.138.10", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "706082d6a0e53c7656eca61866b456178112daf6" + "reference": "cf197a033ad75cd9e3a90a207cf5ec8935aafa48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/706082d6a0e53c7656eca61866b456178112daf6", - "reference": "706082d6a0e53c7656eca61866b456178112daf6", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/cf197a033ad75cd9e3a90a207cf5ec8935aafa48", + "reference": "cf197a033ad75cd9e3a90a207cf5ec8935aafa48", "shasum": "" }, "require": { @@ -335,7 +335,7 @@ "s3", "sdk" ], - "time": "2020-03-30T18:15:57+00:00" + "time": "2020-05-28T18:12:07+00:00" }, { "name": "bcremer/line-reader", @@ -605,28 +605,29 @@ }, { "name": "composer/semver", - "version": "1.5.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" + "reference": "0ec124f57c7e23925c006cbad0de853e3aec3ba2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "url": "https://api.github.com/repos/composer/semver/zipball/0ec124f57c7e23925c006cbad0de853e3aec3ba2", + "reference": "0ec124f57c7e23925c006cbad0de853e3aec3ba2", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5" + "phpstan/phpstan": "^0.12.19", + "phpunit/phpunit": "^4.5 || ^5.0.5 || ^7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -662,7 +663,17 @@ "validation", "versioning" ], - "time": "2020-01-13T12:06:48+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-04-21T13:19:12+00:00" }, { "name": "composer/xdebug-handler", @@ -710,21 +721,22 @@ }, { "name": "doctrine/annotations", - "version": "v1.8.0", + "version": "1.10.3", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc" + "reference": "5db60a4969eba0e0c197a19c077780aadbc43c5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/904dca4eb10715b92569fbcd79e201d5c349b6bc", - "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5db60a4969eba0e0c197a19c077780aadbc43c5d", + "reference": "5db60a4969eba0e0c197a19c077780aadbc43c5d", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": "^7.1" + "ext-tokenizer": "*", + "php": "^7.1 || ^8.0" }, "require-dev": { "doctrine/cache": "1.*", @@ -733,7 +745,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.9.x-dev" } }, "autoload": { @@ -774,7 +786,7 @@ "docblock", "parser" ], - "time": "2019-10-01T18:55:10+00:00" + "time": "2020-05-25T17:24:27+00:00" }, { "name": "doctrine/cache", @@ -1155,33 +1167,38 @@ }, { "name": "doctrine/inflector", - "version": "1.3.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1" + "reference": "4650c8b30c753a76bf44fb2ed00117d6f367490c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/ec3a55242203ffa6a4b27c58176da97ff0a7aec1", - "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/4650c8b30c753a76bf44fb2ed00117d6f367490c", + "reference": "4650c8b30c753a76bf44fb2ed00117d6f367490c", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.2 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^6.2" + "doctrine/coding-standard": "^7.0", + "phpstan/phpstan": "^0.11", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-strict-rules": "^0.11", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector", + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" } }, "notification-url": "https://packagist.org/downloads/", @@ -1210,15 +1227,35 @@ "email": "schmittjoh@gmail.com" } ], - "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "homepage": "http://www.doctrine-project.org", + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", "keywords": [ "inflection", - "pluralize", - "singularize", - "string" + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" ], - "time": "2019-10-30T19:59:35+00:00" + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", + "type": "tidelift" + } + ], + "time": "2020-05-29T07:19:59+00:00" }, { "name": "doctrine/instantiator", @@ -1278,20 +1315,20 @@ }, { "name": "doctrine/lexer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6" + "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6", - "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", + "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", "shasum": "" }, "require": { - "php": "^7.2" + "php": "^7.2 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^6.0", @@ -1336,7 +1373,21 @@ "parser", "php" ], - "time": "2019-10-30T14:39:59+00:00" + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2020-05-25T17:44:05+00:00" }, { "name": "doctrine/orm", @@ -1878,16 +1929,16 @@ }, { "name": "google/auth", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "c7b295feb248f138f462a1e6b7d635e4244204c5" + "reference": "af4abf63988b8c74f589bee1e69ba310d3e43c6c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/c7b295feb248f138f462a1e6b7d635e4244204c5", - "reference": "c7b295feb248f138f462a1e6b7d635e4244204c5", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/af4abf63988b8c74f589bee1e69ba310d3e43c6c", + "reference": "af4abf63988b8c74f589bee1e69ba310d3e43c6c", "shasum": "" }, "require": { @@ -1899,12 +1950,12 @@ "psr/http-message": "^1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^1.11", "guzzlehttp/promises": "0.1.1|^1.3", "kelvinmo/simplejwt": "^0.2.5", "phpseclib/phpseclib": "^2", "phpunit/phpunit": "^4.8.36|^5.7", - "sebastian/comparator": ">=1.2.3" + "sebastian/comparator": ">=1.2.3", + "squizlabs/php_codesniffer": "^3.5" }, "suggest": { "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." @@ -1926,7 +1977,7 @@ "google", "oauth2" ], - "time": "2020-03-26T19:47:36+00:00" + "time": "2020-05-18T17:02:59+00:00" }, { "name": "google/cloud", @@ -2812,6 +2863,49 @@ ], "time": "2019-02-06T13:32:19+00:00" }, + { + "name": "mridang/pmd-annotations", + "version": "0.0.2", + "source": { + "type": "git", + "url": "https://github.com/mridang/pmd-annotations.git", + "reference": "0fcaf0e31698c4d81ddb6fa2538edfda8123a7a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mridang/pmd-annotations/zipball/0fcaf0e31698c4d81ddb6fa2538edfda8123a7a2", + "reference": "0fcaf0e31698c4d81ddb6fa2538edfda8123a7a2", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "bin": [ + "pmd2pr" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mridang Agarwalla" + } + ], + "description": "Turns PMD style XML reports into Github pull-request annotations via the Checks API. This script is meant for use within your Github Action.", + "keywords": [ + "actions", + "annotations", + "github", + "pmd" + ], + "time": "2020-03-31T08:41:21+00:00" + }, { "name": "mtdowling/jmespath.php", "version": "2.5.0", @@ -2919,16 +3013,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v2.0.0", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "e245890383c3ed38b6d202ee373c23ccfebc0f54" + "reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/e245890383c3ed38b6d202ee373c23ccfebc0f54", - "reference": "e245890383c3ed38b6d202ee373c23ccfebc0f54", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/e0f1e33a71587aca81be5cffbb9746510e1fe04e", + "reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e", "shasum": "" }, "require": { @@ -2961,7 +3055,7 @@ } ], "description": "Map nested JSON structures onto PHP classes", - "time": "2020-03-04T17:23:33+00:00" + "time": "2020-04-16T18:48:43+00:00" }, { "name": "ocramius/package-versions", @@ -3297,20 +3391,20 @@ }, { "name": "phan/phan", - "version": "2.6.1", + "version": "2.7.2", "source": { "type": "git", "url": "https://github.com/phan/phan.git", - "reference": "184c591e5b31c1f98426ed8e147a61864bd0cc96" + "reference": "df79f6def6cb7643955af14aa4b97acdd3495ad6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phan/phan/zipball/184c591e5b31c1f98426ed8e147a61864bd0cc96", - "reference": "184c591e5b31c1f98426ed8e147a61864bd0cc96", + "url": "https://api.github.com/repos/phan/phan/zipball/df79f6def6cb7643955af14aa4b97acdd3495ad6", + "reference": "df79f6def6cb7643955af14aa4b97acdd3495ad6", "shasum": "" }, "require": { - "composer/semver": "^1.4", + "composer/semver": "^1.4|^2.0", "composer/xdebug-handler": "^1.3.2", "ext-filter": "*", "ext-json": "*", @@ -3321,7 +3415,8 @@ "php": "^7.1.0", "sabre/event": "^5.0", "symfony/console": "^2.3|^3.0|^4.0|^5.0", - "symfony/polyfill-mbstring": "^1.11.0" + "symfony/polyfill-mbstring": "^1.11.0", + "symfony/polyfill-php72": "^1.15" }, "require-dev": { "brianium/paratest": "^4.0.0", @@ -3366,7 +3461,7 @@ "php", "static" ], - "time": "2020-03-13T21:34:53+00:00" + "time": "2020-05-02T14:09:53+00:00" }, { "name": "phing/phing", @@ -3812,24 +3907,21 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "2.0.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", "shasum": "" }, "require": { "php": ">=7.1" }, - "require-dev": { - "phpunit/phpunit": "~6" - }, "type": "library", "extra": { "branch-alias": { @@ -3860,7 +3952,7 @@ "reflection", "static analysis" ], - "time": "2018-08-07T13:53:10+00:00" + "time": "2020-04-27T09:25:28+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -4405,23 +4497,23 @@ }, { "name": "react/promise", - "version": "v2.7.1", + "version": "v2.8.0", "source": { "type": "git", "url": "https://github.com/reactphp/promise.git", - "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d" + "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/31ffa96f8d2ed0341a57848cbb84d88b89dd664d", - "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d", + "url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4", + "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4", "shasum": "" }, "require": { "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36" }, "type": "library", "autoload": { @@ -4447,7 +4539,7 @@ "promise", "promises" ], - "time": "2019-01-07T21:25:54+00:00" + "time": "2020-05-12T15:16:56+00:00" }, { "name": "rize/uri-template", @@ -4920,64 +5012,37 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.8.1", + "version": "3.5.5", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "d7cf0d894e8aa4c73712ee4a331cc1eaa37cdc7d" + "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d7cf0d894e8aa4c73712ee4a331cc1eaa37cdc7d", - "reference": "d7cf0d894e8aa4c73712ee4a331cc1eaa37cdc7d", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.1.2" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "bin": [ - "scripts/phpcs", - "scripts/phpcbf" + "bin/phpcs", + "bin/phpcbf" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "3.x-dev" } }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -4989,12 +5054,48 @@ } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", "standards" ], - "time": "2017-03-01T22:17:45+00:00" + "time": "2020-04-17T01:09:41+00:00" + }, + { + "name": "staabm/annotate-pull-request-from-checkstyle", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/staabm/annotate-pull-request-from-checkstyle.git", + "reference": "7d3bcdf21e4b30b14c8ca0a7ef39f4b856d3fbfb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/annotate-pull-request-from-checkstyle/zipball/7d3bcdf21e4b30b14c8ca0a7ef39f4b856d3fbfb", + "reference": "7d3bcdf21e4b30b14c8ca0a7ef39f4b856d3fbfb", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "php": "^7.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16.1" + }, + "bin": [ + "cs2pr" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Markus Staab" + } + ], + "time": "2020-02-26T08:24:03+00:00" }, { "name": "stecman/symfony-console-completion", @@ -5418,7 +5519,7 @@ }, { "name": "symfony/debug", - "version": "v4.4.7", + "version": "v4.4.8", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -5470,6 +5571,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", + "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-03-27T16:54:36+00:00" }, { @@ -5545,7 +5660,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.4.7", + "version": "v4.4.8", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -5611,6 +5726,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", + "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-03-27T16:54:36+00:00" }, { @@ -6048,7 +6177,7 @@ }, { "name": "symfony/inflector", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/inflector.git", @@ -6102,20 +6231,34 @@ "symfony", "words" ], + "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-03-27T16:56:45+00:00" }, { "name": "symfony/intl", - "version": "v4.4.7", + "version": "v4.4.8", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", - "reference": "63238a53b1cf0cd3e2b0b22cabc7c0b6f3fd4562" + "reference": "040f10fde20ae35e8623771ba8a733508c87aa6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/intl/zipball/63238a53b1cf0cd3e2b0b22cabc7c0b6f3fd4562", - "reference": "63238a53b1cf0cd3e2b0b22cabc7c0b6f3fd4562", + "url": "https://api.github.com/repos/symfony/intl/zipball/040f10fde20ae35e8623771ba8a733508c87aa6a", + "reference": "040f10fde20ae35e8623771ba8a733508c87aa6a", "shasum": "" }, "require": { @@ -6177,7 +6320,21 @@ "l10n", "localization" ], - "time": "2020-03-27T16:54:36+00:00" + "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-04-12T14:39:55+00:00" }, { "name": "symfony/options-resolver", @@ -6235,16 +6392,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", "shasum": "" }, "require": { @@ -6256,7 +6413,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -6289,20 +6446,34 @@ "polyfill", "portable" ], - "time": "2020-02-27T09:26:54+00:00" + "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-05-12T16:14:59+00:00" }, { "name": "symfony/polyfill-intl-icu", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "9c281272735eb66476e0fa7381e03fb0d4b60197" + "reference": "4ef3923e4a86e1b6ef72d42be59dbf7d33a685e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/9c281272735eb66476e0fa7381e03fb0d4b60197", - "reference": "9c281272735eb66476e0fa7381e03fb0d4b60197", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/4ef3923e4a86e1b6ef72d42be59dbf7d33a685e3", + "reference": "4ef3923e4a86e1b6ef72d42be59dbf7d33a685e3", "shasum": "" }, "require": { @@ -6315,7 +6486,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -6347,20 +6518,34 @@ "portable", "shim" ], - "time": "2020-02-27T09:26:54+00:00" + "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-05-12T16:14:59+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" + "reference": "fa79b11539418b02fc5e1897267673ba2c19419c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c", + "reference": "fa79b11539418b02fc5e1897267673ba2c19419c", "shasum": "" }, "require": { @@ -6372,7 +6557,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -6406,20 +6591,34 @@ "portable", "shim" ], - "time": "2020-03-09T19:04:49+00:00" + "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-05-12T16:47:27+00:00" }, { "name": "symfony/polyfill-php56", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "d51ec491c8ddceae7dca8dd6c7e30428f543f37d" + "reference": "e3c8c138280cdfe4b81488441555583aa1984e23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/d51ec491c8ddceae7dca8dd6c7e30428f543f37d", - "reference": "d51ec491c8ddceae7dca8dd6c7e30428f543f37d", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/e3c8c138280cdfe4b81488441555583aa1984e23", + "reference": "e3c8c138280cdfe4b81488441555583aa1984e23", "shasum": "" }, "require": { @@ -6429,7 +6628,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -6462,20 +6661,34 @@ "portable", "shim" ], - "time": "2020-03-09T19:04:49+00:00" + "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-05-12T16:47:27+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "2a18e37a489803559284416df58c71ccebe50bf0" + "reference": "82225c2d7d23d7e70515496d249c0152679b468e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/2a18e37a489803559284416df58c71ccebe50bf0", - "reference": "2a18e37a489803559284416df58c71ccebe50bf0", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/82225c2d7d23d7e70515496d249c0152679b468e", + "reference": "82225c2d7d23d7e70515496d249c0152679b468e", "shasum": "" }, "require": { @@ -6485,7 +6698,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -6521,20 +6734,103 @@ "portable", "shim" ], - "time": "2020-02-27T09:26:54+00:00" + "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-05-12T16:47:27+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.17.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "f048e612a3905f34931127360bdd2def19a5e582" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/f048e612a3905f34931127360bdd2def19a5e582", + "reference": "f048e612a3905f34931127360bdd2def19a5e582", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.17-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "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-05-12T16:47:27+00:00" }, { "name": "symfony/polyfill-util", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-util.git", - "reference": "d8e76c104127675d0ea3df3be0f2ae24a8619027" + "reference": "4afb4110fc037752cf0ce9869f9ab8162c4e20d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/d8e76c104127675d0ea3df3be0f2ae24a8619027", - "reference": "d8e76c104127675d0ea3df3be0f2ae24a8619027", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/4afb4110fc037752cf0ce9869f9ab8162c4e20d7", + "reference": "4afb4110fc037752cf0ce9869f9ab8162c4e20d7", "shasum": "" }, "require": { @@ -6543,7 +6839,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -6573,7 +6869,21 @@ "polyfill", "shim" ], - "time": "2020-03-02T11:55:35+00:00" + "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-05-12T16:14:59+00:00" }, { "name": "symfony/process", @@ -6626,16 +6936,16 @@ }, { "name": "symfony/property-access", - "version": "v4.4.7", + "version": "v4.4.8", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "75cbf0f388d82685ce06515951397bc1370901d7" + "reference": "f6a51bd76a3a5c36c57221a4f491b9cf02663672" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/75cbf0f388d82685ce06515951397bc1370901d7", - "reference": "75cbf0f388d82685ce06515951397bc1370901d7", + "url": "https://api.github.com/repos/symfony/property-access/zipball/f6a51bd76a3a5c36c57221a4f491b9cf02663672", + "reference": "f6a51bd76a3a5c36c57221a4f491b9cf02663672", "shasum": "" }, "require": { @@ -6689,7 +6999,21 @@ "property path", "reflection" ], - "time": "2020-03-27T16:54:36+00:00" + "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-04-15T15:55:41+00:00" }, { "name": "symfony/serializer", @@ -6986,16 +7310,16 @@ }, { "name": "symfony/var-exporter", - "version": "v4.4.7", + "version": "v4.4.8", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "6e4939b084defee0ab60a21e6a02e3a198afd91f" + "reference": "6e95bdca4a4604da6c148729972d4b627a034b13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/6e4939b084defee0ab60a21e6a02e3a198afd91f", - "reference": "6e4939b084defee0ab60a21e6a02e3a198afd91f", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/6e95bdca4a4604da6c148729972d4b627a034b13", + "reference": "6e95bdca4a4604da6c148729972d4b627a034b13", "shasum": "" }, "require": { @@ -7042,7 +7366,21 @@ "instantiate", "serialize" ], - "time": "2020-03-27T16:54:36+00:00" + "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-04-15T15:55:41+00:00" }, { "name": "symfony/web-link", @@ -7157,16 +7495,16 @@ }, { "name": "webmozart/assert", - "version": "1.7.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", + "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6", + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6", "shasum": "" }, "require": { @@ -7174,7 +7512,7 @@ "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "vimeo/psalm": "<3.6.0" + "vimeo/psalm": "<3.9.1" }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" @@ -7201,7 +7539,7 @@ "check", "validate" ], - "time": "2020-02-14T12:15:55+00:00" + "time": "2020-04-18T12:12:48+00:00" }, { "name": "wimg/php-compatibility", @@ -7427,9 +7765,11 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.4.0" + "php": ">=5.4.0", + "ext-json": "*" }, "platform-dev": { "php": ">=7.2.0" - } + }, + "plugin-api-version": "1.1.0" } diff --git a/idea.properties b/idea.properties new file mode 100644 index 00000000..075f6be8 --- /dev/null +++ b/idea.properties @@ -0,0 +1 @@ +idea.analyze.scope=Inspection diff --git a/phan.php b/phan.php index 2e8e484a..0fefe15f 100644 --- a/phan.php +++ b/phan.php @@ -1,6 +1,6 @@ - * @copyright Copyright (c) 2019 Nosto Solutions Ltd (http://www.nosto.com) + * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com) * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause */ @@ -55,8 +55,9 @@ 'file_list' => [ 'Bootstrap.php' ], + "color_issue_messages_if_supported" => true, 'plugins' => [ 'vendor/drenso/phan-extensions/Plugin/Annotation/SymfonyAnnotationPlugin.php', 'vendor/drenso/phan-extensions/Plugin/DocComment/InlineVarPlugin.php' - ], + ] ]; diff --git a/ruleset.xml b/ruleset.xml index db8fc292..7cc2ca6b 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -1,6 +1,6 @@