Code Duplication    Length = 9-10 lines in 11 locations

src/Assert.php 11 locations

@@ 178-186 (lines=9) @@
175
        static::notEq($value, '', $message);
176
    }
177
178
    public static function integer($value, $message = '')
179
    {
180
        if (!is_int($value)) {
181
            static::reportInvalidArgument(sprintf(
182
                $message ?: 'Expected an integer. Got: %s',
183
                static::typeToString($value)
184
            ));
185
        }
186
    }
187
188
    public static function integerish($value, $message = '')
189
    {
@@ 188-196 (lines=9) @@
185
        }
186
    }
187
188
    public static function integerish($value, $message = '')
189
    {
190
        if (!is_numeric($value) || $value != (int) $value) {
191
            static::reportInvalidArgument(sprintf(
192
                $message ?: 'Expected an integerish value. Got: %s',
193
                static::typeToString($value)
194
            ));
195
        }
196
    }
197
198
    public static function float($value, $message = '')
199
    {
@@ 198-206 (lines=9) @@
195
        }
196
    }
197
198
    public static function float($value, $message = '')
199
    {
200
        if (!is_float($value)) {
201
            static::reportInvalidArgument(sprintf(
202
                $message ?: 'Expected a float. Got: %s',
203
                static::typeToString($value)
204
            ));
205
        }
206
    }
207
208
    public static function numeric($value, $message = '')
209
    {
@@ 208-216 (lines=9) @@
205
        }
206
    }
207
208
    public static function numeric($value, $message = '')
209
    {
210
        if (!is_numeric($value)) {
211
            static::reportInvalidArgument(sprintf(
212
                $message ?: 'Expected a numeric. Got: %s',
213
                static::typeToString($value)
214
            ));
215
        }
216
    }
217
218
    public static function boolean($value, $message = '')
219
    {
@@ 218-226 (lines=9) @@
215
        }
216
    }
217
218
    public static function boolean($value, $message = '')
219
    {
220
        if (!is_bool($value)) {
221
            static::reportInvalidArgument(sprintf(
222
                $message ?: 'Expected a boolean. Got: %s',
223
                static::typeToString($value)
224
            ));
225
        }
226
    }
227
228
    public static function scalar($value, $message = '')
229
    {
@@ 228-236 (lines=9) @@
225
        }
226
    }
227
228
    public static function scalar($value, $message = '')
229
    {
230
        if (!is_scalar($value)) {
231
            static::reportInvalidArgument(sprintf(
232
                $message ?: 'Expected a scalar. Got: %s',
233
                static::typeToString($value)
234
            ));
235
        }
236
    }
237
238
    public static function object($value, $message = '')
239
    {
@@ 238-246 (lines=9) @@
235
        }
236
    }
237
238
    public static function object($value, $message = '')
239
    {
240
        if (!is_object($value)) {
241
            static::reportInvalidArgument(sprintf(
242
                $message ?: 'Expected an object. Got: %s',
243
                static::typeToString($value)
244
            ));
245
        }
246
    }
247
248
    public static function resource($value, $type = null, $message = '')
249
    {
@@ 266-274 (lines=9) @@
263
        }
264
    }
265
266
    public static function isCallable($value, $message = '')
267
    {
268
        if (!is_callable($value)) {
269
            static::reportInvalidArgument(sprintf(
270
                $message ?: 'Expected a callable. Got: %s',
271
                static::typeToString($value)
272
            ));
273
        }
274
    }
275
276
    public static function isArray($value, $message = '')
277
    {
@@ 276-284 (lines=9) @@
273
        }
274
    }
275
276
    public static function isArray($value, $message = '')
277
    {
278
        if (!is_array($value)) {
279
            static::reportInvalidArgument(sprintf(
280
                $message ?: 'Expected an array. Got: %s',
281
                static::typeToString($value)
282
            ));
283
        }
284
    }
285
286
    public static function isTraversable($value, $message = '')
287
    {
@@ 324-333 (lines=10) @@
321
        }
322
    }
323
324
    public static function isInstanceOf($value, $class, $message = '')
325
    {
326
        if (!($value instanceof $class)) {
327
            static::reportInvalidArgument(sprintf(
328
                $message ?: 'Expected an instance of %2$s. Got: %s',
329
                static::typeToString($value),
330
                $class
331
            ));
332
        }
333
    }
334
335
    public static function notInstanceOf($value, $class, $message = '')
336
    {
@@ 335-344 (lines=10) @@
332
        }
333
    }
334
335
    public static function notInstanceOf($value, $class, $message = '')
336
    {
337
        if ($value instanceof $class) {
338
            static::reportInvalidArgument(sprintf(
339
                $message ?: 'Expected an instance other than %2$s. Got: %s',
340
                static::typeToString($value),
341
                $class
342
            ));
343
        }
344
    }
345
346
    public static function isEmpty($value, $message = '')
347
    {