Code Duplication    Length = 16-18 lines in 2 locations

source/Snapshotter/AggregationHandler/Controllers/SnapshotsController.php 1 location

@@ 101-118 (lines=18) @@
98
     * @param SnapshotSource $source
99
     * @return array
100
     */
101
    public function suppressAction($id, SnapshotSource $source)
102
    {
103
        /** @var SnapshotRecord $snapshot */
104
        $snapshot = $source->findWithLastByPK($id);
105
        if (empty($snapshot)) {
106
            throw new NotFoundException;
107
        }
108
109
        $this->authorize('edit', compact('snapshot'));
110
111
        $snapshot->setSuppression($this->input->data('suppression', false));
112
        $snapshot->save();
113
114
        return [
115
            'status'  => 200,
116
            'message' => $this->say('Suppression status updated.')
117
        ];
118
    }
119
120
    /**
121
     * View last snapshot incident source.

source/Snapshotter/FileHandler/Controllers/SnapshotsController.php 1 location

@@ 51-66 (lines=16) @@
48
     * @param Timestamps      $timestamps
49
     * @return string
50
     */
51
    public function viewAction(SnapshotService $service, Timestamps $timestamps)
52
    {
53
        $filename = $this->input->input('filename');
54
        $snapshot = $service->getSnapshot($filename);
55
56
        if (empty($snapshot)) {
57
            throw new NotFoundException;
58
        }
59
60
        $this->authorize('view', compact('snapshot'));
61
62
        return $this->views->render('snapshotter:file/snapshot', [
63
            'snapshot'   => $snapshot,
64
            'timestamps' => $timestamps,
65
        ]);
66
    }
67
68
    /**
69
     * View last snapshot incident source.