ContentManager
in package
implements
ContentManagerInterface
Uses
PhpConfigFile
Content providers registry manager
Table of Contents
Interfaces
- ContentManagerInterface
- Content manager interface
Constants
- PROVIDERS_FILE_NAME = \Arikaim\Core\Utils\Path::CONFIG_PATH . 'content-providers.php'
- Default providers config file name
Properties
- $comments : array<string|int, mixed>
- Config array comments
- $contentProviders : array<string|int, mixed>|null
- Content providers
- $contentTypeRegistry : null
- Content type registry
- $providersFileName : string
- Content providers config file
Methods
- __construct() : mixed
- Constructor
- createItem() : mixed
- Create content item
- createSelector() : string
- Create content selector
- get() : ContentItemInterface|null
- Get content
- getDefaultProvider() : object|null
- Get default provider
- getItem() : ContentItemInterface|null
- Get content item
- getProviders() : array<string|int, mixed>
- Get content providers list
- hasContentType() : bool
- Return true if content type exists
- hasProvider() : bool
- Check if provider 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
- provider() : ContentProviderInterface|null
- Get content provider
- registerProvider() : bool
- Register content provider
- runAction() : mixed
- Run action
- saveConfigFile() : bool
- Save config file
- saveContentItem() : mixed
- Save content item
- search() : mixed
- Search content
- type() : ContentProviderInterface|null
- Get content type provider from registry
- typeRegistry() : object
- Get content type registry
- unRegisterProvider() : 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
- resolveProviderDetails() : array<string|int, mixed>
- Resolve provider edetails
- 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
PROVIDERS_FILE_NAME
Default providers config file name
public
mixed
PROVIDERS_FILE_NAME
= \Arikaim\Core\Utils\Path::CONFIG_PATH . 'content-providers.php'
Properties
$comments
Config array comments
protected
array<string|int, mixed>
$comments
= []
$contentProviders
Content providers
protected
array<string|int, mixed>|null
$contentProviders
= null
$contentTypeRegistry
Content type registry
protected
null
$contentTypeRegistry
= null
$providersFileName
Content providers config file
private
string
$providersFileName
Methods
__construct()
Constructor
public
__construct([string|null $providersFileName = null ]) : mixed
Parameters
- $providersFileName : string|null = null
createItem()
Create content item
public
createItem(mixed $data, string $contentType) : mixed
Parameters
- $data : mixed
- $contentType : string
createSelector()
Create content selector
public
createSelector(string $provider, string $contentType, string $keyFields, string $key[, string $type = 'content' ]) : string
Parameters
- $provider : string
- $contentType : string
- $keyFields : string
- $key : string
- $type : string = 'content'
Return values
stringget()
Get content
public
get(string $selector) : ContentItemInterface|null
Parameters
- $selector : string
Return values
ContentItemInterface|nullgetDefaultProvider()
Get default provider
public
getDefaultProvider(string $contentType) : object|null
Parameters
- $contentType : string
Return values
object|nullgetItem()
Get content item
public
getItem(string $key[, array<string|int, mixed>|null $default = null ]) : ContentItemInterface|null
Parameters
- $key : string
- $default : array<string|int, mixed>|null = null
Return values
ContentItemInterface|nullgetProviders()
Get content providers list
public
getProviders([string|null $category = null ][, string|null $contentType = null ]) : array<string|int, mixed>
Parameters
- $category : string|null = null
- $contentType : string|null = null
Return values
array<string|int, mixed>hasContentType()
Return true if content type exists
public
hasContentType(string $name) : bool
Parameters
- $name : string
Return values
boolhasProvider()
Check if provider exists
public
hasProvider(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
provider()
Get content provider
public
provider(string $name[, string|null $contentType = null ]) : ContentProviderInterface|null
Parameters
- $name : string
- $contentType : string|null = null
Return values
ContentProviderInterface|nullregisterProvider()
Register content provider
public
registerProvider(object|string $provider) : bool
Parameters
- $provider : object|string
Return values
boolrunAction()
Run action
public
runAction(string $contentType, string $actionName, mixed $data[, array<string|int, mixed>|null $options = [] ]) : mixed
Parameters
- $contentType : string
- $actionName : string
- $data : mixed
- $options : array<string|int, mixed>|null = []
saveConfigFile()
Save config file
public
saveConfigFile(string $fileName, array<string|int, mixed> $data) : bool
Parameters
- $fileName : string
- $data : array<string|int, mixed>
Return values
boolsaveContentItem()
Save content item
public
saveContentItem(string $key, string $contentType[, string|null $title = null ]) : mixed
Parameters
- $key : string
- $contentType : string
- $title : string|null = null
search()
Search content
public
search(string $selector[, string $query = '' ][, int $page = 1 ][, int $perPage = 25 ]) : mixed
Parameters
- $selector : string
- $query : string = ''
- $page : int = 1
- $perPage : int = 25
type()
Get content type provider from registry
public
type(string $name[, string|null $providerName = null ]) : ContentProviderInterface|null
Parameters
- $name : string
- $providerName : string|null = null
Return values
ContentProviderInterface|nulltypeRegistry()
Get content type registry
public
typeRegistry() : object
Return values
objectunRegisterProvider()
Unregister content provider
public
unRegisterProvider(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
stringresolveProviderDetails()
Resolve provider edetails
protected
resolveProviderDetails(ContentProviderInterface $provider) : array<string|int, mixed>
Parameters
- $provider : ContentProviderInterface
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