public static function toBoolean($str)
    {
        if (!is_string($str)) {
            throw new InvalidArgumentException(sprintf('String expected, %s received', gettype($str)));
        }

        $booleanTrue = array(
            '1',
            'on',
            'true',
            'yes',
        );
        if (in_array($str, $booleanTrue, true)) {
            return true;
        }
        $booleanFalse = array(
            '0',
            'off',
            'false',
            'no',
        );
        if (in_array($str, $booleanFalse, true)) {
            return false;
        }

        return false;
    }