IMHO this is way more OOP way to do it
      class RobotTransformer extends Fractal\TransformerAbstract
      {
          /**
           * @param Robot $robot
           *
           * @return array
           */
          public function transform(Robot $robot)
          {
              return [
                  'id'    => (int) $robot->id,
                  'name' => $robot->title,
              ];
          }
      }
calling it, ex: item
       $robot = $app->modelsManager->executeQuery($phql); // imagine there is only one robot
       return $app->response->withItem($robot, new RobotTransformer);
calling it, ex: collection
       $robots = $app->modelsManager->executeQuery($phql);
       return $app->response->withCollection($robots, new RobotTransformer);