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

lmc-eu / matej-client-php / 7529439147

15 Jan 2024 01:18PM UTC coverage: 100.0%. Remained the same
7529439147

Pull #145

github

web-flow
Bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #145: Bump actions/checkout from 3 to 4

712 of 712 relevant lines covered (100.0%)

35.03 hits per line

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

100.0
/src/Model/Command/ItemSorting.php
1
<?php declare(strict_types=1);
2

3
namespace Lmc\Matej\Model\Command;
4

5
use Lmc\Matej\Model\Assertion;
6

7
/**
8
 * Sorting items is a way how to use Matej to deliver personalized experience to users.
9
 * It allows to sort given list of items according to the user preference.
10
 */
11
class ItemSorting extends AbstractCommand implements UserAwareInterface
12
{
13
    /** @var string */
14
    private $userId;
15
    /** @var string[] */
16
    private $itemIds = [];
17
    /** @var string|null */
18
    private $modelName;
19

20
    private function __construct(string $userId, array $itemIds)
21
    {
22
        $this->setUserId($userId);
7✔
23
        $this->setItemIds($itemIds);
7✔
24
    }
25

26
    /**
27
     * Sort given item ids for user-based recommendations.
28
     *
29
     * @return static
30
     */
31
    public static function create(string $userId, array $itemIds): self
32
    {
33
        return new static($userId, $itemIds);
7✔
34
    }
35

36
    /**
37
     * Set A/B model name
38
     *
39
     * @return $this
40
     */
41
    public function setModelName(string $modelName): self
42
    {
43
        Assertion::typeIdentifier($modelName);
7✔
44

45
        $this->modelName = $modelName;
7✔
46

47
        return $this;
7✔
48
    }
49

50
    public function getUserId(): string
51
    {
52
        return $this->userId;
7✔
53
    }
54

55
    protected function setUserId(string $userId): void
56
    {
57
        Assertion::typeIdentifier($userId);
7✔
58

59
        $this->userId = $userId;
7✔
60
    }
61

62
    protected function setItemIds(array $itemIds): void
63
    {
64
        Assertion::allTypeIdentifier($itemIds);
7✔
65

66
        $this->itemIds = $itemIds;
7✔
67
    }
68

69
    protected function getCommandType(): string
70
    {
71
        return 'sorting';
7✔
72
    }
73

74
    protected function getCommandParameters(): array
75
    {
76
        $parameters = [
7✔
77
            'user_id' => $this->userId,
7✔
78
            'item_ids' => $this->itemIds,
7✔
79
        ];
7✔
80

81
        if ($this->modelName !== null) {
7✔
82
            $parameters['model_name'] = $this->modelName;
7✔
83
        }
84

85
        return $parameters;
7✔
86
    }
87
}
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