Code Duplication    Length = 12-13 lines in 2 locations

src/services/traits/ObjectById.php 2 locations

@@ 86-98 (lines=13) @@
83
     * @return BaseObject
84
     * @throws ObjectNotFoundException
85
     */
86
    public function getById(int $id, string $toScenario = null): BaseObject
87
    {
88
89
        // Find by ID
90
        if (!$object = $this->findById($id, $toScenario)) {
91
92
            $this->notFoundByIdException($id);
93
94
        }
95
96
        return $object;
97
98
    }
99
100
    /**
101
     * @param int $id
@@ 123-134 (lines=12) @@
120
     * @return BaseObject
121
     * @throws ObjectNotFoundException
122
     */
123
    public function freshGetById(int $id, string $toScenario = null): BaseObject
124
    {
125
126
        if (!$object = $this->freshFindById($id, $toScenario)) {
127
128
            $this->notFoundByIdException($id);
129
130
        }
131
132
        return $object;
133
134
    }
135
136
137
    /*******************************************