ContentTypeRegistry
in package
Uses
PhpConfigFile
Content type registry manager
Table of Contents
Constants
- CONTENT_TYPES_FILE_NAME = \Arikaim\Core\Utils\Path::CONFIG_PATH . 'content-types.php'
- Default content types registry config file name
Properties
- $comments : array<string|int, mixed>
- Config array comments
- $contentTypes : array<string|int, mixed>|null
- Content types
- $contentTypesFileName : string
- Content types config file
Methods
- __construct() : mixed
- Constructor
- addProvider() : bool
- Add content type provider
- get() : ContentTypeInterface
- Get content type
- getContentTypes() : array<string|int, mixed>
- Get registered content types list
- getProviders() : array<string|int, mixed>|null
- Get all content provider for type
- has() : bool
- Check if content type exists
- include() : array<string|int, mixed>|null
- Include file
- includeConfigFile() : array<string|int, mixed>|null
- Include config file
- includePhpArray() : array<string|int, mixed>|null
- Include php array
- load() : void
- Load content providers and content types
- register() : bool
- Register content provider
- registerAction() : bool
- Register content type action
- saveConfigFile() : bool
- Save config file
- unRegister() : bool
- Unregister content provider
- exportArray() : string
- Export array as text
- exportConfig() : string
- Export config as text
- exportItem() : string
- Export item as text
- getCommentsText() : string
- Get array imtem comment as text
- resolveDetails() : array<string|int, mixed>
- Resolve content type details
- setComment() : void
- Set array key comment
- determineMaxTabs() : int
- Get max tabs count
- determineTabs() : int
- Get tabs count for array key
- getFileContent() : string
- Return config file content
- getFileContentHeader() : string
- Get config file header
- getTabs() : string
- Get tabs text
Constants
CONTENT_TYPES_FILE_NAME
Default content types registry config file name
public
mixed
CONTENT_TYPES_FILE_NAME
= \Arikaim\Core\Utils\Path::CONFIG_PATH . 'content-types.php'
Properties
$comments
Config array comments
protected
array<string|int, mixed>
$comments
= []
$contentTypes
Content types
protected
array<string|int, mixed>|null
$contentTypes
= null
$contentTypesFileName
Content types config file
private
string
$contentTypesFileName
Methods
__construct()
Constructor
public
__construct([string|null $contentTypesFileName = null ]) : mixed
Parameters
- $contentTypesFileName : string|null = null
addProvider()
Add content type provider
public
addProvider(string $contentType, string $name) : bool
Parameters
- $contentType : string
- $name : string
Return values
boolget()
Get content type
public
get(string $name) : ContentTypeInterface
Parameters
- $name : string
Return values
ContentTypeInterfacegetContentTypes()
Get registered content types list
public
getContentTypes([string|null $category = null ]) : array<string|int, mixed>
Parameters
- $category : string|null = null
Return values
array<string|int, mixed>getProviders()
Get all content provider for type
public
getProviders(string $contentType) : array<string|int, mixed>|null
Parameters
- $contentType : string
Return values
array<string|int, mixed>|nullhas()
Check if content type exists
public
has(string $name) : bool
Parameters
- $name : string
Return values
boolinclude()
Include file
public
include(string $fileName) : array<string|int, mixed>|null
Parameters
- $fileName : string
-
Full file name
Return values
array<string|int, mixed>|nullincludeConfigFile()
Include config file
public
includeConfigFile(string $fileName[, string|null $extensionName = null ]) : array<string|int, mixed>|null
Parameters
- $fileName : string
- $extensionName : string|null = null
Return values
array<string|int, mixed>|nullincludePhpArray()
Include php array
public
includePhpArray(string $fileName) : array<string|int, mixed>|null
Parameters
- $fileName : string
Return values
array<string|int, mixed>|nullload()
Load content providers and content types
public
load([bool $reload = false ]) : void
Parameters
- $reload : bool = false
register()
Register content provider
public
register(mixed $contentType) : bool
Parameters
- $contentType : mixed
Tags
Return values
boolregisterAction()
Register content type action
public
registerAction(string $contentType, string $class) : bool
Parameters
- $contentType : string
- $class : string
Tags
Return values
boolsaveConfigFile()
Save config file
public
saveConfigFile(string $fileName, array<string|int, mixed> $data) : bool
Parameters
- $fileName : string
- $data : array<string|int, mixed>
Return values
boolunRegister()
Unregister content provider
public
unRegister(string $name) : bool
Parameters
- $name : string
Return values
boolexportArray()
Export array as text
protected
exportArray(array<string|int, mixed> $data, string $arrayKey[, int $currentTab = 1 ]) : string
Parameters
- $data : array<string|int, mixed>
- $arrayKey : string
- $currentTab : int = 1
Return values
stringexportConfig()
Export config as text
protected
exportConfig(array<string|int, mixed> $data) : string
Parameters
- $data : array<string|int, mixed>
Return values
stringexportItem()
Export item as text
protected
exportItem(string|int $key, mixed $value, int $maxTabs[, int $startTab = 1 ]) : string
Parameters
- $key : string|int
- $value : mixed
- $maxTabs : int
- $startTab : int = 1
Return values
stringgetCommentsText()
Get array imtem comment as text
protected
getCommentsText(string $key) : string
Parameters
- $key : string
Return values
stringresolveDetails()
Resolve content type details
protected
resolveDetails(ContentTypeInterface $contentType) : array<string|int, mixed>
Parameters
- $contentType : ContentTypeInterface
Tags
Return values
array<string|int, mixed>setComment()
Set array key comment
protected
setComment(string $comment, string $key) : void
Parameters
- $comment : string
- $key : string
determineMaxTabs()
Get max tabs count
private
determineMaxTabs(array<string|int, mixed> $data[, int $tabSize = 4 ]) : int
Parameters
- $data : array<string|int, mixed>
- $tabSize : int = 4
Return values
intdetermineTabs()
Get tabs count for array key
private
determineTabs(string $key[, int $tabSize = 4 ]) : int
Parameters
- $key : string
- $tabSize : int = 4
Return values
intgetFileContent()
Return config file content
private
getFileContent(array<string|int, mixed> $data) : string
Parameters
- $data : array<string|int, mixed>
Return values
stringgetFileContentHeader()
Get config file header
private
getFileContentHeader() : string
Return values
stringgetTabs()
Get tabs text
private
getTabs(int $count) : string
Parameters
- $count : int