• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

michalsn / codeigniter-nested-model / 13702213830

06 Mar 2025 03:27PM UTC coverage: 95.904%. Remained the same
13702213830

push

github

web-flow
chore: update workflows to include PHP 8.4 (#7)

* chore: update workflows to include PHP 8.4

* cs-fix

* update devkit to dev-develop

* fix phpstan

* update cs fixer workflow

* fix typo

* psalm: disable ensureOverrideAttribute

18 of 18 new or added lines in 3 files covered. (100.0%)

398 of 415 relevant lines covered (95.9%)

11.47 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/Common.php
1
<?php
2

3
use CodeIgniter\Model;
4

5
if (! function_exists('get_foreign_key')) {
6
    /**
7
     * Get foreign key based on model info.
8
     */
9
    function get_foreign_key(Model $model): string
10
    {
11
        $refObj = new ReflectionObject($model);
35✔
12

13
        $refProp = $refObj->getProperty('table');
35✔
14
        $table   = $refProp->getValue($model);
35✔
15

16
        $refProp    = $refObj->getProperty('primaryKey');
35✔
17
        $primaryKey = $refProp->getValue($model);
35✔
18

19
        return singular($table) . '_' . $primaryKey;
35✔
20
    }
21
}
22

23
if (! function_exists('get_primary_key')) {
24
    /**
25
     * Get primary key based on model info.
26
     */
27
    function get_primary_key(Model $model): string
28
    {
29
        $refObj = new ReflectionObject($model);
35✔
30

31
        $refProp = $refObj->getProperty('primaryKey');
35✔
32

33
        return $refProp->getValue($model);
35✔
34
    }
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc