Documentation

ContentBlock implements ContentBlockInterface uses Serializable

Class to create nested blocks of content.

$innerBlock = ContentBlock::create(); $innerBlock->setContent('my inner content'); $outerBlock = ContentBlock::create(); $outerBlock->setContent(sprintf('Inside my outer block I have %s.', $innerBlock->getToken())); $outerBlock->addBlock($innerBlock); echo $outerBlock;

Table of Contents

Interfaces

ContentBlockInterface
ContentBlock Interface

Properties

$blocks  : array<string|int, mixed>
$cached  : bool
$checksum  : string
$content  : string
$id  : string
$tokenTemplate  : string
$version  : int

Methods

__construct()  : mixed
Block constructor.
__serialize()  : array<string|int, mixed>
__toString()  : string
__unserialize()  : void
addBlock()  : $this
build()  : void
create()  : static
disableCache()  : $this
fromArray()  : ContentBlockInterface
getChecksum()  : string
getId()  : string
getToken()  : string
isCached()  : bool
serialize()  : string
setChecksum()  : $this
setContent()  : $this
toArray()  : array<string|int, mixed>
toString()  : string
unserialize()  : void
checkVersion()  : void
generateId()  : string
getUnserializeAllowedClasses()  : array<string|int, mixed>|bool

Properties

$tokenTemplate

protected string $tokenTemplate = '@@BLOCK-%s@@'

Methods

__construct()

Block constructor.

public __construct([string|null $id = null ]) : mixed
Parameters
$id : string|null = null

__serialize()

public final __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__toString()

public __toString() : string
Attributes
#[ReturnTypeWillChange]
Return values
string

__unserialize()

public final __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

build()

public build(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>
Tags
throws
RuntimeException

create()

public static create([string|null $id = null ]) : static
Parameters
$id : string|null = null
Return values
static

disableCache()

public disableCache() : $this
Return values
$this

getChecksum()

public getChecksum() : string
Return values
string

getToken()

public getToken() : string
Return values
string

serialize()

public final serialize() : string
Return values
string

setChecksum()

public setChecksum(string $checksum) : $this
Parameters
$checksum : string
Return values
$this

setContent()

public setContent(string $content) : $this
Parameters
$content : string
Return values
$this

toArray()

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

toString()

public toString() : string
Return values
string

unserialize()

public final unserialize(string $serialized) : void
Parameters
$serialized : string

checkVersion()

protected checkVersion(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>
Tags
throws
RuntimeException

generateId()

protected generateId() : string
Return values
string

getUnserializeAllowedClasses()

protected getUnserializeAllowedClasses() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool

        
On this page

Search results