Code Duplication    Length = 27-27 lines in 2 locations

app/Vendor/PHPExcel/PHPExcel/Calculation/Engineering.php 2 locations

@@ 939-965 (lines=27) @@
936
	 * @TODO Better handling of the approximation method to support the differences between Excel/Gnumeric and Open/Libre Office
937
	 *
938
	 */
939
	public static function BESSELK($x, $ord) {
940
		$x		= (is_null($x))		? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($x);
941
		$ord	= (is_null($ord))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($ord);
942
943
		if ((is_numeric($x)) && (is_numeric($ord))) {
944
			if (($ord < 0) || ($x == 0.0)) {
945
				return PHPExcel_Calculation_Functions::NaN();
946
			}
947
948
			switch(floor($ord)) {
949
				case 0 :	return self::_Besselk0($x);
950
							break;
951
				case 1 :	return self::_Besselk1($x);
952
							break;
953
				default :	$fTox	= 2 / $x;
954
							$fBkm	= self::_Besselk0($x);
955
							$fBk	= self::_Besselk1($x);
956
							for ($n = 1; $n < $ord; ++$n) {
957
								$fBkp	= $fBkm + $n * $fTox * $fBk;
958
								$fBkm	= $fBk;
959
								$fBk	= $fBkp;
960
							}
961
			}
962
			return (is_nan($fBk)) ? PHPExcel_Calculation_Functions::NaN() : $fBk;
963
		}
964
		return PHPExcel_Calculation_Functions::VALUE();
965
	}	//	function BESSELK()
966
967
968
	private static function _Bessely0($fNum) {
@@ 1028-1054 (lines=27) @@
1025
	 *
1026
	 * @return	float
1027
	 */
1028
	public static function BESSELY($x, $ord) {
1029
		$x		= (is_null($x))		? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($x);
1030
		$ord	= (is_null($ord))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($ord);
1031
1032
		if ((is_numeric($x)) && (is_numeric($ord))) {
1033
			if (($ord < 0) || ($x == 0.0)) {
1034
				return PHPExcel_Calculation_Functions::NaN();
1035
			}
1036
1037
			switch(floor($ord)) {
1038
				case 0 :	return self::_Bessely0($x);
1039
							break;
1040
				case 1 :	return self::_Bessely1($x);
1041
							break;
1042
				default:	$fTox	= 2 / $x;
1043
							$fBym	= self::_Bessely0($x);
1044
							$fBy	= self::_Bessely1($x);
1045
							for ($n = 1; $n < $ord; ++$n) {
1046
								$fByp	= $n * $fTox * $fBy - $fBym;
1047
								$fBym	= $fBy;
1048
								$fBy	= $fByp;
1049
							}
1050
			}
1051
			return (is_nan($fBy)) ? PHPExcel_Calculation_Functions::NaN() : $fBy;
1052
		}
1053
		return PHPExcel_Calculation_Functions::VALUE();
1054
	}	//	function BESSELY()
1055
1056
1057
	/**