本文整理匯總了PHP中Zend\InputFilter\Input::getValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP Input::getValue方法的具體用法?PHP Input::getValue怎麽用?PHP Input::getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\InputFilter\Input
的用法示例。
在下文中一共展示了Input::getValue方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testRetrievingValueFiltersTheValue
public function testRetrievingValueFiltersTheValue()
{
$this->input->setValue('bar');
$filter = new Filter\StringToUpper();
$this->input->getFilterChain()->attach($filter);
$this->assertEquals('BAR', $this->input->getValue());
}
示例2: getValue
public function getValue()
{
$value = parent::getValue();
if (null === $value && null === $this->ignoreValue) {
$value = $this->defaultValue;
}
return $value;
}
示例3: testFallbackValue
/**
* @dataProvider dataFallbackValue
*/
public function testFallbackValue($fallbackValue)
{
$this->input->setFallbackValue($fallbackValue);
$validator = new Validator\Date();
$this->input->getValidatorChain()->attach($validator);
$this->input->setValue('123');
// not a date
$this->assertTrue($this->input->isValid());
$this->assertEmpty($this->input->getMessages());
$this->assertSame($fallbackValue, $this->input->getValue());
}
示例4: getResources
/**
* @return ImageResourceInterface[]
*/
public function getResources()
{
$resources = array();
if ($this->isValid) {
$tokens = parent::getValue();
if (is_array($tokens)) {
foreach ($tokens as $token) {
$resources[] = $this->abstractResourceFactory->loadImageResource($token);
}
} else {
$resources[] = $this->abstractResourceFactory->loadImageResource($tokens);
}
}
return $resources;
}
示例5: getResources
/**
* @return ImageResourceInterface[]
*/
public function getResources()
{
$resources = array();
if ($this->isValid) {
$value = parent::getValue();
if (is_array($value)) {
$values = $value;
} else {
$values = array($value);
}
foreach ($values as $value) {
$tokens = $this->scanner->scan($value);
foreach ($tokens as $token) {
$loaded = $this->abstractResourceFactory->loadImageResource($token);
if (is_null($loaded)) {
continue;
}
$resources[] = $loaded;
}
}
}
return $resources;
}