Code Duplication    Length = 17-22 lines in 2 locations

lib/Cerbere/Model/Hacked/HackedProject.php 2 locations

@@ 133-154 (lines=22) @@
130
  /**
131
   * Hashes the remote project downloaded earlier.
132
   */
133
  public function hashRemoteProject() {
134
    // Only do this once, no matter how many times we're called.
135
    if (!empty($this->remote_hashed)) {
136
      return;
137
    }
138
139
    // Ensure that the remote project has actually been downloaded.
140
    $this->downloadRemoteProject();
141
142
    // Set up the remote file group.
143
    $base_path = $this->remote_files_downloader->getFinalDestination();
144
    $this->remote_files = HackedFileGroup::fromDirectory($base_path);
145
    $this->remote_files->computeHashes();
146
147
    $this->remote_hashed = count($this->remote_files->getFiles()) > 0;
148
149
    // Logging.
150
    if (!$this->remote_hashed) {
151
      //throw new \Exception('Could not hash remote project: ' . $this->getTitle());
152
      echo 'Could not hash remote project: ' . $this->getTitle() . "\n";
153
    }
154
  }
155
156
  /**
157
   * Locate the base directory of the local project.
@@ 177-193 (lines=17) @@
174
  /**
175
   * Hash the local version of the project.
176
   */
177
  public function hashLocalProject() {
178
    // Only do this once, no matter how many times we're called.
179
    if (!empty($this->local_hashed)) {
180
      return;
181
    }
182
183
    $location = $this->locateLocalProject();
184
    $this->local_files = hackedFileGroup::fromList($location, $this->remote_files->getFiles());
185
    $this->local_files->computeHashes();
186
    $this->local_hashed = count($this->local_files->getFiles()) > 0;
187
188
    // Logging.
189
    if (!$this->local_hashed) {
190
      //throw new \Exception('Could not hash remote project: ' . $this->getTitle());
191
      echo 'Could not hash local project: ' . $this->getTitle() . "\n";
192
    }
193
  }
194
195
  /**
196
   * Compute the differences between our version and the canonical version of the project.