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

lmc-eu / matej-client-php / 7536558481

15 Jan 2024 01:31PM UTC coverage: 100.0%. Remained the same
7536558481

push

github

OndraM
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>

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

3
namespace Lmc\Matej\Model;
4

5
use Lmc\Matej\Exception\DomainException;
6
use Lmc\Matej\Exception\LogicException;
7
use Lmc\Matej\Model\Command\AbstractCommand;
8

9
/**
10
 * @method static bool allTypeIdentifier(mixed $value) Assert value is valid Matej type identifier for all values
11
 * @internal
12
 */
13
class Assertion extends \Assert\Assertion
14
{
15
    private const MAX_TYPE_IDENTIFIER_LENGTH = 100;
16
    private const MAX_BATCH_SIZE = 1000;
17

18
    protected static $exceptionClass = DomainException::class;
19

20
    /**
21
     * Assert value is valid Matej type identifier
22
     *
23
     * @param mixed $value
24
     */
25
    public static function typeIdentifier($value): bool
26
    {
27
        static::regex(
462✔
28
            $value,
462✔
29
            '/^[0-9A-Za-z-_]+$/',
462✔
30
            'Value "%s" does not match type identifier format requirement (must contain only of alphanumeric chars,'
462✔
31
            . ' dash or underscore)'
462✔
32
        );
462✔
33
        static::maxLength($value, self::MAX_TYPE_IDENTIFIER_LENGTH);
427✔
34

35
        return true;
420✔
36
    }
37

38
    /**
39
     * Assert Commands batch size to Matej is not over size limit.
40
     *
41
     * @param AbstractCommand[] $commands
42
     */
43
    public static function batchSize(array $commands): bool
44
    {
45
        static::lessOrEqualThan(
35✔
46
            count($commands),
35✔
47
            self::MAX_BATCH_SIZE,
35✔
48
            'Request contains %s commands, but at most %s is allowed in one request.'
35✔
49
        );
35✔
50

51
        return true;
21✔
52
    }
53

54
    /**
55
     * Assert that provided classname is an instance or subclass of Response
56
     */
57
    public static function isResponseClass(string $wantedClass): bool
58
    {
59
        if (!is_a($wantedClass, Response::class, true) &&
42✔
60
            !is_subclass_of($wantedClass, Response::class)
42✔
61
        ) {
62
            throw LogicException::forClassNotExtendingOtherClass($wantedClass, Response::class);
14✔
63
        }
64

65
        return true;
28✔
66
    }
67
}
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