diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index be4561e..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage_clover: tests/_output/coverage.xml -json_path: tests/_output/coveralls-upload.json -service_name: travis-ci diff --git a/.editorconfig b/.editorconfig index b646d75..9ee2344 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,6 +13,6 @@ trim_trailing_whitespace = true [*.bat] end_of_line = crlf -[*.json] +[{*.json,*.yml}] indent_style = space -indent_size = 2 \ No newline at end of file +indent_size = 2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..82ee176 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +name: CI + +on: + pull_request: + branches: [ master ] + +jobs: + continous-integration: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-versions: [ "7.4" ] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, dom, fileinfo, pgsql, json + coverage: xdebug #optional + - name: Get composer cache directory + id: composercache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache composer dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composercache.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install dependencies and run ci tasks + run: make install ci diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7c1eed2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: php - -php: - - 7.1 - -cache: - directories: - - vendor - - $HOME/.composer/cache - -install: - - composer install --no-interaction --prefer-dist - -script: - - vendor/bin/phpcs src --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml - - vendor/bin/codecept run --coverage-xml - -after_success: - - vendor/bin/php-coveralls \ No newline at end of file diff --git a/LICENSE b/LICENSE index 9964186..3bb9d2c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,9 @@ The MIT License (MIT) -Copyright (c) 2018 FOND OF GmbH +Copyright (c) 2022 FOND OF GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1baf9a5 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +.PHONY: install +install: + composer install + +.PHONY: phpcs +phpcs: + ./vendor/bin/phpcs --standard=./vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src/FondOfSpryker/* ./tests/* + +.PHONY: phpcbf +phpcbf: + ./vendor/bin/phpcbf --standard=./vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src/FondOfSpryker/* ./tests/* + +.PHONY: phpstan +phpstan: + ./vendor/bin/phpstan --memory-limit=-1 analyse ./src/FondOfSpryker ./tests + +.PHONY: codeception +codeception: + ./vendor/bin/codecept run --env standalone + +.PHONY: ci +ci: phpcs codeception diff --git a/README.md b/README.md index 02597f2..c740081 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # fond-of-spryker/contentful -[![PHP from Travis config](https://img.shields.io/travis/php-v/symfony/symfony.svg)](https://php.net/) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://packagist.org/packages/fond-of-spryker/contentful) -A Spryker-Contentful connector. +A Spryker-Contentful connector. Import content from contentful to storage and updates it via cronjob. ## Install @@ -26,7 +25,7 @@ $this->application->addRouter((new ContentfulRouter())->setSsl(false)); new ContentfulConsole(), ``` -### 4. Add configs to your shop config file or in config/Shared/config_default.php +### 4. Add configs to your shop config file or in config/Shared/config_default.php Example configuration ``` // API-Key @@ -145,4 +144,4 @@ Object (Json) # Pages - If the contentful entry has a "Indentifier" field (URL) it will be imported as page with the given route via IdentifierImporterPlugin. - Add an additional ResourceCreator to add custom logic to a special contentful entry type. -- More documentation soon \ No newline at end of file +- More documentation soon diff --git a/codeception.yml b/codeception.yml index 8bc2bc7..34c96cb 100644 --- a/codeception.yml +++ b/codeception.yml @@ -1,4 +1,4 @@ -namespace: FondOfSpryker +namespace: fond-of-spryker/contentful suites: unit: path: . @@ -6,7 +6,8 @@ suites: settings: shuffle: true lint: true - bootstrap: _bootstrap.php + +bootstrap: _bootstrap.php paths: tests: tests @@ -17,4 +18,22 @@ paths: coverage: enabled: true include: - - src/*.php \ No newline at end of file + - src/FondOfSpryker/*.php + +modules: + enabled: + - \FondOfCodeception\Module\Spryker + config: + \FondOfCodeception\Module\Spryker: + generate_transfer: false + generate_map_classes: false + generate_propel_classes: false + +env: + standalone: + modules: + config: + \FondOfCodeception\Module\Spryker: + generate_transfer: true + generate_map_classes: true + generate_propel_classes: true diff --git a/composer.json b/composer.json index b560f3c..a8ae6e7 100644 --- a/composer.json +++ b/composer.json @@ -3,10 +3,6 @@ "description": "A contentful connector for spryker.", "license": "MIT", "authors": [ - { - "name": "Markus Nörenberg", - "email": "noerenberg.markus@gmail.com" - }, { "name": "Daniel Rose", "email": "daniel-rose@gmx.de" @@ -21,22 +17,23 @@ } ], "require": { - "php": ">=7.3", - "spryker/twig": "^3.8.2", - "spryker/storage": "^3.14.0", + "php": ">=7.4", + "ext-json": "*", + "aptoma/twig-markdown": "2.0.0", + "contentful/contentful": "^6.0.0", + "michelf/php-markdown": "1.9", + "spryker/category-storage": "^2.4", + "spryker/event-behavior": "^1.24", + "spryker/key-builder": "^1.1", "spryker/locale": "^3.3.0", + "spryker/storage": "^3.14.0", "spryker/store": "^1.12.1", - "contentful/contentful": "^6.0.0", - "aptoma/twig-markdown": "2.0.0", - "michelf/php-markdown": "1.9" + "spryker/twig": "^3.8.2" }, "require-dev": { - "spryker/code-sniffer": "^0.14.7", - "codeception/codeception": "^2.5", - "mikey179/vfsstream": "^1.6", - "phpro/grumphp": "^0.14", - "sebastian/phpcpd": "^4.1", - "php-coveralls/php-coveralls": "^2.0" + "fond-of-codeception/spryker": "^1.0", + "spryker/code-sniffer": "*", + "spryker-sdk/phpstan-spryker": "*" }, "suggest": { "fond-of-spryker/contentful-router": "Allows to route to contentful pages in spryker" @@ -50,7 +47,15 @@ }, "autoload-dev": { "psr-4": { - "FondOfSpryker\\": "tests/FondOfSpryker/" + "FondOfSpryker\\": "tests/FondOfSpryker/", + "Generated\\":"src/Generated/", + "Orm\\Zed\\": "src/Orm/Zed/" + } + }, + "config": { + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/grumphp.yml b/grumphp.yml deleted file mode 100644 index 4ffc359..0000000 --- a/grumphp.yml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - git_dir: . - bin_dir: vendor/bin - tasks: - composer: - no_local_repository: true - yamllint: ~ - jsonlint: ~ - xmllint: ~ - phpcs: - standard: vendor/spryker/code-sniffer/Spryker/ruleset.xml - phpcpd: - exclude: ['vendor', 'tests'] - codeception: ~ \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..6667eea --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,7 @@ +parameters: + level: 5 + reportUnmatchedIgnoredErrors: false + scanDirectories: + - src/Orm/Zed + ignoreErrors: + - '#.* on an unknown class Generated\\(Client|Glue|Service|Yves|Zed)\\.*#' diff --git a/src/FondOfSpryker/Client/Contentful/ContentfulClient.php b/src/FondOfSpryker/Client/Contentful/ContentfulClient.php index d5220cb..2680b42 100644 --- a/src/FondOfSpryker/Client/Contentful/ContentfulClient.php +++ b/src/FondOfSpryker/Client/Contentful/ContentfulClient.php @@ -37,7 +37,7 @@ public function getNavigationUrlBy(ContentfulNavigationUrlRequestTransfer $reque * @param string $url * @param string $localeName * - * @return string[]|null + * @return array|null */ public function matchUrl(string $url, string $localeName): ?array { diff --git a/src/FondOfSpryker/Client/Contentful/ContentfulClientInterface.php b/src/FondOfSpryker/Client/Contentful/ContentfulClientInterface.php index e762ee7..507d549 100644 --- a/src/FondOfSpryker/Client/Contentful/ContentfulClientInterface.php +++ b/src/FondOfSpryker/Client/Contentful/ContentfulClientInterface.php @@ -27,7 +27,7 @@ public function getNavigationUrlBy(ContentfulNavigationUrlRequestTransfer $reque * @param string $url * @param string $localeName * - * @return string[]|null + * @return array|null */ public function matchUrl(string $url, string $localeName): ?array; } diff --git a/src/FondOfSpryker/Client/Contentful/ContentfulDependencyProvider.php b/src/FondOfSpryker/Client/Contentful/ContentfulDependencyProvider.php index 9854d90..425e3fc 100644 --- a/src/FondOfSpryker/Client/Contentful/ContentfulDependencyProvider.php +++ b/src/FondOfSpryker/Client/Contentful/ContentfulDependencyProvider.php @@ -7,12 +7,24 @@ class ContentfulDependencyProvider extends AbstractDependencyProvider { + /** + * @var string + */ public const KV_STORAGE = 'KV_STORAGE'; + /** + * @var string + */ public const CLIENT_SEARCH = 'CLIENT_SEARCH'; + /** + * @var string + */ public const CONTENTFUL_SEARCH_QUERY_PLUGIN = 'CONTENTFUL_SEARCH_QUERY_PLUGIN'; + /** + * @var string + */ public const CONTENTFUL_SEARCH_QUERY_EXPANDER_PLUGINS = 'CONTENTFUL_SEARCH_QUERY_EXPANDER_PLUGINS'; /** diff --git a/src/FondOfSpryker/Client/Contentful/ContentfulFactory.php b/src/FondOfSpryker/Client/Contentful/ContentfulFactory.php index 7390984..d88500a 100644 --- a/src/FondOfSpryker/Client/Contentful/ContentfulFactory.php +++ b/src/FondOfSpryker/Client/Contentful/ContentfulFactory.php @@ -24,7 +24,7 @@ public function createContentfulEntryStorageReader(): ContentfulEntryStorageRead { return new ContentfulEntryStorageReader( $this->getStorage(), - $this->createEntryKeyBuilder() + $this->createEntryKeyBuilder(), ); } @@ -43,7 +43,7 @@ public function createContentfulNavigationStorageReader(): ContentfulNavigationS { return new ContentfulNavigationStorageReader( $this->getStorage(), - $this->createNavigationUrlKeyBuilder() + $this->createNavigationUrlKeyBuilder(), ); } diff --git a/src/FondOfSpryker/Client/Contentful/Matcher/UrlMatcher.php b/src/FondOfSpryker/Client/Contentful/Matcher/UrlMatcher.php index b691614..e42b283 100644 --- a/src/FondOfSpryker/Client/Contentful/Matcher/UrlMatcher.php +++ b/src/FondOfSpryker/Client/Contentful/Matcher/UrlMatcher.php @@ -31,7 +31,7 @@ public function __construct(KeyBuilderInterface $keyBuilder, StorageClientInterf * @param string $url * @param string $localeName * - * @return string[]|null + * @return array|null */ public function matchUrl(string $url, string $localeName): ?array { diff --git a/src/FondOfSpryker/Client/Contentful/Matcher/UrlMatcherInterface.php b/src/FondOfSpryker/Client/Contentful/Matcher/UrlMatcherInterface.php index 6c1f5eb..67f56af 100644 --- a/src/FondOfSpryker/Client/Contentful/Matcher/UrlMatcherInterface.php +++ b/src/FondOfSpryker/Client/Contentful/Matcher/UrlMatcherInterface.php @@ -8,7 +8,7 @@ interface UrlMatcherInterface * @param string $url * @param string $localeName * - * @return string[]|null + * @return array|null */ public function matchUrl(string $url, string $localeName): ?array; } diff --git a/src/FondOfSpryker/Client/Contentful/Plugin/Elasticsearch/Query/ContentfulSearchQueryPlugin.php b/src/FondOfSpryker/Client/Contentful/Plugin/Elasticsearch/Query/ContentfulSearchQueryPlugin.php index aea6476..1cbf48e 100644 --- a/src/FondOfSpryker/Client/Contentful/Plugin/Elasticsearch/Query/ContentfulSearchQueryPlugin.php +++ b/src/FondOfSpryker/Client/Contentful/Plugin/Elasticsearch/Query/ContentfulSearchQueryPlugin.php @@ -78,7 +78,7 @@ protected function createSearchQuery(): Query */ protected function addFulltextSearchToQuery(Query $baseQuery): Query { - if (!empty($this->searchString)) { + if ($this->searchString) { $matchQuery = $this->createFulltextSearchQuery($this->searchString); } else { $matchQuery = new MatchAll(); diff --git a/src/FondOfSpryker/Client/Contentful/Storage/ContentfulEntryStorageReader.php b/src/FondOfSpryker/Client/Contentful/Storage/ContentfulEntryStorageReader.php index 961cc43..b97115f 100644 --- a/src/FondOfSpryker/Client/Contentful/Storage/ContentfulEntryStorageReader.php +++ b/src/FondOfSpryker/Client/Contentful/Storage/ContentfulEntryStorageReader.php @@ -40,7 +40,7 @@ public function getEntryBy(ContentfulEntryRequestTransfer $request): ContentfulE $storageData = $this->storageClient->get($storageKey); $response = new ContentfulEntryResponseTransfer(); - if (empty($storageData)) { + if (!$storageData) { $response->setSuccessful(false); $response->setErrorMessage(sprintf('ContentfulEntry not found: "%s"', $storageKey)); diff --git a/src/FondOfSpryker/Client/Contentful/Storage/ContentfulNavigationStorageReader.php b/src/FondOfSpryker/Client/Contentful/Storage/ContentfulNavigationStorageReader.php index 68a55c3..ee8d174 100644 --- a/src/FondOfSpryker/Client/Contentful/Storage/ContentfulNavigationStorageReader.php +++ b/src/FondOfSpryker/Client/Contentful/Storage/ContentfulNavigationStorageReader.php @@ -40,7 +40,7 @@ public function getNavigationUrlBy(ContentfulNavigationUrlRequestTransfer $reque $storageData = $this->storageClient->get($storageKey); $response = new ContentfulNavigationUrlResponseTransfer(); - if (empty($storageData)) { + if (!$storageData) { $response->setSuccessful(false); $response->setErrorMessage(sprintf('Entry not found: "%s"', $storageKey)); diff --git a/src/FondOfSpryker/Shared/Contentful/Builder/Builder.php b/src/FondOfSpryker/Shared/Contentful/Builder/Builder.php index 57bce11..71f8aae 100644 --- a/src/FondOfSpryker/Shared/Contentful/Builder/Builder.php +++ b/src/FondOfSpryker/Shared/Contentful/Builder/Builder.php @@ -20,13 +20,13 @@ class Builder implements BuilderInterface protected $defaultRenderer; /** - * @var \FondOfSpryker\Shared\Contentful\Renderer\RendererInterface[] + * @var array<\FondOfSpryker\Shared\Contentful\Renderer\RendererInterface> */ protected $renderer; /** * @param \FondOfSpryker\Client\Contentful\ContentfulClientInterface $client - * @param \FondOfSpryker\Shared\Contentful\Renderer\RendererInterface[] $renderer + * @param array<\FondOfSpryker\Shared\Contentful\Renderer\RendererInterface> $renderer * @param \FondOfSpryker\Shared\Contentful\Renderer\RendererInterface $defaultRenderer */ public function __construct(ContentfulClientInterface $client, array $renderer, RendererInterface $defaultRenderer) @@ -39,7 +39,7 @@ public function __construct(ContentfulClientInterface $client, array $renderer, /** * @param string $entryId * @param string $locale - * @param string[] $additionalParameters + * @param array $additionalParameters * * @return string */ @@ -58,9 +58,9 @@ public function renderContentfulEntry(string $entryId, string $locale, array $ad * * @param string $entryId * @param string $locale - * @param string[] $options + * @param array $options * - * @return string[] + * @return array */ public function getContentfulEntry(string $entryId, string $locale, array $options = []): array { diff --git a/src/FondOfSpryker/Shared/Contentful/Builder/BuilderInterface.php b/src/FondOfSpryker/Shared/Contentful/Builder/BuilderInterface.php index 0a4f398..821759c 100644 --- a/src/FondOfSpryker/Shared/Contentful/Builder/BuilderInterface.php +++ b/src/FondOfSpryker/Shared/Contentful/Builder/BuilderInterface.php @@ -7,7 +7,7 @@ interface BuilderInterface /** * @param string $entryId * @param string $locale - * @param string[] $additionalParameters + * @param array $additionalParameters * * @return string */ @@ -16,9 +16,9 @@ public function renderContentfulEntry(string $entryId, string $locale, array $ad /** * @param string $entryId * @param string $locale - * @param string[] $options + * @param array $options * - * @return string[] + * @return array */ public function getContentfulEntry(string $entryId, string $locale, array $options = []): array; } diff --git a/src/FondOfSpryker/Shared/Contentful/ContentfulConstants.php b/src/FondOfSpryker/Shared/Contentful/ContentfulConstants.php index 5e039cc..e9e5bbe 100644 --- a/src/FondOfSpryker/Shared/Contentful/ContentfulConstants.php +++ b/src/FondOfSpryker/Shared/Contentful/ContentfulConstants.php @@ -4,27 +4,98 @@ interface ContentfulConstants { + /** + * @var string + */ public const CONTENTFUL_ACCESS_TOKEN = 'CONTENTFUL_ACCESS_TOKEN'; + + /** + * @var string + */ public const CONTENTFUL_SPACE_ID = 'CONTENTFUL_SPACE_ID'; + + /** + * @var string + */ public const CONTENTFUL_LOCALE_TO_STORE_LOCALE = 'CONTENTFUL_LOCALE_TO_STORE_LOCALE'; + + /** + * @var string + */ public const CONTENTFUL_DEFAULT_LOCALE = 'CONTENTFUL_DEFAULT_LOCALE'; + + /** + * @var string + */ public const CONTENTFUL_FIELD_NAME_ACTIVE = 'CONTENTFUL_FIELD_NAME_ACTIVE'; + + /** + * @var string + */ public const CONTENTFUL_FIELD_NAME_IDENTIFIER = 'CONTENTFUL_FIELD_NAME_IDENTIFIER'; + /** + * @var string + */ public const CONTENTFUL_SYNC_STORAGE_QUEUE = 'sync.storage.contentful'; + + /** + * @var string + */ public const CONTENTFUL_SYNC_STORAGE_QUEUE_ERROR = 'sync.storage.contentful.error'; + /** + * @var string + */ public const CONTENTFUL_SYNC_SEARCH_QUEUE = 'sync.search.contentful'; + + /** + * @var string + */ public const CONTENTFUL_SYNC_SEARCH_QUEUE_ERROR = 'sync.search.contentful.error'; + /** + * @var string + */ public const FIELD_BLOG_CATEGORIES = 'blog_categories'; + + /** + * @var string + */ public const FIELD_BLOG_TAGS = 'blog_tags'; + + /** + * @var string + */ public const FIELD_ENTRY_ID = 'entryId'; + + /** + * @var string + */ public const FIELD_TYPE = 'type'; + + /** + * @var string + */ public const FIELD_ID_CATEGORY = 'id_category'; + + /** + * @var string + */ public const FIELD_IS_ACTIVE = 'isActive'; + + /** + * @var string + */ public const FIELD_IDENTIFIER = 'identifier'; + /** + * @var string + */ public const ENTRY_TYPE_ID_PAGE = 'page'; + + /** + * @var string + */ public const ENTRY_TYPE_ID_PAGE_IDENTIFIER = 'page-identifier'; } diff --git a/src/FondOfSpryker/Shared/Contentful/Renderer/AbstractRenderer.php b/src/FondOfSpryker/Shared/Contentful/Renderer/AbstractRenderer.php index 1ac5832..78b9df0 100644 --- a/src/FondOfSpryker/Shared/Contentful/Renderer/AbstractRenderer.php +++ b/src/FondOfSpryker/Shared/Contentful/Renderer/AbstractRenderer.php @@ -38,15 +38,16 @@ public function render(ContentfulEntryResponseTransfer $response, array $additio if ($this->isEnvironmentProduction()) { return ''; } + throw $throwable; } } /** * @param \Generated\Shared\Transfer\ContentfulEntryResponseTransfer $response - * @param string[] $options + * @param array $options * - * @return string[] + * @return array */ public function getRawEntry(ContentfulEntryResponseTransfer $response, array $options = []): array { @@ -75,10 +76,10 @@ protected function isEntryActive(ContentfulEntryResponseTransfer $response): boo /** * @param \Generated\Shared\Transfer\ContentfulEntryResponseTransfer $response - * @param string[] $placeholders - * @param string[] $additionalPlaceholders + * @param array $placeholders + * @param array $additionalPlaceholders * - * @return string[] + * @return array */ protected function mergeAdditionalPlaceholders(ContentfulEntryResponseTransfer $response, array $placeholders, array $additionalPlaceholders) { @@ -87,7 +88,7 @@ protected function mergeAdditionalPlaceholders(ContentfulEntryResponseTransfer $ /** * @param \Generated\Shared\Transfer\ContentfulEntryResponseTransfer $response - * @param string[] $additionalPlaceholders + * @param array $additionalPlaceholders * * @return bool */ @@ -98,7 +99,7 @@ protected function isResponseSuccessful(ContentfulEntryResponseTransfer $respons /** * @param \Generated\Shared\Transfer\ContentfulEntryResponseTransfer $response - * @param string[] $additionalPlaceholders + * @param array $additionalPlaceholders * * @return string */ @@ -128,9 +129,9 @@ abstract protected function getTemplatePath(ContentfulEntryResponseTransfer $res /** * @param \Generated\Shared\Transfer\ContentfulEntryResponseTransfer $response - * @param string[] $additionalPlaceholders + * @param array $additionalPlaceholders * - * @return string[] + * @return array */ abstract protected function getPlaceholders(ContentfulEntryResponseTransfer $response, array $additionalPlaceholders = []): array; } diff --git a/src/FondOfSpryker/Shared/Contentful/Renderer/DefaultRenderer.php b/src/FondOfSpryker/Shared/Contentful/Renderer/DefaultRenderer.php index dd35ff2..349ad6d 100644 --- a/src/FondOfSpryker/Shared/Contentful/Renderer/DefaultRenderer.php +++ b/src/FondOfSpryker/Shared/Contentful/Renderer/DefaultRenderer.php @@ -6,6 +6,9 @@ class DefaultRenderer extends AbstractYvesRenderer { + /** + * @var string + */ protected const RENDERER_TYPE_DEFAULT = 'defaultRenderer'; /** @@ -18,9 +21,9 @@ public function getType(): string /** * @param \Generated\Shared\Transfer\ContentfulEntryResponseTransfer $response - * @param string[] $additionalPlaceholders + * @param array $additionalPlaceholders * - * @return string[] + * @return array */ protected function getPlaceholders(ContentfulEntryResponseTransfer $response, array $additionalPlaceholders = []): array { diff --git a/src/FondOfSpryker/Shared/Contentful/Renderer/RendererInterface.php b/src/FondOfSpryker/Shared/Contentful/Renderer/RendererInterface.php index b91661f..32a986d 100644 --- a/src/FondOfSpryker/Shared/Contentful/Renderer/RendererInterface.php +++ b/src/FondOfSpryker/Shared/Contentful/Renderer/RendererInterface.php @@ -13,7 +13,7 @@ public function getType(): string; /** * @param \Generated\Shared\Transfer\ContentfulEntryResponseTransfer $response - * @param string[] $additionalParameters + * @param array $additionalParameters * * @return string */ @@ -21,9 +21,9 @@ public function render(ContentfulEntryResponseTransfer $response, array $additio /** * @param \Generated\Shared\Transfer\ContentfulEntryResponseTransfer $response - * @param string[] $options + * @param array $options * - * @return string[] + * @return array */ public function getRawEntry(ContentfulEntryResponseTransfer $response, array $options = []): array; } diff --git a/src/FondOfSpryker/Shared/Contentful/Renderer/ZedRenderer.php b/src/FondOfSpryker/Shared/Contentful/Renderer/ZedRenderer.php index 9660f88..d91a64e 100644 --- a/src/FondOfSpryker/Shared/Contentful/Renderer/ZedRenderer.php +++ b/src/FondOfSpryker/Shared/Contentful/Renderer/ZedRenderer.php @@ -6,6 +6,9 @@ class ZedRenderer extends AbstractZedRenderer { + /** + * @var string + */ protected const RENDERER_TYPE_DEFAULT = 'defaultRenderer'; /** @@ -18,9 +21,9 @@ public function getType(): string /** * @param \Generated\Shared\Transfer\ContentfulEntryResponseTransfer $response - * @param string[] $additionalPlaceholders + * @param array $additionalPlaceholders * - * @return string[] + * @return array */ protected function getPlaceholders(ContentfulEntryResponseTransfer $response, array $additionalPlaceholders = []): array { diff --git a/src/FondOfSpryker/Shared/Contentful/Twig/ContentfulTwigExtension.php b/src/FondOfSpryker/Shared/Contentful/Twig/ContentfulTwigExtension.php index bd1d563..6da4b87 100644 --- a/src/FondOfSpryker/Shared/Contentful/Twig/ContentfulTwigExtension.php +++ b/src/FondOfSpryker/Shared/Contentful/Twig/ContentfulTwigExtension.php @@ -10,10 +10,13 @@ class ContentfulTwigExtension extends TwigExtension { - private const IMAGE_MAX_WIDTH = 2000; + /** + * @var int + */ + protected const IMAGE_MAX_WIDTH = 2000; /** - * @var \FondOfSpryker\Shared\Contentful\Builder\BuilderInterface + * @var \FondOfSpryker\Shared\Contentful\Builder\BuilderInterface */ private $builder; @@ -49,12 +52,13 @@ public function getFunctions() new Twig_SimpleFunction('contentfulEntry', [$this, 'renderContentfulEntry'], ['is_safe' => ['html']]), new Twig_SimpleFunction('contentfulImage', [$this, 'resizeContentfulImage']), new Twig_SimpleFunction('getContentfulEntry', [$this, 'getContentfulEntry']), + new Twig_SimpleFunction('getContentfulEntryRecursive', [$this, 'getContentfulEntryRecursive']), ]; } /** * @param string $entryId - * @param string[] $additionalParameters + * @param array $additionalParameters * @param string|null $locale * * @return string @@ -66,10 +70,10 @@ public function renderContentfulEntry(string $entryId, array $additionalParamete /** * @param string $entryId - * @param string[] $options + * @param array $options * @param string|null $locale * - * @return string[] + * @return array */ public function getContentfulEntry(string $entryId, array $options = [], ?string $locale = null): array { @@ -86,7 +90,7 @@ public function formatContentfulUrl(string $url, ?string $locale = null): string { return $this->urlFormatter->format( $url, - $this->getLocaleRoutePrefixesByAppLocale($locale ?? $this->currentLocale) + $this->getLocaleRoutePrefixesByAppLocale($locale ?? $this->currentLocale), ); } @@ -99,7 +103,7 @@ public function formatContentfulUrl(string $url, ?string $locale = null): string */ public function resizeContentfulImage($url, ?int $width = null, ?int $height = null): string { - if (empty($url)) { + if (!$url) { return ''; } @@ -134,7 +138,7 @@ protected function getLocaleRoutePrefixesByAppLocale(string $appLocale, string $ $storeLocaleRoutePrefixes[] = $storeRouteLocalePrefix; } - if (empty($storeLocaleRoutePrefixes)) { + if (!$storeLocaleRoutePrefixes) { return $fallbackRouteLocale; } diff --git a/src/FondOfSpryker/Shared/Contentful/Url/UrlFormatter.php b/src/FondOfSpryker/Shared/Contentful/Url/UrlFormatter.php index 60f4eb2..0c04c5b 100644 --- a/src/FondOfSpryker/Shared/Contentful/Url/UrlFormatter.php +++ b/src/FondOfSpryker/Shared/Contentful/Url/UrlFormatter.php @@ -12,7 +12,7 @@ class UrlFormatter implements UrlFormatterInterface private $storeClient; /** - * @var string[] + * @var array */ private $availableLocaleIsoCodesForCurrentStore; @@ -79,7 +79,7 @@ protected function normalizeLocaleForPath(string $locale): string */ protected function canIFormat(string $url): bool { - if (empty($url)) { + if (!$url) { return false; } @@ -193,7 +193,7 @@ protected function isLocaleAvailableInCurrentStore(string $locale): bool /** * @param string $path * - * @return string[] + * @return array */ protected function tokenize(string $path): array { diff --git a/src/FondOfSpryker/Yves/Contentful/ContentfulDependencyProvider.php b/src/FondOfSpryker/Yves/Contentful/ContentfulDependencyProvider.php index 73ac52b..f765743 100644 --- a/src/FondOfSpryker/Yves/Contentful/ContentfulDependencyProvider.php +++ b/src/FondOfSpryker/Yves/Contentful/ContentfulDependencyProvider.php @@ -13,16 +13,41 @@ class ContentfulDependencyProvider extends AbstractBundleDependencyProvider { + /** + * @var string + */ public const TWIG_MARKDOWN = 'TWIG_MARKDOWN'; + + /** + * @var string + */ public const CATEGORY_STORAGE_CLIENT = 'CATEGORY_STORAGE_CLIENT'; + + /** + * @var string + */ public const CLIENT_STORE = 'CLIENT_STORE'; + + /** + * @var string + */ public const SEARCH_CLIENT = 'SEARCH_CLIENT'; + + /** + * @var string + */ public const SERVICE_LOCALE = 'locale'; + + /** + * @var string + */ public const CLIENT_CONTENFUL_PAGE_SEARCH = 'CLIENT_CONTENFUL_PAGE_SEARCH'; + /** * @var string */ public const SERVICE_REQUEST_STACK = 'request_stack'; + /** * @var string */ @@ -146,7 +171,7 @@ protected function getSearchClient(Container $container): Container { $container[static::SEARCH_CLIENT] = function (Container $container) { return new ContentfulToSearchClientBridge( - $container->getLocator()->search()->client() + $container->getLocator()->search()->client(), ); }; @@ -162,7 +187,7 @@ protected function addContentfulPageSearchClient(Container $container): Containe { $container[static::CLIENT_CONTENFUL_PAGE_SEARCH] = function (Container $container) { return new ContentfulToContentfulPageSearchClientBridge( - $container->getLocator()->contentfulPageSearch()->client() + $container->getLocator()->contentfulPageSearch()->client(), ); }; diff --git a/src/FondOfSpryker/Yves/Contentful/ContentfulFactory.php b/src/FondOfSpryker/Yves/Contentful/ContentfulFactory.php index db79a3c..1cf1a12 100644 --- a/src/FondOfSpryker/Yves/Contentful/ContentfulFactory.php +++ b/src/FondOfSpryker/Yves/Contentful/ContentfulFactory.php @@ -3,7 +3,6 @@ namespace FondOfSpryker\Yves\Contentful; use Aptoma\Twig\Extension\MarkdownExtension; -use FondOfSpryker\Yves\Contentful\Dependency\Renderer\ContentfulToRendererInterface; use FondOfSpryker\Shared\Contentful\Builder\Builder; use FondOfSpryker\Shared\Contentful\Builder\BuilderInterface; use FondOfSpryker\Shared\Contentful\Renderer\DefaultRenderer; @@ -12,6 +11,7 @@ use FondOfSpryker\Shared\Contentful\Url\UrlFormatter; use FondOfSpryker\Shared\Contentful\Url\UrlFormatterInterface; use FondOfSpryker\Yves\Contentful\Dependency\Client\ContentfulToContentfulPageSearchClientInterface; +use FondOfSpryker\Yves\Contentful\Dependency\Renderer\ContentfulToRendererInterface; use FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\Category\NavigationItemCategoryMapper; use FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\ContentfulPage\NavigationItemContentfulPageMapper; use FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\Custom\NavigationItemCustomMapper; @@ -34,7 +34,6 @@ use Spryker\Client\CategoryStorage\CategoryStorageClientInterface; use Spryker\Client\Search\SearchClientInterface; use Spryker\Client\Store\StoreClientInterface; -use Spryker\Shared\Kernel\Communication\Application; use Spryker\Yves\Kernel\AbstractFactory; use Symfony\Component\HttpFoundation\RequestStack; @@ -53,7 +52,6 @@ public function getContentfulPageSearchClient(): ContentfulToContentfulPageSearc /** * @return \FondOfSpryker\Yves\Contentful\Dependency\Renderer\ContentfulToRendererInterface - * @throws \Spryker\Yves\Kernel\Exception\Container\ContainerKeyNotFoundException */ public function getTwigRenderer(): ContentfulToRendererInterface { @@ -93,7 +91,7 @@ public function createBuilder(): BuilderInterface } /** - * @return \FondOfSpryker\Shared\Contentful\Renderer\RendererInterface[] + * @return array<\FondOfSpryker\Shared\Contentful\Renderer\RendererInterface> */ protected function getRenderer(): array { @@ -133,7 +131,7 @@ protected function createNavigationItemFactory(): NavigationItemFactoryInterface } /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemMapperInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemMapperInterface> */ protected function createNavigationItemMapper(): array { @@ -193,7 +191,7 @@ protected function createNavigationNodeCollection(): NavigationNodeCollectionInt } /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeMapperInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeMapperInterface> */ protected function createNavigationNodeMapper(): array { diff --git a/src/FondOfSpryker/Yves/Contentful/Controller/BlogController.php b/src/FondOfSpryker/Yves/Contentful/Controller/BlogController.php index 76db890..cf44172 100644 --- a/src/FondOfSpryker/Yves/Contentful/Controller/BlogController.php +++ b/src/FondOfSpryker/Yves/Contentful/Controller/BlogController.php @@ -38,7 +38,7 @@ public function categoryAction(Request $request, string $entryId): Response 'blogPosts' => $searchResults['results'], 'pagination' => $searchResults['pagination'], 'paginationPath' => $request->getPathInfo(), - ] + ], )); } @@ -72,7 +72,7 @@ public function homeAction(Request $request, string $entryId): Response 'blogPosts' => $searchResults['results'], 'pagination' => $searchResults['pagination'], 'paginationPath' => $request->getPathInfo(), - ] + ], )); } @@ -102,7 +102,7 @@ public function tagAction(Request $request, string $entryId): Response 'blogPosts' => $searchResults['results'], 'pagination' => $searchResults['pagination'], 'paginationPath' => $request->getPathInfo(), - ] + ], )); } } diff --git a/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToContentfulPageSearchClientBridge.php b/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToContentfulPageSearchClientBridge.php index 69452e4..b80297d 100644 --- a/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToContentfulPageSearchClientBridge.php +++ b/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToContentfulPageSearchClientBridge.php @@ -23,7 +23,7 @@ public function __construct(ContentfulPageSearchClientInterface $contentfulPageS * @param string $searchString * @param array $requestParameters * - * @return array|\Elastica\ResultSet + * @return \Elastica\ResultSet|array */ public function contentfulBlogCategorySearch(string $searchString, array $requestParameters) { diff --git a/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToContentfulPageSearchClientInterface.php b/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToContentfulPageSearchClientInterface.php index 61244fe..3f95285 100644 --- a/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToContentfulPageSearchClientInterface.php +++ b/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToContentfulPageSearchClientInterface.php @@ -8,7 +8,7 @@ interface ContentfulToContentfulPageSearchClientInterface * @param string $searchString * @param array $requestParameters * - * @return array|\Elastica\ResultSet + * @return \Elastica\ResultSet|array */ public function contentfulBlogCategorySearch(string $searchString, array $requestParameters); @@ -24,7 +24,7 @@ public function contentfulBlogTagSearch(string $searchString, array $requestPara * @param string $searchString * @param array $requestParameters * - * @return array|\Elastica\ResultSet + * @return \Elastica\ResultSet|array */ public function contentfulCategoryNodeSearch(string $searchString, array $requestParameters); } diff --git a/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToSearchClientBridge.php b/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToSearchClientBridge.php index dbf52e1..c3470f4 100644 --- a/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToSearchClientBridge.php +++ b/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToSearchClientBridge.php @@ -25,7 +25,7 @@ public function __construct(SearchClientInterface $searchClient) * @param array $resultFormatters * @param array $requestParameters * - * @return array|\Elastica\ResultSet + * @return \Elastica\ResultSet|array */ public function search(QueryInterface $searchQuery, array $resultFormatters = [], array $requestParameters = []) { diff --git a/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToSearchClientInterface.php b/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToSearchClientInterface.php index 8595258..1c9b247 100644 --- a/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToSearchClientInterface.php +++ b/src/FondOfSpryker/Yves/Contentful/Dependency/Client/ContentfulToSearchClientInterface.php @@ -11,7 +11,7 @@ interface ContentfulToSearchClientInterface * @param array $resultFormatters * @param array $requestParameters * - * @return array|\Elastica\ResultSet + * @return \Elastica\ResultSet|array */ public function search(QueryInterface $searchQuery, array $resultFormatters = [], array $requestParameters = []); } diff --git a/src/FondOfSpryker/Yves/Contentful/Dependency/Renderer/ContentfulToRendererBridge.php b/src/FondOfSpryker/Yves/Contentful/Dependency/Renderer/ContentfulToRendererBridge.php index 7ea46d0..d4d6f23 100644 --- a/src/FondOfSpryker/Yves/Contentful/Dependency/Renderer/ContentfulToRendererBridge.php +++ b/src/FondOfSpryker/Yves/Contentful/Dependency/Renderer/ContentfulToRendererBridge.php @@ -2,8 +2,6 @@ namespace FondOfSpryker\Yves\Contentful\Dependency\Renderer; -use Generated\Shared\Transfer\LocaleTransfer; -use Spryker\Zed\Glossary\Communication\Plugin\TwigTranslatorPlugin; use Twig\Environment; class ContentfulToRendererBridge implements ContentfulToRendererInterface @@ -31,26 +29,4 @@ public function render(string $template, array $options): string { return $this->twigEnvironment->render($template, $options); } - - /** - * @param \Generated\Shared\Transfer\LocaleTransfer $localeTransfer - * - * @return void - */ - public function setLocaleTransfer(LocaleTransfer $localeTransfer): void - { - $translator = $this->getTranslator(); - $translator->setLocaleTransfer($localeTransfer); - } - - /** - * @return \Spryker\Zed\Glossary\Communication\Plugin\TwigTranslatorPlugin - */ - protected function getTranslator(): TwigTranslatorPlugin - { - /** @var \Spryker\Zed\Glossary\Communication\Plugin\TwigTranslatorPlugin $translator */ - $translator = $this->twigEnvironment->getExtension(TwigTranslatorPlugin::class); - - return $translator; - } } diff --git a/src/FondOfSpryker/Yves/Contentful/Dependency/Renderer/ContentfulToRendererInterface.php b/src/FondOfSpryker/Yves/Contentful/Dependency/Renderer/ContentfulToRendererInterface.php index 20b3ec5..d6d8d88 100644 --- a/src/FondOfSpryker/Yves/Contentful/Dependency/Renderer/ContentfulToRendererInterface.php +++ b/src/FondOfSpryker/Yves/Contentful/Dependency/Renderer/ContentfulToRendererInterface.php @@ -2,8 +2,6 @@ namespace FondOfSpryker\Yves\Contentful\Dependency\Renderer; -use Generated\Shared\Transfer\LocaleTransfer; - interface ContentfulToRendererInterface { /** @@ -13,11 +11,4 @@ interface ContentfulToRendererInterface * @return string */ public function render(string $template, array $options): string; - - /** - * @param \Generated\Shared\Transfer\LocaleTransfer $localeTransfer - * - * @return void - */ - public function setLocaleTransfer(LocaleTransfer $localeTransfer): void; } diff --git a/src/FondOfSpryker/Yves/Contentful/Plugin/ContentfulTwigServiceProvider.php b/src/FondOfSpryker/Yves/Contentful/Plugin/ContentfulTwigServiceProvider.php index 4784979..6ee56a5 100644 --- a/src/FondOfSpryker/Yves/Contentful/Plugin/ContentfulTwigServiceProvider.php +++ b/src/FondOfSpryker/Yves/Contentful/Plugin/ContentfulTwigServiceProvider.php @@ -27,7 +27,7 @@ public function register(Application $app): void $twig->addExtension($factory->getMarkdownTwigExtension()); return $twig; - }) + }), ); } diff --git a/src/FondOfSpryker/Yves/Contentful/Plugin/Twig/ContentfulTwigPlugin.php b/src/FondOfSpryker/Yves/Contentful/Plugin/Twig/ContentfulTwigPlugin.php index 68544bd..3685729 100644 --- a/src/FondOfSpryker/Yves/Contentful/Plugin/Twig/ContentfulTwigPlugin.php +++ b/src/FondOfSpryker/Yves/Contentful/Plugin/Twig/ContentfulTwigPlugin.php @@ -13,11 +13,31 @@ */ class ContentfulTwigPlugin extends AbstractPlugin implements TwigPluginInterface { + /** + * @var string + */ protected const TWIG_FUNCTION_CONTENTFUL_ENTRY = 'contentfulEntry'; + + /** + * @var string + */ protected const TWIG_FUNCTION_CONTENTFUL_URL = 'contentfulUrl'; + + /** + * @var string + */ protected const TWIG_FUNCTION_CONTENTFUL_IMAGE = 'contentfulImage'; + + /** + * @var string + */ protected const TWIG_FUNCTION_GET_CONTENTFUL_ENTRY = 'getContentfulEntry'; + /** + * @var string + */ + protected const TWIG_FUNCTION_GET_CONTENTFUL_ENTRY_RECURSIVE = 'getContentfulEntryRecursive'; + /** * {@inheritDoc} * @@ -48,6 +68,7 @@ protected function addTwigFunctions(Environment $twig): Environment $twig->addFunction($this->createContentfulUrlFunction($twig)); $twig->addFunction($this->createContentfulImageFunction($twig)); $twig->addFunction($this->createGetContentfulEntryFunction($twig)); + $twig->addFunction($this->createGetContentfulEntryRecursiveFunction($twig)); return $twig; } @@ -92,7 +113,7 @@ function (string $entryId, array $additionalParameters = [], ?string $locale = n }, [ 'is_safe' => ['html'], - ] + ], ); } @@ -123,7 +144,7 @@ function ($url, ?int $width = null, ?int $height = null) { return $this ->getFactory() ->createContentfulTwigExtension()->resizeContentfulImage($url, $width, $height); - } + }, ); } diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Category/NavigationItemCategory.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Category/NavigationItemCategory.php index 1c56610..eb6b8f8 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Category/NavigationItemCategory.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Category/NavigationItemCategory.php @@ -12,7 +12,7 @@ class NavigationItemCategory implements NavigationItemInterface protected $categoryId; /** - * @var \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface[] + * @var array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface> */ protected $children = []; @@ -40,7 +40,7 @@ public function getType(): string } /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface> */ public function getChildren(): array { diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Category/NavigationItemCategoryMapper.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Category/NavigationItemCategoryMapper.php index 3ef1bb3..18c57cd 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Category/NavigationItemCategoryMapper.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Category/NavigationItemCategoryMapper.php @@ -7,8 +7,19 @@ class NavigationItemCategoryMapper implements NavigationItemMapperInterface { + /** + * @var string + */ public const TYPE = 'category'; + + /** + * @var string + */ private const KEY_CATEGORY_ID = 'typeId'; + + /** + * @var string + */ private const KEY_CUSTOM_TEXT = 'customText'; /** @@ -20,7 +31,7 @@ public function getType(): string } /** - * @param string[] $navigation + * @param array $navigation * * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface */ @@ -37,7 +48,7 @@ public function createNavigationItem(array $navigation): NavigationItemInterface } /** - * @param string[] $navigation + * @param array $navigation * * @return bool */ diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/ContentfulPage/NavigationItemContentfulPage.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/ContentfulPage/NavigationItemContentfulPage.php index 03d8f86..1c9f1ce 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/ContentfulPage/NavigationItemContentfulPage.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/ContentfulPage/NavigationItemContentfulPage.php @@ -17,7 +17,7 @@ class NavigationItemContentfulPage implements NavigationItemInterface protected $customText; /** - * @var \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface[] + * @var array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface> */ protected $children = []; @@ -38,7 +38,7 @@ public function getType(): string } /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface> */ public function getChildren(): array { diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/ContentfulPage/NavigationItemContentfulPageMapper.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/ContentfulPage/NavigationItemContentfulPageMapper.php index dc05315..c896d11 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/ContentfulPage/NavigationItemContentfulPageMapper.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/ContentfulPage/NavigationItemContentfulPageMapper.php @@ -7,8 +7,19 @@ class NavigationItemContentfulPageMapper implements NavigationItemMapperInterface { + /** + * @var string + */ public const TYPE = 'page'; + + /** + * @var string + */ private const KEY_CONTENTFUL_ENTRY_ID = 'typeId'; + + /** + * @var string + */ private const KEY_CUSTOM_TEXT = 'customText'; /** @@ -20,7 +31,7 @@ public function getType(): string } /** - * @param string[] $navigation + * @param array $navigation * * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface */ @@ -38,7 +49,7 @@ public function createNavigationItem(array $navigation): NavigationItemInterface } /** - * @param string[] $navigation + * @param array $navigation * * @return bool */ diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Custom/NavigationItemCustom.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Custom/NavigationItemCustom.php index 26739c8..d5d3fb8 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Custom/NavigationItemCustom.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Custom/NavigationItemCustom.php @@ -17,7 +17,7 @@ class NavigationItemCustom implements NavigationItemInterface protected $customText; /** - * @var \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface[] + * @var array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface> */ private $children = []; @@ -40,7 +40,7 @@ public function getType(): string } /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface> */ public function getChildren(): array { diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Custom/NavigationItemCustomMapper.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Custom/NavigationItemCustomMapper.php index b7999a2..f3830fa 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Custom/NavigationItemCustomMapper.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/Custom/NavigationItemCustomMapper.php @@ -7,8 +7,19 @@ class NavigationItemCustomMapper implements NavigationItemMapperInterface { + /** + * @var string + */ public const TYPE = 'custom'; + + /** + * @var string + */ private const KEY_URL = 'url'; + + /** + * @var string + */ private const KEY_CUSTOM_TEXT = 'customText'; /** @@ -20,7 +31,7 @@ public function getType(): string } /** - * @param string[] $navigation + * @param array $navigation * * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface */ @@ -33,7 +44,7 @@ public function createNavigationItem(array $navigation): NavigationItemInterface } /** - * @param string[] $navigation + * @param array $navigation * * @return bool */ diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemCollection.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemCollection.php index e06f1a1..4585f9f 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemCollection.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemCollection.php @@ -5,12 +5,12 @@ class NavigationItemCollection implements NavigationItemCollectionInterface { /** - * @var \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface[] + * @var array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface> */ private $items = []; /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface> */ public function getItems(): array { diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemCollectionInterface.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemCollectionInterface.php index 96e5736..9f371c4 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemCollectionInterface.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemCollectionInterface.php @@ -5,7 +5,7 @@ interface NavigationItemCollectionInterface { /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface> */ public function getItems(): array; diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemFactory.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemFactory.php index f3af6f7..d934190 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemFactory.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemFactory.php @@ -4,22 +4,29 @@ class NavigationItemFactory implements NavigationItemFactoryInterface { - private const KEY_CHILDREN = 'children'; - private const KEY_TYPE = 'type'; + /** + * @var string + */ + protected const KEY_CHILDREN = 'children'; + + /** + * @var string + */ + protected const KEY_TYPE = 'type'; /** - * @var \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemMapperInterface[] + * @var array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemMapperInterface> */ private $mapper; /** - * @var \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemCollectionInterface + * @var \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemCollectionInterface */ private $collection; /** * @param \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemCollectionInterface $collection - * @param \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemMapperInterface[] $mapper + * @param array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemMapperInterface> $mapper */ public function __construct(NavigationItemCollectionInterface $collection, array $mapper) { @@ -28,7 +35,7 @@ public function __construct(NavigationItemCollectionInterface $collection, array } /** - * @param string[] $navigation + * @param array<> $navigation * * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemCollectionInterface */ @@ -49,7 +56,7 @@ public function build(array $navigation): NavigationItemCollectionInterface } /** - * @param string[] $navigation + * @param array $navigation * * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface|null */ @@ -93,7 +100,7 @@ private function createNavigationItemRecursive(array $navigation): ?NavigationIt } /** - * @param string[] $navigation + * @param array $navigation * * @return bool */ @@ -103,7 +110,7 @@ protected function hasType(array $navigation): bool } /** - * @param string[] $navigation + * @param array $navigation * * @return string */ @@ -113,7 +120,7 @@ protected function getType(array $navigation): string } /** - * @param string[] $navigation + * @param array $navigation * * @return bool */ @@ -125,9 +132,9 @@ protected function hasChildren(array $navigation): bool } /** - * @param string[] $navigation + * @param array $navigation * - * @return string[] + * @return array */ protected function getChildren(array $navigation): array { diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemFactoryInterface.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemFactoryInterface.php index 6c9f87e..bf688b1 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemFactoryInterface.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemFactoryInterface.php @@ -5,7 +5,7 @@ interface NavigationItemFactoryInterface { /** - * @param string[] $navigationItemsArray + * @param array $navigationItemsArray * * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemCollectionInterface */ diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemInterface.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemInterface.php index bde6a23..8e457a8 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemInterface.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemInterface.php @@ -10,7 +10,7 @@ interface NavigationItemInterface public function getType(): string; /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface> */ public function getChildren(): array; diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemMapperInterface.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemMapperInterface.php index 4909e0e..13a500b 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemMapperInterface.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Item/NavigationItemMapperInterface.php @@ -10,14 +10,14 @@ interface NavigationItemMapperInterface public function getType(): string; /** - * @param string[] $navigation + * @param array $navigation * * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface */ public function createNavigationItem(array $navigation): NavigationItemInterface; /** - * @param string[] $navigation + * @param array $navigation * * @return bool */ diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/NavigationMapper.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/NavigationMapper.php index 7f711ae..3c46d7b 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/NavigationMapper.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/NavigationMapper.php @@ -9,6 +9,9 @@ class NavigationMapper implements NavigationMapperInterface { + /** + * @var string + */ private const FIELD_NAME_JSON_NAVIGATION = 'items'; /** @@ -45,9 +48,9 @@ public function build(ContentfulEntryResponseTransfer $response): NavigationNode } /** - * @param string[] $fields + * @param array $fields * - * @return string[] + * @return array */ protected function extractNavigationJsonArray(array $fields): array { diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/NavigationRenderer.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/NavigationRenderer.php index 2929ae1..42a940a 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/NavigationRenderer.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/NavigationRenderer.php @@ -8,6 +8,9 @@ class NavigationRenderer extends AbstractYvesRenderer { + /** + * @var string + */ protected const RENDERER_TYPE = 'Navigation'; /** @@ -45,9 +48,9 @@ protected function getTemplatePath(ContentfulEntryResponseTransfer $response): s /** * @param \Generated\Shared\Transfer\ContentfulEntryResponseTransfer $response - * @param string[] $additionalPlaceholders + * @param array $additionalPlaceholders * - * @return string[] + * @return array */ protected function getPlaceholders(ContentfulEntryResponseTransfer $response, array $additionalPlaceholders = []): array { diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/Category/NavigationNodeCategoryMapper.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/Category/NavigationNodeCategoryMapper.php index 2375cb4..55f0d39 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/Category/NavigationNodeCategoryMapper.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/Category/NavigationNodeCategoryMapper.php @@ -104,7 +104,7 @@ public function isNavigationItemValid(NavigationItemInterface $item): bool } /** - * @param \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\Category\NavigationItemCategory $item + * @param \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\Category\NavigationItemCategory $item * * @return \Generated\Shared\Transfer\CategoryNodeStorageTransfer */ diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/ContentfulPage/NavigationNodeContentfulPageMapper.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/ContentfulPage/NavigationNodeContentfulPageMapper.php index 4a126fa..e011035 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/ContentfulPage/NavigationNodeContentfulPageMapper.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/ContentfulPage/NavigationNodeContentfulPageMapper.php @@ -87,7 +87,7 @@ public function isNavigationItemValid(NavigationItemInterface $item): bool protected function getContentfulNavigationUrlByEntryId(NavigationItemContentfulPage $item): ContentfulNavigationUrlResponseTransfer { $request = $this->createContentfulNavigationUrlRequest($item->getEntryId()); - + return $this->getContentfulNavigationUrlBy($request); } diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNode.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNode.php index cefaf74..dab78e1 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNode.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNode.php @@ -5,7 +5,7 @@ class NavigationNode implements NavigationNodeInterface { /** - * @var \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface[] + * @var array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface> */ private $children = []; @@ -67,7 +67,7 @@ public function addChild(NavigationNodeInterface $node): void } /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface> */ public function getChildren(): array { diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeCollection.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeCollection.php index 4f74c01..fbdcd4e 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeCollection.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeCollection.php @@ -5,12 +5,12 @@ class NavigationNodeCollection implements NavigationNodeCollectionInterface { /** - * @var \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface[] + * @var array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface> */ private $nodes = []; /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface> */ public function getNodes(): array { diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeCollectionInterface.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeCollectionInterface.php index 3478056..1e2f20d 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeCollectionInterface.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeCollectionInterface.php @@ -5,7 +5,7 @@ interface NavigationNodeCollectionInterface { /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface> */ public function getNodes(): array; diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeFactory.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeFactory.php index a95c4f1..3bdba12 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeFactory.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeFactory.php @@ -2,10 +2,8 @@ namespace FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node; -use FondOfSpryker\Yves\Contentful\Dependency\Renderer\ContentfulToRendererInterface; use FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemCollectionInterface; use FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface; -use Spryker\Shared\Kernel\Communication\Application; use Symfony\Component\HttpFoundation\RequestStack; class NavigationNodeFactory implements NavigationNodeFactoryInterface @@ -21,7 +19,7 @@ class NavigationNodeFactory implements NavigationNodeFactoryInterface private $collection; /** - * @var \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeMapperInterface[] + * @var array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeMapperInterface> */ private $mapper; diff --git a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeInterface.php b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeInterface.php index c983e2f..f720892 100644 --- a/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeInterface.php +++ b/src/FondOfSpryker/Yves/Contentful/Renderer/Navigation/Node/NavigationNodeInterface.php @@ -17,7 +17,7 @@ public function getType(): string; public function addChild(NavigationNodeInterface $node): void; /** - * @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface[] + * @return array<\FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeInterface> */ public function getChildren(): array; diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Client/ContentfulMapper.php b/src/FondOfSpryker/Zed/Contentful/Business/Client/ContentfulMapper.php index 1f603a3..1bb1ceb 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Client/ContentfulMapper.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Client/ContentfulMapper.php @@ -78,7 +78,7 @@ public function createContentfulEntry(Entry $entry): ContentfulEntryInterface /** * @param \Contentful\Delivery\Resource\Entry $entry * - * @return \FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface> */ protected function createContentfulFields(Entry $entry): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntry.php b/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntry.php index e9d6fb6..38d15c4 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntry.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntry.php @@ -13,7 +13,7 @@ class ContentfulEntry implements ContentfulEntryInterface private $entry; /** - * @var \FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface[] + * @var array<\FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface> */ private $fields = []; @@ -52,7 +52,7 @@ public function getContentTypeId(): string } /** - * @param \FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface[] $fields + * @param array<\FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface> $fields * * @return void */ @@ -62,7 +62,7 @@ public function setFields(array $fields): void } /** - * @return \FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface> */ public function getFields(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryCollection.php b/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryCollection.php index bcc4608..9f13064 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryCollection.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryCollection.php @@ -5,7 +5,7 @@ class ContentfulEntryCollection implements ContentfulEntryCollectionInterface { /** - * @var \FondOfSpryker\Zed\Contentful\Business\Client\Entry\ContentfulEntryInterface[] + * @var array<\FondOfSpryker\Zed\Contentful\Business\Client\Entry\ContentfulEntryInterface> */ private $entries; @@ -15,7 +15,7 @@ public function __construct() } /** - * @return \FondOfSpryker\Zed\Contentful\Business\Client\Entry\ContentfulEntryInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Client\Entry\ContentfulEntryInterface> */ public function getAll(): array { @@ -23,7 +23,7 @@ public function getAll(): array } /** - * @param \FondOfSpryker\Zed\Contentful\Business\Client\Entry\ContentfulEntryInterface[] $contentfulEntries + * @param array<\FondOfSpryker\Zed\Contentful\Business\Client\Entry\ContentfulEntryInterface> $contentfulEntries * * @return void */ diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryCollectionInterface.php b/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryCollectionInterface.php index 6aecb76..bc09f3c 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryCollectionInterface.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryCollectionInterface.php @@ -5,12 +5,12 @@ interface ContentfulEntryCollectionInterface { /** - * @return \FondOfSpryker\Zed\Contentful\Business\Client\Entry\ContentfulEntryInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Client\Entry\ContentfulEntryInterface> */ public function getAll(): array; /** - * @param \FondOfSpryker\Zed\Contentful\Business\Client\Entry\ContentfulEntryInterface[] $contentfulEntries + * @param array<\FondOfSpryker\Zed\Contentful\Business\Client\Entry\ContentfulEntryInterface> $contentfulEntries * * @return void */ diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryInterface.php b/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryInterface.php index 2661b32..ad42efd 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryInterface.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Client/Entry/ContentfulEntryInterface.php @@ -24,12 +24,12 @@ public function getId(): string; public function getContentTypeId(): string; /** - * @return \FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface> */ public function getFields(): array; /** - * @param \FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface[] $fields + * @param array<\FondOfSpryker\Zed\Contentful\Business\Client\Field\ContentfulFieldInterface> $fields * * @return void */ diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Client/Field/ContentfulField.php b/src/FondOfSpryker/Zed/Contentful/Business/Client/Field/ContentfulField.php index 54cca22..a7b8483 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Client/Field/ContentfulField.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Client/Field/ContentfulField.php @@ -6,12 +6,39 @@ class ContentfulField implements ContentfulFieldInterface { + /** + * @var string + */ public const FIELD_TYPE_LINK = 'Link'; + + /** + * @var string + */ public const FIELD_TYPE_ASSET = 'Asset'; + + /** + * @var string + */ public const FIELD_TYPE_TEXT = 'Text'; + + /** + * @var string + */ public const FIELD_TYPE_BOOLEAN = 'Boolean'; + + /** + * @var string + */ public const FIELD_TYPE_ENTRY = 'Entry'; + + /** + * @var string + */ public const FIELD_TYPE_OBJECT = 'Object'; + + /** + * @var string + */ public const FIELD_TYPE_ARRAY = 'Array'; /** diff --git a/src/FondOfSpryker/Zed/Contentful/Business/ContentfulBusinessFactory.php b/src/FondOfSpryker/Zed/Contentful/Business/ContentfulBusinessFactory.php index 011e1b0..de4e654 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/ContentfulBusinessFactory.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/ContentfulBusinessFactory.php @@ -64,7 +64,7 @@ public function createImporter(): ImporterInterface $this->createContentfulMapper(), $this->createEntryMapper(), $this->getImporterPlugins(), - $this->getConfig()->getLocaleMapping() + $this->getConfig()->getLocaleMapping(), ); } @@ -77,7 +77,7 @@ protected function createUrlFormatter(): UrlFormatterInterface } /** - * @return \FondOfSpryker\Zed\Contentful\Business\Importer\Plugin\ImporterPluginInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Importer\Plugin\ImporterPluginInterface> */ protected function getImporterPlugins(): array { @@ -91,7 +91,7 @@ protected function getImporterPlugins(): array /** * @return \Orm\Zed\Contentful\Persistence\FosContentfulQuery */ - protected function createFosContentfulQuery(): FosContentfulQuery + protected function getFosContentfulQuery(): FosContentfulQuery { return FosContentfulQuery::create(); } @@ -107,7 +107,7 @@ protected function createNavigationImporterPlugin(): ImporterPluginInterface $this->createUrlFormatter(), $this->getConfig()->getFieldNameActive(), $this->getConfig()->getFieldNameIdentifier(), - $this->createFosContentfulQuery() + $this->getFosContentfulQuery(), ); } @@ -128,7 +128,7 @@ protected function createPageStorageImporterPlugin(): ImporterPluginInterface $this->createIdentifierKeyBuilder(), $this->getStorageClient(), $this->createUrlFormatter(), - $this->createFosContentfulQuery() + $this->getFosContentfulQuery(), ); } @@ -141,7 +141,7 @@ protected function createEntryStorageImporterPlugin(): ImporterPluginInterface $this->createEntryKeyBuilder(), $this->getStorageClient(), $this->getConfig()->getFieldNameActive(), - $this->createFosContentfulQuery() + $this->getFosContentfulQuery(), ); } @@ -156,7 +156,7 @@ protected function createIdentifierImporterPlugin(): ImporterPluginInterface $this->createUrlFormatter(), $this->getConfig()->getFieldNameActive(), $this->getConfig()->getFieldNameIdentifier(), - $this->createFosContentfulQuery() + $this->getFosContentfulQuery(), ); } @@ -176,7 +176,7 @@ public function createFieldMapperLocator(): FieldMapperLocatorInterface return new FieldMapperLocator( $this->createDefaultFieldMapper(), $this->createTypeFieldMapperCollection(), - $this->createCustomFieldMapperCollection() + $this->createCustomFieldMapperCollection(), ); } @@ -310,7 +310,7 @@ protected function createContentfulClient(): Client $this->getConfig()->getAccessToken(), $this->getConfig()->getSpaceId(), 'master', - $this->createDefaultClientOptions() + $this->createDefaultClientOptions(), ); } @@ -319,8 +319,7 @@ protected function createContentfulClient(): Client */ protected function createDefaultClientOptions(): ClientOptions { - return - (new ClientOptions()) + return (new ClientOptions()) ->withDefaultLocale($this->getConfig()->getDefaultLocale()); } @@ -358,18 +357,14 @@ public function getContentfulSearchPageFacade(): ContentulToContentfulPageSearch /** * @return \FondOfSpryker\Zed\Contentful\Dependency\Facade\ContentulToStoreFacadeInterface - * - * @throws \Spryker\Zed\Kernel\Exception\Container\ContainerKeyNotFoundException */ public function getStoreFacade(): ContentulToStoreFacadeInterface { return $this->getProvidedDependency(ContentfulDependencyProvider::FACADE_STORE); } - /** * @return \Generated\Shared\Transfer\StoreTransfer - * @throws \Spryker\Zed\Kernel\Exception\Container\ContainerKeyNotFoundException */ public function getStore(): StoreTransfer { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Importer.php b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Importer.php index 2a366a6..9a4a87f 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Importer.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Importer.php @@ -27,12 +27,12 @@ class Importer implements ImporterInterface protected $entryMapper; /** - * @var \FondOfSpryker\Zed\Contentful\Business\Importer\Plugin\ImporterPluginInterface[] + * @var array<\FondOfSpryker\Zed\Contentful\Business\Importer\Plugin\ImporterPluginInterface> */ protected $importerPlugins; /** - * @var string[] + * @var array */ protected $localeMapping; @@ -40,11 +40,16 @@ class Importer implements ImporterInterface * @param \FondOfSpryker\Zed\Contentful\Business\Client\ContentfulAPIClientInterface $contentfulAPIClient * @param \FondOfSpryker\Zed\Contentful\Business\Client\ContentfulMapperInterface $contentfulMapper * @param \FondOfSpryker\Zed\Contentful\Business\Storage\Entry\EntryMapperInterface $entryMapper - * @param \FondOfSpryker\Zed\Contentful\Business\Importer\Plugin\ImporterPluginInterface[] $importerPlugins - * @param string[] $localeMapping + * @param array<\FondOfSpryker\Zed\Contentful\Business\Importer\Plugin\ImporterPluginInterface> $importerPlugins + * @param array $localeMapping */ - public function __construct(ContentfulAPIClientInterface $contentfulAPIClient, ContentfulMapperInterface $contentfulMapper, EntryMapperInterface $entryMapper, array $importerPlugins, array $localeMapping) - { + public function __construct( + ContentfulAPIClientInterface $contentfulAPIClient, + ContentfulMapperInterface $contentfulMapper, + EntryMapperInterface $entryMapper, + array $importerPlugins, + array $localeMapping + ) { $this->contentfulAPIClient = $contentfulAPIClient; $this->contentfulMapper = $contentfulMapper; $this->entryMapper = $entryMapper; @@ -69,9 +74,10 @@ public function importLastChangedEntries(): int public function importAllEntries(): int { $resourceArray = $this->contentfulAPIClient->findAllEntries(); + $totals = $resourceArray->getTotal(); - if ($resourceArray->getTotal() > 1000) { - for ($i = 0; $i < $resourceArray->getTotal(); $i += 1000) { + if ($totals > 1000) { + for ($i = 0; $i < $totals; $i += 1000) { $res = $this->contentfulAPIClient->findAllEntries($i); $this->importResource($res->getItems()); } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/AbstractStorageImporterPlugin.php b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/AbstractStorageImporterPlugin.php index b0914b1..a379b6f 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/AbstractStorageImporterPlugin.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/AbstractStorageImporterPlugin.php @@ -131,7 +131,7 @@ abstract protected function createStorageKey(ContentfulEntryInterface $contentfu * * @throws * - * @return string[] + * @return array */ abstract protected function createStorageValue(ContentfulEntryInterface $contentfulEntry, EntryInterface $entry, string $locale): array; } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/EntryStorageImporterPlugin.php b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/EntryStorageImporterPlugin.php index 64551c4..edce257 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/EntryStorageImporterPlugin.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/EntryStorageImporterPlugin.php @@ -24,7 +24,7 @@ protected function createStorageKey(ContentfulEntryInterface $contentfulEntry, E * @param \FondOfSpryker\Zed\Contentful\Business\Storage\Entry\EntryInterface $entry * @param string $locale * - * @return string[] + * @return array */ protected function createStorageValue(ContentfulEntryInterface $contentfulEntry, EntryInterface $entry, string $locale): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/IdentifierStorageImporterPlugin.php b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/IdentifierStorageImporterPlugin.php index 23e6050..02646e5 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/IdentifierStorageImporterPlugin.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/IdentifierStorageImporterPlugin.php @@ -18,6 +18,9 @@ class IdentifierStorageImporterPlugin extends AbstractWriterPlugin implements ImporterPluginInterface { + /** + * @var string + */ public const ENTRY_TYPE_ID_EXTEND_WITH = '-identifier'; /** @@ -85,7 +88,7 @@ public function handle(ContentfulEntryInterface $contentfulEntry, EntryInterface { $identifier = $this->getIdentifierFieldContent($entry); - if (empty($identifier)) { + if (!$identifier) { return; } @@ -93,7 +96,7 @@ public function handle(ContentfulEntryInterface $contentfulEntry, EntryInterface $key = $this->createStorageKey( $this->createUrl($identifier, $routePrefixLocale), - $locale + $locale, ); if (!$this->isValid($contentfulEntry, $entry, $locale)) { @@ -182,7 +185,7 @@ protected function isValid(ContentfulEntryInterface $contentfulEntry, EntryInter return false; } - return !empty($this->getIdentifierFieldContent($entry)); + return (bool)$this->getIdentifierFieldContent($entry); } /** diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/NavigationStorageImporterPlugin.php b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/NavigationStorageImporterPlugin.php index 13eb13e..80eb2db 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/NavigationStorageImporterPlugin.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/NavigationStorageImporterPlugin.php @@ -80,7 +80,7 @@ public function handle(ContentfulEntryInterface $contentfulEntry, EntryInterface { $identifier = $this->getIdentifierFieldContent($entry); - if (empty($identifier)) { + if (!$identifier) { return; } @@ -140,7 +140,7 @@ protected function createStorageKey(string $entryId, string $appLocale): string /** * @param string $key - * @param string[] $value + * @param array $value * * @return void */ @@ -154,7 +154,7 @@ protected function createStorageEntry(string $key, array $value = []): void * @param string $identifier * @param string $routeLocalePrefix * - * @return string[] + * @return array */ protected function createStorageValue(EntryInterface $entry, string $identifier, string $routeLocalePrefix): array { @@ -188,11 +188,11 @@ protected function isValid(ContentfulEntryInterface $contentfulEntry, EntryInter return false; } - if (empty($this->getIdentifierFieldContent($entry))) { + if (!$this->getIdentifierFieldContent($entry)) { return false; } - if (empty($this->getTitleFieldContent($entry))) { + if (!$this->getTitleFieldContent($entry)) { return false; } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/PageStorageImporterPlugin.php b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/PageStorageImporterPlugin.php index 15c6426..44b1d59 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/PageStorageImporterPlugin.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Importer/Plugin/Storage/PageStorageImporterPlugin.php @@ -13,6 +13,9 @@ class PageStorageImporterPlugin extends IdentifierStorageImporterPlugin { + /** + * @var string + */ public const CONTENT_TYPE_ID = 'page'; /** diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Asset/AssetField.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Asset/AssetField.php index eaf19e2..36b0597 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Asset/AssetField.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Asset/AssetField.php @@ -6,6 +6,9 @@ class AssetField extends AbstractField { + /** + * @var string + */ public const TYPE = 'Asset'; /** @@ -70,7 +73,7 @@ public function getDescription(): ?string } /** - * @return string[] + * @return array */ public function jsonSerialize(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Asset/AssetFieldMapper.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Asset/AssetFieldMapper.php index 80da726..52cea7d 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Asset/AssetFieldMapper.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Asset/AssetFieldMapper.php @@ -30,8 +30,11 @@ public function getContentfulType(): string * * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface */ - public function createField(ContentfulEntryInterface $contentfulEntry, ContentfulFieldInterface $contentfulField, FieldMapperLocatorInterface $mapperLocator): FieldInterface - { + public function createField( + ContentfulEntryInterface $contentfulEntry, + ContentfulFieldInterface $contentfulField, + FieldMapperLocatorInterface $mapperLocator + ): FieldInterface { if ($contentfulField instanceof ContentfulAssetInterface) { return new AssetField($contentfulField->getId(), $contentfulField->getValue(), $contentfulField->getTitle(), $contentfulField->getDescription()); } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Boolean/BooleanField.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Boolean/BooleanField.php index a3ab236..b2de88f 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Boolean/BooleanField.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Boolean/BooleanField.php @@ -6,6 +6,9 @@ class BooleanField extends AbstractField { + /** + * @var string + */ public const TYPE = 'Boolean'; /** @@ -40,7 +43,7 @@ public function getBoolean(): ?bool } /** - * @return string[] + * @return array */ public function jsonSerialize(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Boolean/BooleanFieldMapper.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Boolean/BooleanFieldMapper.php index 3e709f5..1217b8a 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Boolean/BooleanFieldMapper.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Boolean/BooleanFieldMapper.php @@ -26,8 +26,11 @@ public function getContentfulType(): string * * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface */ - public function createField(ContentfulEntryInterface $contentfulEntry, ContentfulFieldInterface $contentfulField, FieldMapperLocatorInterface $mapperLocator): FieldInterface - { + public function createField( + ContentfulEntryInterface $contentfulEntry, + ContentfulFieldInterface $contentfulField, + FieldMapperLocatorInterface $mapperLocator + ): FieldInterface { return new BooleanField($contentfulField->getId(), $contentfulField->getValue()); } } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionAssetField.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionAssetField.php index 9a19b30..786d1e1 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionAssetField.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionAssetField.php @@ -6,10 +6,13 @@ class CollectionAssetField implements CollectionFieldInterface { + /** + * @var string + */ public const TYPE = 'Asset'; /** - * var \Contentful\Delivery\Resource\Asset + * @var \Contentful\Delivery\Resource\Asset */ private $asset; @@ -22,7 +25,7 @@ public function __construct(Asset $asset) } /** - * @return string[] + * @return array */ public function getAsset(): array { @@ -42,7 +45,7 @@ public function getType(): string } /** - * @return mixed[] + * @return array */ public function jsonSerialize(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionField.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionField.php index 814c780..880038b 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionField.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionField.php @@ -6,16 +6,19 @@ class CollectionField extends AbstractField { + /** + * @var string + */ public const TYPE = 'Array'; /** - * @var \FondOfSpryker\Zed\Contentful\Business\Storage\Collection\CollectionFieldInterface[] + * @var array<\FondOfSpryker\Zed\Contentful\Business\Storage\Collection\CollectionFieldInterface> */ private $fields; /** * @param string $name - * @param \FondOfSpryker\Zed\Contentful\Business\Storage\Collection\CollectionFieldInterface[] $fields + * @param array<\FondOfSpryker\Zed\Contentful\Business\Storage\Collection\CollectionFieldInterface> $fields */ public function __construct(string $name, array $fields = []) { @@ -32,7 +35,7 @@ public function getType(): string } /** - * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Collection\CollectionFieldInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Storage\Collection\CollectionFieldInterface> */ public function getFields(): array { @@ -50,7 +53,7 @@ public function addField(CollectionFieldInterface $field): void } /** - * @return string[] + * @return array */ public function jsonSerialize(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionFieldMapper.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionFieldMapper.php index 0a79447..b85b884 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionFieldMapper.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionFieldMapper.php @@ -27,8 +27,11 @@ public function getContentfulType(): string * * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface */ - public function createField(ContentfulEntryInterface $contentfulEntry, ContentfulFieldInterface $contentfulField, FieldMapperLocatorInterface $mapperLocator): FieldInterface - { + public function createField( + ContentfulEntryInterface $contentfulEntry, + ContentfulFieldInterface $contentfulField, + FieldMapperLocatorInterface $mapperLocator + ): FieldInterface { $field = new CollectionField($contentfulField->getId()); $fieldValues = $contentfulField->getValue(); @@ -39,11 +42,13 @@ public function createField(ContentfulEntryInterface $contentfulEntry, Contentfu foreach ($fieldValues as $fieldValue) { if ($fieldValue instanceof ContentfulEntryInterface && $contentfulField->getItemsLinkType() === ContentfulField::FIELD_TYPE_ENTRY) { $field->addField(new CollectionReferenceField($fieldValue->getId())); + continue; } if ($fieldValue instanceof Asset && $contentfulField->getItemsLinkType() === ContentfulField::FIELD_TYPE_ASSET) { $field->addField(new CollectionAssetField($fieldValue)); + continue; } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionReferenceField.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionReferenceField.php index f5a4957..5a01f22 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionReferenceField.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionReferenceField.php @@ -4,6 +4,9 @@ class CollectionReferenceField implements CollectionFieldInterface { + /** + * @var string + */ public const TYPE = 'Reference'; /** @@ -36,7 +39,7 @@ public function getReferenceId(): string } /** - * @return string[] + * @return array */ public function jsonSerialize(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionTextField.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionTextField.php index 3189f47..9541718 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionTextField.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Collection/CollectionTextField.php @@ -4,6 +4,9 @@ class CollectionTextField implements CollectionFieldInterface { + /** + * @var string + */ public const TYPE = 'Text'; /** @@ -36,7 +39,7 @@ public function getContent(): string } /** - * @return string[] + * @return array */ public function jsonSerialize(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Entry/Entry.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Entry/Entry.php index 8336e74..905ce37 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Entry/Entry.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Entry/Entry.php @@ -19,7 +19,7 @@ class Entry implements EntryInterface private $contentType; /** - * @var \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface[] + * @var array<\FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface> */ private $fields; @@ -57,7 +57,7 @@ public function getContentType(): string } /** - * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface> */ public function getFields(): array { @@ -117,7 +117,7 @@ public function setModifiedAt(DateTimeInterface $modifiedAt): void } /** - * @return string[] + * @return array */ public function jsonSerialize() { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Entry/EntryInterface.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Entry/EntryInterface.php index 9d212a2..e26342e 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Entry/EntryInterface.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Entry/EntryInterface.php @@ -19,7 +19,7 @@ public function getId(): string; public function getContentType(): string; /** - * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface> */ public function getFields(): array; diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/CustomFieldMapperCollection.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/CustomFieldMapperCollection.php index 3df4d36..1e508f8 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/CustomFieldMapperCollection.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/CustomFieldMapperCollection.php @@ -5,7 +5,7 @@ class CustomFieldMapperCollection implements CustomFieldMapperCollectionInterface { /** - * @var \FondOfSpryker\Zed\Contentful\Business\Storage\Field\CustomFieldMapperInterface[] + * @var array<\FondOfSpryker\Zed\Contentful\Business\Storage\Field\CustomFieldMapperInterface> */ private $customFieldMapper; @@ -25,7 +25,7 @@ public function add(CustomFieldMapperInterface $customFieldMapper): void } /** - * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\CustomFieldMapperInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Storage\Field\CustomFieldMapperInterface> */ public function getAll(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/CustomFieldMapperCollectionInterface.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/CustomFieldMapperCollectionInterface.php index f959c98..2474444 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/CustomFieldMapperCollectionInterface.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/CustomFieldMapperCollectionInterface.php @@ -12,7 +12,7 @@ interface CustomFieldMapperCollectionInterface public function add(CustomFieldMapperInterface $customFieldMapper): void; /** - * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\CustomFieldMapperInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Storage\Field\CustomFieldMapperInterface> */ public function getAll(): array; } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/FieldMapperInterface.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/FieldMapperInterface.php index 0e09a6e..a65a0d0 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/FieldMapperInterface.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/FieldMapperInterface.php @@ -14,5 +14,9 @@ interface FieldMapperInterface * * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface */ - public function createField(ContentfulEntryInterface $contentfulEntry, ContentfulFieldInterface $contentfulField, FieldMapperLocatorInterface $mapperLocator): FieldInterface; + public function createField( + ContentfulEntryInterface $contentfulEntry, + ContentfulFieldInterface $contentfulField, + FieldMapperLocatorInterface $mapperLocator + ): FieldInterface; } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/FieldMapperLocator.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/FieldMapperLocator.php index 9e227a9..32f200f 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/FieldMapperLocator.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/FieldMapperLocator.php @@ -27,8 +27,11 @@ class FieldMapperLocator implements FieldMapperLocatorInterface * @param \FondOfSpryker\Zed\Contentful\Business\Storage\Field\TypeFieldMapperCollectionInterface $typeFieldMapperCollection * @param \FondOfSpryker\Zed\Contentful\Business\Storage\Field\CustomFieldMapperCollectionInterface $customFieldMapperCollection */ - public function __construct(FieldMapperInterface $defaultFieldMapper, TypeFieldMapperCollectionInterface $typeFieldMapperCollection, CustomFieldMapperCollectionInterface $customFieldMapperCollection) - { + public function __construct( + FieldMapperInterface $defaultFieldMapper, + TypeFieldMapperCollectionInterface $typeFieldMapperCollection, + CustomFieldMapperCollectionInterface $customFieldMapperCollection + ) { $this->defaultFieldMapper = $defaultFieldMapper; $this->typeFieldMapperCollection = $typeFieldMapperCollection; $this->customFieldMapperCollection = $customFieldMapperCollection; diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/TypeFieldMapperCollection.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/TypeFieldMapperCollection.php index 3040859..f82079a 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/TypeFieldMapperCollection.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/TypeFieldMapperCollection.php @@ -5,7 +5,7 @@ class TypeFieldMapperCollection implements TypeFieldMapperCollectionInterface { /** - * @var \FondOfSpryker\Zed\Contentful\Business\Storage\Field\TypeFieldMapperInterface[] + * @var array<\FondOfSpryker\Zed\Contentful\Business\Storage\Field\TypeFieldMapperInterface> */ private $typeFieldMapper; @@ -15,7 +15,7 @@ public function __construct() } /** - * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\TypeFieldMapperInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Storage\Field\TypeFieldMapperInterface> */ public function getAll(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/TypeFieldMapperCollectionInterface.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/TypeFieldMapperCollectionInterface.php index 62faa30..b922076 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/TypeFieldMapperCollectionInterface.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Field/TypeFieldMapperCollectionInterface.php @@ -12,7 +12,7 @@ interface TypeFieldMapperCollectionInterface public function add(TypeFieldMapperInterface $typeFieldMapper): void; /** - * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\TypeFieldMapperInterface[] + * @return array<\FondOfSpryker\Zed\Contentful\Business\Storage\Field\TypeFieldMapperInterface> */ public function getAll(): array; } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Link/LinkFieldMapper.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Link/LinkFieldMapper.php index b130a71..8346131 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Link/LinkFieldMapper.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Link/LinkFieldMapper.php @@ -27,8 +27,11 @@ public function getContentfulType(): string * * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface */ - public function createField(ContentfulEntryInterface $contentfulEntry, ContentfulFieldInterface $contentfulField, FieldMapperLocatorInterface $mapperLocator): FieldInterface - { + public function createField( + ContentfulEntryInterface $contentfulEntry, + ContentfulFieldInterface $contentfulField, + FieldMapperLocatorInterface $mapperLocator + ): FieldInterface { $mapper = null; if ($contentfulField instanceof ContentfulAssetInterface) { $mapper = $mapperLocator->locateFieldMapperByFieldType(ContentfulField::FIELD_TYPE_ASSET); @@ -41,7 +44,7 @@ public function createField(ContentfulEntryInterface $contentfulEntry, Contentfu if ($mapper === null) { $mapper = $mapperLocator->locateFieldMapperByFieldType(ContentfulField::FIELD_TYPE_TEXT); } - + return $mapper->createField($contentfulEntry, $contentfulField, $mapperLocator); } } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Object/ObjectField.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Object/ObjectField.php index 71e57ed..76a5460 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Object/ObjectField.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Object/ObjectField.php @@ -6,5 +6,8 @@ class ObjectField extends TextField { + /** + * @var string + */ public const TYPE = 'Object'; } diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Object/ObjectFieldMapper.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Object/ObjectFieldMapper.php index a71df19..811d50a 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Object/ObjectFieldMapper.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Object/ObjectFieldMapper.php @@ -26,8 +26,11 @@ public function getContentfulType(): string * * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface */ - public function createField(ContentfulEntryInterface $contentfulEntry, ContentfulFieldInterface $contentfulField, FieldMapperLocatorInterface $mapperLocator): FieldInterface - { + public function createField( + ContentfulEntryInterface $contentfulEntry, + ContentfulFieldInterface $contentfulField, + FieldMapperLocatorInterface $mapperLocator + ): FieldInterface { $content = $contentfulField->getValue(); if (is_array($content)) { $content = json_encode($content); diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Reference/ReferenceField.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Reference/ReferenceField.php index e6d8842..56e0118 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Reference/ReferenceField.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Reference/ReferenceField.php @@ -6,6 +6,9 @@ class ReferenceField extends AbstractField { + /** + * @var string + */ public const TYPE = 'Reference'; /** @@ -40,7 +43,7 @@ public function getReferenceId(): ?string } /** - * @return string[] + * @return array */ public function jsonSerialize(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Reference/ReferenceFieldMapper.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Reference/ReferenceFieldMapper.php index a610537..561f7c3 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Reference/ReferenceFieldMapper.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Reference/ReferenceFieldMapper.php @@ -26,8 +26,11 @@ public function getContentfulType(): string * * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface */ - public function createField(ContentfulEntryInterface $contentfulEntry, ContentfulFieldInterface $contentfulField, FieldMapperLocatorInterface $mapperLocator): FieldInterface - { + public function createField( + ContentfulEntryInterface $contentfulEntry, + ContentfulFieldInterface $contentfulField, + FieldMapperLocatorInterface $mapperLocator + ): FieldInterface { $referenceId = null; if (is_object($contentfulField->getValue())) { $referenceId = $contentfulField->getValue()->getId(); diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Text/TextField.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Text/TextField.php index b07a1ed..8b1c985 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Text/TextField.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Text/TextField.php @@ -6,6 +6,9 @@ class TextField extends AbstractField { + /** + * @var string + */ public const TYPE = 'Text'; /** @@ -40,7 +43,7 @@ public function getContent(): string } /** - * @return string[] + * @return array */ public function jsonSerialize(): array { diff --git a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Text/TextFieldMapper.php b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Text/TextFieldMapper.php index be56501..8d6c4f2 100644 --- a/src/FondOfSpryker/Zed/Contentful/Business/Storage/Text/TextFieldMapper.php +++ b/src/FondOfSpryker/Zed/Contentful/Business/Storage/Text/TextFieldMapper.php @@ -27,8 +27,11 @@ public function getContentfulType(): string * * @return \FondOfSpryker\Zed\Contentful\Business\Storage\Field\FieldInterface */ - public function createField(ContentfulEntryInterface $contentfulEntry, ContentfulFieldInterface $contentfulField, FieldMapperLocatorInterface $mapperLocator): FieldInterface - { + public function createField( + ContentfulEntryInterface $contentfulEntry, + ContentfulFieldInterface $contentfulField, + FieldMapperLocatorInterface $mapperLocator + ): FieldInterface { $content = $contentfulField->getValue(); if ($content === null) { $content = ''; diff --git a/src/FondOfSpryker/Zed/Contentful/Communication/Console/ContentfulConsole.php b/src/FondOfSpryker/Zed/Contentful/Communication/Console/ContentfulConsole.php index 1085dd4..090b4b4 100644 --- a/src/FondOfSpryker/Zed/Contentful/Communication/Console/ContentfulConsole.php +++ b/src/FondOfSpryker/Zed/Contentful/Communication/Console/ContentfulConsole.php @@ -15,9 +15,24 @@ */ class ContentfulConsole extends Console { + /** + * @var string + */ private const COMMAND_NAME = 'contentful:import'; + + /** + * @var string + */ private const DESCRIPTION = 'Imports the contentful entries and saves it in the spryker storage.'; + + /** + * @var string + */ private const OPTION_IMPORT_ALL = 'all'; + + /** + * @var string + */ private const ARGUMENT_ENTRY_ID = 'entryId'; /** diff --git a/src/FondOfSpryker/Zed/Contentful/Communication/ContentfulCommunicationFactory.php b/src/FondOfSpryker/Zed/Contentful/Communication/ContentfulCommunicationFactory.php index 4ddb530..ab5a68a 100644 --- a/src/FondOfSpryker/Zed/Contentful/Communication/ContentfulCommunicationFactory.php +++ b/src/FondOfSpryker/Zed/Contentful/Communication/ContentfulCommunicationFactory.php @@ -28,8 +28,6 @@ class ContentfulCommunicationFactory extends AbstractCommunicationFactory { /** * @return \FondOfSpryker\Shared\Contentful\Twig\ContentfulTwigExtension - * - * @throws \Spryker\Zed\Kernel\Exception\Container\ContainerKeyNotFoundException */ public function createContentfulTwigExtension(): ContentfulTwigExtension { @@ -69,7 +67,7 @@ public function getMarkdownTwigExtension(): MarkdownExtension } /** - * @return \FondOfSpryker\Shared\Contentful\Renderer\RendererInterface[] + * @return array<\FondOfSpryker\Shared\Contentful\Renderer\RendererInterface> */ protected function getRenderer(): array { @@ -78,7 +76,6 @@ protected function getRenderer(): array /** * @return \Generated\Shared\Transfer\StoreTransfer - * @throws \Spryker\Zed\Kernel\Exception\Container\ContainerKeyNotFoundException */ public function getStore(): StoreTransfer { @@ -95,7 +92,6 @@ protected function createDefaultRenderer(): RendererInterface /** * @return \FondOfSpryker\Zed\Contentful\Dependency\Renderer\ContentfulToRendererInterface - * @throws \Spryker\Zed\Kernel\Exception\Container\ContainerKeyNotFoundException */ public function getTwigRenderer(): ContentfulToRendererInterface { @@ -112,8 +108,6 @@ public function getClient(): ContentfulClientInterface /** * @return \FondOfSpryker\Zed\Contentful\Dependency\Facade\ContentfulToLocaleFacadeInterface - * - * @throws \Spryker\Zed\Kernel\Exception\Container\ContainerKeyNotFoundException */ public function getLocaleFacade(): ContentfulToLocaleFacadeInterface { @@ -122,8 +116,6 @@ public function getLocaleFacade(): ContentfulToLocaleFacadeInterface /** * @return \FondOfSpryker\Zed\Contentful\Dependency\Facade\ContentulToStoreFacadeInterface - * - * @throws \Spryker\Zed\Kernel\Exception\Container\ContainerKeyNotFoundException */ public function getStoreFacade(): ContentulToStoreFacadeInterface { diff --git a/src/FondOfSpryker/Zed/Contentful/Communication/Plugin/ContentfulTwigPlugin.php b/src/FondOfSpryker/Zed/Contentful/Communication/Plugin/ContentfulTwigPlugin.php index ca997a9..9056c2c 100644 --- a/src/FondOfSpryker/Zed/Contentful/Communication/Plugin/ContentfulTwigPlugin.php +++ b/src/FondOfSpryker/Zed/Contentful/Communication/Plugin/ContentfulTwigPlugin.php @@ -16,9 +16,24 @@ */ class ContentfulTwigPlugin extends AbstractPlugin implements TwigPluginInterface { + /** + * @var string + */ protected const TWIG_FUNCTION_CONTENTFUL_ENTRY = 'contentfulEntry'; + + /** + * @var string + */ protected const TWIG_FUNCTION_CONTENTFUL_URL = 'contentfulUrl'; + + /** + * @var string + */ protected const TWIG_FUNCTION_CONTENTFUL_IMAGE = 'contentfulImage'; + + /** + * @var string + */ protected const TWIG_FUNCTION_GET_CONTENTFUL_ENTRY = 'getContentfulEntry'; /** @@ -95,7 +110,7 @@ function (string $entryId, array $additionalParameters = [], ?string $locale = n }, [ 'is_safe' => ['html'], - ] + ], ); } @@ -126,7 +141,7 @@ function ($url, ?int $width = null, ?int $height = null) { return $this ->getFactory() ->createContentfulTwigExtension()->resizeContentfulImage($url, $width, $height); - } + }, ); } diff --git a/src/FondOfSpryker/Zed/Contentful/Communication/Plugin/ContentfulTwigServiceProvider.php b/src/FondOfSpryker/Zed/Contentful/Communication/Plugin/ContentfulTwigServiceProvider.php index fa39a2b..33fa8e3 100644 --- a/src/FondOfSpryker/Zed/Contentful/Communication/Plugin/ContentfulTwigServiceProvider.php +++ b/src/FondOfSpryker/Zed/Contentful/Communication/Plugin/ContentfulTwigServiceProvider.php @@ -29,7 +29,7 @@ public function register(Application $app): void $twig->addExtension($factory->getMarkdownTwigExtension()); return $twig; - }) + }), ); } diff --git a/src/FondOfSpryker/Zed/Contentful/ContentfulConfig.php b/src/FondOfSpryker/Zed/Contentful/ContentfulConfig.php index 445ab7b..4d73850 100644 --- a/src/FondOfSpryker/Zed/Contentful/ContentfulConfig.php +++ b/src/FondOfSpryker/Zed/Contentful/ContentfulConfig.php @@ -8,7 +8,14 @@ class ContentfulConfig extends AbstractBundleConfig { + /** + * @var string + */ public const DEFAULT_FIELD_NAME_ACTIVE = 'isActive'; + + /** + * @var string + */ public const DEFAULT_FIELD_NAME_IDENTIFIER = 'identifier'; /** diff --git a/src/FondOfSpryker/Zed/Contentful/ContentfulDependencyProvider.php b/src/FondOfSpryker/Zed/Contentful/ContentfulDependencyProvider.php index 5a26798..3b777b4 100644 --- a/src/FondOfSpryker/Zed/Contentful/ContentfulDependencyProvider.php +++ b/src/FondOfSpryker/Zed/Contentful/ContentfulDependencyProvider.php @@ -17,16 +17,56 @@ class ContentfulDependencyProvider extends AbstractBundleDependencyProvider { + /** + * @var string + */ public const TWIG_MARKDOWN = 'TWIG_MARKDOWN'; + + /** + * @var string + */ public const STORAGE_CLIENT = 'STORAGE_CLIENT'; + + /** + * @var string + */ public const FACADE_LOCALE = 'FACADE_LOCALE'; + + /** + * @var string + */ public const FACADE_STORE = 'FACADE_STORE'; + + /** + * @var string + */ public const CLIENT_STORE = 'CLIENT_STORE'; + + /** + * @var string + */ public const CLIENT = 'CLIENT'; + + /** + * @var string + */ public const CONTENTFUL_STORAGE_FACADE = 'CONTENTFUL_STORAGE_FACADE'; + + /** + * @var string + */ public const CONTENTFUL_PAGE_SEARCH_FACADE = 'CONTENTFUL_PAGE_SEARCH_FACADE'; + + /** + * @var string + */ public const FACADE_EVENT_BEHAVIOUR = 'FACADE_EVENT_BEHAVIOUR'; + + /** + * @var string + */ public const STORE = 'STORE'; + /** * @var string */ @@ -139,7 +179,7 @@ protected function addContentfulStorageFacade(Container $container): Container { $container[static::CONTENTFUL_STORAGE_FACADE] = function (Container $container) { return new ContentfulToContentfulStorageFacadeBridge( - $container->getLocator()->contentfulStorage()->facade() + $container->getLocator()->contentfulStorage()->facade(), ); }; @@ -155,7 +195,7 @@ protected function addContentfulPageSearchFacade(Container $container): Containe { $container[static::CONTENTFUL_PAGE_SEARCH_FACADE] = function (Container $container) { return new ContentulToContentfulPageSearchBridge( - $container->getLocator()->contentfulPageSearch()->facade() + $container->getLocator()->contentfulPageSearch()->facade(), ); }; @@ -171,7 +211,7 @@ protected function addEventBehaviourFacade(Container $container): Container { $container[static::FACADE_EVENT_BEHAVIOUR] = function (Container $container) { return new ContentfulToEventBehaviorFacadeBridge( - $container->getLocator()->eventBehavior()->facade() + $container->getLocator()->eventBehavior()->facade(), ); }; @@ -187,7 +227,7 @@ protected function addLocaleFacade(Container $container): Container { $container[static::FACADE_LOCALE] = function (Container $container) { return new ContentfulToLocaleFacadeBridge( - $container->getLocator()->locale()->facade() + $container->getLocator()->locale()->facade(), ); }; @@ -203,7 +243,7 @@ protected function addStoreFacade(Container $container): Container { $container[static::FACADE_STORE] = function (Container $container) { return new ContentulToStoreFacadeBridge( - $container->getLocator()->store()->facade() + $container->getLocator()->store()->facade(), ); }; @@ -224,8 +264,6 @@ protected function addStore(Container $container): Container return $container; } - - /** * @param \Spryker\Zed\Kernel\Container $container * diff --git a/src/FondOfSpryker/Zed/Contentful/Dependency/ContentfulEvents.php b/src/FondOfSpryker/Zed/Contentful/Dependency/ContentfulEvents.php index cc16a68..a763e11 100644 --- a/src/FondOfSpryker/Zed/Contentful/Dependency/ContentfulEvents.php +++ b/src/FondOfSpryker/Zed/Contentful/Dependency/ContentfulEvents.php @@ -4,11 +4,23 @@ interface ContentfulEvents { + /** + * @var string + */ public const ENTITY_FOS_CONTENTFUL_CREATE = 'Entity.fos_contentful.create'; + /** + * @var string + */ public const ENTITY_FOS_CONTENTFUL_UPDATE = 'Entity.fos_contentful.update'; + /** + * @var string + */ public const ENTITY_FOS_CONTENTFUL_DELETE = 'Entity.fos_contentful.delete'; + /** + * @var string + */ public const CONTENTFUL_PUBLISH = 'Contentful.publish'; } diff --git a/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentfulToContentfulStorageFacadeBridge.php b/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentfulToContentfulStorageFacadeBridge.php index b461377..24ecd16 100644 --- a/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentfulToContentfulStorageFacadeBridge.php +++ b/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentfulToContentfulStorageFacadeBridge.php @@ -7,13 +7,12 @@ class ContentfulToContentfulStorageFacadeBridge implements ContentfulToContentfulStorageFacadeInterface { /** - * @var \FondOfSpryker\Zed\ContentfulStorage\Business\ContentfulStorageFacadeInterface + * @var \FondOfSpryker\Zed\ContentfulStorage\Business\ContentfulStorageFacadeInterface */ protected $contentfulStorageFacade; /** - * ContentfulToContentfulStorageFacadeBridge constructor. - * @param \FondOfSpryker\Zed\ContentfulStorage\Business\ContentfulStorageFacadeInterface $contentfulStorageFacade + * @param \FondOfSpryker\Zed\ContentfulStorage\Business\ContentfulStorageFacadeInterface $contentfulStorageFacade */ public function __construct(ContentfulStorageFacadeInterface $contentfulStorageFacade) { diff --git a/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentfulToLocaleFacadeBridge.php b/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentfulToLocaleFacadeBridge.php index d717be3..f73e600 100644 --- a/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentfulToLocaleFacadeBridge.php +++ b/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentfulToLocaleFacadeBridge.php @@ -13,9 +13,7 @@ class ContentfulToLocaleFacadeBridge implements ContentfulToLocaleFacadeInterfac protected $localeFacade; /** - * ContentfulToLocaleFacadeBridge constructor. - * - * @param \Spryker\Zed\Locale\Business\LocaleFacadeInterface $localeFacade + * @param \Spryker\Zed\Locale\Business\LocaleFacadeInterface $localeFacade */ public function __construct(LocaleFacadeInterface $localeFacade) { diff --git a/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentulToStoreFacadeBridge.php b/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentulToStoreFacadeBridge.php index 1d8a152..9415604 100644 --- a/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentulToStoreFacadeBridge.php +++ b/src/FondOfSpryker/Zed/Contentful/Dependency/Facade/ContentulToStoreFacadeBridge.php @@ -13,9 +13,7 @@ class ContentulToStoreFacadeBridge implements ContentulToStoreFacadeInterface protected $storeFacade; /** - * ContentulToStoreFacadeBridge constructor. - * - * @param \Spryker\Zed\Store\Business\StoreFacadeInterface $storeFacade + * @param \Spryker\Zed\Store\Business\StoreFacadeInterface $storeFacade */ public function __construct(StoreFacadeInterface $storeFacade) { diff --git a/src/FondOfSpryker/Zed/Contentful/Persistence/ContentfulQueryContainer.php b/src/FondOfSpryker/Zed/Contentful/Persistence/ContentfulQueryContainer.php index 2d7b705..5b07abb 100644 --- a/src/FondOfSpryker/Zed/Contentful/Persistence/ContentfulQueryContainer.php +++ b/src/FondOfSpryker/Zed/Contentful/Persistence/ContentfulQueryContainer.php @@ -9,6 +9,9 @@ */ class ContentfulQueryContainer extends AbstractQueryContainer implements ContentfulQueryContainerInterface { + /** + * @var string + */ protected const COL_CONTENTFUL_ENTRY_ID = 'entryId'; /** diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php index e25e40b..ee17168 100644 --- a/tests/_bootstrap.php +++ b/tests/_bootstrap.php @@ -1,7 +1,17 @@ url()); +if (!file_exists($pathToAutoloader)) { + $pathToAutoloader = codecept_root_dir('../../vendor/autoload.php'); +} + +if (!file_exists($pathToAutoloader)) { + $pathToAutoloader = codecept_root_dir('../../autoload.php'); +} + +if (!file_exists($pathToAutoloader)) { + $pathToAutoloader = codecept_root_dir('../../../../autoload.php'); +} + +require_once $pathToAutoloader; diff --git a/tests/_data/.gitkeep b/tests/_data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/_data/stores.php b/tests/_data/stores.php deleted file mode 100644 index f5bfcfb..0000000 --- a/tests/_data/stores.php +++ /dev/null @@ -1,18 +0,0 @@ - [ - 'contexts' => [ - '*' => [], - 'yves' => [], - 'zed' => [], - ], - 'locales' => [ - 'en' => 'en_US', - 'de' => 'de_DE', - ], - 'countries' => ['DE'], - 'currencyIsoCode' => 'EUR', - 'currencyIsoCodes' => ['EUR'], - ], -];