public/Get-TeamForm.ps1
function Get-TeamForm { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [Object]$FixtureList, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [Object]$PredictionObject, [Parameter(Mandatory=$false)] [ValidateNotNullOrEmpty()] [string]$Team ) process{ $NewObjects =@() foreach ($Object in $PredictionObject) { if ($($PSBoundParameters.ContainsKey('Team'))) { $FixtureTeams = $Team } else { $FixtureTeams = $($PredictionObject.FixtureName).Split(' vs ') } foreach ($FixtureTeam in $FixtureTeams) { $NewObjects += $FixtureList | Where-Object {$_.name -like "$FixtureTeam vs*" -or $_.name -like "*vs $FixtureTeam"} } } return $NewObjects } # process } # function |