-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f13267
commit 4155eef
Showing
30 changed files
with
497 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Apiato\Abstract\Providers; | ||
|
||
use Illuminate\Support\ServiceProvider as LaravelServiceProvider; | ||
|
||
abstract class ServiceProvider extends LaravelServiceProvider | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace Apiato\Foundation\Configuration; | ||
|
||
use Apiato\Foundation\Apiato; | ||
|
||
final readonly class ApplicationBuilder | ||
{ | ||
public function __construct( | ||
private Apiato $apiato, | ||
) { | ||
} | ||
|
||
public function withProviders(string ...$path): self | ||
{ | ||
$this->apiato->withProviders(...$path); | ||
|
||
return $this; | ||
} | ||
|
||
public function withConfigs(string ...$path): self | ||
{ | ||
$this->apiato->withConfigs(...$path); | ||
|
||
return $this; | ||
} | ||
|
||
public function withEvents(string ...$path): self | ||
{ | ||
$this->apiato->withEvents(...$path); | ||
|
||
return $this; | ||
} | ||
|
||
public function withCommands(string ...$path): self | ||
{ | ||
$this->apiato->withCommands(...$path); | ||
|
||
return $this; | ||
} | ||
|
||
public function withHelpers(string ...$path): self | ||
{ | ||
$this->apiato->withHelpers(...$path); | ||
|
||
return $this; | ||
} | ||
|
||
public function withTranslations(callable|null $callback = null): self | ||
{ | ||
$this->apiato->withTranslations($callback); | ||
|
||
return $this; | ||
} | ||
|
||
public function create(): Apiato | ||
{ | ||
return $this->apiato; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Apiato\Foundation\Configuration; | ||
|
||
use Apiato\Foundation\Support\PathHelper; | ||
use Illuminate\Support\Str; | ||
|
||
final class Localization | ||
{ | ||
protected static \Closure $namespaceBuilder; | ||
protected array $paths = []; | ||
|
||
public function __construct() | ||
{ | ||
$this->buildNamespaceUsing(function ($path): string { | ||
if (Str::contains($path, PathHelper::getSharedDirectoryPath())) { | ||
return Str::camel(PathHelper::getSharedDirectoryName()); | ||
} | ||
|
||
return Str::of($path) | ||
->after(PathHelper::getContainersDirectoryName() . DIRECTORY_SEPARATOR) | ||
->explode(DIRECTORY_SEPARATOR) | ||
->take(2) | ||
->map(static fn ($part) => Str::camel($part)) | ||
->implode('@'); | ||
}); | ||
} | ||
|
||
public function buildNamespaceUsing(callable $callback): self | ||
{ | ||
self::$namespaceBuilder = $callback; | ||
|
||
return $this; | ||
} | ||
|
||
public function paths(): array | ||
{ | ||
return $this->paths; | ||
} | ||
|
||
public function loadTranslationsFrom(string ...$paths): self | ||
{ | ||
$this->paths = $paths; | ||
|
||
return $this; | ||
} | ||
|
||
public function buildNamespaceFor(string $path): string | ||
{ | ||
return app()->call(self::$namespaceBuilder, compact('path')); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Apiato\Foundation\Loaders; | ||
|
||
use Apiato\Foundation\Apiato; | ||
use Illuminate\Support\Facades\File; | ||
|
||
final readonly class HelperLoader implements Loader | ||
{ | ||
private function __construct(private array $paths) | ||
{ | ||
} | ||
|
||
public static function create(): self | ||
{ | ||
return new self(Apiato::instance()->helperPaths()); | ||
} | ||
|
||
public function load(): void | ||
{ | ||
foreach ($this->paths as $path) { | ||
$files = File::files($path); | ||
|
||
foreach ($files as $file) { | ||
require_once $file; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.