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.
*/
namespace Magento\Backend\Model\Widget\Grid;
/**
* @api
* @since 100.0.2
*/
class Parser
{
/**
* List of allowed operations
*
* @var string[]
*/
protected $_operations = ['-', '+', '/', '*'];
/**
* Parse expression
*
* @param string $expression
* @return array
*/
public function parseExpression($expression)
{
$stack = [];
$expression = $expression ? trim($expression) : '';
foreach ($this->_operations as $operation) {
$splittedExpr = preg_split('/\' . $operation . '/', $expression, -1, PREG_SPLIT_DELIM_CAPTURE);
$count = count($splittedExpr);
if ($count > 1) {
for ($i = 0; $i < $count; $i++) {
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
$stack = array_merge($stack, $this->parseExpression($splittedExpr[$i]));
if ($i > 0) {
$stack[] = $operation;
}
}
break;
}
}
return empty($stack) ? [$expression] : $stack;
}
/**
* Check if string is operation
*
* @param string $operation
* @return bool
*/
public function isOperation($operation)
{
return in_array($operation, $this->_operations);
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* Copyright Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Backend\Model\Widget\Grid;
/**
* @api
* @since 100.0.2
*/
class Parser
{
/**
* List of allowed operations
*
* @var string[]
*/
protected $_operations = ['-', '+', '/', '*'];
/**
* Parse expression
*
* @param string $expression
* @return array
*/
public function parseExpression($expression)
{
$stack = [];
$expression = $expression ? trim($expression) : '';
foreach ($this->_operations as $operation) {
$splittedExpr = preg_split('/\\' . $operation . '/', $expression, -1, PREG_SPLIT_DELIM_CAPTURE);
$count = count($splittedExpr);
if ($count > 1) {
for ($i = 0; $i < $count; $i++) {
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
$stack = array_merge($stack, $this->parseExpression($splittedExpr[$i]));
if ($i > 0) {
$stack[] = $operation;
}
}
break;
}
}
return empty($stack) ? [$expression] : $stack;
}
/**
* Check if string is operation
*
* @param string $operation
* @return bool
*/
public function isOperation($operation)
{
return in_array($operation, $this->_operations);
}
}
Function Calls
| None |
Stats
| MD5 | d24b933a438bbb8ddb0a461bede6a228 |
| Eval Count | 0 |
| Decode Time | 104 ms |