Code Duplication    Length = 13-16 lines in 3 locations

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

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

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

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

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

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