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

lmc-eu / matej-client-php / 7527331519

15 Jan 2024 10:11AM UTC coverage: 100.0%. Remained the same
7527331519

Pull #135

github

web-flow
Merge 117257645 into 9666a6254
Pull Request #135: Update to new coding standard

20 of 21 new or added lines in 5 files covered. (95.24%)

400 existing lines in 23 files now uncovered.

758 of 758 relevant lines covered (100.0%)

18.54 hits per line

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

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

3
namespace Lmc\Matej\Model\Command;
4

5
use Lmc\Matej\Model\Assertion;
6
use Lmc\Matej\Model\Command\Constants\PropertyType;
7

8
/**
9
 * Command to add or delete item property in the database.
10
 */
11
class ItemPropertySetup extends AbstractCommand
12
{
13
    /** @var string */
14
    private $propertyName;
15
    /** @var PropertyType */
16
    private $propertyType;
17

18
    private function __construct(string $propertyName, PropertyType $propertyType)
19
    {
UNCOV
20
        $this->setPropertyName($propertyName);
56✔
UNCOV
21
        $this->propertyType = $propertyType;
28✔
22
    }
7✔
23

24
    /** @return static */
25
    public static function int(string $propertyName): self
26
    {
UNCOV
27
        return new static($propertyName, PropertyType::INT());
8✔
28
    }
29

30
    /** @return static */
31
    public static function double(string $propertyName): self
32
    {
UNCOV
33
        return new static($propertyName, PropertyType::DOUBLE());
8✔
34
    }
35

36
    /** @return static */
37
    public static function string(string $propertyName): self
38
    {
UNCOV
39
        return new static($propertyName, PropertyType::STRING());
8✔
40
    }
41

42
    /** @return static */
43
    public static function boolean(string $propertyName): self
44
    {
UNCOV
45
        return new static($propertyName, PropertyType::BOOLEAN());
8✔
46
    }
47

48
    /** @return static */
49
    public static function timestamp(string $propertyName): self
50
    {
UNCOV
51
        return new static($propertyName, PropertyType::TIMESTAMP());
8✔
52
    }
53

54
    /** @return static */
55
    public static function set(string $propertyName): self
56
    {
UNCOV
57
        return new static($propertyName, PropertyType::SET());
8✔
58
    }
59

60
    /** @return static */
61
    public static function geolocation(string $propertyName): self
62
    {
UNCOV
63
        return new static($propertyName, PropertyType::GEOLOCATION());
8✔
64
    }
65

66
    protected function setPropertyName(string $propertyName): void
67
    {
UNCOV
68
        Assertion::typeIdentifier($propertyName);
56✔
UNCOV
69
        Assertion::notEq(
56✔
UNCOV
70
            $propertyName,
56✔
UNCOV
71
            'item_id',
56✔
UNCOV
72
            'Cannot manipulate with property "item_id" - it is used by Matej to identify items.'
56✔
UNCOV
73
        );
42✔
74

UNCOV
75
        $this->propertyName = $propertyName;
28✔
76
    }
7✔
77

78
    protected function getCommandType(): string
79
    {
UNCOV
80
        return 'item-properties-setup';
28✔
81
    }
82

83
    protected function getCommandParameters(): array
84
    {
UNCOV
85
        return [
21✔
UNCOV
86
            'property_name' => $this->propertyName,
28✔
UNCOV
87
            'property_type' => $this->propertyType->jsonSerialize(),
28✔
UNCOV
88
        ];
21✔
89
    }
90
}
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