本文整理汇总了PHP中Doctrine\Common\Collections\Collection::indexOf方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::indexOf方法的具体用法?PHP Collection::indexOf怎么用?PHP Collection::indexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Collections\Collection
的用法示例。
在下文中一共展示了Collection::indexOf方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexOf
/**
* {@inheritdoc}
*/
public function indexOf($element)
{
$this->initialize();
return $this->coll->indexOf($element);
}
示例2: testSearch
public function testSearch()
{
$this->_coll[0] = 'test';
$this->assertEquals(0, $this->_coll->indexOf('test'));
}
示例3:
function it_does_not_contain_index_of_elements_of_type_other_than_specified(Collection $internal)
{
$this->indexOf(4)->shouldBe(false);
$internal->indexOf(Argument::any())->shouldNotHaveBeenCalled();
}
示例4: hasRole
public function hasRole(Role $role)
{
$index = $this->roles->indexOf($role);
return is_numeric($index);
}
示例5: testSearch
public function testSearch()
{
$this->collection[0] = 'Test';
$this->assertEquals(0, $this->collection->indexOf('Test'));
}
示例6: indexOf
/**
* {@inheritdoc}
*/
public function indexOf($element)
{
return $this->inner->indexOf($element);
}
示例7: indexOf
/**
* {@inheritDoc}
*/
public function indexOf($element)
{
return $this->collection->indexOf($element) === false ? false : $this->getKey($element);
}
示例8: testIndexOf
/**
* @dataProvider provideCollection
*/
public function testIndexOf(Collection $coll, array $elements)
{
$keys = array_keys($elements);
$this->assertSame(current($keys), $coll->indexOf(current($elements)));
$this->assertSame(end($keys), $coll->indexOf(end($elements)));
$this->assertFalse($coll->indexOf('this-will-surely-not-exist'));
}
示例9: getMainAliasId
/**
* return int
*/
public function getMainAliasId()
{
return $this->aliases->indexOf($this->getMainAlias());
}