com\setasign\SetaSite\Block

BlockFactory

File: /SetaSite/src/Block/BlockFactory.php

Class hierarchy

Summary

Properties

$autoloader

$cache

private ?\Psr\SimpleCache\CacheInterface BlockFactory::$cache

$di

private BlockFactory::$di

$hashNames

protected array BlockFactory::$hashNames = array()

$logger

private ?\Psr\Log\LoggerInterface BlockFactory::$logger

$registeredBlocks

protected array<string, string> BlockFactory::$registeredBlocks = array()

Methods

__sleep()

public BlockFactory::__sleep (
void
): void
Exceptions

Throws \com\setasign\SetaSite\Exception

buildBlock()

public BlockFactory::buildBlock (
BlockParent\BlockParentInterface $blockParent,
string $blockName,
string $blockType,
array $data = array ( )
): BlockInterface

Returns a block instance for a block

Parameters
$blockParent: BlockParent\BlockParentInterface
 
$blockName: string
 
$blockType: string
 
$data: array
 

getBlockClassName()

public BlockFactory::getBlockClassName (
string $blockType
): string
Parameters
$blockType: string
 

getBlockConfig()

public BlockFactory::getBlockConfig (
void
): array

Returns the config of all blocks

getBlockHashName()

public BlockFactory::getBlockHashName (
string $blockType
): string
Parameters
$blockType: string
 
Exceptions

Throws \com\setasign\SetaSite\Exception

getBlockTypeByClassName()

public BlockFactory::getBlockTypeByClassName (
string $className
): string

The method will convert the class name

Parameters
$className: string
 

getBlockTypeByHashName()

public BlockFactory::getBlockTypeByHashName (
string $hashName
): string
Parameters
$hashName: string
 
Exceptions

Throws \com\setasign\SetaSite\Exception

getRegisteredBlocks()

public BlockFactory::getRegisteredBlocks (
void
): array

Returns the names of the registred blocks

registerBlock()

public BlockFactory::registerBlock (
string $blockPath,
string $namespaceOfClass
): void

Registers a block to blockfactory

Parameters
$blockPath: string

Path to block class file

$namespaceOfClass: string

Namespace of block class

Exceptions

Throws \InvalidArgumentException If $blockPath isn't readable.

registerBlocks()

public BlockFactory::registerBlocks (
string $blocksPath,
string $namespaceOfClass
): void
Parameters
$blocksPath: string
 
$namespaceOfClass: string
 

setCache()

public BlockFactory::setCache (
\Psr\SimpleCache\CacheInterface $cache
): void
Parameters
$cache: \Psr\SimpleCache\CacheInterface
 

setLogger()

public BlockFactory::setLogger (
\Psr\Log\LoggerInterface $logger
): void
Parameters
$logger: \Psr\Log\LoggerInterface