ACC SHELL
<?php
class Counter
{
private static $counter;
/**
* Set counter to initial value. If initial value is not set, default is zero
*/
public static function init($initValue = false)
{
self::$counter = intval($initValue);
}
/**
* @return Actual value of the counter
*/
public static function getCounter()
{
return self::$counter;
}
/**
* Set counter + 1
*/
public static function increment()
{
self::$counter++;
}
/**
* Set counter - 1
*/
public static function decrement()
{
self::$counter--;
}
/**
* Check if counter is even
* @return boolen
*/
public static function isEven()
{
return self::$counter % 2 == 0 ? true : false;
}
/**
* Check if counter is odd
* @return boolen
*/
public static function isOdd()
{
return self::$counter % 2 != 0 ? true : false;
}
}
ACC SHELL 2018