Action/Api/Signer.php
private static function getParamsToSign(
        array $params,
        array $ignoreParamKeys = [],
        int $currentLevel = 1,
        string $prefix = ''
    ): array
    {
        $paramsToSign = [];
        foreach ($params as $key => $value) {
            if ((in_array($key, $ignoreParamKeys) && $currentLevel == 1)) {
                continue;
            }
            $paramKey = ($prefix ? $prefix . ':' : '') . $key;
            if (is_array($value)) {
                if ($currentLevel >= self::MAXIMUM_RECURSION_DEPTH) {
                    $paramsToSign[$paramKey] = (string)$paramKey.':';
                } else {
                    $subArray = self::getParamsToSign($value, $ignoreParamKeys, $currentLevel + 1, $paramKey);
                    $paramsToSign = array_merge($paramsToSign, $subArray);
                }
            } else {
                if (is_bool($value)) {
                    $value = $value ? '1' : '0';
                } else {
                    $value = (string)$value;
                }
                $paramsToSign[$paramKey] = (string)$paramKey.':'.$value;
            }
        }
        if ($currentLevel == 1) {
            ksort($paramsToSign, SORT_NATURAL);
        }
        return $paramsToSign;
    }
private static function getParamsToSign(
        array $params,
        array $ignoreParamKeys = [],
        int $currentLevel = 1,
        string $prefix = ''
    ): array
    {
        $paramsToSign = [];
        foreach ($params as $key => $value) {
            if ((in_array($key, $ignoreParamKeys) && $currentLevel == 1)) {
                continue;
            }
            $paramKey = ($prefix ? $prefix . ':' : '') . $key;
            if (is_array($value)) {
                if ($currentLevel >= self::MAXIMUM_RECURSION_DEPTH) {
                    $paramsToSign[$paramKey] = (string)$paramKey.':';
                } else {
                    $subArray = self::getParamsToSign($value, $ignoreParamKeys, $currentLevel + 1, $paramKey);
                    $paramsToSign = array_merge($paramsToSign, $subArray);
                }
            } else {
                if (is_bool($value)) {
                    $value = $value ? '1' : '0';
                } else {
                    $value = (string)$value;
                }
                $paramsToSign[$paramKey] = (string)$paramKey.':'.$value;
            }
        }
        if ($currentLevel == 1) {
            ksort($paramsToSign, SORT_NATURAL);
        }
        return $paramsToSign;
    }
private static function getParamsToSign ( array $ params , array $ ignoreParamKeys = [ ] , int $ currentLevel = 1 , string $ prefix = '' ) : array { $ paramsToSign = [ ] ; foreach ( $ params as $ key => $ value ) { if ( ( in_array ( $ key , $ ignoreParamKeys ) && $ currentLevel == 1 ) ) { continue ; } $ paramKey = ( $ prefix ? $ prefix . ':' : '' ) . $ key ; if ( is_array ( $ value ) ) { if ( $ currentLevel >= self :: MAXIMUM_RECURSION_DEPTH ) { $ paramsToSign [ $ paramKey ] = ( string ) $ paramKey . ':' ; } else { $ subArray = self :: getParamsToSign ( $ value , $ ignoreParamKeys , $ currentLevel + 1 , $ paramKey ) ; $ paramsToSign = array_merge ( $ paramsToSign , $ subArray ) ; } } else { if ( is_bool ( $ value ) ) { $ value = $ value ? '1' : '0' ; } else { $ value = ( string ) $ value ; } $ paramsToSign [ $ paramKey ] = ( string ) $ paramKey . ':' . $ value ; } } if ( $ currentLevel == 1 ) { ksort ( $ paramsToSign , SORT_NATURAL ) ; } return $ paramsToSign ; }
Get parameters to sign
@param array $params
@param array $ignoreParamKeys
@param int $currentLevel
@param string $prefix
@return array
Get parameters to sign