/**
  * Handles a single membership request entity by approving it.
  *
  * @param Connection $connection The connection to use for requests.
  * @param MemberRequestEntity $entity The entity to handle.
  *
  * @throws ConnectionException If something goes wrong with the connection.
  */
 protected function handleEntity(Connection $connection, $entity)
 {
     $connection->request(Connection::REQ_LITE, $entity->getActionUrl(), 'POST', $entity->getInputData());
 }
예제 #2
0
 /**
  * Scans the comments for admin comments in the past.
  */
 private function isHandled(Connection $connection, $postId)
 {
     $params = ['fields' => 'message', 'limit' => 500];
     $path = "/{group_id}_{$postId}/comments";
     $response = $connection->request(Connection::REQ_GRAPH, $path, 'GET', $params);
     $comments = $response->getGraphObjectList();
     foreach ($comments as $comment) {
         if (strpos($comment->getProperty('message'), '[admin]') === 0) {
             return true;
         }
     }
     return false;
 }