Overview
  • Namespace
  • Class
  • Tree

Namespaces

  • CupOfTea
    • Counter
      • Facades

Classes

  • Counter
  • CounterServiceProvider

Class Counter

CupOfTea\Counter\Counter implements SeekableIterator uses CupOfTea\Package\Package (not available)
Namespace: CupOfTea\Counter
Located at Counter.php

Methods summary

public CupOfTea\Support\Counter
# loop( mixed $traversable )

Loop over a variable.

Loop over a variable.

Parameters

$traversable

Returns

CupOfTea\Support\Counter
public Traversable|array
# getTraversable( )

Get the item that's being traversed.

Get the item that's being traversed.

Returns

Traversable|array
public
# seek( integer $position )

Seeks to a position.

Seeks to a position.

Parameters

$position

Throws

InvalidArgumentException
when $position is not an integer.
OutOfBoundsException
when the seek $position exeeds the traversable's length.

Implementation of

SeekableIterator::seek()
public mixed
# rewind( )

Set the internal pointer of the traversable to its first element.

Set the internal pointer of the traversable to its first element.

Returns

mixed

Implementation of

Iterator::rewind()
public mixed
# current( )

Return the current element in the traversable.

Return the current element in the traversable.

Returns

mixed

Implementation of

Iterator::current()
public mixed
# key( )

Return the index element of the current traversable position.

Return the index element of the current traversable position.

Returns

mixed

Implementation of

Iterator::key()
public mixed
# next( )

Advance the internal array pointer of the traversable.

Advance the internal array pointer of the traversable.

Returns

mixed

Implementation of

Iterator::next()
public mixed
# prev( )

Rewind the internal array pointer of the traversable.

Rewind the internal array pointer of the traversable.

Returns

mixed
public boolean
# valid( )

Checks if current position of the traversable is valid.

Checks if current position of the traversable is valid.

Returns

boolean

Implementation of

Iterator::valid()
public mixed
# end( )

Set the internal pointer of the traversable to its last element.

Set the internal pointer of the traversable to its last element.

Returns

mixed
public
# start( boolean|integer $length = false )

Start a simple counter.

Start a simple counter.

Parameters

$length
public
# increment( integer $by = 1 )

Increment the counter by a specified amount.

Increment the counter by a specified amount.

Parameters

$by
public
# decrement( integer $by = 1 )

Decrement the counter by a specified amount.

Decrement the counter by a specified amount.

Parameters

$by
public
# tick( )

Increment the counter by 1.

Increment the counter by 1.

public boolean
# first( )

Check if the current position is the initial position.

Check if the current position is the initial position.

Returns

boolean
public boolean
# last( )

Check if the current position is the last position. Will always return false if no length was specified for a simple counter.

Check if the current position is the last position. Will always return false if no length was specified for a simple counter.

Returns

boolean
public boolean
# nth( $n )

Check if the current iteration is the nth iteration (1 based).

Check if the current iteration is the nth iteration (1 based).

Returns

boolean
public boolean
# even( )

Check if the current iteration is an even iteration (1 based).

Check if the current iteration is an even iteration (1 based).

Returns

boolean
public boolean
# odd( )

Check if the current iteration is an odd iteration (1 based).

Check if the current iteration is an odd iteration (1 based).

Returns

boolean
public mixed
# item( )

Return the current element.

Return the current element.

Returns

mixed
public integer
# index( )

Get the current position.

Get the current position.

Returns

integer
public integer
# iteration( )

Get the current iteration.

Get the current iteration.

Returns

integer
public float
# length( )

Get the length of the traversable or the counter.

Get the length of the traversable or the counter.

Returns

float
public
# traverse( $traversable )

See

\CupOfTea\Support\Counter::loop
public
# i( )

See

\CupOfTea\Support\Counter::index
public
# position( )

See

\CupOfTea\Support\Counter::index

Constants summary

string PACKAGE

Package Name.

Package Name.

Const

string
# 'CupOfTea/Counter'
string VERSION

Package Version.

Package Version.

Const

string
# '1.0.3'
API documentation generated by ApiGen