for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* File containing the {@link Request_Param_Validator_Callback} class.
*
* @package Application Utils
* @subpackage Request
* @see Request_Param_Validator_Callback
*/
declare(strict_types=1);
namespace AppUtils;
* Validates a string containing only letters, lowercase and uppercase, and numbers.
* @author Sebastian Mordziol <[email protected]>
class Request_Param_Validator_Callback extends Request_Param_Validator
{
public function getDefaultOptions() : array
return array(
'arguments' => array(),
'callback' => null
);
}
protected function _validate()
$args = $this->getArrayOption('arguments');
array_unshift($args, $this->value);
$result = call_user_func_array($this->getOption('callback'), $args);
if($result !== false) {
return $this->value;
return null;