PHP Класс Newscoop\Service\Implementation\ThemeServiceLocalFileSystem

Наследование: implements Newscoop\Service\IThemeService
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$themeConfigFileName string
$themesFolder string

Защищенные свойства (Protected)

Свойство Тип Описание
$cacheThemeConfigs array
$cacheXMLEmelemt array
$errorHandler Newscoop\Service\IErrorHandler
$id Newscoop\Service\Resource\ResourceId

Открытые методы

Метод Описание
__construct ( ResourceId $id ) Construct the service based on the provided resource id.
findById ( $id )
getById ( $id ) * ---------------------------------------------------------------
getCount ( Search $search = NULL )
getEntities ( Search $search = NULL, $offset, $limit )
getPresentationImages ( Theme $theme ) * ---------------------------------------------------------------
toFullPath ( Theme | string $theme, string $file = '' ) : string Provides the full path for a theme.

Защищенные методы

Метод Описание
escapePath ( string $path ) : string Converts the provided path from the OS specific form (if is the cae) to using just forward slashes.
extractRelativePathFrom ( string $path ) : string Extracts from a provided file path the path where that file is located, attention the path needs to be in the escaped form.
filterThemes ( SearchTheme $search, array $themes ) : array Filters the provided array of themes based on the search.
findAllThemesConfigPaths ( ) : array Finds all paths to the configurations XML files for themes, that are located in the theme folder.
getErrorHandler ( ) : Newscoop\Service\IErrorHandler Provides the error handler.
getNodes ( SimpleXMLElement $node, string $tagName, string $attribute = NULL, $value = '' ) : array Finds all the childrens from the provided node that have the provided tag name
getResourceId ( ) : Newscoop\Services\Resource\ResourceId Provides the resource id.
loadTheme ( SimpleXMLElement $nodeTheme, string $id, string $themeConfig ) : Theme Loads the theme object.
loadThemeByPath ( str $themePath ) : Theme Load the theme from the provided relative path.
loadThemes ( array $themesConfigs ) : array Loads the provided theme configuration files.
loadXML ( string $path ) : SimpleXMLElement Loads the XML content into SimpleXMLElement.
readAttribute ( SimpleXMLElement $node, string $attribute ) : string Convienient method for read an attribute from a node.
sort ( array $array, string $property, $ascending ) : array Sort the array.
trim ( array $array, integer $offset, integer $limit ) : array Trims the array based on the offset and limit.

Описание методов

__construct() публичный метод

Construct the service based on the provided resource id.
public __construct ( ResourceId $id )
$id Newscoop\Service\Resource\ResourceId The resource id, not null not empty

escapePath() защищенный метод

Converts the provided path from the OS specific form (if is the cae) to using just forward slashes.
protected escapePath ( string $path ) : string
$path string The path, *(not null not empty).
Результат string The escaped path.

extractRelativePathFrom() защищенный метод

Extracts from a provided file path the path where that file is located, attention the path needs to be in the escaped form.
protected extractRelativePathFrom ( string $path ) : string
$path string The path from which to extract the relative path, *(not null not empty).
Результат string The relative path for the provided path, not null.

filterThemes() защищенный метод

Filters the provided array of themes based on the search.
protected filterThemes ( SearchTheme $search, array $themes ) : array
$search Newscoop\Service\Model\SearchTheme The search to filter the themes by, *(not null not empty).
$themes array The array of Theme objects to be filtered, *(not null not empty).
Результат array The array containing all themes that respect the search.

findAllThemesConfigPaths() защищенный метод

Finds all paths to the configurations XML files for themes, that are located in the theme folder.
protected findAllThemesConfigPaths ( ) : array
Результат array The array containing as key the id of the theme config and as a value the relative path of the theme configuration XML file in escaped form. The id of a theme is formed based on the publication path with the crec32 applied.

findById() публичный метод

public findById ( $id )

getById() публичный метод

* ---------------------------------------------------------------
public getById ( $id )

getCount() публичный метод

public getCount ( Search $search = NULL )
$search Newscoop\Service\Model\Search\Search

getEntities() публичный метод

public getEntities ( Search $search = NULL, $offset, $limit )
$search Newscoop\Service\Model\Search\Search

