• 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/UserMerge.php
1
<?php declare(strict_types=1);
2

3
namespace Lmc\Matej\Model\Command;
4

5
use Lmc\Matej\Model\Assertion;
6

7
/**
8
 * Take all interactions from the source user and merge them to the target user.
9
 * Source user will be DELETED and unknown to Matej from this action.
10
 */
11
class UserMerge extends AbstractCommand implements UserAwareInterface
12
{
13
    /** @var string */
14
    private $sourceUserId;
15
    /** @var string */
16
    private $targetUserId;
17
    /** @var int */
18
    private $timestamp;
19

20
    private function __construct(string $targetUserId, string $sourceUserId, int $timestamp = null)
21
    {
22
        $this->setTargetUserId($targetUserId);
7✔
23
        $this->setSourceUserId($sourceUserId);
7✔
24
        $this->setTimestamp($timestamp ?? time());
7✔
25

26
        $this->assertUserIdsNotEqual();
7✔
27
    }
28

29
    /**
30
     * Merge source user into target user AND DELETE SOURCE USER.
31
     *
32
     * @return static
33
     */
34
    public static function mergeInto(string $targetUserId, string $sourceUserIdToBeDeleted, int $timestamp = null): self
35
    {
36
        return new static($targetUserId, $sourceUserIdToBeDeleted, $timestamp);
7✔
37
    }
38

39
    /**
40
     * Merge source user into target user AND DELETE SOURCE USER.
41
     *
42
     * @return static
43
     */
44
    public static function mergeFromSourceToTargetUser(
45
        string $sourceUserIdToBeDeleted,
46
        string $targetUserId,
47
        int $timestamp = null
48
    ): self {
49
        return new static($targetUserId, $sourceUserIdToBeDeleted, $timestamp);
7✔
50
    }
51

52
    public function getUserId(): string
53
    {
54
        return $this->targetUserId;
7✔
55
    }
56

57
    public function getSourceUserId(): string
58
    {
59
        return $this->sourceUserId;
7✔
60
    }
61

62
    protected function setSourceUserId(string $sourceUserId): void
63
    {
64
        Assertion::typeIdentifier($sourceUserId);
7✔
65

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

69
    protected function setTargetUserId(string $targetUserId): void
70
    {
71
        Assertion::typeIdentifier($targetUserId);
7✔
72

73
        $this->targetUserId = $targetUserId;
7✔
74
    }
75

76
    protected function setTimestamp(int $timestamp): void
77
    {
78
        Assertion::greaterThan($timestamp, 0);
7✔
79

80
        $this->timestamp = $timestamp;
7✔
81
    }
82

83
    private function assertUserIdsNotEqual(): void
84
    {
85
        Assertion::notEq(
7✔
86
            $this->sourceUserId,
7✔
87
            $this->targetUserId,
7✔
88
            'You have to provide different source and target user id in UserMerge ("%s" set for both)'
7✔
89
        );
7✔
90
    }
91

92
    protected function getCommandType(): string
93
    {
94
        return 'user-merge';
7✔
95
    }
96

97
    protected function getCommandParameters(): array
98
    {
99
        return [
7✔
100
            'target_user_id' => $this->targetUserId,
7✔
101
            'source_user_id' => $this->sourceUserId,
7✔
102
            'timestamp' => $this->timestamp,
7✔
103
        ];
7✔
104
    }
105
}
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