forked from GNUsocial/gnu-social
[DOCUMENTATION][REFACTOR] Add documentation to all flagged function and do some small cleanup
This commit is contained in:
@@ -89,6 +89,15 @@ abstract class Common
|
||||
return self::user()->getActor();
|
||||
}
|
||||
|
||||
public static function userNickname(): ?string
|
||||
{
|
||||
if (($user = self::user()) == null) {
|
||||
throw new NoLoggedInUser();
|
||||
} else {
|
||||
return $user->getNickname();
|
||||
}
|
||||
}
|
||||
|
||||
public static function ensureLoggedIn(): LocalUser
|
||||
{
|
||||
if (($user = self::user()) == null) {
|
||||
@@ -114,32 +123,9 @@ abstract class Common
|
||||
}
|
||||
}
|
||||
|
||||
// function array_diff_recursive($arr1, $arr2)
|
||||
// {
|
||||
// $outputDiff = [];
|
||||
|
||||
// foreach ($arr1 as $key => $value) {
|
||||
// // if the key exists in the second array, recursively call this function
|
||||
// // if it is an array, otherwise check if the value is in arr2
|
||||
// if (array_key_exists($key, $arr2)) {
|
||||
// if (is_array($value)) {
|
||||
// $recursiveDiff = self::array_diff_recursive($value, $arr2[$key]);
|
||||
// if (count($recursiveDiff)) {
|
||||
// $outputDiff[$key] = $recursiveDiff;
|
||||
// }
|
||||
// } else if (!in_array($value, $arr2)) {
|
||||
// $outputDiff[$key] = $value;
|
||||
// }
|
||||
// } else if (!in_array($value, $arr2)) {
|
||||
// // if the key is not in the second array, check if the value is in
|
||||
// // the second array (this is a quirk of how array_diff works)
|
||||
// $outputDiff[$key] = $value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return $outputDiff;
|
||||
// }
|
||||
|
||||
/**
|
||||
* A recursive `array_diff`, while PHP itself doesn't provide one
|
||||
*/
|
||||
public function array_diff_recursive(array $array1, array $array2)
|
||||
{
|
||||
$difference = [];
|
||||
|
||||
Reference in New Issue
Block a user