CodeExplorer readjust example
$result =
[];
foreach ($snippets as $setId =>
$set) { foreach ($set['snippets'
] as $translationKey =>
$snippet) { if (mb_strpos((string) $snippet['author'
], 'user/'
) !== 0
) { continue;
} $result[$setId]['snippets'
][$translationKey] =
$snippet;
} } return $this->
readjust($result,
$snippets);
}} $result =
[];
foreach ($snippets as $setId =>
$set) { foreach ($set['snippets'
] as $translationKey =>
$snippet) { if (!\
in_array($snippet['author'
],
$requestFilterValue, true
)) { continue;
} $result[$setId]['snippets'
][$translationKey] =
$snippet;
} } return $this->
readjust($result,
$snippets);
}} $result =
[];
foreach ($snippets as $setId =>
$set) { foreach ($set['snippets'
] as $translationKey =>
$snippet) { if (!\
in_array($translationKey,
$requestFilterValue, true
)) { continue;
} $result[$setId]['snippets'
][$translationKey] =
$snippet;
} } return $this->
readjust($result,
$snippets);
}} $result =
[];
foreach ($snippets as $setId =>
$set) { foreach ($set['snippets'
] as $translationKey =>
$snippet) { if (!
empty($snippet['value'
])) { continue;
} $result[$setId]['snippets'
][$translationKey] =
$snippet;
} } return $this->
readjust($result,
$snippets);
}} foreach ($requestFilterValue as $term) { foreach ($snippets as $setId =>
$set) { foreach ($set['snippets'
] as $translationKey =>
$snippet) { if (!
fnmatch(sprintf('%s*',
(string) $term),
$snippet['translationKey'
], \FNM_CASEFOLD
)) { continue;
} $result[$setId]['snippets'
][$translationKey] =
$snippet;
} } } return $this->
readjust($result,
$snippets);
}} $term =
sprintf('*%s*',
$requestFilterValue);
$keyMatch =
fnmatch($term,
$snippet['translationKey'
], \FNM_CASEFOLD
);
$valueMatch =
fnmatch($term,
$snippet['value'
], \FNM_CASEFOLD
);
if (!
$keyMatch && !
$valueMatch) { continue;
} $result[$setId]['snippets'
][$translationKey] =
$snippet;
} } return $this->
readjust($result,
$snippets);
}} $result =
[];
foreach ($snippets as $setId =>
$set) { foreach ($set['snippets'
] as $translationKey =>
$snippet) { if ($snippet['id'
] === null ||
mb_strpos((string) $snippet['author'
], 'user/'
) === 0
) { continue;
} $result[$setId]['snippets'
][$translationKey] =
$snippet;
} } return $this->
readjust($result,
$snippets);
}}