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

@@ 103-114 (lines=12) @@
100
     * @return BaseObject|null
101
     * @throws ObjectNotFoundException
102
     */
103
    public function getByString(string $string, string $toScenario = null): BaseObject
104
    {
105
106
        if (!$model = $this->findByString($string, $toScenario)) {
107
108
            $this->notFoundByStringException($string);
109
110
        }
111
112
        return $model;
113
114
    }
115
116
    /**
117
     * @param string $string
@@ 139-150 (lines=12) @@
136
     * @return BaseObject
137
     * @throws ObjectNotFoundException
138
     */
139
    public function freshGetByString(string $string, string $toScenario = null): BaseObject
140
    {
141
142
        if (!$model = $this->freshFindByString($string, $toScenario)) {
143
144
            $this->notFoundByStringException($string);
145
146
        }
147
148
        return $model;
149
150
    }
151
152
    /*******************************************
153
     * CACHE