Code Duplication    Length = 18-18 lines in 2 locations

src/Version.php 2 locations

@@ 51-68 (lines=18) @@
48
        parent::__construct();
49
        unset($this->Major, $this->Minor, $this->Build, $this->Revision);
50
51
        if (!is_integer($major)) {
52
            $args = [
53
                'class'    => typeof($this)->Name,
54
                'name'     => 'major',
55
                'pos'      => 0,
56
                'expected' => typeof(0),
57
                'actual'   => typeof($major),
58
            ];
59
60
            $msg = nml_msg('Invalid argument type.');
61
            $msg .= nml_msg(
62
                ' "{name}" (position {pos}) must to be an instance of "{expected}"; "{actual}" given.',
63
                $args
64
            );
65
            $msg .= nml_msg(' Convert value or use the "{class}::parse" (static) method.', $args);
66
67
            throw new InvalidArgumentException($msg);
68
        }
69
70
        if (!is_integer($minor)) {
71
            $args = [
@@ 70-87 (lines=18) @@
67
            throw new InvalidArgumentException($msg);
68
        }
69
70
        if (!is_integer($minor)) {
71
            $args = [
72
                'class'    => typeof($this)->Name,
73
                'name'     => 'minor',
74
                'pos'      => 1,
75
                'expected' => typeof(0),
76
                'actual'   => typeof($minor),
77
            ];
78
79
            $msg = nml_msg('Invalid argument type.');
80
            $msg .= nml_msg(
81
                ' "{name}" (position {pos}) must to be an instance of "{expected}"; "{actual}" given.',
82
                $args
83
            );
84
            $msg .= nml_msg(' Convert value or use the "{class}::parse" (static) method.', $args);
85
86
            throw new InvalidArgumentException($msg);
87
        }
88
89
        if ($major < 0) {
90
            $args = [