Differential D15500 Diff 37368 src/applications/diffusion/conduit/DiffusionQueryPathsConduitAPIMethod.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/conduit/DiffusionQueryPathsConduitAPIMethod.php
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | final class DiffusionQueryPathsConduitAPIMethod | ||||
} | } | ||||
protected function filterResults($lines, ConduitAPIRequest $request) { | protected function filterResults($lines, ConduitAPIRequest $request) { | ||||
$pattern = $request->getValue('pattern'); | $pattern = $request->getValue('pattern'); | ||||
$limit = (int)$request->getValue('limit'); | $limit = (int)$request->getValue('limit'); | ||||
$offset = (int)$request->getValue('offset'); | $offset = (int)$request->getValue('offset'); | ||||
if (strlen($pattern)) { | if (strlen($pattern)) { | ||||
$pattern = '/'.preg_quote($pattern, '/').'/'; | // Add delimiters to the regex pattern. | ||||
$pattern = '('.$pattern.')'; | |||||
} | } | ||||
$results = array(); | $results = array(); | ||||
$count = 0; | $count = 0; | ||||
foreach ($lines as $line) { | foreach ($lines as $line) { | ||||
if (strlen($pattern) && !preg_match($pattern, $line)) { | if (strlen($pattern) && !preg_match($pattern, $line)) { | ||||
continue; | continue; | ||||
} | } | ||||
Show All 13 Lines |