/** * @param string $id * @return User|null */ public function getUser($id) { try { $cfUser = $this->cultureFeed->getUser($id, self::INCLUDE_PRIVATE_FIELDS); // Cast to a User object that can be safely encoded to json. return User::fromCultureFeedUser($cfUser); } catch (\CultureFeed_ParseException $e) { return null; } }