Addng some comments

This commit is contained in:
Dendy 2023-07-10 14:21:15 +02:00
parent e56d803823
commit 2edc35dcb9
1 changed files with 8 additions and 2 deletions

View File

@ -2,11 +2,13 @@
class Item implements JsonSerializable
{
// TODO: create a persist() method that updates the line if the offset where
// TODO: Create a persist() method that updates the line if the offset where
// it originally existed in is given by 'ftell'. If it doesn't have an
// ID, then try to find it in the file and if it doesn't exist, append
//
// TODO: Mantain ":" between tags and subtags that can multiple subtags, use
// another character ("="?) to signal that it should be unique
//
// TODO: Maybe implement tags as an associative array or somethign?
//
// TODO: Change to id here in all occurrences
@ -23,6 +25,7 @@ class Item implements JsonSerializable
$db->map(function ($line) use (&$ret, $id) {
if ($line[0] == $id) {
$ret = Item::fromLine($line);
return true;
}
@ -48,6 +51,9 @@ class Item implements JsonSerializable
{
$from_path = $php_file['tmp_name'] ?? null;
// TODO: If any step fails, nothing should be actually written to the
// media file or the image copied. Maybe revert the changes?
// --- CHECKS ---
if (!is_string($from_path))
Json::error('Passed invalid upload structure')->die();