Code Duplication    Length = 8-10 lines in 2 locations

src/ReferenceData/USHolTradeDates.php 1 location

@@ 114-121 (lines=8) @@
111
     * @param  string  $pattern
112
     * @param  string  $errorMessage
113
     */
114
    private function validateInput(string $input, string $pattern, string $errorMessage): void
115
    {
116
        preg_match_all($pattern, $input, $matches, PREG_SET_ORDER, 0);
117
118
        if (empty($matches)) {
119
            throw WrongData::invalidValuesProvided($errorMessage);
120
        }
121
    }
122
}
123

src/AlternativeData/SocialSentiment.php 1 location

@@ 73-82 (lines=10) @@
70
        }
71
    }
72
73
    private function validateDate(string $date)
74
    {
75
        $re = '/(20\d{2})(\d{2})(\d{2})/mi';
76
77
        preg_match_all($re, $date, $matches, PREG_SET_ORDER, 0);
78
79
        if (empty($matches)) {
80
            throw WrongData::invalidValuesProvided('Format date to use YYYYMMDD to fetch sentiment data.');
81
        }
82
    }
83
}
84