forked from BorisMorel/IcalBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4aab7ed
commit cc60305
Showing
3 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace BOMO\IcalBundle\Model; | ||
|
||
class Alarm | ||
{ | ||
/** | ||
* vAlarm object | ||
*/ | ||
private $alarm; | ||
|
||
public function __construct($param) | ||
{ | ||
if (is_array($param)) { | ||
$this->alarm = new \valarm($param); | ||
|
||
} elseif ($param instanceOf \valarm) { | ||
$this->alarm = $param; | ||
|
||
} else { | ||
throw new InvalidArgumentException('Invalid constructor parameter'); | ||
|
||
} | ||
|
||
} | ||
|
||
public function setAction($action) | ||
{ | ||
switch($action) { | ||
case 'display': | ||
$this->alarm->setProperty('description', 'Need to be setted'); | ||
$this->alarm->setProperty('trigger', '-PT1H', array('VALUE' => 'DURATION')); | ||
break; | ||
|
||
default: | ||
throw new \InvalidArgumentException('Only [display] options are available'); | ||
break; | ||
} | ||
|
||
$this->alarm->setProperty('action', $action); | ||
|
||
return $this; | ||
} | ||
|
||
public function setDescription($desc) | ||
{ | ||
$this->alarm->setProperty('description', $desc); | ||
|
||
return $this; | ||
} | ||
|
||
public function setTrigger($str) | ||
{ | ||
$this->alarm->setProperty('trigger', $str, array('VALUE' => 'DURATION')); | ||
|
||
return $this; | ||
} | ||
|
||
public function getAlarm() | ||
{ | ||
return $this->alarm; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters