Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /** * Copyright Magento, Inc. All rights reserved. * See COPYING.txt for license ..
Decoded Output download
<?php
/**
* Copyright Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\Catalog\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
/**
* Set value for Special Price start date
*/
class SetSpecialPriceStartDate implements ObserverInterface
{
/**
* @var TimezoneInterface
*/
private $localeDate;
/**
* @param TimezoneInterface $localeDate
*/
public function __construct(TimezoneInterface $localeDate)
{
$this->localeDate = $localeDate;
}
/**
* Set the current date to Special Price From attribute if it's empty.
*
* @param \Magento\Framework\Event\Observer $observer
* @return $this
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
/** @var $product \Magento\Catalog\Model\Product */
$product = $observer->getEvent()->getProduct();
if ($product->getSpecialPrice() && $product->getSpecialFromDate() === null) {
$product->setData('special_from_date', $this->localeDate->date()->setTime(0, 0));
}
return $this;
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* Copyright Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\Catalog\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
/**
* Set value for Special Price start date
*/
class SetSpecialPriceStartDate implements ObserverInterface
{
/**
* @var TimezoneInterface
*/
private $localeDate;
/**
* @param TimezoneInterface $localeDate
*/
public function __construct(TimezoneInterface $localeDate)
{
$this->localeDate = $localeDate;
}
/**
* Set the current date to Special Price From attribute if it's empty.
*
* @param \Magento\Framework\Event\Observer $observer
* @return $this
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
/** @var $product \Magento\Catalog\Model\Product */
$product = $observer->getEvent()->getProduct();
if ($product->getSpecialPrice() && $product->getSpecialFromDate() === null) {
$product->setData('special_from_date', $this->localeDate->date()->setTime(0, 0));
}
return $this;
}
}
Function Calls
None |
Stats
MD5 | 4e8470dc93b22c7a5cb94517fe2c62a9 |
Eval Count | 0 |
Decode Time | 77 ms |