Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $toData = $datum['to']['data'];
- $toArray = [];
- $tagArray = [];
- foreach ($toData as $toUser) {
- array_push($toArray, $toUser['id']);
- }
- if (isset($datum['message_tags'])) {
- foreach($datum['message_tags'] as $tag) {
- if (array_search($tag['id'], $toArray) !== false) {
- $toArray[$tag['id']] = null;
- }
- }
- }
- $toArray = array_filter($toArray);
- // if $toArray is empty, then this post was a self post, e.g the poster posted on their own wall and tagged a bunch of people
- // otherwise the post has a definite recipient
- if(!empty($rekeyedToData)) {
- // should never be more than one element in the array
- if(count($rekeyedToData) > 1){
- Logger::log("More than one element in recipient array.");
- }
- $recipient = end($rekeyedToData); // could have used reset, instead of end() to get the first element. Assumption is there would only by one element in the array
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement