| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | protected function upsertEntryType(array $entry, string $contentfulType) |
||
| 17 | { |
||
| 18 | $pivot = DB::table('entry_types') |
||
| 19 | ->where('contentful_id', '=', $entry['sys']['id']) |
||
| 20 | ->first(); |
||
| 21 | |||
| 22 | if (empty($pivot)) { |
||
| 23 | DB::table('entry_types') |
||
| 24 | ->insert([ |
||
| 25 | 'contentful_id' => $entry['sys']['id'], |
||
| 26 | 'contentful_type' => $contentfulType, |
||
| 27 | ]); |
||
| 28 | } else { |
||
| 29 | DB::table('entry_types') |
||
| 30 | ->where('contentful_id', '=', $entry['sys']['id']) |
||
| 31 | ->update([ |
||
| 32 | 'contentful_type' => $contentfulType, |
||
| 33 | ]); |
||
| 50 |