I write a little homegrown ORM (academic interest). I try to stick to the concept of TDD as a training exercise, and as part of this exercise, I am writing API documentation when developing a class.
Random point: I'm working on a classic getCollection class class. I want him to be able to receive collections of X assets (say, blog posts) for a specific user, as well as collections based on an arbitrary array of numerical values. So you can have a method like any of these
$User = $UserMapper->load(1);
$ArticleCollection = $ArticleMapper->getCollection(range(10,20));
$ArticleCollection = $ArticleMapper->getCollection($User);
$ArticleCollection = $ArticleMapper->getCollection($User->getId());
So, when writing documentation for the getCollection method - I want to declare the @param variable in Docblock. Is it better to have a unique method for each type of argument, or is it acceptable to have a method that delegates to the correct inner method / class based on the type of the argument?
source
share