File Processor.php
has 815 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace HiPay\Wallet\Mirakl\Vendor;
use DateTime;
Method transferFiles
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transferFiles(array $shopIds, $tmpFilePath)
{
if (count($shopIds) > 0) {
// Fetches all Mirakl file names
$allMiraklFiles = array();
Function transferFiles
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function transferFiles(array $shopIds, $tmpFilePath)
{
if (count($shopIds) > 0) {
// Fetches all Mirakl file names
$allMiraklFiles = array();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Processor
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class Processor extends AbstractApiProcessor
{
/** @var VendorManagerInterface */
protected $vendorManager;
Method registerWallets
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function registerWallets($miraklData)
{
$vendorCollection = array();
foreach ($miraklData as $vendorData) {
Method handleBankInfo
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleBankInfo($vendorCollection, $miraklDataCollection, $tmpFilePath)
{
//Index mirakl Data
$miraklDataCollection = $this->indexMiraklData($miraklDataCollection);
Function registerWallets
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function registerWallets($miraklData)
{
$vendorCollection = array();
foreach ($miraklData as $vendorData) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method process
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process($tmpFilesPath, DateTime $lastUpdate = null)
{
try {
$this->logger->info('Control Mirakl Settings', array('miraklId' => null, "action" => "Wallet creation"));
Function handleBankInfo
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function handleBankInfo($vendorCollection, $miraklDataCollection, $tmpFilePath)
{
//Index mirakl Data
$miraklDataCollection = $this->indexMiraklData($miraklDataCollection);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getFileBack
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getFileBack($fileType, $allMiraklFiles, $frontFile, $shopId, $tmpFilePath)
{
try {
$backType = $this->getFileBackType($fileType);
Method logVendor
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
$miraklId,
$hipayId,
$login,
$statusWalletAccount,
$status,
Method createVendor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function createVendor(
$email,
$walletId,
$walletSpaceId,
$identified,
Method createVendor
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
$email,
$walletId,
$walletSpaceId,
$identified,
$miraklId,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
EventDispatcherInterface $dispatcherInterface,
LoggerInterface $logger,
ApiFactory $factory,
VendorManagerInterface $vendorManager,
DocumentManagerInterface $documentManager,
Function disableVendor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function disableVendor($vendorData)
{
$vendor = $this->vendorManager->findByMiraklId($vendorData['shop_id']);
$logVendor = $this->logVendorManager->findByMiraklId($vendorData['shop_id']);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getFileBack
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function getFileBack($fileType, $allMiraklFiles, $frontFile, $shopId, $tmpFilePath)
Avoid too many return
statements within this method. Open
return $document->getDocumentType() == $theFile['type'] &&
$document->getMiraklDocumentId() == $theFile['id'];
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($boolControl === false) {
// log critical
$title = $this->criticalMessageMiraklSettings;
$message = $this->formatNotification->formatMessage($title);
$this->logger->critical($message, array('miraklId' => null, "action" => "Wallet creation"));
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 95.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function addBankInformation($vendor, $miraklBankInfo, $checkBankStatus = false)
{
if ($checkBankStatus) {
$bankInfoStatus = $this->getBankInfoStatus($vendor);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 92.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function isBankInfoUsable(VendorInterface $vendor, $miraklBankInfo, $checkBankStatus = false)
{
if ($checkBankStatus) {
$bankInfoStatus = $this->getBankInfoStatus($vendor);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 92.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76