Skip to content

Commit

Permalink
Cleanup Docblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
PineappleIOnic committed Feb 25, 2024
1 parent 22231e4 commit a18b197
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 15 deletions.
6 changes: 6 additions & 0 deletions src/Migration/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public function add($resource)
$this->cache[$resource->getName()][$resource->getInternalId()] = $resource;
}

/**
* Add All Resources
*
* @param resource[] $resources
* @return void
*/
public function addAll(array $resources)
{
foreach ($resources as $resource) {
Expand Down
6 changes: 6 additions & 0 deletions src/Migration/Destination.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public function setSource(Source $source): self

/**
* Transfer Resources to Destination from Source callback
*
* @param string[] $resources Resources to transfer
* @param callable $callback Callback to run after transfer
*/
public function run(array $resources, callable $callback): void
{
Expand All @@ -39,6 +42,9 @@ public function run(array $resources, callable $callback): void

/**
* Import Resources
*
* @param resource[] $resources Resources to import
* @param callable $callback Callback to run after import
*/
abstract protected function import(array $resources, callable $callback): void;
}
3 changes: 0 additions & 3 deletions src/Migration/Destinations/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ public static function getSupportedResources(): array
];
}

/**
* Report checks if all resources are accessible and ready for writing.
*/
public function report(array $resources = []): array
{
$report = [];
Expand Down
4 changes: 2 additions & 2 deletions src/Migration/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ public function setMessage(string $message): self
}

/**
* @returns array<string>
* @returns string[]
*/
public function getPermissions(): array
{
return $this->permissions;
}

/**
* @param array<string> $permissions
* @param string[] $permissions
*/
public function setPermissions(array $permissions): self
{
Expand Down
18 changes: 14 additions & 4 deletions src/Migration/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public function callback(array $resources): void

/**
* Transfer Resources into destination
*
* @param string[] $resources Resources to transfer
* @param callable $callback Callback to run after transfer
*/
public function run(array $resources, callable $callback): void
{
Expand All @@ -39,6 +42,12 @@ public function run(array $resources, callable $callback): void
$this->exportResources($resources, 100);
}

/**
* Export Resources
*
* @param string[] $resources Resources to export
* @param int $batchSize Max 100
*/
public function exportResources(array $resources, int $batchSize)
{
// Convert Resources back into their relevant groups
Expand Down Expand Up @@ -82,31 +91,32 @@ public function exportResources(array $resources, int $batchSize)
/**
* Export Auth Group
*
* @param array $resources Resources to export
* @param int $batchSize Max 100
* @param string[] $resources Resources to export
*/
abstract protected function exportGroupAuth(int $batchSize, array $resources);

/**
* Export Databases Group
*
* @param int $batchSize Max 100
* @param array $resources Resources to export
* @param string[] $resources Resources to export
*/
abstract protected function exportGroupDatabases(int $batchSize, array $resources);

/**
* Export Storage Group
*
* @param int $batchSize Max 5
* @param array $resources Resources to export
* @param string[] $resources Resources to export
*/
abstract protected function exportGroupStorage(int $batchSize, array $resources);

/**
* Export Functions Group
*
* @param int $batchSize Max 100
* @param array $resources Resources to export
* @param string[] $resources Resources to export
*/
abstract protected function exportGroupFunctions(int $batchSize, array $resources);
}
6 changes: 1 addition & 5 deletions src/Migration/Sources/Appwrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ class Appwrite extends Source

protected string $key = '';

/**
* Constructor
*
* @return self
*/
public function __construct(string $project, string $endpoint, string $key)
{
$this->client = (new Client())
Expand Down Expand Up @@ -272,6 +267,7 @@ public function report(array $resources = []): array
* Export Auth Resources
*
* @param int $batchSize Max 100
* @param string[] $resources
* @return void
*/
protected function exportGroupAuth(int $batchSize, array $resources)
Expand Down
7 changes: 6 additions & 1 deletion src/Migration/Target.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ abstract class Target
/**
* Global Headers
*
* @var array
* @var array<string, string>
*/
protected $headers = [
'Content-Type' => '',
Expand All @@ -30,6 +30,9 @@ public function registerCache(Cache &$cache): void

/**
* Run Transfer
*
* @param string[] $resources Resources to transfer
* @param callable $callback Callback to run after transfer
*/
abstract public function run(array $resources, callable $callback): void;

Expand All @@ -41,6 +44,8 @@ abstract public function run(array $resources, callable $callback): void;
*
* On Destinations, this function should just return nothing but still check if the API is available.
* If any issues are found then an exception should be thrown with an error message.
*
* @param string[] $resources Resources to report
*/
abstract public function report(array $resources = []): array;

Expand Down

0 comments on commit a18b197

Please sign in to comment.