PHP Class CMS\Page

Inheritance: extends Model
Show file Open project: sphido/cms Class Usage Examples

Public Properties

Property Type Description
$children array

Protected Properties

Property Type Description
$content string | null
$meta array

Public Methods

Method Description
__construct ( $file = null, array $meta = [], $content = null )
__get ( string $name ) : null Return file metadata value
__isset ( string $name ) : boolean
__set ( string $name, mixed $value ) Set meta value
fromPath ( string $path, array $meta = [] ) : static Create new File instance from path
getContent ( ) : string Return file content
getDescription ( ) : mixed Return automatic description Notice: getDescription use slow function shorten() in some cases
getDir ( ) : string Return current directory
getMeta ( array $meta = [] ) : array Return current file metadata
getName ( ) : string Return name of file without extension
getSlug ( string | null $src = null ) : string Return link to file
getUrl ( null | string $src = null ) : string
is ( string $ext ) : boolean Check extension.
isValid ( array $skip = [] ) : boolean
setContent ( string $content ) Set file content

Method Details

__construct() public method

public __construct ( $file = null, array $meta = [], $content = null )
$meta array

__get() public method

Return file metadata value
public __get ( string $name ) : null
$name string
return null

__isset() public method

public __isset ( string $name ) : boolean
$name string
return boolean

__set() public method

Set meta value
public __set ( string $name, mixed $value )
$name string
$value mixed

fromPath() public static method

Create new File instance from path
public static fromPath ( string $path, array $meta = [] ) : static
$path string
$meta array
return static

getContent() public method

Return file content
public getContent ( ) : string
return string

getDescription() public method

Return automatic description Notice: getDescription use slow function shorten() in some cases
public getDescription ( ) : mixed
return mixed

getDir() public method

Return current directory
public getDir ( ) : string
return string

getMeta() public method

Return current file metadata
public getMeta ( array $meta = [] ) : array
$meta array
return array

getName() public method

Return name of file without extension
public getName ( ) : string
return string

getSlug() public method

Return link to file
public getSlug ( string | null $src = null ) : string
$src string | null
return string

getUrl() public method

public getUrl ( null | string $src = null ) : string
$src null | string
return string

is() public method

Check extension.
public is ( string $ext ) : boolean
$ext string
return boolean

isValid() public method

public isValid ( array $skip = [] ) : boolean
$skip array
return boolean

setContent() public method

Set file content
public setContent ( string $content )
$content string

Property Details

$children public property

public array $children
return array

$content protected property

protected string|null $content
return string | null

$meta protected property

protected array $meta
return array