Skip to content

Commit

Permalink
Authorizator: Add new method getUnmatchedTransactions() for finding n…
Browse files Browse the repository at this point in the history
…ew unknown variables.
  • Loading branch information
janbarasek authored Aug 6, 2020
1 parent e53a9c0 commit 8737262
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/BaseAuthorizator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,28 @@ public function authOrders(array $unauthorizedVariables, callable $callback, str
}
}
}
}


/**
* @param int[] $validVariables
* @return Transaction[]
*/
public function getUnmatchedTransactions(array $validVariables): array
{
$return = [];
foreach ($this->getTransactions() as $transaction) {
$matched = false;
foreach ($validVariables as $currentVariable) {
if ($transaction->isVariableSymbol($currentVariable) === true) {
$matched = true;
break;
}
}
if ($matched === false) {
$return[] = $transaction;
}
}

return $return;
}
}

0 comments on commit 8737262

Please sign in to comment.