Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/parametertype/ConduitBoolParameterType.php
<?php | <?php | ||||
final class ConduitBoolParameterType | final class ConduitBoolParameterType | ||||
extends ConduitParameterType { | extends ConduitParameterType { | ||||
protected function getParameterValue(array $request, $key) { | protected function getParameterValue(array $request, $key) { | ||||
$value = parent::getParameterValue($request, $key); | $value = parent::getParameterValue($request, $key); | ||||
return $this->parseBoolValue($request, $key, $value); | |||||
if (!is_bool($value)) { | |||||
$this->raiseValidationException( | |||||
$request, | |||||
$key, | |||||
pht('Expected boolean (true or false), got something else.')); | |||||
} | |||||
return $value; | |||||
} | } | ||||
protected function getParameterTypeName() { | protected function getParameterTypeName() { | ||||
return 'bool'; | return 'bool'; | ||||
} | } | ||||
protected function getParameterFormatDescriptions() { | protected function getParameterFormatDescriptions() { | ||||
return array( | return array( | ||||
Show All 12 Lines |