Skip to content

Commit 4279e3e

Browse files
author
roman
committed
MAGETWO-92163: Redundancy in Custom Option Filenames
1 parent cb15e60 commit 4279e3e

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidateFactory.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66

77
namespace Magento\Catalog\Model\Product\Option\Type\File;
88

9+
/**
10+
* Class ValidateFactory. Creates Validator with type "ExistingValidate"
11+
*/
912
class ValidateFactory
1013
{
1114
/**
15+
* Main factory method
16+
*
1217
* @return \Zend_Validate
1318
*/
1419
public function create()

app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Magento\Framework\App\ObjectManager;
1515

1616
/**
17+
* Validator class. Represents logic for validation file given from product option
18+
*
1719
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1820
*/
1921
class ValidatorFile extends Validator
@@ -70,6 +72,8 @@ class ValidatorFile extends Validator
7072
private $random;
7173

7274
/**
75+
* Constructor method
76+
*
7377
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
7478
* @param \Magento\Framework\Filesystem $filesystem
7579
* @param \Magento\Framework\File\Size $fileSize
@@ -96,6 +100,8 @@ public function __construct(
96100
}
97101

98102
/**
103+
* Setter method for the product
104+
*
99105
* @param Product $product
100106
* @return $this
101107
*/
@@ -106,6 +112,8 @@ public function setProduct(Product $product)
106112
}
107113

108114
/**
115+
* Validation method
116+
*
109117
* @param \Magento\Framework\DataObject $processingParams
110118
* @param \Magento\Catalog\Model\Product\Option $option
111119
* @return array
@@ -253,6 +261,8 @@ protected function initFilesystem()
253261
}
254262

255263
/**
264+
* Validate contents length method
265+
*
256266
* @return bool
257267
* @todo need correctly name
258268
*/

app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfo.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class ValidatorInfo extends Validator
3737
protected $fileRelativePath;
3838

3939
/**
40+
* Construct method
41+
*
4042
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
4143
* @param \Magento\Framework\Filesystem $filesystem
4244
* @param \Magento\Framework\File\Size $fileSize
@@ -56,6 +58,8 @@ public function __construct(
5658
}
5759

5860
/**
61+
* Setter method for property "useQuotePath"
62+
*
5963
* @param mixed $useQuotePath
6064
* @return $this
6165
*/
@@ -66,6 +70,8 @@ public function setUseQuotePath($useQuotePath)
6670
}
6771

6872
/**
73+
* Validate method for the option value depends on an option
74+
*
6975
* @param array $optionValue
7076
* @param \Magento\Catalog\Model\Product\Option $option
7177
* @return bool
@@ -112,6 +118,8 @@ public function validate($optionValue, $option)
112118
}
113119

114120
/**
121+
* Method for creation secret key for the given file
122+
*
115123
* @param string $fileRelativePath
116124
* @return string
117125
*/
@@ -121,6 +129,8 @@ protected function buildSecretKey($fileRelativePath)
121129
}
122130

123131
/**
132+
* Calculates path for the file
133+
*
124134
* @param array $optionValue
125135
* @return void
126136
*/

app/code/Magento/Sales/Model/Download.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Magento\Framework\App\Filesystem\DirectoryList;
99
use Magento\Framework\Exception\LocalizedException;
1010

11+
/**
12+
* Class Download. Represents download logic for files
13+
*/
1114
class Download
1215
{
1316
/**
@@ -36,6 +39,8 @@ class Download
3639
protected $rootDirBasePath;
3740

3841
/**
42+
* Constructor method
43+
*
3944
* @param \Magento\Framework\Filesystem $filesystem
4045
* @param \Magento\MediaStorage\Helper\File\Storage\Database $fileStorageDatabase
4146
* @param \Magento\MediaStorage\Model\File\Storage\DatabaseFactory $storageDatabaseFactory
@@ -84,6 +89,8 @@ public function downloadFile($info)
8489
}
8590

8691
/**
92+
* Method checks, if file can be returned depends on the given filepath
93+
*
8794
* @param string $relativePath
8895
* @return bool
8996
*/

app/code/Magento/Wishlist/Controller/Index/DownloadCustomOption.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use Magento\Framework\Controller\ResultFactory;
1212
use Magento\Framework\Serialize\Serializer\Json;
1313

14+
/**
15+
* Class DownloadCustomOption. Represents request-flow logic for option's file download
16+
*/
1417
class DownloadCustomOption extends \Magento\Wishlist\Controller\AbstractIndex
1518
{
1619
/**
@@ -26,6 +29,8 @@ class DownloadCustomOption extends \Magento\Wishlist\Controller\AbstractIndex
2629
private $json;
2730

2831
/**
32+
* Constructor method
33+
*
2934
* @param Action\Context $context
3035
* @param \Magento\Framework\App\Response\Http\FileFactory $fileResponseFactory
3136
* @param Json|null $json

0 commit comments

Comments
 (0)