protected function execute(InputInterface $input, OutputInterface $output)
 {
     $isVerbose = $output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
     $projectCode = $input->getOption('project-code');
     $memberResource = new MemberResource($this->sourceClient);
     $page = 0;
     $perPage = 10;
     $maxPages = 1;
     $criteria = [];
     $data = [];
     while ($page < $maxPages) {
         $members = $memberResource->getList(++$page, $perPage, $this->getMemberCriteria(), [], [], ['project_code' => $projectCode, 'PII' => 1]);
         $maxPages = $members['pages'];
         // if no items, return
         if (!count($members['items']) || !$members['total']) {
             break;
         }
         foreach ($members['items'] as $key => $member) {
             if ($isVerbose) {
                 $no = ($page - 1) * $perPage + $key + 1;
                 $output->writeln("{$no} - Reading member #{$member['id']}");
             }
             if ($this->checkAccept($member)) {
                 // activate member
                 $memberResource->setApplicantsStatus([$member['id']], 'accept', 'Accepted via API');
                 var_dump($member);
                 if ($isVerbose) {
                     $output->writeln("Accepting member #{$member['id']}");
                 }
             }
         }
     }
 }
 protected function processMessage($inData, $message)
 {
     if ($this->output->isVerbose()) {
         print json_encode($inData, JSON_PRETTY_PRINT) . "\n";
     }
     $memberId = $inData->member_id;
     $action = $inData->action;
     $memberResource = new MemberResource($this->client);
     $response = $memberResource->setApplicantsStatus($memberId, $action);
     if ($this->output->isVerbose()) {
         print json_encode($response, JSON_PRETTY_PRINT) . "\n";
     }
     return true;
 }
<?php

require __DIR__ . '/../vendor/autoload.php';
use Survos\Client\SurvosClient;
use Survos\Client\Resource\MemberResource;
$config = json_decode(file_get_contents(__DIR__ . '/config.json'), true);
$client = new SurvosClient($config['endpoint']);
if (!$client->authorize($config['username'], $config['password'])) {
    throw new \Exception('Wrong credentials!');
}
$resource = new MemberResource($client);
$data = $resource->getList(1, 100, ['enrollment_status_code' => 'applicant']);
$applicants = $data['items'];
foreach ($applicants as $applicant) {
    $id = $applicant['id'];
    if (isEligible($applicant)) {
        $resource->setApplicantsStatus($id, 'accept', null, 'qualified by age');
    } else {
        $resource->setApplicantsStatus($id, 'reject', null, 'Sorry, you don\'t qualify');
    }
}
function isEligible($applicant)
{
    return isset($applicant['submitted']) && $applicant['submitted']['age'] < 21;
}