class CategoryTree implements ResolverInterface
// [...] field declarations, constructor using dependency injection
$context, // some context info (e.g. the user ID if any)
array $args = null // an associative array of the parameters passed
$rootCategoryId = $this->getCategoryId($args);
// a bunch of helper functions.
// $category ends up being an array-like value with the data we want
$categoriesTree = $this->categoryTree->getTree($info, $rootCategoryId);
$result = $this->extractDataFromCategoryTree->execute($categoriesTree);
$category = current($result);