mirror of
https://github.com/friendica/friendica
synced 2025-04-26 19:50:10 +00:00
Move activity_match() to Protocol\Activity::match()
- With tests
This commit is contained in:
parent
9e94e8b48c
commit
52c42491c4
9 changed files with 135 additions and 37 deletions
23
src/Protocol/Activity.php
Normal file
23
src/Protocol/Activity.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Protocol;
|
||||
|
||||
/**
|
||||
* Base class for the Activity namespace
|
||||
*/
|
||||
final class Activity
|
||||
{
|
||||
/**
|
||||
* Compare activity uri. Knows about activity namespace.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string $needle
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function match(string $haystack, string $needle) {
|
||||
return (($haystack === $needle) ||
|
||||
((basename($needle) === $haystack) &&
|
||||
strstr($needle, NAMESPACE_ACTIVITY_SCHEMA)));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue