Skip to content

Commit

Permalink
Fix type check (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
smaeda-ks authored Sep 6, 2021
1 parent 57d87e2 commit 410489b
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Block/Cache/Additional.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct(
*/
public function canShowBlock()
{
if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
if ($this->config->getType() === Config::FASTLY && $this->config->isEnabled()) {
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/FastlyCdn/Purge/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(
public function execute()
{
try {
if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
if ($this->config->getType() === Config::FASTLY && $this->config->isEnabled()) {
// check if content type is given
$contentType = $this->getRequest()->getParam('content_types', false);
if (!$contentType) {
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/FastlyCdn/Purge/Quick.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __construct(
public function execute()
{
try {
if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
if ($this->config->getType() === Config::FASTLY && $this->config->isEnabled()) {
// check if url is given
$url = $this->getRequest()->getParam('quick_purge_url', false);

Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/FastlyCdn/Purge/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct(
public function execute()
{
try {
if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
if ($this->config->getType() === Config::FASTLY && $this->config->isEnabled()) {
// check if store exists
$storeId = $this->getRequest()->getParam('stores', false);
/** @var \Magento\Store\Model\Store $store */
Expand Down
2 changes: 1 addition & 1 deletion Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public function __construct(
*/
public function isFastlyEnabled()
{
if ($this->getType() == Config::FASTLY) {
if ($this->getType() === Config::FASTLY) {
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions Model/Layout/LayoutPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function afterGenerateElements(\Magento\Framework\View\Layout $subject)
{
// if subject is cacheable, FPC cache is enabled, Fastly module is chosen and general TTL is > 0
if ($subject->isCacheable() && $this->config->isEnabled()
&& $this->config->getType() == Config::FASTLY && $this->config->getTtl()) {
&& $this->config->getType() === Config::FASTLY && $this->config->getTtl()) {
// get cache control header
$header = $this->response->getHeader('cache-control');
if (($header instanceof \Zend\Http\Header\HeaderInterface) && ($value = $header->getFieldValue())) {
Expand Down Expand Up @@ -107,7 +107,7 @@ public function afterGenerateElements(\Magento\Framework\View\Layout $subject)
*/
public function afterGetOutput(\Magento\Framework\View\Layout $subject, $result) // @codingStandardsIgnoreLine - unused parameter
{
if ($this->config->getType() == Config::FASTLY) {
if ($this->config->getType() === Config::FASTLY) {
$this->response->setHeader("Fastly-Module-Enabled", "1.2.166", true);
}

Expand Down
2 changes: 1 addition & 1 deletion Model/PageCache/ConfigPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function aroundGetType(Config $config, callable $proceed)
if ($this->_scopeConfig->getValue(Config::XML_PAGECACHE_TYPE) === 'fastly') {
$result = \Fastly\Cdn\Model\Config::FASTLY;
} else {
$result = $proceed();
$result = (int)$proceed();
}
return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion Observer/FlushAllCacheObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function __construct(Config $config, PurgeCache $purgeCache)
*/
public function execute(\Magento\Framework\Event\Observer $observer) // @codingStandardsIgnoreLine - unused parameter
{
if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
if ($this->config->getType() === Config::FASTLY && $this->config->isEnabled()) {
$this->purgeCache->sendPurgeRequest();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Observer/InvalidateVarnishObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct(
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
if ($this->config->getType() === Config::FASTLY && $this->config->isEnabled()) {
$object = $observer->getEvent()->getObject();

if ($object instanceof \Magento\Framework\DataObject\IdentityInterface && $this->canPurgeObject($object)) {
Expand Down

0 comments on commit 410489b

Please sign in to comment.