/**
  * Roda a aplicação
  */
 public static function run()
 {
     $request = new Request();
     $job = $request->get('job');
     $validator = new NotEmpty('job', $job);
     if (!$validator->isValid()) {
         header("HTTP/1.1 422 Unprocessable Entity", true, 422);
         echo $validator->getMessage();
         self::stop();
     }
     $config = self::getConfig();
     $jobConfig = new JobConfig($job, $config['server'], $config['port']);
     $jobConfig->setCredentials(new Credentials());
     $client = new Client();
     $build = $client->doRequest($jobConfig);
     $formatter = new ArduinoFormatter();
     $data = $formatter->format($build);
     $usbDetector = new Detector();
     $usbArduino = $usbDetector->detect($config['serialType'], $config['serialCount']);
     $serialReader = new SerialWriter();
     $serialReader->write($usbArduino, $data);
 }
 /**
  * @test
  */
 public function deveRetornarValorQuandoSolicitarValorExistente()
 {
     $_GET['name'] = 'jamal';
     $request = new Request();
     $this->assertEquals('jamal', $request->get('name'));
 }