Collections\Collection::indexExists PHP Method

indexExists() public method

public indexExists ( $index )
    public function indexExists($index)
    {
        if (!is_int($index)) {
            throw new InvalidArgumentException("Index must be an integer");
        }
        if ($index < 0) {
            throw new InvalidArgumentException("Index must be a non-negative integer");
        }
        return $index < $this->count();
    }

Usage Example

 public function testIndexExitsRejectsNonIntegers()
 {
     $this->setExpectedException("Collections\\Exceptions\\InvalidArgumentException");
     $col = new Collection('TestClassA');
     $col->indexExists("wat");
 }