Interface BaseApi
PURPOSE
An Api Interface is used to declare a family of related classes, and what they are meant to satisfy. It also declares any dependencies, and any interoperability that can occur with it, or any additional apis that it provides.
This information is used internally to validate the execution plan.
This information can be indexed by checking the Codex
USAGE
Effective useage of this interface construct without collisions requires that these interfaces ONLY BE IMPLEMENTED BY CONCRETE, FINAL CLASSES
The traits and abstractions of this system are built to honor the considerations if these without directly implementing them.
Concrete classes can implement them as proof that they honor their api. Internally, the system will FAVOR the object for jobs related to it's DECLARED API when it has MULTIPLE AVAILABLE OPTIONS that all honor a scope.
DECLARE THE API IN THE CONCRETE CLASS if it is not met by inheritance (traits cannot accomplish this for you. You must either declare this yourself or inherit it from one of our base classes).
const API = '\oroboros\core\interfaces\api\adapters\AdapterApi'; //honors the adapter api
Api Interfaces serve as an index of how class type and class scope relate to specific api use cases. This information is available by checking the Codex
Direct known implementers
oroboros\core\interfaces\api\ClassTypeApi
,
oroboros\core\interfaces\api\controllers\ControllerApi
,
oroboros\core\interfaces\api\CoreApi
,
oroboros\core\interfaces\api\psr\Psr7Api
Indirect known implementers
oroboros\core\libraries\api\ClassTypes
,
oroboros\core\libraries\file\FileUpload
,
oroboros\core\libraries\request\Request
,
oroboros\core\libraries\request\ServerRequest
,
oroboros\core\libraries\response\Response
,
oroboros\core\libraries\stream\Message
,
oroboros\core\libraries\stream\Stream
,
oroboros\core\libraries\uri\Uri
,
oroboros\Oroboros
Author: Brian Dayhoff brian@mopsyd.me
Since: 0.2.4-alpha
See:
\oroboros\core\codex\Codex
Which can also be done by any class using the codex trait
See:
\oroboros\core\traits\codex\CodexTrait
Or by extending the abstract
See:
\oroboros\core\abstracts\codex\Codex
CONSIDERATIONS
These interfaces DO enforce methods
,for objects to report their api. This condition can be satisfied by including the api trait in your class. Most traits use this one
,so it is likely already available if you are implementing any other trait.
See:
\oroboros\core\traits\api\ApiTrait
These interfaces DO declare numerous constants. There is a low probability of constant collision with external codebases. If this causes an issue
,wrap the object that implements the api in one that doesn't
,and use a pass-through to obtain it's values.
There is a trait that can accomplish this strict enumeration based off of any interface attached to a class that uses it
,which can also filter results by prefix or suffix of the constant name. It's super handy for indexing these in any class that uses them.
See:
\oroboros\core\traits\libraries\enum\EnumTrait
There are also sets of provided defaults under the concrete namespace
See: \oroboros\core\libraries\enum
Satisfies: \oroboros\core\interfaces\api\ClassTypeApi::CLASS_TYPE_API_VALID
Located at core/interfaces/api/BaseApi.php
Constants summary
string |
OROBOROS_DECLARED_API
|
#
self::API
|
string |
OROBOROS_DECLARED_CLASS_TYPE
|
#
self::CLASS_TYPE
|
string |
OROBOROS_DECLARED_CLASS_SCOPE
|
#
self::CLASS_SCOPE
|