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

daycry / auth / 25518434194

07 May 2026 07:49PM UTC coverage: 58.608% (-6.4%) from 64.989%
25518434194

push

github

web-flow
Merge pull request #47 from daycry/development

Implement security enhancements and new account features

277 of 1030 new or added lines in 55 files covered. (26.89%)

11 existing lines in 6 files now uncovered.

3544 of 6047 relevant lines covered (58.61%)

47.97 hits per line

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

0.0
/src/Entities/AuditLog.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of Daycry Auth.
7
 *
8
 * (c) Daycry <daycry9@proton.me>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace Daycry\Auth\Entities;
15

16
use CodeIgniter\Entity\Entity;
17
use CodeIgniter\I18n\Time;
18
use JsonException;
19

20
/**
21
 * Represents one row in the auth_audit_logs table.
22
 *
23
 * @property int|null    $actor_id   The user that triggered the event (admin or self). Null for system actions.
24
 * @property Time|null   $created_at
25
 * @property string      $event_type Short snake_case identifier (e.g. "totp.enabled", "password.changed").
26
 * @property int|null    $id
27
 * @property string|null $ip_address
28
 * @property string|null $metadata   JSON-encoded extra context.
29
 * @property string|null $user_agent
30
 * @property int|null    $user_id    The user the event affects.
31
 */
32
class AuditLog extends Entity
33
{
34
    protected $casts = [
35
        'id'       => '?integer',
36
        'user_id'  => '?integer',
37
        'actor_id' => '?integer',
38
    ];
39
    protected $dates = ['created_at'];
40

41
    /**
42
     * Decode metadata from JSON to array.
43
     *
44
     * @return array<string, mixed>
45
     */
NEW
46
    public function getMetadata(): array
×
47
    {
NEW
48
        $raw = $this->attributes['metadata'] ?? null;
×
49

NEW
50
        if (! is_string($raw) || $raw === '') {
×
NEW
51
            return [];
×
52
        }
53

54
        try {
NEW
55
            $decoded = json_decode($raw, true, 512, JSON_THROW_ON_ERROR);
×
56

NEW
57
            return is_array($decoded) ? $decoded : [];
×
NEW
58
        } catch (JsonException) {
×
NEW
59
            return [];
×
60
        }
61
    }
62
}
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