Skip to content

Commit

Permalink
Merge pull request #3 from hnuti-brontosaurus/support-for-multiple-ty…
Browse files Browse the repository at this point in the history
…pes-and-programs

EventParameters: added support for multiple types and programs
  • Loading branch information
dakur authored Jan 30, 2019
2 parents bc9529f + c8f72c4 commit 64f7c3b
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions src/Request/EventParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,20 @@ public function setType($type)
throw new InvalidArgumentException('Value `' . $type . '` is not of valid types for `type` parameter.');
}

$this->params['typ'] = $type;
$this->params['typ'][] = $type;
return $this;
}

/**
* @param string[] $types
* @return self
*/
public function setTypes(array $types)
{
foreach ($types as $type) {
$this->setType($type);
}

return $this;
}

Expand All @@ -130,7 +143,20 @@ public function setProgram($program)
throw new InvalidArgumentException('Value `' . $program . '` is not of valid types for `program` parameter.');
}

$this->params['program'] = $program;
$this->params['program'][] = $program;
return $this;
}

/**
* @param string[] $programs
* @return self
*/
public function setPrograms(array $programs)
{
foreach ($programs as $program) {
$this->setProgram($program);
}

return $this;
}

Expand Down

0 comments on commit 64f7c3b

Please sign in to comment.