HTML5 input: month

@param  mixed  $value   Value to be validated.
@param  array  $params  Validation parameters.
@param  array  $field   Blueprint for the field.
@return bool   True if validation succeeded.
429530
public static function typeMonth($value, array $params, array $field)
    {
        if (!isset($params['format'])) {
            $params['format'] = 'Y-m';
        }

        return self::typeDatetime($value, $params, $field);
    }
992686
public function validate($field, $value, $validator) {
		if(strlen($value) === 0) return false;
		$value = (int) $value;
		return $value <= $this->max;
	}
17098
public static function typeEmail($value, array $params, array $field)
    {
        $values = !\is_array($value) ? explode(',', preg_replace('/\s+/', '', $value)) : $value;

        foreach ($values as $val) {
            if (!(self::typeText($val, $params, $field) && filter_var($val, FILTER_VALIDATE_EMAIL))) {
                return false;
            }
        }

        return true;
    }
405910
public static function typeCheckboxes($value, array $params, array $field)
    {
        // Set multiple: true so checkboxes can easily use min/max counts to control number of options required
        $field['multiple'] = true;

        return self::typeArray((array) $value, $params, $field);
    }
1164615
public function validate($field, $value, $validator) {

		if(empty($value)) return false;
		if(!filter_var($value, FILTER_VALIDATE_URL)) return false;

		$url = parse_url($value);
		if(!in_array($url['scheme'], $this->allowed_protocols)) return false;

		if($this->allowed_domains === null) return true;

		return in_array($url['host'], $this->allowed_domains);

	}
671335
protected function validate_date($field, $input, $param = null)
    {
        if (!isset($input[$field]) || empty($input[$field])) {
            return;
        }

        // Default
        if (!$param)
        {
            $cdate1 = date('Y-m-d', strtotime($input[$field]));
            $cdate2 = date('Y-m-d H:i:s', strtotime($input[$field]));

            if ($cdate1 != $input[$field] && $cdate2 != $input[$field])
            {
                return array(
                    'field'      => $field,
                    'value'      => $input[$field],
                    'rule'       => __FUNCTION__,
                    'param' => $param,
                );
            }
        } else {
            $date = \DateTime::createFromFormat($param, $input[$field]);

            if ($date === false || $input[$field] != date($param, $date->getTimestamp()))
            {
                return array(
                    'field'      => $field,
                    'value'      => $input[$field],
                    'rule'       => __FUNCTION__,
                    'param' => $param,
                );
            }
        }
    }
868800
protected function validateMax($field, $value, $params)
    {
        if (!\is_numeric($value)) {
            return false;
        }

        if (\function_exists('\bccomp')) {
            return !(\bccomp($value, $params[0], 14) === 1);
        }

        return $params[0] >= $value;
    }
634327
protected function validateInteger($field, $value, $params)
    {
        if (isset($params[0]) && (bool) $params[0]) {
            //strict mode
            return preg_match('/^(\d|-[1-9]|-?[1-9]\d*)$/i', $value);
        }

        return \filter_var($value, \FILTER_VALIDATE_INT) !== false;
    }
247712
private function check($value, $params) {

		if(true === is_string($value) || true === is_numeric($value)) {
			return floatval($value) >= floatval($params[0]) && floatval($value) <= floatval($params[1]);
		}

		return false;
	}
245
public static function of(int $value) : Month
    {
        Field\MonthOfYear::check($value);

        return Month::get($value);
    }
866545
protected function _buildValue($field, $options, $params)
    {
        $string = null;

        if ($options['operator'] === 'LIKE') {
            $string .= '%';
        }
        $string .= Hash::get($params, $options['column']);
        if ($options['operator'] === 'LIKE') {
            $string .= '%';
        }
        return $string;
    }
884494
public function notSubmitterEmail($field, $value, $parameters)
    {
        if ($this->guard->guest()) {
            return true;
        }

        $userEmail = $this->guard->user()->email;
        $emails    = $this->bannedEmailService->getEmailTemplatesFromRepository()->push($value);

        foreach ($emails->all() as $emailTemplate) {
            $emailRule = new Email($emailTemplate);

            if ($emailRule->check($userEmail)) {
                return false;
            }
        }

        return true;
    }
1051148
protected function validateRequired($field, $value)
    {
        if (is_null($value)) {
            return false;
        } elseif (is_string($value) && '' === trim($value)) {
            return false;
        }

        return true;
    }
216223
public static function typeNumber($value, array $params, array $field)
    {
        if (!is_numeric($value)) {
            return false;
        }

        if (isset($params['min']) && $value < $params['min']) {
            return false;
        }

        if (isset($params['max']) && $value > $params['max']) {
            return false;
        }

        $min = $params['min'] ?? 0;

        return !(isset($params['step']) && fmod($value - $min, $params['step']) === 0);
    }
713243
public static function typeText($value, array $params, array $field)
    {
        if (!\is_string($value) && !is_numeric($value)) {
            return false;
        }

        $value = (string)$value;

        if (!empty($params['trim'])) {
            $value = trim($value);
        }

        if (isset($params['min']) && \strlen($value) < $params['min']) {
            return false;
        }

        if (isset($params['max']) && \strlen($value) > $params['max']) {
            return false;
        }

        $min = $params['min'] ?? 0;
        if (isset($params['step']) && (\strlen($value) - $min) % $params['step'] === 0) {
            return false;
        }

        if ((!isset($params['multiline']) || !$params['multiline']) && preg_match('/\R/um', $value)) {
            return false;
        }

        return true;
    }
1054495
protected function validate_starts($field, $input, $param = null)
    {
        if (!isset($input[$field]) || empty($input[$field])) {
            return;
        }

        if (strpos($input[$field], $param) !== 0) {
            return array(
                'field' => $field,
                'value' => $input[$field],
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }
    }
1300924
protected function _validate_timestamp($value, $parameters)
    {
        $timestamp = is_numeric($value) ? (int)$value : strtotime($value);
        if ($timestamp === false) {
            return null;
        }

        if (isset($parameters[0])) {
            if ($parameters[0] === 'start') {
                /** @noinspection SummerTimeUnsafeTimeManipulationInspection */
                return (int)($timestamp / 86400) * 86400;
            } elseif ($parameters[0] === 'end') {
                /** @noinspection SummerTimeUnsafeTimeManipulationInspection */
                return (int)($timestamp / 86400) * 86400 + 86399;
            } else {
                return strtotime(date($parameters[0], $timestamp));
            }
        }

        return $timestamp;
    }