Neos\Flow\ObjectManagement\Proxy\ProxyMethod::buildArraySetupCode PHP Метод

buildArraySetupCode() защищенный Метод

Builds a string containing PHP code to build the array given as input.
protected buildArraySetupCode ( array $array ) : string
$array array
Результат string e.g. 'array()' or 'array(1 => 'bar')
    protected function buildArraySetupCode(array $array)
    {
        $code = 'array(';
        foreach ($array as $key => $value) {
            $code .= is_string($key) ? "'" . $key . "'" : $key;
            $code .= ' => ';
            if ($value === null) {
                $code .= 'NULL';
            } elseif (is_bool($value)) {
                $code .= $value ? 'TRUE' : 'FALSE';
            } elseif (is_numeric($value)) {
                $code .= $value;
            } elseif (is_string($value)) {
                $code .= "'" . $value . "'";
            }
            $code .= ', ';
        }
        return rtrim($code, ', ') . ')';
    }