Differential D16694 Diff 40187 src/applications/conduit/parametertype/ConduitIntListParameterType.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/parametertype/ConduitIntListParameterType.php
<?php | <?php | ||||
final class ConduitIntListParameterType | final class ConduitIntListParameterType | ||||
extends ConduitListParameterType { | extends ConduitListParameterType { | ||||
protected function getParameterValue(array $request, $key) { | protected function getParameterValue(array $request, $key) { | ||||
$list = parent::getParameterValue($request, $key); | $list = parent::getParameterValue($request, $key); | ||||
foreach ($list as $idx => $item) { | foreach ($list as $idx => $item) { | ||||
if (!is_int($item)) { | $list[$idx] = $this->parseIntValue($request, $key.'['.$idx.']', $item); | ||||
$this->raiseValidationException( | |||||
$request, | |||||
$key, | |||||
pht( | |||||
'Expected a list of integers, but item with index "%s" is '. | |||||
'not an integer.', | |||||
$idx)); | |||||
} | |||||
} | } | ||||
return $list; | return $list; | ||||
} | } | ||||
protected function getParameterTypeName() { | protected function getParameterTypeName() { | ||||
return 'list<int>'; | return 'list<int>'; | ||||
} | } | ||||
Show All 14 Lines |