Get information about member visits for a period.

@param int $masterId
Master Customer ID.
@param \DateTime $dateFrom
Date From.
@param \DateTime $dateTo
Date To.

@return array|\stdClass
Information about Member visits for a period.
545191
public function getVisitCountByDate($masterId, \DateTime $dateFrom, \DateTime $dateTo) {
    $json = [
      'CL_GetFacilityVisitCountByDateInput' => [
        'MasterCustomerId' => $masterId,
        'DateFrom' => $dateFrom->format('Y-m-d H:i:s'),
        'DateTo' => $dateTo->format('Y-m-d H:i:s'),
      ],
    ];

    $results = $this->doAPIcall('CL_GetFacilityVisitCountByDate', $json);
    if (empty($results)) {
      return [];
    }

    if (!empty($results->ErrorMessage)) {
      $logger = \Drupal::logger('openy_campaign_queue');
      $logger->alert('Could not retrieve visits information for members for batch operation');
      return [];
    }
    $visits = $results->FacilityVisitCustomerRecord;
    return reset($visits);
  }
201299
private function getNoWorkDaysOverMultipleYears(DateTime $firstDay, DateTime $lastDay, string $region, int $startYear, int $endYear, array $noWork): HolidayList
    {
        $holidays = [];
        $holidays[] = $this->getNoWorkDaysForTimespan($firstDay, new DateTime(sprintf('%s-12-31', $startYear), $firstDay->getTimezone()), $region, $noWork);
        for ($year = $startYear + 1; $year < $endYear; ++$year) {
            $holidays[] = $this->getNoWorkDaysForTimespan(
                new DateTime(sprintf('%s-01-01', $year), $firstDay->getTimezone()),
                new DateTime(sprintf('%s-12-31', $year), $firstDay->getTimezone()),
                $region,
                $noWork);
        }
        $holidays[] = $this->getNoWorkDaysForTimespan(new DateTime(sprintf('%s-01-01', $endYear), $firstDay->getTimezone()), $lastDay, $region, $noWork);

        return $this->mergeHolidayLists($holidays);
    }
855762
public static function getEvenementsLies($id, $date, $date2)
    {
        global $config;
        $req = "
            SELECT idEvenement
            FROM _evenementPersonne
            WHERE idPersonne = '".$id."'
        ";
        $res = $config->connexionBdd->requete($req);
        $events=array();
        while ($event = mysql_fetch_assoc($res)) {
            $events[]=$event;
        }
        $return=array();
        foreach ($events as $event) {
            $idEvent=$event["idEvenement"];
            $req = "
                SELECT dateDebut
                FROM historiqueEvenement
                WHERE idEvenement = '".$idEvent."'
                ORDER BY `idHistoriqueEvenement` DESC
            ";
            $res = $config->connexionBdd->requete($req);
            $dateEvent = mysql_fetch_object($res)->dateDebut;
            if (($dateEvent >= $date && $dateEvent < $date2) || ($date2==3000 && $dateEvent=="0000-00-00")) {
                $return[] = $idEvent;
            }
        }
        return $return;
    }
607403
public function getWallets($merchantGroupId, DateTime $pastDate = null)
    {
        if (!$pastDate) {
            $pastDate = new DateTime('1970-01-01');
        }
        return $this->hipay->getMerchantsGroupAccounts($merchantGroupId, $pastDate);
    }
96028
public function filterByApprovedBefore(\DateTime $date)
    {
        $this->query->andWhere(
             'cv.cvDateApproved <= ' . $this->query->createNamedParameter($date->format('Y-m-d H:i-s'))
        );
    }
219265
public function getResetDate($dateFrom = '')
    {
        if (empty($dateFrom)) {
            $dateFrom = new Carbon;
        }

        $period = new Period($this->resettable_interval, $this->resettable_count, $dateFrom);

        return $period->getEndDate();
    }
898504
public static function getFacilityCheckIns($memberId, $startDate, $endDate) {
    return \Drupal::entityQuery('openy_campaign_member_checkin')
      ->condition('member', $memberId)
      ->condition('date', $startDate->format('U'), '>=')
      ->condition('date', $endDate->format('U'), '<')
      ->execute();
  }
787379
public static function getExistingActivities($memberCampaignId, $date, $activityIds = []) {
    $query = \Drupal::entityQuery('openy_campaign_memb_camp_actv')
      ->condition('member_campaign', $memberCampaignId)
      ->condition('date', $date->format('U'));
    if (!empty($activityIds)) {
      $query->condition('activity', $activityIds, 'IN');
    }
    return $query->execute();
  }
