PageHead
class PageHead extends Collection implements CollectionInterface, Countable, ArrayAccess, IteratorAggregate
Page head class
Properties
protected array | $data | Collection items data | from Collection |
protected array | $params | Property params |
Methods
Constructor
Create colection form json file
Merge collection items
Push value to collection
Add value to begining of collection array
Return true if key exists and value not empty in collection
Get params
Set meta title, description and keywords
Apply meta tags if values are empty
Set items value if not exist in collection
Apply item value if is empty in collection
Apply og property if value is not empty
Apply twitter property if value is not empty
Create keywords
Set keywords if field is empty
Set Open Graph description property
Set twitter title property
Set twitter description property
Add property
Create property array
Resolve properties
Details
at line 34
__construct(array $data = [])
Constructor
in Collection at line 45
static Collection
create(array $data)
Create colleciton
in Collection at line 58
static Collection
createFromFile(string $fileName, string|null $root = null, array|null $vars = null)
Create colection form json file
in Collection at line 73
ArrayIterator
getIterator()
Return iterator
in Collection at line 84
bool
has(string $key)
Return true if key exists in collection
in Collection at line 95
bool
offsetExists(string $key)
Return true if key exists in collection
in Collection at line 106
Collection
union(array $data)
Union arrays
in Collection at line 119
Collection
replace(array $replacement)
Replace array
in Collection at line 132
mixed
offsetGet(string $key)
Get item
in Collection at line 144
void
offsetSet(string $key, mixed $value)
Set item
in Collection at line 155
void
offsetUnset(string $key)
Remove item
in Collection at line 166
Collection
remove(string $key)
Remove item
in Collection at line 178
void
removeEmptyItems()
Remove empy items
in Collection at line 190
integer
count()
Return collection items count.
in Collection at line 202
void
setBooleanValue(string $path, integer|string $value)
Set bool value
in Collection at line 221
void
setValue(string $path, mixed $value)
Set item value by path
in Collection at line 234
void
merge(string $key, array $data, bool $recursive = false)
Merge collection items
in Collection at line 249
void
mergeItems(array $data, bool $recursive = false)
Merge all collection items
in Collection at line 261
Collection
set(string $key, mixed $value)
Set item value in collection
in Collection at line 275
void
add(string $key, mixed $value)
Add item to collection
in Collection at line 292
bool
push(string $key, mixed $value, string|null $subKey = null)
Push value to collection
in Collection at line 319
bool
prepend(string $key, mixed $value, string|null $subKey = null)
Add value to begining of collection array
in Collection at line 343
Collection
withData(array $data)
Set collection data
in Collection at line 356
array
slice(array|string $keys)
Slice collecion by keys
in Collection at line 366
array
toArray()
Return collection array
in Collection at line 377
bool
isEmpty(string $key)
Return true if key exists and value not empty in collection
in Collection at line 388
Collection
getCollection(string $key)
Get collection item
in Collection at line 400
mixed
get(string $key, mixed $default = null)
Get value from collection
in Collection at line 412
bool
getBool(string $key, bool|null $default = null)
Get boolean value
in Collection at line 424
string|null
getString(string $key, string|null $default = null)
Get text value
in Collection at line 438
int|null
getInt(string $key, int|null $default = null)
Get int value
in Collection at line 452
float|null
getFloat(string $key, float|null $default = null)
Get float value
in Collection at line 466
array
getArray(string $key, mixed $default = null)
Return array values
in Collection at line 478
void
clear()
Clear collection data
in Collection at line 488
Collection
copy()
Clone object
in Collection at line 499
mixed
__get(string $key)
Get value
in Collection at line 510
__set(string $key, mixed $value)
Set value
in Collection at line 522
mixed
getByPath(string $path, mixed $default = null)
Get value by path
in Collection at line 536
bool
addField(string $path, mixed $value)
Add value
in Collection at line 555
array
getItems()
Get collection items
at line 50
PageHead
param(string $name, string $value)
Set property value param
at line 62
array
getParams()
Get params
at line 74
PageHead
__call(string $name, array $arguments)
Add or set property
at line 97
PageHead
setMetaTags(array $data)
Set meta title, description and keywords
at line 112
PageHead
applyDefaultMetaTags(array $data)
Apply meta tags if values are empty
at line 127
PageHead
applyDefaultItems(array $items)
Set items value if not exist in collection
at line 145
PageHead
applyDefault(string $key, array $data)
Apply item value if is empty in collection
at line 162
PageHead
applyOgProperty(string $key, string $default = '')
Apply og property if value is not empty
at line 179
PageHead
applyTwitterProperty(string $key, string $default = '')
Apply twitter property if value is not empty
at line 195
PageHead
keywords(string|array ...$keywords)
Set keywords metatag
at line 208
string
createKeywords(mixed ...$keywords)
Create keywords
at line 225
PageHead
applyDefaultKeywors(array ...$keywords)
Set keywords if field is empty
at line 242
PageHead
og(string $name, mixed $value, array $options = [])
Set Open Graph property
at line 253
PageHead
ogTitle(string|null $title = null)
Set Open Graph title property
at line 266
PageHead
ogDescription(string|null $description = null)
Set Open Graph description property
at line 281
PageHead
twitter(string $name, mixed $value, array $options = [])
Set twitter property
at line 292
PageHead
twitterTitle(string|null $title = null)
Set twitter title property
at line 305
PageHead
twitterDescription(string|null $description = null)
Set twitter description property
at line 321
protected PageHead
addProperty(string $key, string $name, string $value, array $options = [])
Add property
at line 337
protected array
createProperty(string $name, string $value, array $options = [])
Create property array
at line 352
bool
resolveProperties(string $key)
Resolve properties