45 lines
1023 B
PHP
45 lines
1023 B
PHP
<?php
|
|
|
|
namespace App\Services\BundleCreators\Creators;
|
|
|
|
use App\Exceptions\NotImplemented;
|
|
use App\Services\BundleCreators\Contracts\CreatesBundle;
|
|
use Illuminate\Filesystem\FilesystemAdapter;
|
|
|
|
abstract class BaseBundleCreator implements CreatesBundle
|
|
{
|
|
/**
|
|
* Create a bundle
|
|
*/
|
|
public function createBundle(): string
|
|
{
|
|
throw new NotImplemented();
|
|
}
|
|
|
|
/**
|
|
* Return a boolean value indicating if the creator can actually make the
|
|
* bundle using known data.
|
|
*/
|
|
public function canCreateBundle(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Return an array describing what kind of data the creator needs in
|
|
* addition to the one it already has
|
|
*/
|
|
public function formSpecs(): ?array
|
|
{
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Return an instance of the creator, using specified data as input
|
|
*/
|
|
public static function make(?array $data, FilesystemAdapter $disk): CreatesBundle
|
|
{
|
|
return new static($data, $disk);
|
|
}
|
|
}
|