| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | public static function getIdByTitle($title) |
||
| 12 | { |
||
| 13 | $id = null; |
||
| 14 | if (empty($title)) { |
||
| 15 | return $id; |
||
| 16 | } |
||
| 17 | $place = self::query()->where('title', $title)->first(); |
||
| 18 | if ($place !== null) { |
||
| 19 | $id = $place->id; |
||
| 20 | } else { |
||
| 21 | $place = self::query()->create(compact('title')); |
||
| 22 | $id = $place->id; |
||
| 23 | } |
||
| 24 | |||
| 25 | return $id; |
||
| 26 | } |
||
| 28 |