本文整理匯總了PHP中Ouzo\Utilities\Arrays::filterByAllowedKeys方法的典型用法代碼示例。如果您正苦於以下問題:PHP Arrays::filterByAllowedKeys方法的具體用法?PHP Arrays::filterByAllowedKeys怎麽用?PHP Arrays::filterByAllowedKeys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ouzo\Utilities\Arrays
的用法示例。
在下文中一共展示了Arrays::filterByAllowedKeys方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: matches
public function matches($argument)
{
if (get_class($this->expected) !== get_class($argument)) {
return false;
}
$actualAttributes = Arrays::filterByAllowedKeys($argument->attributes(), $this->expected->getFields());
return $this->expectedAttributes == $actualAttributes;
}
示例2: _assertSamePersistentAttributes
private function _assertSamePersistentAttributes(Model $expected)
{
$expectedAttributes = Arrays::filterByAllowedKeys($expected->attributes(), $expected->getFields());
$actualAttributes = Arrays::filterByAllowedKeys($this->_actual->attributes(), $this->_actual->getFields());
AssertAdapter::assertEquals($expectedAttributes, $actualAttributes, 'Models have different attributes ');
}
示例3: filterByAllowedKeys
public function filterByAllowedKeys($allowedKeys)
{
$this->_array = Arrays::filterByAllowedKeys($this->_array, $allowedKeys);
return $this;
}
示例4: shouldFilterByAllowedKeys
/**
* @test
*/
public function shouldFilterByAllowedKeys()
{
//given
$array = array('a' => 1, 'b' => 2, 'c' => 3);
//when
$filtered = Arrays::filterByAllowedKeys($array, array('a', 'b'));
//then
$this->assertEquals(array('a' => 1, 'b' => 2), $filtered);
}