Code Duplication    Length = 13-16 lines in 2 locations

src/Charcoal/Cms/Service/Manager/EventManager.php 1 location

@@ 235-250 (lines=16) @@
232
     * @param integer|null $id The event id.
233
     * @return mixed
234
     */
235
    public function entry($id = null)
236
    {
237
        if (!$id) {
238
            return $this->currentEvent();
239
        }
240
241
        if (!isset($this->entry[$id])) {
242
            /** @var Model $model */
243
            $model = $this->modelFactory();
244
            /** @var EventInterface $entry */
245
            $entry = $model->get($this->objType())->loadfrom('id', $id);
246
            $this->entry[$id] = $entry->id() ? $entry : $this->currentEvent();
247
        }
248
249
        return $this->entry[$id];
250
    }
251
252
    /**
253
     * All available events

src/Charcoal/Cms/Service/Manager/NewsManager.php 1 location

@@ 140-152 (lines=13) @@
137
     * @param integer|null $id The news id.
138
     * @return mixed
139
     */
140
    public function entry($id = null)
141
    {
142
        if (!$id) {
143
            return $this->currentNews();
144
        }
145
146
        if (!isset($this->entry[$id])) {
147
            $entry = $this->modelFactory()->get($this->objType())->loadFrom('id', $id);
148
            $this->entry[$id] = $entry->id() ? $entry : $this->currentNews();
149
        }
150
151
        return $this->entry[$id];
152
    }
153
154
    /**
155
     * All available news.