Code Duplication    Length = 13-16 lines in 3 locations

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

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

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

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

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

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