本文整理汇总了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;
}