Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
3 / 3
IntegerSanitizer
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
 sanitize
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
<?php
declare(strict_types=1);
namespace Korobochkin\WPKit\Sanitizers;
/**
 * Class IntegerSanitizer
 * @package Korobochkin\WPKit\Sanitizers
 */
class IntegerSanitizer implements SanitizerInterface
{
    /**
     * @param $value mixed Any types of values.
     *
     * @return int Value converted to int.
     */
    public static function sanitize($value)
    {
        if (is_object($value)) {
            return 1;
        }
        return (int) $value;
    }
}