diff --git a/drupal_coverage_core.services.yml b/drupal_coverage_core.services.yml
index 9e154f6..bca1072 100644
--- a/drupal_coverage_core.services.yml
+++ b/drupal_coverage_core.services.yml
@@ -1,8 +1,11 @@
 services:
   drupal_coverage_core.analysis_manager:
     class: Drupal\drupal_coverage_core\AnalysisManager
-    arguments: [ '@date.formatter' ]
+    arguments: [ '@date.formatter', '@drupal_coverage_core.travis_client' ]
 
   drupal_coverage_core.module_manager:
     class: Drupal\drupal_coverage_core\ModuleManager
     arguments: [ '@drupal_coverage_core.analysis_manager' ]
+
+  drupal_coverage_core.travis_client:
+    class: Drupal\drupal_coverage_core\TravisClient
diff --git a/src/AnalysisManager.php b/src/AnalysisManager.php
index 2c06af3..15060b1 100644
--- a/src/AnalysisManager.php
+++ b/src/AnalysisManager.php
@@ -31,11 +31,17 @@ class AnalysisManager {
   protected $date_formatter;
 
   /**
+   * @var TravisClient;
+   */
+  protected $travisClient;
+
+  /**
    * @param BuildData|NULL $build_data
    */
-  public function __construct(DateFormatter $date_formatter) {
+  public function __construct(DateFormatter $date_formatter, TravisClient $travis_client) {
     $this->generator = new Generator();
     $this->date_formatter = $date_formatter;
+    $this->travisClient = $travis_client;
   }
 
   /**
diff --git a/src/Generator.php b/src/Generator.php
index a070f04..f20eba3 100644
--- a/src/Generator.php
+++ b/src/Generator.php
@@ -1,30 +1,45 @@
 <?php
-/**
- * @file
- * Contains
- */
 
 namespace Drupal\drupal_coverage_core;
 
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\drupal_coverage_core\Client\TravisClient;
-use Drupal\drupal_coverage_core\Exception\InvalidModuleTypeException;
 
-class Generator
-{
+/**
+ * Defines a generator which will generate input for TravisClient.
+ */
+class Generator {
 
+  /**
+   * The HTTP client.
+   *
+   * @var TravisClient
+   */
   protected $client;
 
-  protected $branch_prefix = "reports";
+  /**
+   * Prefix used for creating new branches in GitHub.
+   *
+   * @var string
+   */
+  protected $branchPrefix = "reports";
 
+  /**
+   * The RawGit base URL.
+   *
+   * @var string
+   */
   protected $url = "https://rawgit.com/legovaer/dc-travis/";
 
   const BUILD_BUILDING = 0;
   const BUILD_SUCCESSFUL = 1;
   const BUILD_FAILED = 2;
 
+  /**
+   * Constructs a Generator.
+   */
   public function __construct() {
-    $this->client = new TravisClient();
+    $this->client = \Drupal::service('@drupal_coverage_core.travis_client');
   }
 
   /**
@@ -34,6 +49,7 @@ class Generator
    *   The data that needs to be sent to Travis CI.
    *
    * @return \Psr\Http\Message\ResponseInterface
+   *   The response object coming from the TravisCI Client.
    */
   public function build(BuildData $build_data) {
     return $this->client->build($this->generateBody($build_data));
@@ -43,21 +59,27 @@ class Generator
    * Creates a prefix for the coverage URL.
    *
    * @param BuildData $build_data
+   *   The build data.
+   *
    * @return string
+   *   The URL prefix where the coverage analysis can be found.
    */
   protected function getCoverageUrlPrefix(BuildData $build_data) {
     $module_name = ModuleManager::cleanModuleName(
       $build_data->getModule()->title->getString()
     );
     $build_number = $build_data->getBuildData()->number;
-    return $this->url . $this->branch_prefix . "/$module_name/$build_number/";
+    return $this->url . $this->branchPrefix . "/$module_name/$build_number/";
   }
 
   /**
    * Creates the URL where the analysis can be found.
    *
    * @param BuildData $build_data
+   *   The build data.
+   *
    * @return string
+   *   The absolute URL where the analysis can be found.
    */
   public function getCoverageUrl(BuildData $build_data) {
     return $this->getCoverageLink($build_data, "index.html");
@@ -67,7 +89,10 @@ class Generator
    * Creates the URL where the badge can be found.
    *
    * @param BuildData $build_data
+   *   The build data.
+   *
    * @return string
+   *   The absolute URL where the badge can be found.
    */
   public function getCoverageBadge(BuildData $build_data) {
     return $this->getCoverageLink($build_data, "badge.svg");
@@ -77,8 +102,12 @@ class Generator
    * Creates the base link where the coverage can be found.
    *
    * @param BuildData $build_data
-   * @param $path
+   *   The build data.
+   * @param string $path
+   *   The path that should be used for generating the URL.
+   *
    * @return string
+   *   The base link of where the coverage information can be found.
    */
   protected function getCoverageLink(BuildData $build_data, $path) {
     return $this->getCoverageUrlPrefix($build_data) . $path;
@@ -88,16 +117,20 @@ class Generator
    * Creates a name of a branch which will be used for storing the analysis.
    *
    * @param EntityInterface $module
+   *   The module.
+   *
    * @return string
+   *   The branch that will be used for this module & build.
    */
   protected function getDestinationBranch(EntityInterface $module) {
-    return $this->branch_prefix . "/" . ModuleManager::cleanModuleName($module->title->getString());
+    return $this->branchPrefix . "/" . ModuleManager::cleanModuleName($module->title->getString());
   }
 
   /**
    * Generates the body field which will be sent to Travis CI.
    *
    * @param BuildData $build_data
+   *   The build data of of the analysis.
    */
   protected function generateBody(BuildData $build_data) {
     $module = $build_data->getModule();
@@ -117,7 +150,7 @@ class Generator
             'cd drupal_ti/',
             'composer install',
             'ln -sf $HOME/drupal_ti/drupal-ti "$HOME/.composer/vendor/bin"',
-          ]
+          ],
         ],
       ],
     ];
@@ -130,8 +163,14 @@ class Generator
   }
 
   /**
-   * @param null $build_id
+   * Get the build data from Travis for a given ID.
+   *
+   * @param string|null $build_id
+   *   The id of the build.
+   *
    * @return mixed|object
+   *   When a $build_id is given, the details of that build. Otherwise
+   *   the build details of the last build.
    */
   public function getBuildData($build_id = NULL) {
     if ($build_id) {
@@ -143,18 +182,27 @@ class Generator
     return $build;
   }
 
+  /**
+   * Determines which call-out class should be used.
+   *
+   * @param int $build_status
+   *   The current status of the build.
+   *
+   * @return string
+   *   The CSS classname which should be used.
+   */
   public static function getCalloutClass($build_status) {
     switch ($build_status) {
-      case \Drupal\drupal_coverage_core\Generator::BUILD_BUILDING:
+      case Generator::BUILD_BUILDING:
       default:
         $callout_class = "bs-callout-info";
         break;
 
-      case \Drupal\drupal_coverage_core\Generator::BUILD_FAILED:
+      case Generator::BUILD_FAILED:
         $callout_class = "bs-callout-failed";
         break;
 
-      case \Drupal\drupal_coverage_core\Generator::BUILD_SUCCESSFUL:
+      case Generator::BUILD_SUCCESSFUL:
         $callout_class = "bs-callout-success";
     }
 
