Skip to content

Commit 4dce03c

Browse files
committed
Merge pull request #6 from kaihiro/check-interface
TongueTypeInterfaceが実装されているかをチェックする
2 parents 6fed416 + 3cad1ec commit 4dce03c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Controller/Component/TongueComponent.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function startup(Controller $controller) {
2424
foreach ($params as $i => $param) {
2525

2626
$class = $param->getClass();
27-
// Class unspecified case
27+
// Class unspecified case
2828
if (is_null($class)) {
2929
continue;
3030
}
@@ -39,6 +39,9 @@ public function startup(Controller $controller) {
3939
$value = null;
4040
}
4141
$type = new $className($value);
42+
if (!($type instanceof TongueTypeInterface)) {
43+
throw new LogicException($className . ' should be instance of TongueTypeInterface.');
44+
}
4245
$type->check();
4346
$controller->request->params['pass'][$i] = $type;
4447
}
@@ -51,4 +54,4 @@ public function startup(Controller $controller) {
5154
));
5255
}
5356
}
54-
}
57+
}

0 commit comments

Comments
 (0)