Code Duplication    Length = 7-8 lines in 2 locations

Form.php 2 locations

@@ 1762-1769 (lines=8) @@
1759
			// If the field is required and the value is empty return an error message.
1760
			if (($value === '') || ($value === null))
1761
			{
1762
				if ($element['label'])
1763
				{
1764
					$message = Text::_($element['label']);
1765
				}
1766
				else
1767
				{
1768
					$message = Text::_($element['name']);
1769
				}
1770
1771
				$message = Text::sprintf('JLIB_FORM_VALIDATE_FIELD_REQUIRED', $message);
1772
@@ 1811-1817 (lines=7) @@
1808
1809
				return new \UnexpectedValueException($message);
1810
			}
1811
			else
1812
			{
1813
				$message = Text::_($element['label']);
1814
				$message = Text::sprintf('JLIB_FORM_VALIDATE_FIELD_INVALID', $message);
1815
1816
				return new \UnexpectedValueException($message);
1817
			}
1818
		}
1819
1820
		return true;