Skip to content

Commit

Permalink
fix bug with not isset element
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew committed Sep 18, 2024
1 parent a3fa241 commit 32f9ad7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Console/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Commands extends Command
/**
* @var QuoteFactory
*/
protected $quoteFactory;
protected QuoteFactory $quoteFactory;

/**
* @var GetOrdersList
Expand Down
31 changes: 18 additions & 13 deletions Provider/ConfigurationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ class ConfigurationProvider
*/
public function __construct(
ScopeConfigInterface $scopeConfig,
FrameworkDateTime $dateTime,
Json $json
) {
FrameworkDateTime $dateTime,
Json $json
)
{
$this->scopeConfig = $scopeConfig;
$this->dateTime = $dateTime;
$this->_json = $json;
Expand Down Expand Up @@ -124,7 +125,7 @@ public function getIsQwqerParcelEnabled(): bool
*/
public function getParcelSize(): string
{
return (string) $this->scopeConfig->getValue(
return (string)$this->scopeConfig->getValue(
self::API_PARCEL_SIZE,
ScopeInterface::SCOPE_STORE
);
Expand All @@ -137,7 +138,7 @@ public function getParcelSize(): string
*/
public function getAPIBaseUrl(): string
{
return (string) $this->scopeConfig->getValue(
return (string)$this->scopeConfig->getValue(
self::API_BASE_URL_PATH,
ScopeInterface::SCOPE_STORE
);
Expand All @@ -150,7 +151,7 @@ public function getAPIBaseUrl(): string
*/
public function getApiBearerToken(): string
{
return (string) $this->scopeConfig->getValue(
return (string)$this->scopeConfig->getValue(
self::API_BEARER_TOKEN,
ScopeInterface::SCOPE_STORE
);
Expand All @@ -163,7 +164,7 @@ public function getApiBearerToken(): string
*/
public function getTradingPointId(): string
{
return (string) $this->scopeConfig->getValue(
return (string)$this->scopeConfig->getValue(
self::API_TRADING_POINT_ID,
ScopeInterface::SCOPE_STORE
);
Expand All @@ -186,7 +187,7 @@ public function getTradingPointUrl(): string
*/
public function getCategory(): string
{
return (string) $this->scopeConfig->getValue(
return (string)$this->scopeConfig->getValue(
self::API_CATEGORY,
ScopeInterface::SCOPE_STORE
);
Expand All @@ -199,7 +200,7 @@ public function getCategory(): string
*/
public function getStoreAddress(): string
{
return (string) $this->scopeConfig->getValue(
return (string)$this->scopeConfig->getValue(
self::API_STORE_ADDRESS,
ScopeInterface::SCOPE_STORE
);
Expand All @@ -211,7 +212,7 @@ public function getStoreAddress(): string
*/
public function getStoreConfig($path): string
{
return (string) $this->scopeConfig->getValue(
return (string)$this->scopeConfig->getValue(
$path,
ScopeInterface::SCOPE_STORE
);
Expand Down Expand Up @@ -329,15 +330,19 @@ public function checkWorkingHours(): bool
return true;
}
$workingHoursArray = $this->_json->unserialize($workingHoursConfig);
if(!is_array($workingHoursArray) || empty($workingHoursArray)) {
if (!is_array($workingHoursArray) || empty($workingHoursArray)) {
return true;
}
$days = ['Sunday','Monday', 'Tuesday', 'Wednesday','Thursday','Friday','Saturday'];
$days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
$today = $this->dateTime->date('N') * 1;
$dayOfWeek = $days[$today];
$isOpen = false;
foreach ($workingHoursArray as $workingHour) {
if($workingHour['day_of_week'] == $dayOfWeek) {
if (isset($workingHour['day_of_week'])
&& $workingHour['day_of_week'] == $dayOfWeek
&& isset($workingHour['time_from'])
&& isset($workingHour['time_to'])
) {
$dateTime = new \DateTime();
$startTimeObj = $dateTime::createFromFormat('H:i', $workingHour['time_from']);
$endTimeObj = $dateTime->createFromFormat('H:i', $workingHour['time_to']);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"magento/module-store": "101.0.*"
},
"type": "magento2-module",
"version": "1.0.8",
"version": "1.0.9",
"autoload": {
"files": [
"registration.php"
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Qwqer_Express" setup_version="1.0.8">
<module name="Qwqer_Express" setup_version="1.0.9">
<sequence>
<module name="Magento_Checkout"/>
<module name="Magento_Webapi" />
Expand Down

0 comments on commit 32f9ad7

Please sign in to comment.