Code Duplication    Length = 12-12 lines in 3 locations

src/services/traits/ModelByString.php 1 location

@@ 148-159 (lines=12) @@
145
     * @return BaseModel
146
     * @throws ModelNotFoundException
147
     */
148
    public function freshGetByString(string $string, string $toScenario = null): BaseModel
149
    {
150
151
        if (!$model = $this->freshFindByString($string, $toScenario)) {
152
153
            $this->notFoundByStringException($string);
154
155
        }
156
157
        return $model;
158
159
    }
160
161
    /*******************************************
162
     * CACHE

src/services/traits/ObjectByString.php 2 locations

@@ 110-121 (lines=12) @@
107
     * @return BaseObject|null
108
     * @throws ObjectNotFoundException
109
     */
110
    public function getByString(string $string, string $toScenario = null): BaseObject
111
    {
112
113
        if (!$model = $this->findByString($string, $toScenario)) {
114
115
            $this->notFoundByStringException($string);
116
117
        }
118
119
        return $model;
120
121
    }
122
123
    /**
124
     * @param string $string
@@ 148-159 (lines=12) @@
145
     * @return BaseObject
146
     * @throws ObjectNotFoundException
147
     */
148
    public function freshGetByString(string $string, string $toScenario = null): BaseObject
149
    {
150
151
        if (!$model = $this->freshFindByString($string, $toScenario)) {
152
153
            $this->notFoundByStringException($string);
154
155
        }
156
157
        return $model;
158
159
    }
160
161
    /*******************************************
162
     * CACHE