original_string: protected function fillArraySubPeriods($startDate, $endDate, $period)
      {
          $arrayPeriods = array();
          $endSubperiod = Period\Factory::build($period, $endDate);
          $arrayPeriods[] = $endSubperiod;
  
          // set end date to start of end period since we're comparing against start date.
          $endDate = $endSubperiod->getDateStart();
          while ($endDate->isLater($startDate)) {
              $endDate = $endDate->addPeriod(-1, $period);
              $subPeriod = Period\Factory::build($period, $endDate);
              $arrayPeriods[] = $subPeriod;
          }
          $arrayPeriods = array_reverse($arrayPeriods);
          foreach ($arrayPeriods as $period) {
              $this->addSubperiod($period);
          }
      }
code: protected function fillArraySubPeriods($startDate, $endDate, $period)
      {
          $arrayPeriods = array();
          $endSubperiod = Period\Factory::build($period, $endDate);
          $arrayPeriods[] = $endSubperiod;
  
          // set end date to start of end period since we're comparing against start date.
          $endDate = $endSubperiod->getDateStart();
          while ($endDate->isLater($startDate)) {
              $endDate = $endDate->addPeriod(-1, $period);
              $subPeriod = Period\Factory::build($period, $endDate);
              $arrayPeriods[] = $subPeriod;
          }
          $arrayPeriods = array_reverse($arrayPeriods);
          foreach ($arrayPeriods as $period) {
              $this->addSubperiod($period);
          }
      }
code_tokens: protected function fillArraySubPeriods ( $ startDate , $ endDate , $ period ) { $ arrayPeriods = array ( ) ; $ endSubperiod = Period \ Factory :: build ( $ period , $ endDate ) ; $ arrayPeriods [ ] = $ endSubperiod ; // set end date to start of end period since we're comparing against start date. $ endDate = $ endSubperiod -> getDateStart ( ) ; while ( $ endDate -> isLater ( $ startDate ) ) { $ endDate = $ endDate -> addPeriod ( - 1 , $ period ) ; $ subPeriod = Period \ Factory :: build ( $ period , $ endDate ) ; $ arrayPeriods [ ] = $ subPeriod ; } $ arrayPeriods = array_reverse ( $ arrayPeriods ) ; foreach ( $ arrayPeriods as $ period ) { $ this -> addSubperiod ( $ period ) ; } }
docstring: Adds new subperiods
  
  @param Date $startDate
  @param Date $endDate
  @param string $period
docstring_tokens: Adds new subperiods