Code Duplication    Length = 12-13 lines in 2 locations

src/services/traits/ObjectById.php 2 locations

@@ 76-88 (lines=13) @@
73
     * @return BaseObject
74
     * @throws ObjectNotFoundException
75
     */
76
    public function getById(int $id, string $toScenario = null): BaseObject
77
    {
78
79
        // Find by ID
80
        if (!$object = $this->findById($id, $toScenario)) {
81
82
            $this->notFoundByIdException($id);
83
84
        }
85
86
        return $object;
87
88
    }
89
90
    /**
91
     * @param int $id
@@ 119-130 (lines=12) @@
116
     * @return BaseObject
117
     * @throws ObjectNotFoundException
118
     */
119
    public function freshGetById(int $id, string $toScenario = null): BaseObject
120
    {
121
122
        if (!$object = $this->freshFindById($id, $toScenario)) {
123
124
            $this->notFoundByIdException($id);
125
126
        }
127
128
        return $object;
129
130
    }
131
132
    /**
133
     * Find an existing cache by ID