-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented the services layer from Grizz-IT
- Loading branch information
1 parent
8887fac
commit 94b62b8
Showing
41 changed files
with
555 additions
and
439 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
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
vendor/ | ||
composer.lock | ||
var/ |
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
configuration/configuration/service-compiler-extensions.configuration.json
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
configuration/configuration/service-compiler-hooks.configuration.json
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
configuration/configuration/service-factory-extensions.configuration.json
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
configuration/configuration/service-factory-hooks.configuration.json
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,22 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft-07/schema", | ||
"$id": "invocations.schema.json", | ||
"type": ["object"], | ||
"properties": { | ||
"service": { | ||
"type": "string", | ||
"pattern": "^[\\.\\w-]+$" | ||
}, | ||
"method": { | ||
"type": "string" | ||
}, | ||
"parameters": { | ||
"type": "object" | ||
}, | ||
"cache": { | ||
"type": "boolean", | ||
"default": true | ||
} | ||
}, | ||
"required": ["service", "method"] | ||
} |
This file was deleted.
Oops, something went wrong.
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
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,18 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft-07/schema", | ||
"$id": "tags.schema.json", | ||
"type": "object", | ||
"properties": { | ||
"trigger": { | ||
"type": "string" | ||
}, | ||
"service": { | ||
"type": "string" | ||
}, | ||
"sortOrder": { | ||
"type": "integer", | ||
"default": 1000 | ||
} | ||
}, | ||
"required": ["service", "trigger"] | ||
} |
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,10 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft-07/schema", | ||
"$id": "triggers.schema.json", | ||
"type": ["object", "array"], | ||
"properties": { | ||
"service": { | ||
"type": "string" | ||
} | ||
} | ||
} |
6 changes: 0 additions & 6 deletions
6
configuration/service-factory-hooks/environment-variable-hook.json
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,8 @@ | ||
{ | ||
"triggers": { | ||
"core.service.compilers": {}, | ||
"core.service.validators": {}, | ||
"core.service.factories": {}, | ||
"core.service.hooks": {} | ||
} | ||
} |
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
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,87 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright (C) GrizzIT, Inc. All rights reserved. | ||
* See LICENSE for license details. | ||
*/ | ||
|
||
namespace Ulrack\Kernel\Component\Compiler; | ||
|
||
use GrizzIt\Validator\Common\ValidatorInterface; | ||
use Ulrack\Kernel\Component\Registry\WrappedServiceRegistry; | ||
use GrizzIt\Services\Common\Compiler\ServiceCompilerInterface; | ||
use GrizzIt\Services\Common\Registry\ServiceRegistryInterface; | ||
use GrizzIt\Services\Common\Compiler\ServiceCompilerExtensionInterface; | ||
|
||
class WrappedServiceCompiler implements ServiceCompilerInterface | ||
{ | ||
/** | ||
* Contains the original service compiler. | ||
* | ||
* @var ServiceCompilerInterface | ||
*/ | ||
private ServiceCompilerInterface $serviceCompiler; | ||
|
||
/** | ||
* Contains the compiled service registry. | ||
* | ||
* @var ServiceRegistryInterface|null | ||
*/ | ||
private ?ServiceRegistryInterface $serviceRegistry = null; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param ServiceCompilerInterface $serviceCompiler | ||
*/ | ||
public function __construct(ServiceCompilerInterface $serviceCompiler) | ||
{ | ||
$this->serviceCompiler = $serviceCompiler; | ||
} | ||
|
||
/** | ||
* Compiles the services and returns the compiled services. | ||
* | ||
* @return ServiceRegistryInterface | ||
*/ | ||
public function compile(): ServiceRegistryInterface | ||
{ | ||
if ($this->serviceRegistry === null) { | ||
$this->serviceRegistry = new WrappedServiceRegistry( | ||
$this->serviceCompiler->compile() | ||
); | ||
} | ||
|
||
return $this->serviceRegistry; | ||
} | ||
|
||
/** | ||
* Adds a validator for a service key. | ||
* | ||
* @param string $key | ||
* @param ValidatorInterface $validator | ||
* | ||
* @return void | ||
*/ | ||
public function addValidator( | ||
string $key, | ||
ValidatorInterface $validator | ||
): void { | ||
$this->serviceCompiler->addValidator($key, $validator); | ||
} | ||
|
||
/** | ||
* Adds an extension to the service compiler. | ||
* | ||
* @param ServiceCompilerExtensionInterface $extension | ||
* @param int $sortOrder | ||
* | ||
* @return void | ||
*/ | ||
public function addExtension( | ||
ServiceCompilerExtensionInterface $extension, | ||
int $sortOrder | ||
): void { | ||
$this->serviceCompiler->addExtension($extension, $sortOrder); | ||
} | ||
} |
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
Oops, something went wrong.