src/Alg/Math/Factorial.php
public static function calculate( $integer )
	{
		Deprecation::getInstance()
			->setErrorVersion( '0.8.5' )
			->setExceptionVersion( '0.9' )
			->message( sprintf(
				'Please use %s (%s) instead',
				'public library "CeusMedia/Math"',
			 	'https://packagist.org/packages/ceus-media/math'
			) );
		if( $integer < 0 )
			throw new InvalidArgumentException( "Factorial is defined for positive natural Numbers only" );
		else if( !is_int( $integer ) )
			throw new InvalidArgumentException( "Factorial is defined for natural Numbers (Integer) only" );
		else if( $integer == 0 )
			return 1;
		else
			return $integer * self::calculate( $integer - 1 );
		return 0;
	}
public static function calculate( $integer )
	{
		Deprecation::getInstance()
			->setErrorVersion( '0.8.5' )
			->setExceptionVersion( '0.9' )
			->message( sprintf(
				'Please use %s (%s) instead',
				'public library "CeusMedia/Math"',
			 	'https://packagist.org/packages/ceus-media/math'
			) );
		if( $integer < 0 )
			throw new InvalidArgumentException( "Factorial is defined for positive natural Numbers only" );
		else if( !is_int( $integer ) )
			throw new InvalidArgumentException( "Factorial is defined for natural Numbers (Integer) only" );
		else if( $integer == 0 )
			return 1;
		else
			return $integer * self::calculate( $integer - 1 );
		return 0;
	}
public static function calculate ( $ integer ) { Deprecation :: getInstance ( ) -> setErrorVersion ( '0.8.5' ) -> setExceptionVersion ( '0.9' ) -> message ( sprintf ( 'Please use %s (%s) instead' , 'public library "CeusMedia/Math"' , 'https://packagist.org/packages/ceus-media/math' ) ) ; if ( $ integer < 0 ) throw new InvalidArgumentException ( "Factorial is defined for positive natural Numbers only" ) ; else if ( ! is_int ( $ integer ) ) throw new InvalidArgumentException ( "Factorial is defined for natural Numbers (Integer) only" ) ; else if ( $ integer == 0 ) return 1 ; else return $ integer * self :: calculate ( $ integer - 1 ) ; return 0 ; }
Calculates Factorial of Integer recursive and returns Integer or Double.
@access		public
@static
@param		int			$integer		Integer (<=170) to calculate Factorial for
@return		mixed
Calculates Factorial of Integer recursive and returns Integer or Double .