Private/Helpers.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function Get-PSClassCyclicErrorMessage
{
    param (
        [Parameter(Mandatory=$true)]
        [string[]]
        $Links
    )

    # get middle length
    $length = [int](($Links | Measure-Object -Property Length -Minimum).Minimum * 0.5) - 1
    $space = [string]::new(' ', $length)

    # build the separator
    $separator = "`n$($space)$(@('|', 'V') -join "`n$($space)")`n"

    # build and return the sting
    return ($Links -join $separator)
}