#!/usr/bin/env php 
<?php 
 
require_once __DIR__ . '/../bootstrap/client.php'; 
 
$usage = 'usage: ' . PHP_EOL . 
    '    ' . basename(__FILE__) . ' <host> <applicant name> <repository name>' . PHP_EOL; 
 
execute(function () use ($baseUrl, $command, $values) { 
 
    throwExceptionIfInvalidNumberOfValuesWasProvided($values, 3); 
 
    list($host, $applicantName, $repositoryName) = extractValues($values); 
 
    throwExceptionIfValueIsInvalid($host, 'host'); 
    throwExceptionIfValueIsInvalid($applicantName, 'applicant name'); 
    throwExceptionIfValueIsInvalid($repositoryName, 'repository name'); 
 
    $data   = array( 
        'applicant_name' => $applicantName 
    ); 
    $url    = $baseUrl . '/' . $repositoryName; 
    $lines  = $command->post($host, $url, $data); 
 
    foreach ($lines as $line) { 
        echo $line . PHP_EOL; 
    } 
}, $usage); 
 
 |