public function testCheckEmail()
 {
     $email = '*****@*****.**';
     $response = array('site1', 'site2');
     $client = $this->getMockBuilder('InoHibp\\Client')->disableOriginalConstructor()->getMock();
     $client->expects($this->once())->method('checkEmail')->with($email)->will($this->returnValue($response));
     $service = new Service();
     $service->setClient($client);
     $this->assertSame($response, $service->checkEmail($email));
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $serviceOptions = array();
     $email = $input->getArgument('email');
     $useSsl = $input->getOption('ssl');
     if ($useSsl) {
         $serviceOptions[Service::OPT_USE_SSL] = true;
     }
     $caFile = $input->getOption('ca-file');
     if ($caFile) {
         $serviceOptions[Service::OPT_CA_FILE] = $caFile;
     }
     $plain = $input->getOption('plain');
     $showExceptions = $input->getOption('show-exceptions');
     $service = new Service($serviceOptions);
     try {
         $result = $service->checkEmail($email);
     } catch (\Exception $e) {
         $this->outputException($email, $output, $e, $showExceptions, $plain);
         return;
     }
     $this->outputResult($email, $result, $output, $plain);
 }
<?php

use InoHibp\Service;
require __DIR__ . '/../vendor/autoload.php';
if (!isset($_SERVER['argv'][1])) {
    printf("Usage: %s <email>\n", $_SERVER['argv'][0]);
    exit;
}
$email = $_SERVER['argv'][1];
$service = new Service(array('use_ssl' => true));
try {
    $result = $service->checkEmail($email);
} catch (\Exception $e) {
    printf("Error: [%s] %s\n%s\n", get_class($e), $e->getMessage(), $e->getTraceAsString());
    exit;
}
if (null === $result) {
    printf("Not pwned\n");
} else {
    printf("Pwned on these websites: %s\n", implode(', ', $result));
}