本文整理匯總了PHP中Base::isEmpty方法的典型用法代碼示例。如果您正苦於以下問題:PHP Base::isEmpty方法的具體用法?PHP Base::isEmpty怎麽用?PHP Base::isEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Base
的用法示例。
在下文中一共展示了Base::isEmpty方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testConstructor
/**
* @return null
*/
public function testConstructor()
{
$this->assertInstanceOf('\\Appfuel\\View\\Html\\Tag\\GenericTagInterface', $this->meta);
/*
* no content should be added to this tag
*/
$this->assertTrue($this->meta->isEmpty());
}
示例2: testIsEmpty
public function testIsEmpty()
{
$instance1 = new Base('');
$this->assertTrue($instance1->isEmpty());
$instance2 = new Base(' ');
$this->assertTrue($instance2->isEmpty());
$instance3 = new Base(false);
$this->assertTrue($instance3->isEmpty());
$instance4 = new Base(null);
$this->assertTrue($instance4->isEmpty());
$instance5 = new Base('0');
$this->assertFalse($instance5->isEmpty());
$instance6 = new Base('foo');
$this->assertFalse($instance6->isEmpty());
}
示例3: isEmpty
/**
* @see Base
*/
protected function isEmpty($value)
{
if (is_array($value)) {
// array is not empty when a value is found
foreach ($value as $key => $val) {
// int and string '0' are 'empty' values that are explicitly accepted
if ($val === 0 || $val === '0' || !empty($val)) {
return false;
}
}
return true;
}
return parent::isEmpty($value);
}
示例4: isEmpty
/**
* @see Base
*/
protected function isEmpty($value)
{
if (is_array($value)) {
$filtered = array_filter($value);
return empty($filtered);
}
return parent::isEmpty($value);
}