[Bridge] Fix function names
is* implies Boolean return values, which is not true for these functions
This commit is contained in:
parent
5ad1fa8242
commit
d520e82d9e
1 changed files with 9 additions and 9 deletions
|
@ -143,7 +143,7 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
return $this->items;
|
return $this->items;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isValidTextValue($value, $pattern = null){
|
protected function validateTextValue($value, $pattern = null){
|
||||||
if(!is_null($pattern)){
|
if(!is_null($pattern)){
|
||||||
$filteredValue = filter_var($value, FILTER_VALIDATE_REGEXP,
|
$filteredValue = filter_var($value, FILTER_VALIDATE_REGEXP,
|
||||||
array('options' => array(
|
array('options' => array(
|
||||||
|
@ -160,7 +160,7 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
return $filteredValue;
|
return $filteredValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isValidNumberValue($value){
|
protected function validateNumberValue($value){
|
||||||
$filteredValue = filter_var($value, FILTER_VALIDATE_INT);
|
$filteredValue = filter_var($value, FILTER_VALIDATE_INT);
|
||||||
|
|
||||||
if($filteredValue === false && !empty($value))
|
if($filteredValue === false && !empty($value))
|
||||||
|
@ -169,7 +169,7 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
return $filteredValue;
|
return $filteredValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isValidCheckboxValue($value){
|
protected function validateCheckboxValue($value){
|
||||||
$filteredValue = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
$filteredValue = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
||||||
|
|
||||||
if(is_null($filteredValue))
|
if(is_null($filteredValue))
|
||||||
|
@ -178,7 +178,7 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
return $filteredValue;
|
return $filteredValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isValidListValue($value, $expectedValues){
|
protected function validateListValue($value, $expectedValues){
|
||||||
$filteredValue = filter_var($value);
|
$filteredValue = filter_var($value);
|
||||||
|
|
||||||
if($filteredValue === false)
|
if($filteredValue === false)
|
||||||
|
@ -211,20 +211,20 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
|
|
||||||
switch($set[$name]['type']){
|
switch($set[$name]['type']){
|
||||||
case 'number':
|
case 'number':
|
||||||
$data[$name] = $this->isValidNumberValue($value);
|
$data[$name] = $this->validateNumberValue($value);
|
||||||
break;
|
break;
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
$data[$name] = $this->isValidCheckboxValue($value);
|
$data[$name] = $this->validateCheckboxValue($value);
|
||||||
break;
|
break;
|
||||||
case 'list':
|
case 'list':
|
||||||
$data[$name] = $this->isValidListValue($value, $set[$name]['values']);
|
$data[$name] = $this->validateListValue($value, $set[$name]['values']);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case 'text':
|
case 'text':
|
||||||
if(isset($set[$name]['pattern'])){
|
if(isset($set[$name]['pattern'])){
|
||||||
$data[$name] = $this->isValidTextValue($value, $set[$name]['pattern']);
|
$data[$name] = $this->validateTextValue($value, $set[$name]['pattern']);
|
||||||
} else {
|
} else {
|
||||||
$data[$name] = $this->isValidTextValue($value);
|
$data[$name] = $this->validateTextValue($value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue