$client, Logger $logger) { $this->client = $client; $this->logger = $logger; } public function getUser($name) { try { $this->logger->info(sprintf('Attempting get user %s', $name)); $user = $this->client->callGetUserDataFunction($name); // do something with data // wrap into suitable class // or transform it somehow $this->logger->info(sprintf('Got user data for %s', $name), array('user' => $user)); return $user; } catch (\Exception $e) { $this->logger->error(sprintf('%s occured while getting user: %s', get_class($e), $e->getMessage), array('exception' => $e)); throw new WebserviceException('GetUser error' , 0, $e); } } }