@@ -72,16 +72,16 @@ |
||
72 | 72 | // we need a valid PHP class |
73 | 73 | if (!class_exists($value)) |
74 | 74 | { |
75 | - $result->addError(static::MSG_NOTVALIDCLASS); |
|
76 | - return $result; |
|
75 | + $result->addError(static::MSG_NOTVALIDCLASS); |
|
76 | + return $result; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // the class must be a StoryTemplate |
80 | 80 | $refClass = new ReflectionClass($value); |
81 | 81 | if (!$refClass->isSubclassOf('DataSift\Storyplayer\PlayerLib\StoryTemplate')) |
82 | 82 | { |
83 | - $result->addError(static::MSG_NOTVALIDTEMPLATE); |
|
84 | - return $result; |
|
83 | + $result->addError(static::MSG_NOTVALIDTEMPLATE); |
|
84 | + return $result; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | // all done |
@@ -64,22 +64,19 @@ |
||
64 | 64 | |
65 | 65 | public function validate($value, ValidationResult $result = null) |
66 | 66 | { |
67 | - if ($result === null) |
|
68 | - { |
|
67 | + if ($result === null) { |
|
69 | 68 | $result = new ValidationResult($value); |
70 | 69 | } |
71 | 70 | |
72 | 71 | // we need a valid PHP class |
73 | - if (!class_exists($value)) |
|
74 | - { |
|
72 | + if (!class_exists($value)) { |
|
75 | 73 | $result->addError(static::MSG_NOTVALIDCLASS); |
76 | 74 | return $result; |
77 | 75 | } |
78 | 76 | |
79 | 77 | // the class must be a StoryTemplate |
80 | 78 | $refClass = new ReflectionClass($value); |
81 | - if (!$refClass->isSubclassOf('Storyplayer\Stories\StoryTemplate')) |
|
82 | - { |
|
79 | + if (!$refClass->isSubclassOf('Storyplayer\Stories\StoryTemplate')) { |
|
83 | 80 | $result->addError(static::MSG_NOTVALIDTEMPLATE); |
84 | 81 | return $result; |
85 | 82 | } |
@@ -61,14 +61,14 @@ |
||
61 | 61 | // get the hosts table, if we have one |
62 | 62 | $hostsTable = $this->getTable(); |
63 | 63 | if (!$hostsTable) { |
64 | - return; |
|
64 | + return; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // remove any empty test environments |
68 | 68 | foreach ($hostsTable as $testEnv => $hosts) { |
69 | - if (count(get_object_vars($hosts)) == 0) { |
|
70 | - unset($hostsTable->$testEnv); |
|
71 | - } |
|
69 | + if (count(get_object_vars($hosts)) == 0) { |
|
70 | + unset($hostsTable->$testEnv); |
|
71 | + } |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // cleanup the tables |
@@ -60,14 +60,14 @@ |
||
60 | 60 | // get the roles table, if we have one |
61 | 61 | $rolesTable = $this->getTable(); |
62 | 62 | if (!$rolesTable) { |
63 | - return; |
|
63 | + return; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | // remove any empty test environments |
67 | 67 | foreach ($rolesTable as $testEnv => $roles) { |
68 | - if (count(get_object_vars($roles)) == 0) { |
|
69 | - unset($rolesTable->$testEnv); |
|
70 | - } |
|
68 | + if (count(get_object_vars($roles)) == 0) { |
|
69 | + unset($rolesTable->$testEnv); |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // cleanup the tables |
@@ -57,7 +57,8 @@ |
||
57 | 57 | */ |
58 | 58 | class E4xx_InvalidArgument extends Exxx_Exception |
59 | 59 | { |
60 | - public function __construct($argumentName, $reason = '', $params = array()) { |
|
60 | + public function __construct($argumentName, $reason = '', $params = array()) |
|
61 | + { |
|
61 | 62 | $msg = "Missing argument '$argumentName'"; |
62 | 63 | if (strlen($reason) > 0) { |
63 | 64 | $msg .= "; reason is '{$reason}'"; |
@@ -57,7 +57,8 @@ |
||
57 | 57 | */ |
58 | 58 | class E4xx_MissingArgument extends Exxx_Exception |
59 | 59 | { |
60 | - public function __construct($method, $reason = '', $params = array()) { |
|
60 | + public function __construct($method, $reason = '', $params = array()) |
|
61 | + { |
|
61 | 62 | $msg = "Missing argument in '$method'"; |
62 | 63 | if (strlen($reason) > 0) { |
63 | 64 | $msg .= "; reason is '{$reason}'"; |
@@ -57,7 +57,8 @@ |
||
57 | 57 | */ |
58 | 58 | class E4xx_ObsoleteProse extends Exxx_Exception |
59 | 59 | { |
60 | - public function __construct($oldProse, $newProse) { |
|
60 | + public function __construct($oldProse, $newProse) |
|
61 | + { |
|
61 | 62 | $msg = "Support for '$oldProse' has been removed; please use $newProse instead"; |
62 | 63 | parent::__construct(400, $msg, $msg); |
63 | 64 | } |
@@ -57,7 +57,8 @@ |
||
57 | 57 | */ |
58 | 58 | class E4xx_StoryShouldFail extends Exxx_Exception |
59 | 59 | { |
60 | - public function __construct() { |
|
60 | + public function __construct() |
|
61 | + { |
|
61 | 62 | $msg = "Story should fail"; |
62 | 63 | parent::__construct(400, $msg, $msg); |
63 | 64 | } |
@@ -55,7 +55,8 @@ |
||
55 | 55 | */ |
56 | 56 | class E5xx_ActionFailed extends E5xx_ProseException |
57 | 57 | { |
58 | - public function __construct($actionName, $reason = '', $params = array()) { |
|
58 | + public function __construct($actionName, $reason = '', $params = array()) |
|
59 | + { |
|
59 | 60 | $msg = "Action '$actionName' failed"; |
60 | 61 | if (strlen($reason) > 0) { |
61 | 62 | $msg .= "; reason is '{$reason}'"; |
@@ -55,7 +55,8 @@ |
||
55 | 55 | */ |
56 | 56 | class E5xx_ExpectFailed extends E5xx_ProseException |
57 | 57 | { |
58 | - public function __construct($actionName, $expected, $found) { |
|
58 | + public function __construct($actionName, $expected, $found) |
|
59 | + { |
|
59 | 60 | $msg = "Action '$actionName' failed; expected '$expected', found '$found'"; |
60 | 61 | parent::__construct(500, $msg, $msg); |
61 | 62 | } |