Code Duplication    Length = 11-13 lines in 2 locations

src/services/traits/ModelByString.php 1 location

@@ 128-140 (lines=13) @@
125
     * @param string|null $toScenario
126
     * @return BaseModel|null
127
     */
128
    public function freshFindByString(string $string, string $toScenario = null)
129
    {
130
131
        // Find record in db
132
        if (!$record = $this->findRecordByString($string)) {
133
            return null;
134
        }
135
136
        $model = $this->create($record, $toScenario);
137
138
        return $model;
139
140
    }
141
142
    /**
143
     * @param string $string

src/services/traits/ObjectByString.php 1 location

@@ 121-131 (lines=11) @@
118
     * @param string|null $toScenario
119
     * @return BaseObject|null
120
     */
121
    public function freshFindByString(string $string, string $toScenario = null)
122
    {
123
124
        // Find record in db
125
        if (!$record = $this->findRecordByString($string)) {
126
            return null;
127
        }
128
129
        return $this->createFromRecord($record, $toScenario);
130
131
    }
132
133
    /**
134
     * @param string $string