create a new instance
Counter
Counter
(
[string $filename = ""], [int $use_ip = YANA_COUNTER_USE_IP]
)
List of parameters:
Name |
Type |
Description |
$filename |
string |
name of file to safe values to |
$use_ip |
int |
count on reload on / off |
Description:
Use the $use_ip parameter with the setting YANA_COUNTER_USE_IP to create a counter with IP checking (does'nt change on reload) or with the setting YANA_COUNTER_IGNORE_IP to create a counter without IP checking (always changes when an update is called).
Increment/Decrement counter
int
count
(
string $id, [string $info = ""], [int $ammount = 1]
)
List of parameters:
Name |
Type |
Description |
$id |
string |
counter id |
$info |
string |
optional description to be safed along with the counter |
$ammount |
int |
number to add to counter |
Description:
Adds $ammount (defaults to +1) to the counter $id and sets the counter description (the 'info' field) to $info (defaults to "").
Note: as you might already have guessed, using a negative value for $ammount decrements the counter.
compare with another object
string
equals
(
object $anotherObject
)
List of parameters:
Name |
Type |
Description |
$anotherObject |
object |
any object or var you want to compare |
Description:
Returns bool(true) if this object and $anotherObject are equal and bool(false) otherwise.
Two instances are considered equal if and only if they are both objects of the same class, they both refer to the same filesystem resource and use the same IP settings.
Redefinition of: Object::equals()
get counter
array
get
(
[string $id = "*"]
)
List of parameters:
Name |
Type |
Description |
$id |
string |
counter id |
Description:
Returns the current counter settings as:
Array(
'COUNT' => int
'INFO' => string
)
Note: you may use the wildcard '*' to get all counters as an associative, multidimensional array:
Array(
ID1 => Array(
'COUNT' => int
'INFO' => string
)
ID2 => Array(
'COUNT' => int
'INFO' => string
)
...
)
get counter value
mixed
getCount
(
[string $id = "*"]
)
List of parameters:
Name |
Type |
Description |
$id |
string |
counter id |
Description:
This function returns the current value of counter $key.
Note: you may use the wildcard '*' to get an associative array for all values:
Array(
ID1 => int
ID2 => int
...
)
get counter info
mixed
getInfo
(
[string $id = "*"]
)
List of parameters:
Name |
Type |
Description |
$id |
string |
counter id |
Description:
The 'info' field is an optional text value, that describes the counter.
This function returns the current description of counter $key.
Note: you may use the wildcard '*' to get an associative array for all counters:
Array(
ID1 => string
ID2 => string
...
)
inherited from base classes
Inherited From Object