Code Duplication    Length = 14-15 lines in 3 locations

src/Version.php 2 locations

@@ 89-103 (lines=15) @@
86
            throw new InvalidArgumentException($msg);
87
        }
88
89
        if ($major < 0) {
90
            $args = [
91
                'name'     => 'major',
92
                'pos'      => 0,
93
                'actual'   => $major,
94
            ];
95
96
            $msg = nml_msg('Invalid argument value.');
97
            $msg .= nml_msg(
98
                ' "{name}" (position {pos}) must to be a positive number; "{actual}" given.',
99
                $args
100
            );
101
102
            throw new InvalidArgumentException($msg);
103
        }
104
105
        if ($minor < 0) {
106
            $args = [
@@ 105-119 (lines=15) @@
102
            throw new InvalidArgumentException($msg);
103
        }
104
105
        if ($minor < 0) {
106
            $args = [
107
                'name'     => 'minor',
108
                'pos'      => 1,
109
                'actual'   => $minor,
110
            ];
111
112
            $msg = nml_msg('Invalid argument value.');
113
            $msg .= nml_msg(
114
                ' "{name}" (position {pos}) must to be a positive number; "{actual}" given.',
115
                $args
116
            );
117
118
            throw new InvalidArgumentException($msg);
119
        }
120
121
        $this->major = $major;
122
        $this->minor = $minor;

src/VersionComponent.php 1 location

@@ 50-63 (lines=14) @@
47
            $this->stringValue = '';
48
        } else {
49
            // Validation of values
50
            if ($this->IntValue < 0) {
51
                $args = [
52
                    'position' => '1st',
53
                    'actual'   => $intValue,
54
                ];
55
56
                $msg = nml_msg('Invalid argument value.');
57
                $msg .= nml_msg(
58
                    ' {position} argument must to be a positive number; "{actual}" given.',
59
                    $args
60
                );
61
62
                throw new InvalidArgumentException($msg);
63
            } // Integer is valid
64
65
            if ($stringValue !== null) {
66
                if ($this->StringValue != '') {