本文整理匯總了PHP中Wire::getSignal方法的典型用法代碼示例。如果您正苦於以下問題:PHP Wire::getSignal方法的具體用法?PHP Wire::getSignal怎麽用?PHP Wire::getSignal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Wire
的用法示例。
在下文中一共展示了Wire::getSignal方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: returnsCachedSignal
/**
* @test
* @covers ::getSignal
* @covers \Hamdrew\AdventOfCode\Day7\CircuitComponent::getSignal
* @covers \Hamdrew\AdventOfCode\Day7\CircuitComponent::setSignal
*/
public function returnsCachedSignal()
{
$signal = 123;
$source = \Mockery::mock('\\Hamdrew\\AdventOfCode\\Day7\\CircuitComponent')->shouldReceive('getSignal')->andReturn($signal)->once()->getMock();
$wire = new Wire('test', $source);
$wire->getSignal();
$this->assertSame($signal, $wire->getSignal());
}
示例2: getSignal
/**
* @inheritDoc
*/
public function getSignal()
{
$signal = parent::getSignal();
if (is_null($signal)) {
$input = $this->source->getSignal();
if (!is_null($input)) {
$signal = SixteenBitMask::mask(~$input);
$this->setSignal($signal);
}
}
return $signal;
}
示例3: testCanSetAndGetSignal
public function testCanSetAndGetSignal()
{
$wire = new Wire('a');
$wire->setSignal(123);
$this->assertEquals(123, $wire->getSignal());
}