Pull merge.
[yaffs-website] / web / modules / contrib / hacked / src / Controller / HackedDiffController.php.rej
1 --- src/Controller/HackedDiffController.php
2 +++ src/Controller/HackedDiffController.php
3 @@ -2,14 +2,46 @@
4  
5  namespace Drupal\hacked\Controller;
6  
7 -use Drupal\diff\EntityComparisonBase;
8 +use Drupal\Core\Controller\ControllerBase;
9 +use Drupal\diff\DiffEntityComparison;
10  use Drupal\hacked\hackedFileHasher;
11  use Drupal\hacked\hackedProject;
12 +use Symfony\Component\DependencyInjection\ContainerInterface;
13  
14  /**
15   * Controller routines for hacked routes.
16   */
17 -class HackedDiffController extends EntityComparisonBase {
18 +class HackedDiffController extends ControllerBase {
19 +
20 +  /**
21 +   * Wrapper object for writing/reading configuration from diff.plugins.yml
22 +   */
23 +  protected $config;
24 +
25 +  /**
26 +   * The diff entity comparison service.
27 +   */
28 +  protected $entityComparison;
29 +
30 +  /**
31 +   * Constructs a HackedDiffController object.
32 +   *
33 +   * @param DiffEntityComparison $entity_comparison
34 +   *   DiffEntityComparison service.
35 +   */
36 +  public function __construct(DiffEntityComparison $entity_comparison) {
37 +    $this->config = $this->config('diff.settings');
38 +    $this->entityComparison = $entity_comparison;
39 +  }
40 +
41 +  /**
42 +   * {@inheritdoc}
43 +   */
44 +  public static function create(ContainerInterface $container) {
45 +    return new static(
46 +      $container->get('diff.entity_comparison')
47 +    );
48 +  }
49  
50    /**
51     * Shows a diff report for a specific file in a project.
52 @@ -50,7 +82,7 @@ class HackedDiffController extends EntityComparisonBase {
53        $build = [
54          '#theme'    => 'table',
55          '#header'   => [t('Original'), '', t('Current'), ''],
56 -        '#rows'     => $this->getRows($hasher->fetch_lines($original_file), $hasher->fetch_lines($installed_file), TRUE),
57 +        '#rows'     => $this->entityComparison->getRows($hasher->fetch_lines($original_file), $hasher->fetch_lines($installed_file), TRUE),
58        ];
59  
60        // Add the CSS for the diff.
61 @@ -86,4 +118,4 @@ class HackedDiffController extends EntityComparisonBase {
62      ]);
63    }
64  
65 -}+}