369507
public function getSafeList($count = null, $maxId = null, $sinceId = null)
    {
        $parameters = array(
          'count' => $count,
          'max_id' => $maxId,
          'since_id' => $sinceId,
        );

        $parameters = array_filter($parameters, function($val) {return !is_null($val);});

        return $this->online->call('/storage/c14/safe', 'GET', $parameters);
    }
459771
public function getMasterList()
    {
        $list = [];
        foreach ($this->getCriteria() as $c) {
            if ($c instanceof Criteria) {
                $list = array_merge($list, $c->getMasterList());
            } else {
                $list[] = $c->getMaster();
            }
        }
        return $list;
    }
1044440
public function memberCardSummaryById(string $from, string $to, string $cardId)
    {
        $ext = [
            'card_id' => $cardId,
        ];

        return $this->query('datacube/getcardmembercarddetail', $from, $to, $ext);
    }
809359
private function convertDateParams($dateFrom, $dateTo)
    {
        $dateFromConverted = new \DateTime($dateFrom);

        $dateToConverted = new \DateTime($dateTo);
        $dateToConverted->modify('+1 day -1 second');

        return [
            $dateFromConverted->getTimestamp(),
            $dateToConverted->getTimestamp(),
        ];
    }
468056
public function cancelSubscription($subscriptionId, \DateTime $cancellationDate = null, $cancellationNote = null)
    {
        $requestData = new Cancel\RequestData($subscriptionId);
        $requestData->setCancellationDate($cancellationDate);
        $requestData->setCancellationNote($cancellationNote);

        $request = new Cancel\Request($requestData);

        return $this->sendRequest($request, Cancel\ApiResponse::class);
    }
877431
public function getStatementOfAccount(SEPAAccount $account, \DateTime $from, \DateTime $to)
    {
        $responses = array();

        $this->logger->info('Start fetching statement of account results');
        $this->logger->info('Start date: ' . $from->format('Y-m-d'));
        $this->logger->info('End date  : ' . $to->format('Y-m-d'));

        $dialog = $this->getDialog();
        $dialog->syncDialog();
        $dialog->initDialog();

        $message = $this->createStateOfAccountMessage($dialog, $account, $from, $to, null);
        $response = $dialog->sendMessage($message);
        $touchdowns = $response->getTouchdowns($message);
        $soaResponse = new GetStatementOfAccount($response->rawResponse);
        $responses[] = $soaResponse->getRawMt940();

        $touchdownCounter = 1;
        while (isset($touchdowns[HKKAZ::NAME])) {
            $this->logger->info('Fetching more statement of account results (' . $touchdownCounter++ . ') ...');
            $message = $this->createStateOfAccountMessage(
                $dialog,
                $account,
                $from,
                $to,
                $touchdowns[HKKAZ::NAME]
            );

            $r = $dialog->sendMessage($message);
            $touchdowns = $r->getTouchDowns($message);
            $soaResponse = new GetStatementOfAccount($r->rawResponse);
            $responses[] = $soaResponse->getRawMt940();
        }

        $this->logger->info('Fetching of ' . $touchdownCounter . ' pages done.');
        $this->logger->debug('HKKAZ response:');

        $dialog->endDialog();

        return GetStatementOfAccount::createModelFromRawMt940(implode('', $responses));
    }
453567
protected void setJoin(String[] masterLabels, String masterColumn,
                           String dataColumn, List<String> masterData) {
        setJoin(masterLabels, masterColumn, dataColumn, null, false, masterData);
    }
1169135
public function viewAction($externalNetworkId, $externalRouteId, $externalLineId, $seasonId, $externalStopPointId = null)
    {
        $lineManager = $this->get('canal_tp_mtt.line_manager');
        $customerId = $this->getRequest()->get('customerId');

        if ($customerId == null) {
            $customer = $this->getUser()->getCustomer();
        } else {
            $customer = $this->get('sam_core.customer')->find($customerId);
        }
        $perimeter = $this->get('nmm.perimeter_manager')->findOneByExternalNetworkId(
            $customer,
            $externalNetworkId
        );
        $timetable = $this->getTimetable(
            $externalRouteId,
            $perimeter->getExternalCoverageId(),
            $lineManager->getLineConfigByExternalLineIdAndSeasonId($externalLineId, $seasonId)
        );

        $displayMenu = $this->get('security.context')->getToken()->getUser() != 'anon.';
        if ($displayMenu) {
            $displayMenu = $this->get('request')->get('timetableOnly', false) != true;
        }

        return $this->renderLayout($timetable, $externalStopPointId, false, $displayMenu);
    }
862128
public static function extractDataFromPath($attribute, $masterData)
    {
        $results = [];

        $value = Arr::get($masterData, $attribute, '__missing__');

        if ($value !== '__missing__') {
            Arr::set($results, $attribute, $value);
        }

        return $results;
    }