![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/framework/Filter/Template/Tokenizer/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\Filter\Template\Tokenizer; /** * Template constructions parameters tokenizer */ class Parameter extends \Magento\Framework\Filter\Template\Tokenizer\AbstractTokenizer { /** * Tokenize string and return getted parameters * * @return array */ public function tokenize() { $parameters = []; $parameterName = ''; do { if ($this->isWhiteSpace()) { continue; } if ($this->char() !== '=') { $parameterName .= $this->char(); } else { $parameters[$parameterName] = $this->getValue(); $parameterName = ''; } } while ($this->next()); return $parameters; } /** * Get string value in parameters through tokenize * * @return string * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function getValue() { $this->next(); $value = ''; if ($this->isWhiteSpace()) { return $value; } $quoteStart = $this->char() == "'" || $this->char() == '"'; if ($quoteStart) { $breakSymbol = $this->char(); } else { $breakSymbol = false; $value .= $this->char(); } while ($this->next()) { if (!$breakSymbol && $this->isWhiteSpace()) { break; } elseif ($breakSymbol && $this->char() == $breakSymbol) { break; } elseif ($this->char() == '\\') { $this->next(); if ($this->char() != '\\') { $value .= '\\'; } $value .= $this->char(); } else { $value .= $this->char(); } } return $value; } }