Code Duplication    Length = 14-14 lines in 4 locations

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

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