• 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

66.67
/src/DataType/ArrayHandler.php
1
<?php
2

3
namespace Plank\Metable\DataType;
4

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

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

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

35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function unserializeValue(string $serializedValue): mixed
39
    {
40
        return json_decode(
12✔
41
            $serializedValue,
12✔
42
            true,
12✔
43
            512,
12✔
44
            JSON_THROW_ON_ERROR
12✔
45
        );
12✔
46
    }
47

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

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

NEW
UNCOV
59
        return substr(
×
NEW
UNCOV
60
            json_encode($value, JSON_THROW_ON_ERROR),
×
NEW
UNCOV
61
            0,
×
NEW
UNCOV
62
            config('metable.stringValueIndexLength', 255)
×
NEW
UNCOV
63
        );
×
64
    }
65

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