Code Duplication    Length = 13-16 lines in 3 locations

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

@@ 139-154 (lines=16) @@
136
     * @param int $segmentId
137
     * @return array
138
     */
139
    private function getOverviewsOfSegment($segmentId)
140
    {
141
        // get specified segment
142
        $segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
143
        $segment = $segmentRepository->find($segmentId);
144
145
        if (!$segment) {
146
            throw new \Exception('Unkown segment ID');
147
        }
148
149
        // init the segment
150
        $segmentRepository->initSegment($segment);
151
152
        // get the overviews
153
        return $segment->getOverviews();
154
    }
155
156
    /**
157
     * get all overviews of a config

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

@@ 86-98 (lines=13) @@
83
     *
84
     * @throws \InvalidArgumentException
85
     */
86
    private function generateOverviewsOfSegment($segmentId)
87
    {
88
        /** @var AnalyticsSegmentRepository $segmentRepository */
89
        $segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
90
        $segment           = $segmentRepository->find($segmentId);
91
92
        if (!$segment) {
93
            throw new \InvalidArgumentException('Unknown segment ID');
94
        }
95
96
        // init the segment
97
        $segmentRepository->initSegment($segment);
98
    }
99
100
    /**
101
     * Get all overviews of a config

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

@@ 92-104 (lines=13) @@
89
     * @param int $segmentId
90
     * @return array
91
     */
92
    private function getOverviewsOfSegment($segmentId)
93
    {
94
        // get specified segment
95
        $segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
96
        $segment = $segmentRepository->find($segmentId);
97
98
        if (!$segment) {
99
            throw new \Exception('Unkown segment ID');
100
        }
101
102
        // get the overviews
103
        return $segment->getOverviews();
104
    }
105
106
    /**
107
     * get all overviews of a config