Skip to content

Commit

Permalink
project-base classes are compliant with the principle of encapsulatio…
Browse files Browse the repository at this point in the history
…n (#1640)

* compliance with the principle of encapsulation in the project base classes (tests are excluded)
* removed unused dependencies
  • Loading branch information
pk16011990 authored Apr 6, 2020
1 parent ef5c646 commit 5311d35
Show file tree
Hide file tree
Showing 36 changed files with 198 additions and 257 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Front/ImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getAdditionalImageAction($entityName, $type, $sizeName, int $ima
* @param string $imageFilepath
* @return \Symfony\Component\HttpFoundation\StreamedResponse
*/
protected function sendImage(string $imageFilepath): StreamedResponse
private function sendImage(string $imageFilepath): StreamedResponse
{
try {
$fileStream = $this->filesystem->readStream($imageFilepath);
Expand Down
4 changes: 2 additions & 2 deletions src/DataFixtures/Demo/AdministratorDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AdministratorDataFixture extends AbstractReferenceFixture
/**
* @var \Shopsys\FrameworkBundle\Model\Administrator\AdministratorFacade
*/
protected $administratorFacade;
private $administratorFacade;

/**
* @param \Shopsys\FrameworkBundle\Model\Administrator\AdministratorFacade $administratorFacade
Expand All @@ -42,7 +42,7 @@ public function load(ObjectManager $manager)
* @param string $referenceName
* @see \Shopsys\FrameworkBundle\Migrations\Version20180702111015
*/
protected function createAdministratorReference(int $administratorId, string $referenceName)
private function createAdministratorReference(int $administratorId, string $referenceName)
{
$administrator = $this->administratorFacade->getById($administratorId);
$this->addReference($referenceName, $administrator);
Expand Down
4 changes: 2 additions & 2 deletions src/DataFixtures/Demo/AdvertDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class AdvertDataFixture extends AbstractReferenceFixture
/**
* @var \Shopsys\FrameworkBundle\Model\Advert\AdvertFacade
*/
protected $advertFacade;
private $advertFacade;

/**
* @var \Shopsys\FrameworkBundle\Model\Advert\AdvertDataFactoryInterface
*/
protected $advertDataFactory;
private $advertDataFactory;

/**
* @param \Shopsys\FrameworkBundle\Model\Advert\AdvertFacade $advertFacade
Expand Down
24 changes: 12 additions & 12 deletions src/DataFixtures/Demo/ArticleDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ class ArticleDataFixture extends AbstractReferenceFixture
public const ARTICLE_PRIVACY_POLICY = 'article_privacy_policy';
public const ARTICLE_COOKIES = 'article_cookies';

protected const ATTRIBUTE_NAME_KEY = 'name';
protected const ATTRIBUTE_TEXT_KEY = 'text';
protected const ATTRIBUTE_PLACEMENT_KEY = 'placement';
protected const REFERENCE_NAME_KEY = 'referenceName';
private const ATTRIBUTE_NAME_KEY = 'name';
private const ATTRIBUTE_TEXT_KEY = 'text';
private const ATTRIBUTE_PLACEMENT_KEY = 'placement';
private const REFERENCE_NAME_KEY = 'referenceName';

/**
* @var \Shopsys\FrameworkBundle\Model\Article\ArticleFacade
*/
protected $articleFacade;
private $articleFacade;

/**
* @var \App\Model\Article\ArticleDataFactory
*/
protected $articleDataFactory;
private $articleDataFactory;

/**
* @var \Shopsys\FrameworkBundle\Component\Domain\Domain
*/
protected $domain;
private $domain;

/**
* @param \Shopsys\FrameworkBundle\Model\Article\ArticleFacade $articleFacade
Expand Down Expand Up @@ -72,7 +72,7 @@ public function load(ObjectManager $manager)
* @param string $locale
* @return string[][]
*/
protected function getDataForArticles(string $locale): array
private function getDataForArticles(string $locale): array
{
return [
[
Expand Down Expand Up @@ -106,7 +106,7 @@ protected function getDataForArticles(string $locale): array
* @param array $articles
* @param int $domainId
*/
protected function createArticlesFromArray(array $articles, int $domainId): void
private function createArticlesFromArray(array $articles, int $domainId): void
{
foreach ($articles as $article) {
$this->createArticleFromArray($article, $domainId);
Expand All @@ -117,7 +117,7 @@ protected function createArticlesFromArray(array $articles, int $domainId): void
* @param array $data
* @param int $domainId
*/
protected function createArticleFromArray(array $data, int $domainId): void
private function createArticleFromArray(array $data, int $domainId): void
{
$articleData = $this->articleDataFactory->create();
$articleData->domainId = $domainId;
Expand All @@ -132,15 +132,15 @@ protected function createArticleFromArray(array $data, int $domainId): void
* @param \App\Model\Article\ArticleData $articleData
* @param string|null $referenceName
*/
protected function createArticleFromArticleData(ArticleData $articleData, ?string $referenceName = null): void
private function createArticleFromArticleData(ArticleData $articleData, ?string $referenceName = null): void
{
$article = $this->articleFacade->create($articleData);
if ($referenceName !== null) {
$this->addReferenceForDomain($referenceName, $article, $articleData->domainId);
}
}

protected function changeDataForSecondDomain()
private function changeDataForSecondDomain()
{
/** @var \App\Model\Article\Article $cookiesArticle */
$cookiesArticle = $this->getReferenceForDomain(self::ARTICLE_COOKIES, Domain::SECOND_DOMAIN_ID);
Expand Down
10 changes: 5 additions & 5 deletions src/DataFixtures/Demo/AvailabilityDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ class AvailabilityDataFixture extends AbstractReferenceFixture
/**
* @var \Shopsys\FrameworkBundle\Model\Product\Availability\AvailabilityFacade
*/
protected $availabilityFacade;
private $availabilityFacade;

/**
* @var \Shopsys\FrameworkBundle\Model\Product\Availability\AvailabilityDataFactoryInterface
*/
protected $availabilityDataFactory;
private $availabilityDataFactory;

/**
* @var \Shopsys\FrameworkBundle\Component\Setting\Setting
*/
protected $setting;
private $setting;

/**
* @var \Shopsys\FrameworkBundle\Component\Domain\Domain
*/
protected $domain;
private $domain;

/**
* @param \Shopsys\FrameworkBundle\Model\Product\Availability\AvailabilityFacade $availabilityFacade
Expand Down Expand Up @@ -99,7 +99,7 @@ public function load(ObjectManager $manager)
* @param string|null $referenceName
* @return \Shopsys\FrameworkBundle\Model\Product\Availability\Availability
*/
protected function createAvailability(AvailabilityData $availabilityData, $referenceName = null)
private function createAvailability(AvailabilityData $availabilityData, $referenceName = null)
{
$availability = $this->availabilityFacade->create($availabilityData);
if ($referenceName !== null) {
Expand Down
4 changes: 2 additions & 2 deletions src/DataFixtures/Demo/BestsellingProductDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class BestsellingProductDataFixture extends AbstractReferenceFixture implements
/**
* @var \Shopsys\FrameworkBundle\Model\Product\BestsellingProduct\ManualBestsellingProductFacade
*/
protected $manualBestsellingProductFacade;
private $manualBestsellingProductFacade;

/**
* @var \Shopsys\FrameworkBundle\Component\Domain\Domain
*/
protected $domain;
private $domain;

/**
* @param \Shopsys\FrameworkBundle\Model\Product\BestsellingProduct\ManualBestsellingProductFacade $manualBestsellingProductFacade
Expand Down
8 changes: 4 additions & 4 deletions src/DataFixtures/Demo/BrandDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class BrandDataFixture extends AbstractReferenceFixture
public const BRAND_NIKON = 'brand_nikon';

/** @var \Shopsys\FrameworkBundle\Model\Product\Brand\BrandFacade */
protected $brandFacade;
private $brandFacade;

/** @var \App\Model\Product\Brand\BrandDataFactory */
protected $brandDataFactory;
private $brandDataFactory;

/**
* @var \Shopsys\FrameworkBundle\Component\Domain\Domain
*/
protected $domain;
private $domain;

/**
* @param \Shopsys\FrameworkBundle\Model\Product\Brand\BrandFacade $brandFacade
Expand Down Expand Up @@ -82,7 +82,7 @@ public function load(ObjectManager $manager)
/**
* @return string[]
*/
protected function getBrandNamesIndexedByBrandConstants()
private function getBrandNamesIndexedByBrandConstants()
{
return [
self::BRAND_APPLE => 'Apple',
Expand Down
8 changes: 4 additions & 4 deletions src/DataFixtures/Demo/CategoryDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ class CategoryDataFixture extends AbstractReferenceFixture
/**
* @var \Shopsys\FrameworkBundle\Model\Category\CategoryFacade
*/
protected $categoryFacade;
private $categoryFacade;

/**
* @var \App\Model\Category\CategoryDataFactory
*/
protected $categoryDataFactory;
private $categoryDataFactory;

/**
* @var \Shopsys\FrameworkBundle\Component\Domain\Domain
*/
protected $domain;
private $domain;

/**
* @param \Shopsys\FrameworkBundle\Model\Category\CategoryFacade $categoryFacade
Expand Down Expand Up @@ -179,7 +179,7 @@ public function load(ObjectManager $manager)
* @param string|null $referenceName
* @return \App\Model\Category\Category
*/
protected function createCategory(CategoryData $categoryData, $referenceName = null)
private function createCategory(CategoryData $categoryData, $referenceName = null)
{
/** @var \App\Model\Category\Category $category */
$category = $this->categoryFacade->create($categoryData);
Expand Down
8 changes: 4 additions & 4 deletions src/DataFixtures/Demo/CountryDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ class CountryDataFixture extends AbstractReferenceFixture
/**
* @var \Shopsys\FrameworkBundle\Model\Country\CountryFacade
*/
protected $countryFacade;
private $countryFacade;

/**
* @var \Shopsys\FrameworkBundle\Model\Country\CountryDataFactoryInterface
*/
protected $countryDataFactory;
private $countryDataFactory;

/**
* @var \Shopsys\FrameworkBundle\Component\Domain\Domain
*/
protected $domain;
private $domain;

/**
* @param \Shopsys\FrameworkBundle\Model\Country\CountryFacade $countryFacade
Expand Down Expand Up @@ -72,7 +72,7 @@ public function load(ObjectManager $manager): void
* @param \Shopsys\FrameworkBundle\Model\Country\CountryData $countryData
* @param string $referenceName
*/
protected function createCountry(CountryData $countryData, $referenceName): void
private function createCountry(CountryData $countryData, $referenceName): void
{
$country = $this->countryFacade->create($countryData);
$this->addReference($referenceName, $country);
Expand Down
15 changes: 3 additions & 12 deletions src/DataFixtures/Demo/CurrencyDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Doctrine\Common\Persistence\ObjectManager;
use Shopsys\FrameworkBundle\Component\DataFixture\AbstractReferenceFixture;
use Shopsys\FrameworkBundle\Component\Domain\Domain;
use Shopsys\FrameworkBundle\Model\Pricing\Currency\Currency;
use Shopsys\FrameworkBundle\Model\Pricing\Currency\CurrencyDataFactoryInterface;
use Shopsys\FrameworkBundle\Model\Pricing\Currency\CurrencyFacade;
Expand All @@ -19,31 +18,23 @@ class CurrencyDataFixture extends AbstractReferenceFixture
/**
* @var \Shopsys\FrameworkBundle\Model\Pricing\Currency\CurrencyFacade
*/
protected $currencyFacade;
private $currencyFacade;

/**
* @var \Shopsys\FrameworkBundle\Model\Pricing\Currency\CurrencyDataFactoryInterface
*/
protected $currencyDataFactory;

/**
* @var \Shopsys\FrameworkBundle\Component\Domain\Domain
*/
protected $domain;
private $currencyDataFactory;

/**
* @param \Shopsys\FrameworkBundle\Model\Pricing\Currency\CurrencyFacade $currencyFacade
* @param \Shopsys\FrameworkBundle\Model\Pricing\Currency\CurrencyDataFactoryInterface $currencyDataFactory
* @param \Shopsys\FrameworkBundle\Component\Domain\Domain $domain
*/
public function __construct(
CurrencyFacade $currencyFacade,
CurrencyDataFactoryInterface $currencyDataFactory,
Domain $domain
CurrencyDataFactoryInterface $currencyDataFactory
) {
$this->currencyFacade = $currencyFacade;
$this->currencyDataFactory = $currencyDataFactory;
$this->domain = $domain;
}

/**
Expand Down
Loading

0 comments on commit 5311d35

Please sign in to comment.