mmk2410
/
my-todo-list
Archived
1
0
Fork 0
This repository has been archived on 2021-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
my-todo-list/src/IdManager.php

27 lines
636 B
PHP

<?php declare(strict_types=1);
namespace MMK2410\MyTodoList;
class IdManager
{
private static array $ids = array();
public static function generateID(string $classname): int
{
if (!array_key_exists($classname, self::$ids)) {
self::$ids[$classname] = 0;
return 0;
} else {
return ++self::$ids[$classname];
}
}
public static function getCurrentId(string $classname)
{
if (!array_key_exists($classname, self::$ids)) {
return 0;
} else {
return self::$ids[$classname];
}
}
}