Code Duplication    Length = 13-16 lines in 3 locations

src/Kunstmaan/DashboardBundle/Command/GoogleAnalyticsDataCollectCommand.php 1 location

@@ 179-194 (lines=16) @@
176
     *
177
     * @return array
178
     */
179
    private function getOverviewsOfSegment($segmentId)
180
    {
181
        // get specified segment
182
        $segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
183
        $segment = $segmentRepository->find($segmentId);
184
185
        if (!$segment) {
186
            throw new \Exception('Unkown segment ID');
187
        }
188
189
        // init the segment
190
        $segmentRepository->initSegment($segment);
191
192
        // get the overviews
193
        return $segment->getOverviews();
194
    }
195
196
    /**
197
     * get all overviews of a config

src/Kunstmaan/DashboardBundle/Command/GoogleAnalyticsOverviewsGenerateCommand.php 1 location

@@ 110-122 (lines=13) @@
107
     *
108
     * @throws \InvalidArgumentException
109
     */
110
    private function generateOverviewsOfSegment($segmentId)
111
    {
112
        /** @var AnalyticsSegmentRepository $segmentRepository */
113
        $segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
114
        $segment = $segmentRepository->find($segmentId);
115
116
        if (!$segment) {
117
            throw new \InvalidArgumentException('Unknown segment ID');
118
        }
119
120
        // init the segment
121
        $segmentRepository->initSegment($segment);
122
    }
123
124
    /**
125
     * Get all overviews of a config

src/Kunstmaan/DashboardBundle/Command/GoogleAnalyticsOverviewsListCommand.php 1 location

@@ 118-130 (lines=13) @@
115
     *
116
     * @return array
117
     */
118
    private function getOverviewsOfSegment($segmentId)
119
    {
120
        // get specified segment
121
        $segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
122
        $segment = $segmentRepository->find($segmentId);
123
124
        if (!$segment) {
125
            throw new \Exception('Unkown segment ID');
126
        }
127
128
        // get the overviews
129
        return $segment->getOverviews();
130
    }
131
132
    /**
133
     * get all overviews of a config