public function output12v() { $input = $this->inputPower->getPower(); $unit = $this->inputPower->getUnit(); if ($input < self::TARGET_POWER) { throw new \Exception('输入电源不能小于' . self::TARGET_POWER . $unit); } echo '电源适配转换开始,输入电源:', $input, $unit, PHP_EOL; $output = floor($input / ($input / self::TARGET_POWER)); echo '电源适配转换结束,输出电源:', $output, $unit, PHP_EOL; }
public function __construct() { parent::__construct(self::POWER); }