Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken CI #65

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"require-dev": {
"phpunit/phpunit": "^8.0|^9.0",
"php-vcr/php-vcr": "^1.4",
"friendsofphp/php-cs-fixer": "^3.0",
"friendsofphp/php-cs-fixer": "3.60.0",
"php-coveralls/php-coveralls": "^2.1",
"dms/phpunit-arraysubset-asserts": "^0.4 | ^0.5"
} ,
Expand Down
2 changes: 1 addition & 1 deletion examples/balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_once 'bootstrap.php';

$balanceDocument = \Didww\Item\Balance::find();
$balanceDocument = Didww\Item\Balance::find();
$balance = $balanceDocument->getData();
var_dump(
$balance->getTotalBalance(), // double(1000.00)
Expand Down
4 changes: 2 additions & 2 deletions examples/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

$apiKey = $_SERVER['DIDWW_API_KEY'] ?? exit("Please provide an DIDWW API key!\n");

$credentials = new \Didww\Credentials($apiKey, 'sandbox');
$credentials = new Didww\Credentials($apiKey, 'sandbox');
$httpClientConfig = [
'timeout' => 20,
// 'debug' => true,
// 'sink' => STDOUT,
];
\Didww\Configuration::configure($credentials, $httpClientConfig);
Didww\Configuration::configure($credentials, $httpClientConfig);
4 changes: 2 additions & 2 deletions examples/channel_groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

require_once 'bootstrap.php';

$capacityGroup = new \Didww\Item\SharedCapacityGroup();
$capacityGroup = new Didww\Item\SharedCapacityGroup();
// set name (should be unique)
$capacityGroup->setName('My New Channel Group '.uniqid());

$capacityPool = \Didww\Item\CapacityPool::all()->getData()[0];
$capacityPool = Didww\Item\CapacityPool::all()->getData()[0];
$capacityGroup->setMeteredhannelsCount(10);
// see capacity order example to purchase shared channels and assign them to pool
$capacityGroup->setSharedChannelsCount(1);
Expand Down
4 changes: 2 additions & 2 deletions examples/countries.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
'sort' => 'name', // -name for desceding order
];
$countriesDocument = \Didww\Item\Country::all($parameters);
$countriesDocument = Didww\Item\Country::all($parameters);
$countries = $countriesDocument->getData();
foreach ($countries as $country) {
var_dump(
Expand All @@ -22,7 +22,7 @@

// fetch the specific country
$usUuid = '1f6fc2bd-f081-4202-9b1a-d9cb88d942b9';
$countryDocument = \Didww\Item\Country::find($usUuid);
$countryDocument = Didww\Item\Country::find($usUuid);
$country = $countryDocument->getData();
var_dump(
$country->getId(), // 1f6fc2bd-f081-4202-9b1a-d9cb88d942b9
Expand Down
4 changes: 2 additions & 2 deletions examples/did_groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
'include' => 'stock_keeping_units',
];
$didGroupsDocument = \Didww\Item\DidGroup::all($parameters);
$didGroupsDocument = Didww\Item\DidGroup::all($parameters);
$didGroups = $didGroupsDocument->getData();

var_dump(count($didGroups)); // 2
Expand All @@ -36,7 +36,7 @@

// fetch the specific DID group
$uuid = 'df73511e-3b8e-4967-9bd8-d7b88ae1a084';
$didGroupDocument = \Didww\Item\DidGroup::find($uuid, ['include' => 'stock_keeping_units']);
$didGroupDocument = Didww\Item\DidGroup::find($uuid, ['include' => 'stock_keeping_units']);
$didGroup = $didGroupDocument->getData();
var_dump(
$didGroup->getId(), // df73511e-3b8e-4967-9bd8-d7b88ae1a084
Expand Down
8 changes: 4 additions & 4 deletions examples/dids.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
require_once 'bootstrap.php';

// get last ordered DID
$did = \Didww\Item\Did::all(['sort' => '-created_at', 'page' => ['size' => 1, 'number' => 1]])->getData()[0];
$did = Didww\Item\Did::all(['sort' => '-created_at', 'page' => ['size' => 1, 'number' => 1]])->getData()[0];

// see trunks example to create Trunk
// get last SIP trunk
$trunk = \Didww\Item\VoiceInTrunk::all(['sort' => '-created_at', 'filter' => ['configuration.type' => 'sip_configurations']])->getData()[0];
$trunk = Didww\Item\VoiceInTrunk::all(['sort' => '-created_at', 'filter' => ['configuration.type' => 'sip_configurations']])->getData()[0];

// assign trunk
$did->setTrunk($trunk);
Expand All @@ -26,14 +26,14 @@
}

// assign capacity
$capacityPools = \Didww\Item\CapacityPool::all()->getData()->all();
$capacityPools = Didww\Item\CapacityPool::all()->getData()->all();

$supportedPools = array_filter($capacityPools, function ($v, $k) {
return 'Extended' == $v->getName();
}, ARRAY_FILTER_USE_BOTH);
$supportedPool = reset($supportedPools);

$sharedCapacityGroup = \Didww\Item\SharedCapacityGroup::all(['filters' => ['capacity_pool.id' => $supportedPool->getId()]])->getData()[0];
$sharedCapacityGroup = Didww\Item\SharedCapacityGroup::all(['filters' => ['capacity_pool.id' => $supportedPool->getId()]])->getData()[0];
// assign channel group to use shared channels
$did->setSharedCapacityGroup($sharedCapacityGroup);
// assign channel pool to use dedicated channels
Expand Down
6 changes: 3 additions & 3 deletions examples/orders_available_dids.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_once 'bootstrap.php';

$availableDidsDocument = \Didww\Item\AvailableDid::all([
$availableDidsDocument = Didww\Item\AvailableDid::all([
'include' => 'did_group.stock_keeping_units',
]);
$availableDids = $availableDidsDocument->getData()->all();
Expand All @@ -16,11 +16,11 @@
$sku = $skus[array_rand($skus)];
var_dump($sku->getId()); // be1d31ce-c317-4a8a-85bd-5fe3915d4524

$orderItem = new \Didww\Item\OrderItem\AvailableDid();
$orderItem = new Didww\Item\OrderItem\AvailableDid();
$orderItem->setAvailableDidId($availableDid->getId());
$orderItem->setSku($sku);

$order = new \Didww\Item\Order();
$order = new Didww\Item\Order();
$items = [
$orderItem,
];
Expand Down
6 changes: 3 additions & 3 deletions examples/orders_capacities.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
require_once 'bootstrap.php';

// get capacity pool
$capacityPoolsDocument = \Didww\Item\CapacityPool::all();
$capacityPoolsDocument = Didww\Item\CapacityPool::all();
$capacityPools = $capacityPoolsDocument->getData()->all();
$capacityPool = $capacityPools[array_rand($capacityPools)];
var_dump($capacityPool->getName()); // Extended

// purchase capacity
$orderItem = new \Didww\Item\OrderItem\Capacity();
$orderItem = new Didww\Item\OrderItem\Capacity();
$orderItem->setCapacityPool($capacityPool);
$orderItem->setQty(1);

$order = new \Didww\Item\Order();
$order = new Didww\Item\Order();
$items = [
$orderItem,
];
Expand Down
8 changes: 4 additions & 4 deletions examples/orders_reservation_dids.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_once 'bootstrap.php';

// get available DID
$availableDidsDocument = \Didww\Item\AvailableDid::all([
$availableDidsDocument = Didww\Item\AvailableDid::all([
'include' => 'did_group.stock_keeping_units',
]);
$availableDids = $availableDidsDocument->getData()->all();
Expand All @@ -18,7 +18,7 @@
var_dump($sku->getId()); // be1d31ce-c317-4a8a-85bd-5fe3915d4524

// reserve selected DID
$didReservation = new \Didww\Item\DidReservation();
$didReservation = new Didww\Item\DidReservation();
$didReservation->setAvailableDid($availableDid);
$didReservation->setDescription('php sdk');
$didReservation = $didReservation->save()->getData();
Expand All @@ -29,11 +29,11 @@
);

// purchase reserved DID
$orderItem = new \Didww\Item\OrderItem\ReservationDid();
$orderItem = new Didww\Item\OrderItem\ReservationDid();
$orderItem->setDidReservationId($didReservation->getId());
$orderItem->setSku($sku);

$order = new \Didww\Item\Order();
$order = new Didww\Item\Order();
$items = [
$orderItem,
];
Expand Down
4 changes: 2 additions & 2 deletions examples/orders_sku.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
];
$orderAttributes = [
'items' => [
new \Didww\Item\OrderItem\Did($orderItemAttributes),
new Didww\Item\OrderItem\Did($orderItemAttributes),
],
];
$order = new \Didww\Item\Order($orderAttributes);
$order = new Didww\Item\Order($orderAttributes);
$orderDocument = $order->save();
$order = $orderDocument->getData();

Expand Down
4 changes: 2 additions & 2 deletions examples/regions.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'include' => 'country',
'sort' => '-name', // name for asceding order
];
$regionsDocument = \Didww\Item\Region::all($parameters);
$regionsDocument = Didww\Item\Region::all($parameters);
$regions = $regionsDocument->getData();
foreach ($regions as $region) {
var_dump(
Expand All @@ -23,7 +23,7 @@

// fetch the specific region
$uuid = '8bef58e3-8e0e-43ba-8d03-1143968a6a47';
$regionDocument = \Didww\Item\Region::find($uuid, ['include' => 'country']);
$regionDocument = Didww\Item\Region::find($uuid, ['include' => 'country']);
$region = $regionDocument->getData();
var_dump(
$region->getId(), // 8bef58e3-8e0e-43ba-8d03-1143968a6a47
Expand Down
8 changes: 4 additions & 4 deletions examples/trunks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
require_once 'bootstrap.php';

// create Sip Configuration object
$trunkSipConfig = new \Didww\Item\Configuration\Sip([
$trunkSipConfig = new Didww\Item\Configuration\Sip([
'username' => 'username',
'host' => '216.58.215.110',
'sst_refresh_method_id' => 1,
'port' => 5060,
'codec_ids' => \Didww\Item\Configuration\Base::getDefaultCodecIds(),
'rerouting_disconnect_code_ids' => \Didww\Item\Configuration\Base::getDefaultReroutingDisconnectCodeIds(),
'codec_ids' => Didww\Item\Configuration\Base::getDefaultCodecIds(),
'rerouting_disconnect_code_ids' => Didww\Item\Configuration\Base::getDefaultReroutingDisconnectCodeIds(),
]);

$trunk = new \Didww\Item\VoiceInTrunk();
$trunk = new Didww\Item\VoiceInTrunk();
// set name (should be unique)
$trunk->setName('My New Custom Sip Trunk '.uniqid());
// set configuration object
Expand Down
4 changes: 2 additions & 2 deletions examples/upload_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// FILE_PATH="/path/to/file.jpeg" DIDWW_API_KEY=PLACEYOURAPIKEYHERE php examples/upload_file.php
$filePath = $_SERVER['FILE_PATH'] ?? exit("Please provide FILE_PATH env variable\n");
$fileContent = file_get_contents($filePath);
$enc = new \Didww\Encrypt();
$enc = new Didww\Encrypt();
$fingerprint = $enc->getFingerprint();
$encData = $enc->encrypt($fileContent);
$uploadResult = \Didww\Item\EncryptedFile::upload($fingerprint, [$encData], ['php library example']);
$uploadResult = Didww\Item\EncryptedFile::upload($fingerprint, [$encData], ['php library example']);
var_dump(
$uploadResult->success(), // bool(true)
$uploadResult->getIds() // array(1) { [0]=> string(36) "659fcd19-063d-4471-9a73-33f3f9e2bab7" }
Expand Down
2 changes: 1 addition & 1 deletion src/Credentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function getVersion(): ?string
return $this->version;
}

public function __construct($apiKey, $env, string $version = null)
public function __construct($apiKey, $env, ?string $version = null)
{
$this->apiKey = $apiKey;
$this->env = $env;
Expand Down
2 changes: 1 addition & 1 deletion src/Item/Balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Balance extends BaseItem
protected $type = 'balances';

// $uuid for singular resource is not needed
public static function find(string $uuid = null, array $parameters = [])
public static function find(?string $uuid = null, array $parameters = [])
{
return self::getRepository()->take($parameters);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Item/CapacityPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function setTotalChannelsCount(int $totalChannelsCount)
protected function getWhiteListAttributesKeys()
{
return [
'total_channels_count',
];
'total_channels_count',
];
}
}
Loading
Loading