Skip to content

Commit

Permalink
Merge pull request #38 from ho-nl/revert-37-revert-36-STEUN-409
Browse files Browse the repository at this point in the history
feat(STEUN-409): change php requirements
  • Loading branch information
wimvdputten authored Jun 20, 2023
2 parents 0f91b7e + f533fdf commit 54e210e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
"name": "honl/magento2-import",
"description": "",
"require": {
"php": "~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0",
"php": "~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.2",
"guzzlehttp/guzzle": "^7",
"prewk/xml-string-streamer": "^1.2",
"prewk/xml-string-streamer-guzzle": "^1.2",
"kevinrob/guzzle-cache-middleware": "^4",
"ecomdev/magento-psr6-bridge": "^0.2.1",
"symfony/stopwatch": "~4.0",
"symfony/stopwatch": "^v6.2",
"bakame/psr7-csv-factory": "^1.0@dev",
"league/csv": "^9.1",
"monolog/monolog": "^2.8"
"monolog/monolog": "^2.8",
"ext-mbstring": "*"
},
"type": "magento2-module",
"autoload": {
Expand Down
9 changes: 5 additions & 4 deletions src/Console/Command/CronScheduleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function configure()
*
* @throws \Magento\Framework\Exception\AlreadyExistsException
*
* @return void
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -100,7 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

if (! $job) {
$output->writeln("<error>".((string) new Phrase("Job not found"))."</error>");
return;
return 0;
}


Expand All @@ -109,7 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(
(string) new Phrase("Job is already %1", ["<error>".$existingJob->getStatus()."</error>"])
);
return;
return 0;
}

try {
Expand All @@ -121,7 +121,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
[$ahead]
)
."</error>");
return;
return 0;
}

$jobSchedule = $this->generateSchedule($job, $ahead);
Expand All @@ -130,6 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$jobSchedule->getResource()->save($jobSchedule);
$output->writeln("<info>".((string) new Phrase("Job scheduled"))."</info>");
return 0;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Console/Command/HoImportRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function configure()
* @param InputInterface $input
* @param OutputInterface $output
*
* @return void
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -104,11 +104,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!isset($profiles[$profile])) {
$profileList = implode(", ", array_keys($profiles));
$output->writeln((string) new Phrase("<error>Profile not in profilelist: %1</error>", [$profileList]));
return;
return 0;
}

$profileInstance = $profiles[$profile];
$profileInstance->run();
return 0;
}


Expand Down
2 changes: 1 addition & 1 deletion src/RowModifier/ExternalCategoryManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,6 @@ private function extractCategoriesFromString($categories)
{
return array_filter(array_map(function ($category) {
return trim($category, " \t\n\r\0\x0B/");
}, explode(',', trim($categories, " \t\n\r\0\x0B/"))));
}, explode(',', trim($categories ?? '', " \t\n\r\0\x0B/"))));
}
}
7 changes: 6 additions & 1 deletion src/Streamer/FileCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getIterator()
$csvReader->setDelimiter($this->delimiter);
}
foreach ($csvReader->getIterator() as $row) {
yield (empty($this->headers) ? $row : \array_combine($this->headers, \array_map('utf8_encode', $row)));
yield (empty($this->headers) ? $row : \array_combine($this->headers, \array_map(self::class . '::convert_encoding', $row)));
}
}

Expand All @@ -112,4 +112,9 @@ private function getRequestFile(): string
? $this->requestFile
: $this->directoryList->getRoot() . '/' . trim($this->requestFile, '/');
}

public function convert_encoding($row)
{
return mb_convert_encoding($row, 'UTF-8', 'ISO-8859-1');
}
}

0 comments on commit 54e210e

Please sign in to comment.