MMCT TEAM
Server IP : 103.191.208.50  /  Your IP : 216.73.216.53
Web Server : LiteSpeed
System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64
User : celkcksm ( 1031)
PHP Version : 7.4.33
Disable Function : show_source, system, shell_exec, passthru, popen, exec
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/celkcksm/cms.ncriptech.com/vendor/twilio/sdk/src/Twilio/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/celkcksm/cms.ncriptech.com/vendor/twilio/sdk/src/Twilio/Serialize.php
<?php

namespace Twilio;

class Serialize {

    private static function flatten(array $map, array $result = [], array $previous = []): array {
        foreach ($map as $key => $value) {
            if (\is_array($value)) {
                $result = self::flatten($value, $result, \array_merge($previous, [$key]));
            } else {
                $result[\implode('.', \array_merge($previous, [$key]))] = $value;
            }
        }

        return $result;
    }

    public static function prefixedCollapsibleMap($map, string $prefix): array {
        if ($map === null || $map === Values::NONE) {
            return [];
        }

        $flattened = self::flatten($map);
        $result = [];
        foreach ($flattened as $key => $value) {
            $result[$prefix . '.' . $key] = $value;
        }

        return $result;
    }

    public static function iso8601Date($dateTime): string {
        if ($dateTime === null || $dateTime === Values::NONE) {
            return Values::NONE;
        }

        if (\is_string($dateTime)) {
            return $dateTime;
        }

        $utcDate = clone $dateTime;
        $utcDate->setTimezone(new \DateTimeZone('+0000'));
        return $utcDate->format('Y-m-d');
    }

    public static function iso8601DateTime($dateTime): string {
        if ($dateTime === null || $dateTime === Values::NONE) {
            return Values::NONE;
        }

        if (\is_string($dateTime)) {
            return $dateTime;
        }

        $utcDate = clone $dateTime;
        $utcDate->setTimezone(new \DateTimeZone('+0000'));
        return $utcDate->format('Y-m-d\TH:i:s\Z');
    }

    public static function booleanToString($boolOrStr) {
        if ($boolOrStr === null || \is_string($boolOrStr)) {
            return $boolOrStr;
        }

        return $boolOrStr ? 'true' : 'false';
    }

    public static function jsonObject($object) {
        if (\is_array($object)) {
            return \json_encode($object);
        }
        return $object;
    }

    public static function map($values, $map_func) {
        if (!\is_array($values)) {
            return $values;
        }
        return \array_map($map_func, $values);
    }

}

MMCT - 2023