Skip to content

Commit

Permalink
Fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbrauer committed Feb 3, 2018
1 parent 8eeb1d1 commit d0ec600
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/UnitConverter/UnitConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected function calculate (
throw new MissingCalculatorException("No calculator was found to perform mathematical operations with.");

# Attempt a self conversion if one exists (e.g., temperatures)
$selConversion = $from->convert($calculator, $value, $to, $precision);
$selfConversion = $from->convert($calculator, $value, $to, $precision);
if ($selfConversion) return $selfConversion;

$fromUnits = $from->getUnits();
Expand Down Expand Up @@ -262,4 +262,39 @@ protected function castUnitsTo (string $type): array

return $units;
}

/**
* Print debug output for the current calculation.
*
* @throws ErrorException If dev dependencies are missing.
* @return $this
*/
public function debug (): UnitConverterInterface
{
$dumper = "var_dump";
if (function_exists("dump")) $dumper = "dump";

# debug output
echo PHP_EOL;
echo "Debug out for caluclation:";
echo PHP_EOL;
echo "--------------------------";
echo PHP_EOL;
$dumper([
"precision" => null,
"rounding_mode" => null,
"units" => [
"value" => null,
"from" => null,
"to" => null,
],
"products" => [
"mul" => null,
"div" => null,
"result" => null,
],
]);

return $this;
}
}

0 comments on commit d0ec600

Please sign in to comment.