Skip to content

Commit

Permalink
Merge pull request #9 from xray-labs/main
Browse files Browse the repository at this point in the history
Merge main into develop
  • Loading branch information
GabsCoding authored Jul 27, 2024
2 parents 0800305 + f4a5211 commit e5d05f1
Show file tree
Hide file tree
Showing 131 changed files with 451 additions and 412 deletions.
38 changes: 38 additions & 0 deletions .github/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PHP CI

on:
pull_request:
branches:
- main
- develop

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"

- name: Install dependencies
run: composer install

- name: Run PHPMD
run: ./vendor/bin/phpmd src/ text phpmd.xml

- name: Run PHP_CodeSniffer
run: ./vendor/bin/phpcs --standard=phpcs.xml

- name: Run Pint Check
run: ./vendor/bin/pint --test

- name: Run PHPStan
run: ./vendor/bin/phpstan analyse

- name: Run Pest
run: ./vendor/bin/pest --coverage --min=100 --parallel
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

[![PHP CI](https://github.com/sjspereira/azure-storage-php-sdk/actions/workflows/CI.yaml/badge.svg)](https://github.com/sjspereira/azure-storage-php-sdk/actions/workflows/CI.yaml)
[![PHP CI](https://github.com/xray-labs/azure-storage-php-sdk/actions/workflows/CI.yaml/badge.svg)](https://github.com/xray-labs/azure-storage-php-sdk/actions/workflows/CI.yaml)

## Description

Expand All @@ -11,16 +11,16 @@ Integrate with Azure's cloud storage services
## Installation

```bash
composer require sjpereira/azure-storage-php-sdk
composer require xray/azure-storage-php-sdk
```

## Usage

Setup Blob Storage

```php
use Sjpereira\AzureStoragePhpSdk\BlobStorage\{BlobStorage, Config};
use Sjpereira\AzureStoragePhpSdk\Http\Request;
use Xray\AzureStoragePhpSdk\BlobStorage\{BlobStorage, Config};
use Xray\AzureStoragePhpSdk\Http\Request;

$request = new Request(new Config([
'account' => 'your_account_name',
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sjpereira/azure-storage-php-sdk",
"name": "xray/azure-storage-php-sdk",
"description": "Integrate with Azure's cloud storage services",
"type": "library",
"license": "MIT",
Expand Down Expand Up @@ -37,8 +37,8 @@
],
"autoload": {
"psr-4": {
"Sjpereira\\AzureStoragePhpSdk\\": "src/",
"Sjpereira\\Tests\\": "tests/"
"Xray\\AzureStoragePhpSdk\\": "src/",
"Xray\\Tests\\": "tests/"
},
"files": [
"src/helpers.php"
Expand Down
6 changes: 3 additions & 3 deletions docs/StorageAccount.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Getting the storage account information

```php
use Sjpereira\AzureStoragePhpSdk\BlobStorage\{BlobStorage, Config};
use Sjpereira\AzureStoragePhpSdk\Http\Request;
use Xray\AzureStoragePhpSdk\BlobStorage\{BlobStorage, Config};
use Xray\AzureStoragePhpSdk\Http\Request;

$request = new Request(new Config([
'account' => 'your_account_name',
Expand All @@ -14,5 +14,5 @@ $request = new Request(new Config([
$blobStorage = new BlobStorage($request);

$blobStorage->account()->information();
// returns Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account\AccountInformation;
// returns Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account\AccountInformation;
```
12 changes: 6 additions & 6 deletions src/Authentication/MicrosoftEntraId.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\Authentication;
namespace Xray\AzureStoragePhpSdk\Authentication;

use DateTime;
use GuzzleHttp\Client;
use Psr\Http\Client\RequestExceptionInterface;
use Sjpereira\AzureStoragePhpSdk\BlobStorage\Enums\HttpVerb;
use Sjpereira\AzureStoragePhpSdk\Contracts\Authentication\Auth;
use Sjpereira\AzureStoragePhpSdk\Exceptions\RequestException;
use Sjpereira\AzureStoragePhpSdk\Http\{Headers};
use Xray\AzureStoragePhpSdk\BlobStorage\Enums\HttpVerb;
use Xray\AzureStoragePhpSdk\Contracts\Authentication\Auth;
use Xray\AzureStoragePhpSdk\Exceptions\RequestException;
use Xray\AzureStoragePhpSdk\Http\Headers;

final class MicrosoftEntraId implements Auth
{
Expand Down Expand Up @@ -66,7 +66,7 @@ protected function authenticate(): void
throw RequestException::createFromRequestException($e);
}

/** @var array{token_type: string, expires_in: int, access_token: string} */
/** @var array{token_type: string, expires_in: int, access_token: string} $body */
$body = json_decode((string) $response->getBody(), true);

$this->token = "{$body['token_type']} {$body['access_token']}";
Expand Down
8 changes: 4 additions & 4 deletions src/Authentication/SharedKeyAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\Authentication;
namespace Xray\AzureStoragePhpSdk\Authentication;

use Sjpereira\AzureStoragePhpSdk\BlobStorage\Enums\HttpVerb;
use Sjpereira\AzureStoragePhpSdk\Contracts\Authentication\Auth;
use Sjpereira\AzureStoragePhpSdk\Http\Headers;
use Xray\AzureStoragePhpSdk\BlobStorage\Enums\HttpVerb;
use Xray\AzureStoragePhpSdk\Contracts\Authentication\Auth;
use Xray\AzureStoragePhpSdk\Http\Headers;

final class SharedKeyAuth implements Auth
{
Expand Down
8 changes: 4 additions & 4 deletions src/BlobStorage/BlobStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage;
namespace Xray\AzureStoragePhpSdk\BlobStorage;

use Sjpereira\AzureStoragePhpSdk\BlobStorage\Managers\Blob\BlobManager;
use Sjpereira\AzureStoragePhpSdk\BlobStorage\Managers\{AccountManager, ContainerManager};
use Sjpereira\AzureStoragePhpSdk\Contracts\Http\Request as RequestContract;
use Xray\AzureStoragePhpSdk\BlobStorage\Managers\Blob\BlobManager;
use Xray\AzureStoragePhpSdk\BlobStorage\Managers\{AccountManager, ContainerManager};
use Xray\AzureStoragePhpSdk\Contracts\Http\Request as RequestContract;

final class BlobStorage
{
Expand Down
4 changes: 2 additions & 2 deletions src/BlobStorage/Concerns/ValidateContainerName.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Concerns;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Concerns;

use Sjpereira\AzureStoragePhpSdk\Exceptions\InvalidArgumentException;
use Xray\AzureStoragePhpSdk\Exceptions\InvalidArgumentException;

trait ValidateContainerName
{
Expand Down
4 changes: 2 additions & 2 deletions src/BlobStorage/Concerns/ValidateMetadataKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Concerns;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Concerns;

use Sjpereira\AzureStoragePhpSdk\Exceptions\InvalidArgumentException;
use Xray\AzureStoragePhpSdk\Exceptions\InvalidArgumentException;

trait ValidateMetadataKey
{
Expand Down
12 changes: 6 additions & 6 deletions src/BlobStorage/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage;
namespace Xray\AzureStoragePhpSdk\BlobStorage;

use Sjpereira\AzureStoragePhpSdk\Contracts\Authentication\Auth;
use Sjpereira\AzureStoragePhpSdk\Contracts\{Converter, Parser};
use Sjpereira\AzureStoragePhpSdk\Converter\XmlConverter;
use Sjpereira\AzureStoragePhpSdk\Exceptions\InvalidArgumentException;
use Sjpereira\AzureStoragePhpSdk\Parsers\XmlParser;
use Xray\AzureStoragePhpSdk\Contracts\Authentication\Auth;
use Xray\AzureStoragePhpSdk\Contracts\{Converter, Parser};
use Xray\AzureStoragePhpSdk\Converter\XmlConverter;
use Xray\AzureStoragePhpSdk\Exceptions\InvalidArgumentException;
use Xray\AzureStoragePhpSdk\Parsers\XmlParser;

/**
* @phpstan-type ConfigType array{version?: string, parser?: Parser, converter?: Converter}
Expand Down
2 changes: 1 addition & 1 deletion src/BlobStorage/Entities/Account/AccountInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account;

use DateTimeImmutable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;

use Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty\Cors\Cors;
use Sjpereira\AzureStoragePhpSdk\Contracts\{Arrayable, Xmlable};
use Sjpereira\AzureStoragePhpSdk\Converter\XmlConverter;
use Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty\Cors\Cors;
use Xray\AzureStoragePhpSdk\Contracts\{Arrayable, Xmlable};
use Xray\AzureStoragePhpSdk\Converter\XmlConverter;

/**
* @phpstan-import-type LoggingType from Logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty\Cors;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty\Cors;

use Sjpereira\AzureStoragePhpSdk\Contracts\Arrayable;
use Sjpereira\AzureStoragePhpSdk\Support\Collection;
use Xray\AzureStoragePhpSdk\Contracts\Arrayable;
use Xray\AzureStoragePhpSdk\Support\Collection;

/**
* @phpstan-import-type CorsRuleType from CorsRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty\Cors;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty\Cors;

use Sjpereira\AzureStoragePhpSdk\Contracts\Arrayable;
use Xray\AzureStoragePhpSdk\Contracts\Arrayable;

/**
* @phpstan-type CorsRuleType array{AllowedOrigins?: string, AllowedMethods?: string, MaxAgeInSeconds?: int, ExposedHeaders?: string, AllowedHeaders?: string}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;

use Sjpereira\AzureStoragePhpSdk\Contracts\Arrayable;
use Xray\AzureStoragePhpSdk\Contracts\Arrayable;

/**
* @phpstan-type DeleteRetentionPolicyType array{Enabled?: bool, AllowPermanentDelete?: bool, Days?: int}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;

use Sjpereira\AzureStoragePhpSdk\Contracts\Arrayable;
use Xray\AzureStoragePhpSdk\Contracts\Arrayable;

/**
* @phpstan-type RetentionPolicyType array{Days?: int, Enabled: bool}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;

use Sjpereira\AzureStoragePhpSdk\Contracts\Arrayable;
use Xray\AzureStoragePhpSdk\Contracts\Arrayable;

/**
* @phpstan-type RetentionPolicyType array{Days?: int, Enabled: bool}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;

use Sjpereira\AzureStoragePhpSdk\Contracts\Arrayable;
use Xray\AzureStoragePhpSdk\Contracts\Arrayable;

/**
* @phpstan-type RetentionPolicyType array{Days?: int, Enabled: bool}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account\BlobStorageProperty;

use Sjpereira\AzureStoragePhpSdk\Contracts\Arrayable;
use Xray\AzureStoragePhpSdk\Contracts\Arrayable;

/**
* @phpstan-type StaticWebsiteType array{Enabled?: bool, IndexDocument?: string, DefaultIndexDocumentPath?: string, ErrorDocument404Path?: string}
Expand Down
2 changes: 1 addition & 1 deletion src/BlobStorage/Entities/Account/GeoReplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account;

use DateTimeImmutable;

Expand Down
8 changes: 4 additions & 4 deletions src/BlobStorage/Entities/Account/KeyInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account;

use DateTimeImmutable;
use Sjpereira\AzureStoragePhpSdk\Contracts\{Arrayable, Xmlable};
use Sjpereira\AzureStoragePhpSdk\Converter\XmlConverter;
use Sjpereira\AzureStoragePhpSdk\Exceptions\RequiredFieldException;
use Xray\AzureStoragePhpSdk\Contracts\{Arrayable, Xmlable};
use Xray\AzureStoragePhpSdk\Converter\XmlConverter;
use Xray\AzureStoragePhpSdk\Exceptions\RequiredFieldException;

/** @implements Arrayable<array{KeyInfo: array{Start: string, Expiry: string}}> */
final readonly class KeyInfo implements Arrayable, Xmlable
Expand Down
2 changes: 1 addition & 1 deletion src/BlobStorage/Entities/Account/UserDelegationKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Account;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Account;

use DateTimeImmutable;

Expand Down
10 changes: 5 additions & 5 deletions src/BlobStorage/Entities/Blob/Blob.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Blob;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Blob;

use DateTime;
use DateTimeImmutable;
use Sjpereira\AzureStoragePhpSdk\BlobStorage\Enums\ExpirationOption;
use Sjpereira\AzureStoragePhpSdk\BlobStorage\Managers\Blob\{BlobLeaseManager, BlobManager, BlobTagManager};
use Sjpereira\AzureStoragePhpSdk\Concerns\HasManager;
use Sjpereira\AzureStoragePhpSdk\Exceptions\RequiredFieldException;
use Xray\AzureStoragePhpSdk\BlobStorage\Enums\ExpirationOption;
use Xray\AzureStoragePhpSdk\BlobStorage\Managers\Blob\{BlobLeaseManager, BlobManager, BlobTagManager};
use Xray\AzureStoragePhpSdk\Concerns\HasManager;
use Xray\AzureStoragePhpSdk\Exceptions\RequiredFieldException;

/**
* @phpstan-import-type PropertiesType from Properties
Expand Down
10 changes: 5 additions & 5 deletions src/BlobStorage/Entities/Blob/BlobLease.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace Sjpereira\AzureStoragePhpSdk\BlobStorage\Entities\Blob;
namespace Xray\AzureStoragePhpSdk\BlobStorage\Entities\Blob;

use DateTimeImmutable;
use Sjpereira\AzureStoragePhpSdk\BlobStorage\Managers\Blob\BlobLeaseManager;
use Sjpereira\AzureStoragePhpSdk\BlobStorage\Resource;
use Sjpereira\AzureStoragePhpSdk\Concerns\HasManager;
use Sjpereira\AzureStoragePhpSdk\Exceptions\RequiredFieldException;
use Xray\AzureStoragePhpSdk\BlobStorage\Managers\Blob\BlobLeaseManager;
use Xray\AzureStoragePhpSdk\BlobStorage\Resource;
use Xray\AzureStoragePhpSdk\Concerns\HasManager;
use Xray\AzureStoragePhpSdk\Exceptions\RequiredFieldException;

/**
* @phpstan-type BlobLeaseType array{'Last-Modified'?: string, ETag?: string, Server?: string, Date?: string, 'x-ms-request-id'?: string, 'x-ms-version'?: string, 'x-ms-lease-id'?: string}
Expand Down
Loading

0 comments on commit e5d05f1

Please sign in to comment.