The visitor will be called one extra time for the root of the tree. $category will be undefined in the visitor for this call. The root will have a depth of zero, so the top-level categories will have a depth of one.