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

plank / laravel-metable / 8731108978

18 Apr 2024 01:38AM UTC coverage: 92.361% (-6.4%) from 98.76%
8731108978

Pull #102

github

frasmage
added metable:refresh artisan command
Pull Request #102: V6

215 of 248 new or added lines in 18 files covered. (86.69%)

26 existing lines in 7 files now uncovered.

399 of 432 relevant lines covered (92.36%)

65.06 hits per line

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

53.85
/src/DataType/ObjectHandler.php
1
<?php
2

3
namespace Plank\Metable\DataType;
4

5
/**
6
 * Handle serialization of plain objects.
7
 * @deprecated Use SerializeHandler instead.
8
 */
9
class ObjectHandler implements HandlerInterface
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function getDataType(): string
15
    {
16
        return 'object';
6✔
17
    }
18

19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function canHandleValue(mixed $value): bool
23
    {
24
        return is_object($value);
6✔
25
    }
26

27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function serializeValue(mixed $value): string
31
    {
32
        return json_encode($value);
6✔
33
    }
34

35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function unserializeValue(string $serializedValue): mixed
39
    {
40
        return json_decode($serializedValue, false);
6✔
41
    }
42

43
    public function getNumericValue(mixed $value): null|int|float
44
    {
45
        return null;
6✔
46
    }
47

48
    public function getStringValue(mixed $value): null|string
49
    {
50
        if (!config('metable.indexComplexDataTypes', false)) {
6✔
51
            return null;
6✔
52
        }
53

NEW
UNCOV
54
        return substr(
×
NEW
UNCOV
55
            json_encode($value, JSON_THROW_ON_ERROR),
×
NEW
UNCOV
56
            0,
×
NEW
UNCOV
57
            config('metable.stringValueIndexLength', 255)
×
NEW
UNCOV
58
        );
×
59
    }
60

61
    public function isIdempotent(): bool
62
    {
NEW
UNCOV
63
        return true;
×
64
    }
65
}
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

© 2025 Coveralls, Inc