Code Duplication    Length = 14-14 lines in 4 locations

src/Kunstmaan/DashboardBundle/Helper/Google/Analytics/ConfigHelper.php 4 locations

@@ 70-83 (lines=14) @@
67
     *
68
     * @return string $token
69
     */
70
    private function getToken($configId = false)
71
    {
72
        if (!$this->token || $configId) {
73
            /** @var AnalyticsConfigRepository $analyticsConfigRepository */
74
            $analyticsConfigRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
75
            if ($configId) {
76
                $this->token = $analyticsConfigRepository->find($configId)->getToken();
77
            } else {
78
                $this->token = $analyticsConfigRepository->findFirst()->getToken();
79
            }
80
        }
81
82
        return $this->token;
83
    }
84
85
    /**
86
     * Save the token to the database
@@ 132-145 (lines=14) @@
129
     *
130
     * @return string $accountId
131
     */
132
    public function getAccountId($configId = false)
133
    {
134
        if (!$this->accountId || $configId) {
135
            /** @var AnalyticsConfigRepository $analyticsConfigRepository */
136
            $analyticsConfigRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
137
            if ($configId) {
138
                $this->accountId = $analyticsConfigRepository->find($configId)->getAccountId();
139
            } else {
140
                $this->accountId = $analyticsConfigRepository->findFirst()->getAccountId();
141
            }
142
        }
143
144
        return $this->accountId;
145
    }
146
147
    /**
148
     * Save the accountId to the database
@@ 205-218 (lines=14) @@
202
     *
203
     * @return string $propertyId
204
     */
205
    public function getPropertyId($configId = false)
206
    {
207
        if (!$this->propertyId || $configId) {
208
            /** @var AnalyticsConfigRepository $analyticsConfigRepository */
209
            $analyticsConfigRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
210
            if ($configId) {
211
                $this->propertyId = $analyticsConfigRepository->find($configId)->getPropertyId();
212
            } else {
213
                $this->propertyId = $analyticsConfigRepository->findFirst()->getPropertyId();
214
            }
215
        }
216
217
        return $this->propertyId;
218
    }
219
220
    /**
221
     * Save the propertyId to the database
@@ 285-298 (lines=14) @@
282
     *
283
     * @return string $propertyId
284
     */
285
    public function getProfileId($configId = false)
286
    {
287
        if (!$this->profileId || $configId) {
288
            /** @var AnalyticsConfigRepository $analyticsConfigRepository */
289
            $analyticsConfigRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
290
            if ($configId) {
291
                $this->profileId = $analyticsConfigRepository->find($configId)->getProfileId();
292
            } else {
293
                $this->profileId = $analyticsConfigRepository->findFirst()->getProfileId();
294
            }
295
        }
296
297
        return $this->profileId;
298
    }
299
300
    /**
301
     * Save the profileId to the database