You are here

public function DateRecurRRule::getWeekdays in Recurring Dates Field 8

File

src/DateRecurRRule.php, line 333

Class

DateRecurRRule

Namespace

Drupal\date_recur

Code

public function getWeekdays() {
  $weekdays = [];
  $byday = $this->parts['BYDAY'];
  if (!is_array($byday)) {
    $byday = explode(',', $byday);
  }
  $this->byweekday = array();
  $this->byweekday_nth = array();
  foreach ($byday as $value) {
    $value = trim(strtoupper($value));
    $valid = preg_match('/^([+-]?[0-9]+)?([A-Z]{2})$/', $value, $matches);
    if (!empty($matches[2])) {
      $day = RRule::$week_days[$matches[2]];
      $weekdays[$day] = $day;
    }
  }
  return $weekdays;
  if (!empty($this->parts['BYDAY'])) {
    $days = explode(',', $this->parts['BYDAY']);
    foreach ($days as $day) {
      $day = preg_replace('/[\\+\\-0-9]*/', '', $day);
      $weekdays[$day] = $day;
    }
  }
  return $weekdays;
}