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 /** * Reserved product attribute list * * Copyright Magento, Inc. All rights res..
Decoded Output download
<?php
/**
* Reserved product attribute list
*
* Copyright Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model\Product;
/**
* @api
* @since 100.0.2
*/
class ReservedAttributeList
{
/**
* @var string[]
*/
protected $_reservedAttributes;
/**
* @param string $productModel
* @param array $reservedAttributes
* @param array $allowedAttributes
*/
public function __construct($productModel, array $reservedAttributes = [], array $allowedAttributes = [])
{
$methods = get_class_methods($productModel);
foreach ($methods as $method) {
if (preg_match('/^get([A-Z]{1}.+)/', $method, $matches)) {
$method = $matches[1];
$tmp = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $method));
$reservedAttributes[] = $tmp;
}
}
$this->_reservedAttributes = array_diff($reservedAttributes, $allowedAttributes);
}
/**
* Check whether attribute reserved or not
*
* @param \Magento\Catalog\Model\Entity\Attribute $attribute
* @return boolean
*/
public function isReservedAttribute($attribute)
{
return $attribute->getIsUserDefined() && in_array($attribute->getAttributeCode(), $this->_reservedAttributes);
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* Reserved product attribute list
*
* Copyright Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model\Product;
/**
* @api
* @since 100.0.2
*/
class ReservedAttributeList
{
/**
* @var string[]
*/
protected $_reservedAttributes;
/**
* @param string $productModel
* @param array $reservedAttributes
* @param array $allowedAttributes
*/
public function __construct($productModel, array $reservedAttributes = [], array $allowedAttributes = [])
{
$methods = get_class_methods($productModel);
foreach ($methods as $method) {
if (preg_match('/^get([A-Z]{1}.+)/', $method, $matches)) {
$method = $matches[1];
$tmp = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $method));
$reservedAttributes[] = $tmp;
}
}
$this->_reservedAttributes = array_diff($reservedAttributes, $allowedAttributes);
}
/**
* Check whether attribute reserved or not
*
* @param \Magento\Catalog\Model\Entity\Attribute $attribute
* @return boolean
*/
public function isReservedAttribute($attribute)
{
return $attribute->getIsUserDefined() && in_array($attribute->getAttributeCode(), $this->_reservedAttributes);
}
}
Function Calls
None |
Stats
MD5 | f3a06febb2a59668226b8e99b8288707 |
Eval Count | 0 |
Decode Time | 103 ms |