PHP Classes

File: client/create-repository

Recommend this page to a friend!
  Classes of nvb   PHP Unique Number Repository   client/create-repository   Download  
File: client/create-repository
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Unique Number Repository
Maintain repositories of unique numbers via an API
Author: By
Last change:
Date: 4 years ago
Size: 851 bytes


Class file image Download
#!/usr/bin/env 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);

$host, $applicantName, $repositoryName) = extractValues($values);

throwExceptionIfValueIsInvalid($host, 'host');
throwExceptionIfValueIsInvalid($applicantName, 'applicant name');
throwExceptionIfValueIsInvalid($repositoryName, 'repository name');

$data = array(
'applicant_name' => $applicantName,
'repository_name' => $repositoryName
$lines = $command->post($host, $baseUrl, $data);

    foreach (
$lines as $line) {
$line . PHP_EOL;