getErrorHandler() защищенный метод

Provides the error handler.
protected getErrorHandler ( ) : Newscoop\Service\IErrorHandler
Результат Newscoop\Service\IErrorHandler The error handler to be used.

getNodes() защищенный метод

Finds all the childrens from the provided node that have the provided tag name
protected getNodes ( SimpleXMLElement $node, string $tagName, string $attribute = NULL, $value = '' ) : array
$node SimpleXMLElement The node in which to search the childrens, not null.
$tagName string The tag name for the childrens to find, not null.
$attribute string Optional attribute name to search the kids by, beside the tag name.
$value Optional but if $attribute is specified than specify also the value of the attribute to find by.
Результат array an array containing all the found nodes, not null can be empty.

getPresentationImages() публичный метод

* ---------------------------------------------------------------
public getPresentationImages ( Theme $theme )
$theme Newscoop\Entity\Theme

getResourceId() защищенный метод

Provides the resource id.
protected getResourceId ( ) : Newscoop\Services\Resource\ResourceId
Результат Newscoop\Services\Resource\ResourceId The resource id.

loadTheme() защищенный метод

Loads the theme object.
protected loadTheme ( SimpleXMLElement $nodeTheme, string $id, string $themeConfig ) : Theme
$nodeTheme SimpleXMLElement The node Theme XML element, *(not null not empty).
$id string The id of the loaded Theme, *(not null not empty).
$themeConfig string The path of the Theme XML file in order to extract the theme path, *(not null not empty).
Результат Newscoop\Entity\Theme The loaded theme object, NULL if there was an issue.

loadThemeByPath() защищенный метод

Load the theme from the provided relative path.
protected loadThemeByPath ( str $themePath ) : Theme
$themePath str The theme relative path.
Результат Newscoop\Entity\Theme The loaded theme.

loadThemes() защищенный метод

Loads the provided theme configuration files.
protected loadThemes ( array $themesConfigs ) : array
$themesConfigs array The array containing as key the ide of the theme config (index) and as a value the relative path of the theme configuration XML file, *(not null not empty).
Результат array The array containing all the loaded themes.

loadXML() защищенный метод

Loads the XML content into SimpleXMLElement.
protected loadXML ( string $path ) : SimpleXMLElement
$path string The path to the XML file, *(not null not empty).
Результат SimpleXMLElement The XML element, NULL if the XML is not valid.

readAttribute() защищенный метод

This method will throw an exception in case the attribute is not specified.
protected readAttribute ( SimpleXMLElement $node, string $attribute ) : string
$node SimpleXMLElement The node to read from, *(not null not empty).
$attribute string The attribute name, *(not null not empty).
Результат string The attribute value, not null.

sort() защищенный метод

Sort the array.
protected sort ( array $array, string $property, $ascending ) : array
$array array The array of elements to be sorted.
$property string The method name that provides the sorting key.
Результат array The sorted array.

toFullPath() публичный метод

Provides the full path for a theme.
public toFullPath ( Theme | string $theme, string $file = '' ) : string
$theme Newscoop\Entity\Theme | string The Theme or path, *(not null not empty).
$file string Optional a file to be appended to the path.
Результат string The full path to the theme and file if is the case.

trim() защищенный метод

Trims the array based on the offset and limit.
protected trim ( array $array, integer $offset, integer $limit ) : array
$array array The array to be trimed, not null.
$offset integer The offset.
$limit integer The limit.
Результат array The trimed array.

Описание свойств

$cacheThemeConfigs защищенное свойство

protected array $cacheThemeConfigs
Результат array

$cacheXMLEmelemt защищенное свойство

protected array $cacheXMLEmelemt
Результат array

$errorHandler защищенное свойство

protected IErrorHandler,Newscoop\Service $errorHandler
Результат Newscoop\Service\IErrorHandler

$id защищенное свойство

protected ResourceId,Newscoop\Service\Resource $id
Результат Newscoop\Service\Resource\ResourceId

$themeConfigFileName публичное свойство

public string $themeConfigFileName
Результат string

$themesFolder публичное свойство

public string $themesFolder
Результат string