• 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

57.14
/src/DataType/SerializableHandler.php
1
<?php
2

3
namespace Plank\Metable\DataType;
4

5
use Serializable;
6

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

21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function canHandleValue(mixed $value): bool
25
    {
26
        return $value instanceof Serializable;
6✔
27
    }
28

29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function serializeValue(mixed $value): string
33
    {
34
        return serialize($value);
12✔
35
    }
36

37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function unserializeValue(string $serializedValue): mixed
41
    {
42
        $allowedClasses = config('metable.options.serializable.allowedClasses', false);
12✔
43
        return unserialize($serializedValue, ['allowed_classes' => $allowedClasses]);
12✔
44
    }
45

46
    public function getNumericValue(mixed $value): null|int|float
47
    {
48
        return null;
6✔
49
    }
50

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

NEW
UNCOV
57
        return substr(
×
NEW
UNCOV
58
            serialize($value),
×
NEW
UNCOV
59
            0,
×
NEW
UNCOV
60
            config('metable.stringValueIndexLength', 255)
×
NEW
UNCOV
61
        );
×
62
    }
63

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