![]() 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/mautic.corals.io/app/bundles/CoreBundle/Helper/ListParser/ |
<?php namespace Mautic\CoreBundle\Helper\ListParser; use Mautic\CoreBundle\Helper\ListParser\Exception\FormatNotSupportedException; class ArrayListParser implements ListParserInterface { public function parse($list): array { if (!is_array($list)) { throw new FormatNotSupportedException(); } if ( array_key_exists(0, $list) && !is_array($list[0]) && array_keys($list) === range(0, count($list) - 1) ) { $choices = []; // Numerical array so set labels as values and return as choices foreach ($list as $value) { if ('' === $value || null === $value) { continue; } $choices[trim(html_entity_decode($value, ENT_QUOTES))] = trim(html_entity_decode($value, ENT_QUOTES)); } return $choices; } return $list; } }