Move activity_match() to Protocol\Activity::match()

- With tests
This commit is contained in:
Philipp Holzer 2019-10-23 02:05:11 +02:00
parent 9e94e8b48c
commit 52c42491c4
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
9 changed files with 135 additions and 37 deletions

23
src/Protocol/Activity.php Normal file
View 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)));
}
}