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