name: MacAddressValidator class_comment: '# * Validates whether a value is a valid MAC address. # * # * @author Ninos Ego ' dependencies: - name: Constraint type: class source: Symfony\Component\Validator\Constraint - name: ConstraintValidator type: class source: Symfony\Component\Validator\ConstraintValidator - name: UnexpectedTypeException type: class source: Symfony\Component\Validator\Exception\UnexpectedTypeException - name: UnexpectedValueException type: class source: Symfony\Component\Validator\Exception\UnexpectedValueException properties: [] methods: - name: checkMac visibility: private parameters: - name: mac - name: type comment: "# * Validates whether a value is a valid MAC address.\n# *\n# * @author\ \ Ninos Ego \n# */\n# class MacAddressValidator extends ConstraintValidator\n\ # {\n# public function validate(mixed $value, Constraint $constraint): void\n\ # {\n# if (!$constraint instanceof MacAddress) {\n# throw new UnexpectedTypeException($constraint,\ \ MacAddress::class);\n# }\n# \n# if (null === $value || '' === $value) {\n# return;\n\ # }\n# \n# if (!\\is_scalar($value) && !$value instanceof \\Stringable) {\n# throw\ \ new UnexpectedValueException($value, 'string');\n# }\n# \n# $value = (string)\ \ $value;\n# \n# if (null !== $constraint->normalizer) {\n# $value = ($constraint->normalizer)($value);\n\ # }\n# \n# if (!self::checkMac($value, $constraint->type)) {\n# $this->context->buildViolation($constraint->message)\n\ # ->setParameter('{{ value }}', $this->formatValue($value))\n# ->setCode(MacAddress::INVALID_MAC_ERROR)\n\ # ->addViolation();\n# }\n# }\n# \n# /**\n# * Checks whether a MAC address is\ \ valid." - name: isUnicast visibility: private parameters: - name: mac comment: '# * Checks whether a MAC address is unicast or multicast.' - name: isLocal visibility: private parameters: - name: mac comment: '# * Checks whether a MAC address is local or universal.' - name: isBroadcast visibility: private parameters: - name: mac comment: '# * Checks whether a MAC address is broadcast.' - name: sanitize visibility: private parameters: - name: mac comment: '# * Returns the sanitized MAC address.' traits: - Symfony\Component\Validator\Constraint - Symfony\Component\Validator\ConstraintValidator - Symfony\Component\Validator\Exception\UnexpectedTypeException - Symfony\Component\Validator\Exception\UnexpectedValueException interfaces: []