protected function getMapRateOptions() {
    $map = [];

    $cid = __METHOD__;
    if ($cache = $this->cache->get($cid)) {
      return $cache->data;
    }

    $domain = $this->getUrlFromOpenyProgramsSearchSettings('base_url');

    // Here we'll iterate over each program and scrape data for each school.
    // We should be careful in order not to make a high load on Daxko.
    $programs = $this->getAllChildCarePrograms();
    foreach ($programs as $program) {
      // Get a list of schools for particular program.
      $schools = $this->scrapeDaxkoSchoolsByProgram($program->id);

      // @todo Check whether we were scraping correct page (with schools).
      $school_pages = $schools->each(function ($school) {
        $href = $school->attr('href');
        return [
          'url' => $href,
          'id' => $this->getQueryParam('location_id', $href),
        ];
      });

      // Scrape each school page to get the rates url.
      foreach ($school_pages as $school_page) {
        $url = $domain . $school_page['url'];
        $source = $this->getDaxkoPageSource($url);
        $this->crawler->clear();
        $this->crawler->addHtmlContent($source);
        $rate_list = $this->crawler->filter('#session-list-table tr.childcare-rate');

        // Scrape each rate item.
        $rate_data = $rate_list->each(function ($rate_data_item) {
          // Get context ID && session name.
          $link = $rate_data_item->filter('a.session-name');
          return [
            'context_id' => $this->getQueryParam('context_id', $link->attr('href')),
            'name' => $link->text(),
            'registration_url' => $link->attr('href'),
          ];
        });

        // Fill in map dada.
        if (!isset($map[$school_page['id']][$program->id])) {
          $map[$school_page['id']][$program->id] = [];
        }

        foreach ($rate_data as $rate_data_item) {
          $map[$school_page['id']][$program->id][$rate_data_item['context_id']] = $rate_data_item;
        }
      }
    }

    $this->cache->set($cid, $map);
    return $map;
  }
protected function getMapRateOptions() {
    $map = [];

    $cid = __METHOD__;
    if ($cache = $this->cache->get($cid)) {
      return $cache->data;
    }

    $domain = $this->getUrlFromOpenyProgramsSearchSettings('base_url');

    // Here we'll iterate over each program and scrape data for each school.
    // We should be careful in order not to make a high load on Daxko.
    $programs = $this->getAllChildCarePrograms();
    foreach ($programs as $program) {
      // Get a list of schools for particular program.
      $schools = $this->scrapeDaxkoSchoolsByProgram($program->id);

      // @todo Check whether we were scraping correct page (with schools).
      $school_pages = $schools->each(function ($school) {
        $href = $school->attr('href');
        return [
          'url' => $href,
          'id' => $this->getQueryParam('location_id', $href),
        ];
      });

      // Scrape each school page to get the rates url.
      foreach ($school_pages as $school_page) {
        $url = $domain . $school_page['url'];
        $source = $this->getDaxkoPageSource($url);
        $this->crawler->clear();
        $this->crawler->addHtmlContent($source);
        $rate_list = $this->crawler->filter('#session-list-table tr.childcare-rate');

        // Scrape each rate item.
        $rate_data = $rate_list->each(function ($rate_data_item) {
          // Get context ID && session name.
          $link = $rate_data_item->filter('a.session-name');
          return [
            'context_id' => $this->getQueryParam('context_id', $link->attr('href')),
            'name' => $link->text(),
            'registration_url' => $link->attr('href'),
          ];
        });

        // Fill in map dada.
        if (!isset($map[$school_page['id']][$program->id])) {
          $map[$school_page['id']][$program->id] = [];
        }

        foreach ($rate_data as $rate_data_item) {
          $map[$school_page['id']][$program->id][$rate_data_item['context_id']] = $rate_data_item;
        }
      }
    }

    $this->cache->set($cid, $map);
    return $map;
  }
protected function getMapRateOptions ( ) { $ map = [ ] ; $ cid = __METHOD__ ; if ( $ cache = $ this -> cache -> get ( $ cid ) ) { return $ cache -> data ; } $ domain = $ this -> getUrlFromOpenyProgramsSearchSettings ( 'base_url' ) ; // Here we'll iterate over each program and scrape data for each school. // We should be careful in order not to make a high load on Daxko. $ programs = $ this -> getAllChildCarePrograms ( ) ; foreach ( $ programs as $ program ) { // Get a list of schools for particular program. $ schools = $ this -> scrapeDaxkoSchoolsByProgram ( $ program -> id ) ; // @todo Check whether we were scraping correct page (with schools). $ school_pages = $ schools -> each ( function ( $ school ) { $ href = $ school -> attr ( 'href' ) ; return [ 'url' => $ href , 'id' => $ this -> getQueryParam ( 'location_id' , $ href ) , ] ; } ) ; // Scrape each school page to get the rates url. foreach ( $ school_pages as $ school_page ) { $ url = $ domain . $ school_page [ 'url' ] ; $ source = $ this -> getDaxkoPageSource ( $ url ) ; $ this -> crawler -> clear ( ) ; $ this -> crawler -> addHtmlContent ( $ source ) ; $ rate_list = $ this -> crawler -> filter ( '#session-list-table tr.childcare-rate' ) ; // Scrape each rate item. $ rate_data = $ rate_list -> each ( function ( $ rate_data_item ) { // Get context ID && session name. $ link = $ rate_data_item -> filter ( 'a.session-name' ) ; return [ 'context_id' => $ this -> getQueryParam ( 'context_id' , $ link -> attr ( 'href' ) ) , 'name' => $ link -> text ( ) , 'registration_url' => $ link -> attr ( 'href' ) , ] ; } ) ; // Fill in map dada. if ( ! isset ( $ map [ $ school_page [ 'id' ] ] [ $ program -> id ] ) ) { $ map [ $ school_page [ 'id' ] ] [ $ program -> id ] = [ ] ; } foreach ( $ rate_data as $ rate_data_item ) { $ map [ $ school_page [ 'id' ] ] [ $ program -> id ] [ $ rate_data_item [ 'context_id' ] ] = $ rate_data_item ; } } } $ this -> cache -> set ( $ cid , $ map ) ; return $ map ; }
Return the map of rate options by school and program.

@return array
Map. [school_id][program_id][[rate_option]]

@ingroup cache
Return the map of rate options by school and program .