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

tochka-developers / queue-promises / 4892848008

pending completion
4892848008

push

github

darkdarin
fix: psalm 8 and pint

2 of 4 new or added lines in 1 file covered. (50.0%)

757 of 972 relevant lines covered (77.88%)

2.86 hits per line

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

90.48
/src/Models/Casts/ConditionsCast.php
1
<?php
2

3
namespace Tochka\Promises\Models\Casts;
4

5
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
6
use Tochka\Promises\Core\Support\ConditionTransition;
7

8
/**
9
 * @template-implements CastsAttributes<array<ConditionTransition>, string>
10
 */
11
class ConditionsCast implements CastsAttributes
12
{
13
    /**
14
     * @throws \JsonException
15
     */
16
    public function get($model, string $key, $value, array $attributes): array
17
    {
18
        if ($value === null) {
4✔
NEW
19
            return [];
×
20
        }
21

22
        return array_map(
4✔
23
            static function ($conditionTransition) {
4✔
24
                return ConditionTransition::fromArray($conditionTransition);
2✔
25
            },
4✔
26
            json_decode($value, true, 512, JSON_THROW_ON_ERROR)
4✔
27
        );
4✔
28
    }
29

30
    /**
31
     * @throws \JsonException
32
     */
33
    public function set($model, string $key, $value, array $attributes): array
34
    {
35
        if ($value === null) {
4✔
NEW
36
            return [];
×
37
        }
38

39
        return [
4✔
40
            $key => json_encode(
4✔
41
                array_map(
4✔
42
                    static function (ConditionTransition $conditionTransition) {
4✔
43
                        return $conditionTransition->toArray();
2✔
44
                    },
4✔
45
                    $value
4✔
46
                ),
4✔
47
                JSON_THROW_ON_ERROR
4✔
48
            ),
4✔
49
        ];
4✔
50
    }
51
}
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