Skip to content

Commit 2de0f4b

Browse files
committed
SDK-766: Use anonymous function instead of private callback method
1 parent 99d0d91 commit 2de0f4b

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/Yoti/Entity/MultiValue.php

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ private function applyFilters()
6060
if (count($this->filters) > 0) {
6161
$filtered_array = array_filter(
6262
$this->getArrayCopy(),
63-
[$this, 'filterItem']
63+
function ($item) {
64+
foreach ($this->filters as $callback) {
65+
if (call_user_func($callback, $item) === true) {
66+
return true;
67+
}
68+
}
69+
return false;
70+
}
6471
);
6572
$this->exchangeArray(array_values($filtered_array));
6673
}
@@ -75,22 +82,6 @@ private function applyFilters()
7582
}
7683
}
7784

78-
/**
79-
* Callback for array_filter().
80-
*
81-
* @param mixed $item
82-
* @return boolean
83-
*/
84-
private function filterItem($item)
85-
{
86-
foreach ($this->filters as $callback) {
87-
if (call_user_func($callback, $item) === true) {
88-
return true;
89-
}
90-
}
91-
return false;
92-
}
93-
9485
/**
9586
* Filter items by instance.
9687
*

0 commit comments

Comments
 (0)