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

plank / laravel-metable / 8842761288

26 Apr 2024 03:37AM UTC coverage: 94.939% (-3.8%) from 98.76%
8842761288

Pull #102

github

frasmage
use prefix index on value instead of separate string_value column
Pull Request #102: V6

373 of 402 new or added lines in 25 files covered. (92.79%)

3 existing lines in 1 file now uncovered.

544 of 573 relevant lines covered (94.94%)

192.47 hits per line

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

92.86
/src/DataType/PureEnumHandler.php
1
<?php
2

3
namespace Plank\Metable\DataType;
4

5
class PureEnumHandler implements HandlerInterface
6
{
7
    public function getDataType(): string
8
    {
9
        return 'enum';
852✔
10
    }
11

12
    public function canHandleValue(mixed $value): bool
13
    {
14
        return $value instanceof \UnitEnum && !($value instanceof \BackedEnum);
114✔
15
    }
16

17
    public function serializeValue(mixed $value): string
18
    {
19
        return sprintf(
6✔
20
            '%s#%s',
6✔
21
            $value::class,
6✔
22
            $value->name
6✔
23
        );
6✔
24
    }
25

26
    public function unserializeValue(string $serializedValue): mixed
27
    {
28
        [$class, $name] = explode('#', $serializedValue, 2);
6✔
29

30
        if (!class_exists($class)
6✔
31
            || !is_a($class, \UnitEnum::class, true)
6✔
32
        ) {
NEW
33
            return null;
×
34
        }
35

36
        return constant("$class::$name");
6✔
37
    }
38

39
    public function getNumericValue(mixed $value): null|int|float
40
    {
41
        return null;
6✔
42
    }
43

44
    public function useHmacVerification(): bool
45
    {
46
        return false;
6✔
47
    }
48
}
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