public function testGetExistingWireReturnsAWireObject() { $wire = new Wire('a'); $circuit = new Circuit(); $circuit->addWire($wire); $this->assertInstanceOf('Wire', $circuit->getWire('a')); }
break; case 'LSHIFT': $wire1 = $circuit->getWire($cmd['wires'][0]); if ($wire1 === false) { break; } $result = $wire1->getSignal() << (int) $cmd['value']; break; case 'RSHIFT': $wire1 = $circuit->getWire($cmd['wires'][0]); if ($wire1 === false) { break; } $result = $wire1->getSignal() >> (int) $cmd['value']; break; case 'NOT': $wire1 = $circuit->getWire($cmd['wires'][0]); if ($wire1 === false) { break; } $result = ~$wire1->getSignal(); break; } if ($result !== false) { $assignee->setSignal($result); $circuit->addWire($assignee); $processedIndexes[] = $key; } } } while (count($lines) > count($processedIndexes) && ++$loopCount < 1000); echo 'Answer: A: ' . $circuit->getWire('a')->getSignal() . PHP_EOL;