public function getFrequency(): int
    {
        $data = $this->attributes["Recurrence"];
        if ($data === "ONCE") {
            return AlarmInterface::ONCE;
        }
        if ($data === "DAILY") {
            $data = "ON_0123456";
        } elseif ($data === "WEEKDAYS") {
            $data = "ON_12345";
        } elseif ($data === "WEEKENDS") {
            $data = "ON_06";
        }
        if (!preg_match("/^ON_([0-9]+)$/", $data, $matches)) {
            $error = "Unrecognised frequency for alarm ({$data}), please report this issue on github.com";
            throw new \RuntimeException($error);
        }

        $data = $matches[1];
        $days = 0;
        foreach ($this->days as $key => $val) {
            if (strpos($data, (string) $key) !== false) {
                $days = $days | $val;
            }
        }

        return $days;
    }
public function getFrequency(): int
    {
        $data = $this->attributes["Recurrence"];
        if ($data === "ONCE") {
            return AlarmInterface::ONCE;
        }
        if ($data === "DAILY") {
            $data = "ON_0123456";
        } elseif ($data === "WEEKDAYS") {
            $data = "ON_12345";
        } elseif ($data === "WEEKENDS") {
            $data = "ON_06";
        }
        if (!preg_match("/^ON_([0-9]+)$/", $data, $matches)) {
            $error = "Unrecognised frequency for alarm ({$data}), please report this issue on github.com";
            throw new \RuntimeException($error);
        }

        $data = $matches[1];
        $days = 0;
        foreach ($this->days as $key => $val) {
            if (strpos($data, (string) $key) !== false) {
                $days = $days | $val;
            }
        }

        return $days;
    }
public function getFrequency ( ) : int { $ data = $ this -> attributes [ "Recurrence" ] ; if ( $ data === "ONCE" ) { return AlarmInterface :: ONCE ; } if ( $ data === "DAILY" ) { $ data = "ON_0123456" ; } elseif ( $ data === "WEEKDAYS" ) { $ data = "ON_12345" ; } elseif ( $ data === "WEEKENDS" ) { $ data = "ON_06" ; } if ( ! preg_match ( "/^ON_([0-9]+)$/" , $ data , $ matches ) ) { $ error = "Unrecognised frequency for alarm ({$data}), please report this issue on github.com" ; throw new \ RuntimeException ( $ error ) ; } $ data = $ matches [ 1 ] ; $ days = 0 ; foreach ( $ this -> days as $ key => $ val ) { if ( strpos ( $ data , ( string ) $ key ) !== false ) { $ days = $ days | $ val ; } } return $ days ; }
Get the frequency of the alarm.

The result is an integer which can be compared using the bitwise operators and the class constants for each day.
If the alarm is a one time only alarm then it will not match any of the day constants,
but will be equal to the class constant ONCE.

@return int
Get the frequency of the alarm .