Skip to content

Commit 30244d3

Browse files
committed
Make all private fields/methods protected to provide better expandability
1 parent 2067634 commit 30244d3

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/Storage/LocalStorage.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ class LocalStorage implements StorageInterface
1111
/**
1212
* @var string
1313
*/
14-
private $absolutePath;
14+
protected $absolutePath;
1515
/**
1616
* @var string
1717
*/
18-
private $baseUrl;
18+
protected $baseUrl;
1919

2020
/**
2121
* LocalStorage constructor.
@@ -156,7 +156,7 @@ public function removeAttachment(AttachmentInterface $attachment): void {
156156
* @param AttachmentInterface $attachment
157157
* @return string
158158
*/
159-
private function getAttachmentFileName(AttachmentInterface $attachment): ?string {
159+
protected function getAttachmentFileName(AttachmentInterface $attachment): ?string {
160160
$ext = trim($attachment->getExtension());
161161
$slug = trim($attachment->getSlug());
162162

@@ -175,7 +175,7 @@ private function getAttachmentFileName(AttachmentInterface $attachment): ?string
175175
* @param string $path
176176
* @param AttachmentInterface $attachment
177177
*/
178-
private function updateAttachmentInfo(string $path, AttachmentInterface $attachment): void {
178+
protected function updateAttachmentInfo(string $path, AttachmentInterface $attachment): void {
179179
$attachment->setFileSize((int)filesize($path));
180180
$attachment->setMimeType(mime_content_type($path));
181181
$attachment->setStorageIdentifier($this->getStorageIdentifier());

src/StorageRegistry/StorageRegistry.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
class StorageRegistry
99
{
1010
/** @var StorageInterface[] */
11-
private $registeredStorageServicesByClass = [];
11+
protected $registeredStorageServicesByClass = [];
1212

1313
/** @var StorageInterface[] */
14-
private $registeredStorageServicesByIdentifiers = [];
14+
protected $registeredStorageServicesByIdentifiers = [];
1515

1616
/** @var StorageInterface|null */
17-
private $defaultStorage;
17+
protected $defaultStorage;
1818

1919
/**
2020
* @param StorageInterface $storage

src/Uploader/AttachmentUploader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
class AttachmentUploader
2020
{
2121
/** @var StorageRegistry */
22-
private $storageRegistry;
22+
protected $storageRegistry;
2323

2424
/** @var string */
25-
private $entityClass;
25+
protected $entityClass;
2626

2727
/** @var ExtensionSuggester */
28-
private $extensionSuggester;
28+
protected $extensionSuggester;
2929

3030
/** @var SlugGeneratorInterface */
31-
private $slugGenerator;
31+
protected $slugGenerator;
3232

3333
/** @var DownloaderInterface */
34-
private $downloader;
34+
protected $downloader;
3535

3636
/**
3737
* AttachmentRepository constructor.

src/Utils/SlugGenerator/SampleSlugGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class SampleSlugGenerator implements SlugGeneratorInterface
1313
public const MAX_DUPLICATION_CHECKS = 10;
1414

1515
/** @var ObjectRepository */
16-
private $repository;
16+
protected $repository;
1717

1818
/** @var int */
19-
private $slugLength;
19+
protected $slugLength;
2020

2121
/** @var string */
22-
private $slugColumn;
22+
protected $slugColumn;
2323

2424
/**
2525
* SampleSlugGenerator constructor.
@@ -61,7 +61,7 @@ public function generate(?AttachmentInterface $attachment = null): ?string {
6161
* @return string
6262
* @throws SlugGeneratorException
6363
*/
64-
private function randomAlphanumericString($length): string {
64+
protected function randomAlphanumericString($length): string {
6565
$allowedCharacters = '0123456789abcdefghijklmnopqrstuvwxyz';
6666
$repeats = max(ceil($length / strlen($allowedCharacters)), 1);
6767
$str = substr(str_shuffle(str_repeat($allowedCharacters, $repeats)), 0, $length);

0 commit comments

Comments
 (0)