-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow ResponseIf/ResponseElseIf statements with no ResponseRules.
- Loading branch information
=
committed
Jun 20, 2016
1 parent
d9f1c74
commit cf8ee74
Showing
4 changed files
with
70 additions
and
23 deletions.
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
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* Copyright (c) 2013-2016 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* | ||
* @author Jérôme Bogaerts, <[email protected]> | ||
* @license GPLv2 | ||
|
@@ -61,7 +61,6 @@ class ResponseElseIf extends QtiComponent { | |
* | ||
* @param Expression $expression An expression to be evaluated with the Else If statement. | ||
* @param ResponseRuleCollection $responseRules A collection of ResponseRule objects. | ||
* @throws InvalidArgumentException If $responseRules is an empty collection. | ||
*/ | ||
public function __construct(Expression $expression, ResponseRuleCollection $responseRules) { | ||
$this->setExpression($expression); | ||
|
@@ -101,16 +100,9 @@ public function getResponseRules() { | |
* to the Else If statement returns true. | ||
* | ||
* @param ResponseRuleCollection $responseRules A collection of ResponseRule objects. | ||
* @throws InvalidArgumentException If $responseRules is an empty collection. | ||
*/ | ||
public function setResponseRules(ResponseRuleCollection $responseRules) { | ||
if (count($responseRules) > 0) { | ||
$this->responseRules = $responseRules; | ||
} | ||
else { | ||
$msg = "A ResponseElseIf object must be bound to at lease one ResponseRule object."; | ||
throw new InvalidArgumentException($msg); | ||
} | ||
$this->responseRules = $responseRules; | ||
} | ||
|
||
public function getQtiClassName() { | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* Copyright (c) 2013-2016 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* | ||
* @author Jérôme Bogaerts, <[email protected]> | ||
* @license GPLv2 | ||
|
@@ -67,7 +67,6 @@ class ResponseIf extends QtiComponent { | |
* | ||
* @param Expression $expression The expression to be evaluated with the If statement. | ||
* @param ResponseRuleCollection $responseRules A collection of sub expressions to be evaluated if the Expression returns true. | ||
* @throws InvalidArgumentException If $responseRules does not contain any ResponseRule object. | ||
*/ | ||
public function __construct(Expression $expression, ResponseRuleCollection $responseRules) { | ||
$this->setExpression($expression); | ||
|
@@ -97,16 +96,9 @@ public function setExpression(Expression $expression) { | |
* evaluated with the If statement returns true. | ||
* | ||
* @param ResponseRuleCollection $responseRules A collection of ResponseRule objects. | ||
* @throws InvalidArgumentException If $responseRules is an empty collection. | ||
*/ | ||
public function setResponseRules(ResponseRuleCollection $responseRules) { | ||
if (count($responseRules) > 0) { | ||
$this->responseRules = $responseRules; | ||
} | ||
else { | ||
$msg = "A ResponseIf object must be bound to at least one ResponseRule."; | ||
throw new InvalidArgumentException($msg); | ||
} | ||
$this->responseRules = $responseRules; | ||
} | ||
|
||
/** | ||
|
@@ -124,8 +116,10 @@ public function getQtiClassName() { | |
} | ||
|
||
public function getComponents() { | ||
$comp = array_merge(array($this->getExpression()), | ||
$this->getResponseRules()->getArrayCopy()); | ||
$comp = array_merge( | ||
array($this->getExpression()), | ||
$this->getResponseRules()->getArrayCopy() | ||
); | ||
|
||
return new QtiComponentCollection($comp); | ||
} | ||
|
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