Skip to content

Commit

Permalink
Merge pull request #5 from spryker-eco/bugfix/cms-2969-fix-naming-issue
Browse files Browse the repository at this point in the history
[CMS-2969] Fix module naming and added cs-fix script
  • Loading branch information
Incognito authored Oct 25, 2019
2 parents f43f9cc + 13b6531 commit 30e26ba
Show file tree
Hide file tree
Showing 84 changed files with 745 additions and 744 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# CoreMedia Changelog
# Coremedia Changelog

[Release Changelog](https://github.com/spryker-eco/coremedia/releases)
4 changes: 2 additions & 2 deletions codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ namespace: SprykerEcoTest
actor: Tester

include:
- tests/SprykerEcoTest/Client/CoreMedia
- tests/SprykerEcoTest/Yves/CoreMedia
- tests/SprykerEcoTest/Client/Coremedia
- tests/SprykerEcoTest/Yves/Coremedia

paths:
tests: tests
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "spryker-eco/coremedia",
"type": "library",
"description": "CoreMedia module",
"description": "Coremedia module",
"license": "proprietary",
"require": {
"php": ">=7.1",
Expand All @@ -24,7 +24,7 @@
"autoload": {
"psr-4": {
"SprykerEco\\": "src/SprykerEco/",
"SprykerEcoTest\\Client\\CoreMedia\\Helper\\": "tests/SprykerEcoTest/Client/CoreMedia/_support/Helper/"
"SprykerEcoTest\\Client\\Coremedia\\Helper\\": "tests/SprykerEcoTest/Client/Coremedia/_support/Helper/"
}
},
"autoload-dev": {
Expand All @@ -40,7 +40,8 @@
}
},
"scripts": {
"cs-check": "phpcs --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml -p src/ tests/"
"cs-check": "phpcs --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml -p src/ tests/",
"cs-fix": "phpcbf --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml -p src/ tests/"
},
"config": {
"sort-packages": true
Expand Down
23 changes: 0 additions & 23 deletions src/SprykerEco/Client/CoreMedia/Api/ApiClientInterface.php

This file was deleted.

30 changes: 0 additions & 30 deletions src/SprykerEco/Client/CoreMedia/CoreMediaClientInterface.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace SprykerEco\Client\CoreMedia\Api;
namespace SprykerEco\Client\Coremedia\Api;

use Generated\Shared\Transfer\CoreMediaApiResponseTransfer;
use Generated\Shared\Transfer\CoreMediaFragmentRequestTransfer;
use SprykerEco\Client\CoreMedia\Api\Builder\RequestBuilderInterface;
use SprykerEco\Client\CoreMedia\Api\Builder\UrlBuilderInterface;
use SprykerEco\Client\CoreMedia\Api\Executor\RequestExecutorInterface;
use Generated\Shared\Transfer\CoremediaApiResponseTransfer;
use Generated\Shared\Transfer\CoremediaFragmentRequestTransfer;
use SprykerEco\Client\Coremedia\Api\Builder\RequestBuilderInterface;
use SprykerEco\Client\Coremedia\Api\Builder\UrlBuilderInterface;
use SprykerEco\Client\Coremedia\Api\Executor\RequestExecutorInterface;

class ApiClient implements ApiClientInterface
{
protected const REQUEST_GET_METHOD = 'GET';

/**
* @var \SprykerEco\Client\CoreMedia\Api\Builder\RequestBuilderInterface
* @var \SprykerEco\Client\Coremedia\Api\Builder\RequestBuilderInterface
*/
protected $requestBuilder;

/**
* @var \SprykerEco\Client\CoreMedia\Api\Executor\RequestExecutorInterface
* @var \SprykerEco\Client\Coremedia\Api\Executor\RequestExecutorInterface
*/
protected $requestExecutor;

/**
* @var \SprykerEco\Client\CoreMedia\Api\Builder\UrlBuilderInterface
* @var \SprykerEco\Client\Coremedia\Api\Builder\UrlBuilderInterface
*/
protected $urlBuilder;

/**
* @param \SprykerEco\Client\CoreMedia\Api\Builder\RequestBuilderInterface $requestBuilder
* @param \SprykerEco\Client\CoreMedia\Api\Executor\RequestExecutorInterface $requestExecutor
* @param \SprykerEco\Client\CoreMedia\Api\Builder\UrlBuilderInterface $urlBuilder
* @param \SprykerEco\Client\Coremedia\Api\Builder\RequestBuilderInterface $requestBuilder
* @param \SprykerEco\Client\Coremedia\Api\Executor\RequestExecutorInterface $requestExecutor
* @param \SprykerEco\Client\Coremedia\Api\Builder\UrlBuilderInterface $urlBuilder
*/
public function __construct(
RequestBuilderInterface $requestBuilder,
Expand All @@ -48,13 +48,13 @@ public function __construct(
}

/**
* @param \Generated\Shared\Transfer\CoreMediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
* @param \Generated\Shared\Transfer\CoremediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
*
* @return \Generated\Shared\Transfer\CoreMediaApiResponseTransfer
* @return \Generated\Shared\Transfer\CoremediaApiResponseTransfer
*/
public function getDocumentFragment(
CoreMediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
): CoreMediaApiResponseTransfer {
CoremediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
): CoremediaApiResponseTransfer {
$request = $this->requestBuilder->buildRequest(
static::REQUEST_GET_METHOD,
$this->urlBuilder->buildDocumentFragmentApiUrl($coreMediaFragmentRequestTransfer)
Expand Down
23 changes: 23 additions & 0 deletions src/SprykerEco/Client/Coremedia/Api/ApiClientInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace SprykerEco\Client\Coremedia\Api;

use Generated\Shared\Transfer\CoremediaApiResponseTransfer;
use Generated\Shared\Transfer\CoremediaFragmentRequestTransfer;

interface ApiClientInterface
{
/**
* @param \Generated\Shared\Transfer\CoremediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
*
* @return \Generated\Shared\Transfer\CoremediaApiResponseTransfer
*/
public function getDocumentFragment(
CoremediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
): CoremediaApiResponseTransfer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace SprykerEco\Client\CoreMedia\Api\Builder;
namespace SprykerEco\Client\Coremedia\Api\Builder;

use GuzzleHttp\Psr7\Request as Psr7Request;
use Psr\Http\Message\RequestInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace SprykerEco\Client\CoreMedia\Api\Builder;
namespace SprykerEco\Client\Coremedia\Api\Builder;

use Psr\Http\Message\RequestInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,58 @@
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace SprykerEco\Client\CoreMedia\Api\Builder;
namespace SprykerEco\Client\Coremedia\Api\Builder;

use Generated\Shared\Transfer\CoreMediaFragmentRequestTransfer;
use SprykerEco\Client\CoreMedia\Api\Configuration\UrlConfigurationInterface;
use Generated\Shared\Transfer\CoremediaFragmentRequestTransfer;
use SprykerEco\Client\Coremedia\Api\Configuration\UrlConfigurationInterface;

class UrlBuilder implements UrlBuilderInterface
{
protected const HTTP_QUERY_KEY_VALUE_PATTERN = '%s=%s';

protected const NAME_QUERY_PARAMS = [
CoreMediaFragmentRequestTransfer::PAGE_ID,
CoreMediaFragmentRequestTransfer::PRODUCT_ID,
CoreMediaFragmentRequestTransfer::CATEGORY_ID,
CoreMediaFragmentRequestTransfer::VIEW,
CoreMediaFragmentRequestTransfer::PLACEMENT,
CoremediaFragmentRequestTransfer::PAGE_ID,
CoremediaFragmentRequestTransfer::PRODUCT_ID,
CoremediaFragmentRequestTransfer::CATEGORY_ID,
CoremediaFragmentRequestTransfer::VIEW,
CoremediaFragmentRequestTransfer::PLACEMENT,
];

/**
* @var \SprykerEco\Client\CoreMedia\Api\Configuration\UrlConfigurationInterface
* @var \SprykerEco\Client\Coremedia\Api\Configuration\UrlConfigurationInterface
*/
protected $urlConfiguration;

/**
* @param \SprykerEco\Client\CoreMedia\Api\Configuration\UrlConfigurationInterface $urlConfiguration
* @param \SprykerEco\Client\Coremedia\Api\Configuration\UrlConfigurationInterface $urlConfiguration
*/
public function __construct(UrlConfigurationInterface $urlConfiguration)
{
$this->urlConfiguration = $urlConfiguration;
}

/**
* @param \Generated\Shared\Transfer\CoreMediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
* @param \Generated\Shared\Transfer\CoremediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
*
* @return string
*/
public function buildDocumentFragmentApiUrl(
CoreMediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
CoremediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
): string {
$query = $this->transformCoreMediaFragmentRequestTransferPropertiesToQueryString(
$query = $this->transformCoremediaFragmentRequestTransferPropertiesToQueryString(
$coreMediaFragmentRequestTransfer
);

return $this->urlConfiguration->getCoreMediaHost() . $this->urlConfiguration->getBasePath() . $query;
return $this->urlConfiguration->getCoremediaHost() . $this->urlConfiguration->getBasePath() . $query;
}

/**
* @param \Generated\Shared\Transfer\CoreMediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
* @param \Generated\Shared\Transfer\CoremediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
*
* @return string
*/
protected function transformCoreMediaFragmentRequestTransferPropertiesToQueryString(
CoreMediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
protected function transformCoremediaFragmentRequestTransferPropertiesToQueryString(
CoremediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
): string {
$store = $this->urlConfiguration->getStore($coreMediaFragmentRequestTransfer->getStore());
$locale = $this->urlConfiguration->getLocale($store, $coreMediaFragmentRequestTransfer->getLocale());
Expand All @@ -65,7 +65,7 @@ protected function transformCoreMediaFragmentRequestTransferPropertiesToQueryStr

foreach ($coreMediaFragmentRequestTransferArray as $key => $value) {
if (in_array($key, static::NAME_QUERY_PARAMS, true)) {
$queryParams[] = $this->serializeCoreMediaFragmentRequestTransferProperty($key, $value);
$queryParams[] = $this->serializeCoremediaFragmentRequestTransferProperty($key, $value);
}
}

Expand All @@ -83,7 +83,7 @@ protected function transformCoreMediaFragmentRequestTransferPropertiesToQueryStr
*
* @return string
*/
protected function serializeCoreMediaFragmentRequestTransferProperty(string $key, $value): string
protected function serializeCoremediaFragmentRequestTransferProperty(string $key, $value): string
{
if (is_bool($value)) {
return sprintf(static::HTTP_QUERY_KEY_VALUE_PATTERN, $key, var_export($value, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace SprykerEco\Client\CoreMedia\Api\Builder;
namespace SprykerEco\Client\Coremedia\Api\Builder;

use Generated\Shared\Transfer\CoreMediaFragmentRequestTransfer;
use Generated\Shared\Transfer\CoremediaFragmentRequestTransfer;

interface UrlBuilderInterface
{
/**
* @param \Generated\Shared\Transfer\CoreMediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
* @param \Generated\Shared\Transfer\CoremediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
*
* @return string
*/
public function buildDocumentFragmentApiUrl(
CoreMediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
CoremediaFragmentRequestTransfer $coreMediaFragmentRequestTransfer
): string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace SprykerEco\Client\CoreMedia\Api\Configuration;
namespace SprykerEco\Client\Coremedia\Api\Configuration;

use SprykerEco\Client\CoreMedia\Api\Exception\UrlConfigurationException;
use SprykerEco\Client\CoreMedia\CoreMediaConfig;
use SprykerEco\Client\Coremedia\Api\Exception\UrlConfigurationException;
use SprykerEco\Client\Coremedia\CoremediaConfig;

class UrlConfiguration implements UrlConfigurationInterface
{
/**
* @var \SprykerEco\Client\CoreMedia\CoreMediaConfig
* @var \SprykerEco\Client\Coremedia\CoremediaConfig
*/
protected $config;

/**
* @param \SprykerEco\Client\CoreMedia\CoreMediaConfig $config
* @param \SprykerEco\Client\Coremedia\CoremediaConfig $config
*/
public function __construct(CoreMediaConfig $config)
public function __construct(CoremediaConfig $config)
{
$this->config = $config;
}

/**
* @throws \SprykerEco\Client\CoreMedia\Api\Exception\UrlConfigurationException
* @throws \SprykerEco\Client\Coremedia\Api\Exception\UrlConfigurationException
*
* @return string
*/
public function getCoreMediaHost(): string
public function getCoremediaHost(): string
{
$coreMediaHost = $this->config->getCoreMediaHost();
$coreMediaHost = $this->config->getCoremediaHost();

if (!$coreMediaHost) {
throw new UrlConfigurationException('Please specify the CoreMedia host in configuration.');
throw new UrlConfigurationException('Please specify the Coremedia host in configuration.');
}

return $coreMediaHost;
Expand All @@ -52,7 +52,7 @@ public function getBasePath(): string
/**
* @param string $storeName
*
* @throws \SprykerEco\Client\CoreMedia\Api\Exception\UrlConfigurationException
* @throws \SprykerEco\Client\Coremedia\Api\Exception\UrlConfigurationException
*
* @return string
*/
Expand All @@ -73,7 +73,7 @@ public function getStore(string $storeName): string
* @param string $store
* @param string $localeName
*
* @throws \SprykerEco\Client\CoreMedia\Api\Exception\UrlConfigurationException
* @throws \SprykerEco\Client\Coremedia\Api\Exception\UrlConfigurationException
*
* @return string
*/
Expand Down
Loading

0 comments on commit 30e26ba

Please sign in to comment.