Airship\Engine\Bolt\Supplier::createSupplier PHP Method

createSupplier() public method

This is used when saving a new supplier configuration for the very first time.
public createSupplier ( string $channelName, array $data ) : Supplier
$channelName string
$data array
return Airship\Engine\Continuum\Supplier
    public function createSupplier(string $channelName, array $data) : SupplierObject
    {
        $supplierName = $this->escapeSupplierName($data['supplier']);
        if (\file_exists(ROOT . '/config/supplier_keys/' . $supplierName . '.json')) {
            throw new CouldNotCreateSupplier('File already exists: config/supplier_keys/' . $supplierName . '.json');
        }
        $written = \file_put_contents(ROOT . '/config/supplier_keys/' . $supplierName . '.json', \json_encode(['channels' => [$channelName], 'signing_keys' => []], JSON_PRETTY_PRINT));
        if ($written === false) {
            throw new AccessDenied(\__('Could not save new key'));
        }
        return $this->getSupplier($supplierName, true);
    }