Skip to content

Conversation

mxschmitt
Copy link
Member

This pull request integrates the Track and Folder class. So that the handling with these often used objects is more easier.

Fix: #11
Fix: #12

@mxschmitt mxschmitt requested a review from irgendwr October 13, 2018 11:25
@mxschmitt mxschmitt changed the title Added track class Added Track and Folder class Oct 13, 2018
@mxschmitt mxschmitt changed the title Added Track and Folder class [WIP] Added Track and Folder class Oct 13, 2018
@mxschmitt mxschmitt changed the title [WIP] Added Track and Folder class Added Track and Folder class Oct 13, 2018
src/Folder.php Outdated
/**
* shouldContainsChildren checks if the given file should be
*
* @return string folder UUID
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong return type & description

src/API.php Outdated
}
}
}
if (sizeof($todo) !== 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use count instead of sizeof

src/File.php Outdated
/**
* Class File | src/File.php
*
* A single File with his available actions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"his" should be "it's" since a file is not human and can't have a gender. 😄 This also occurs in other files.

src/API.php Outdated
}
}
if (sizeof($todo) !== 0) {
throw new Exception('Inconsistent data...');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe 'Invalid parent' would be a more clear error.

src/API.php Outdated
}
}

$todo = array_filter($files, function ($file) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of calling array_filter twice and foreach twice you could also do the same thing with two foreach loops.
In the first one you can check if $file["parent"] === "", array_push it as Folder or File to $parents, if not you can add it to $items and loop over them in a second foreach like you did below.

@irgendwr irgendwr assigned mxschmitt and unassigned irgendwr Oct 13, 2018
@mxschmitt mxschmitt merged commit b74b367 into master Oct 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants