PHP 클래스 Gc\Core\Object

파일 보기 프로젝트 열기: gotcms/gotcms 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$data array Object attributes
$origData array Original data
$underscoreCache array Setter/Getter underscore transformation cache

공개 메소드들

메소드 설명
__call ( string $method, array $args ) : mixed | Object Set/Get attribute wrapper
__construct ( ) Initialize constructor
__toArray ( array $array = [] ) : array Convert object attributes to array
addData ( array $array ) : Object Add data to the object.
getData ( string $key = '', string | integer $index = null ) : mixed Retrieves data from the object
getOrigData ( string $key = null ) : mixed Get Original data
hasData ( string $key = '' ) : boolean If $key is empty, checks whether there's any data in the object Otherwise checks if the specified attribute is set.
hasDataChangedFor ( string $field ) : boolean Check if data has changed
init ( ) : void Initialize data
offsetExists ( string $offset ) : boolean Implementation of ArrayAccess::offsetExists()
offsetGet ( string $offset ) : mixed Implementation of ArrayAccess::offsetGet()
offsetSet ( string $offset, mixed $value ) : void Implementation of ArrayAccess::offsetSet()
offsetUnset ( string $offset ) : void Implementation of ArrayAccess::offsetUnset()
setData ( string | array $key, mixed $value = null ) : Object Overwrite data in the object.
setOrigData ( string $key = null, mixed $data = null ) : Object Set Original data
toArray ( array $array = [] ) : array Public wrapper for __toArray
toJson ( array $array = [] ) : string Public wrapper for __toJson
toString ( string $format = '' ) : string Public wrapper for __toString
toXml ( array $array = [], string $rootName = 'item', boolean $addOpenTag = false, boolean $addCdata = true ) : string Public wrapper for __toXml
unsetData ( string $key = null ) : Object Unset data from the object.

보호된 메소드들

메소드 설명
__toJson ( array $array = [] ) : string Convert object attributes to JSON
__toXml ( array $array = [], string $rootName = 'item', boolean $addOpenTag = false, boolean $addCdata = true ) : string Convert object attributes to XML
setId ( integer $id = null ) : Object Set Id
underscore ( string $name ) : string Converts field names for setters and geters

메소드 상세

__call() 공개 메소드

Set/Get attribute wrapper
public __call ( string $method, array $args ) : mixed | Object
$method string Method
$args array Arguments
리턴 mixed | Object

__construct() 공개 메소드

Initialize constructor
public __construct ( )

__toArray() 공개 메소드

Convert object attributes to array
public __toArray ( array $array = [] ) : array
$array array array of required attributes
리턴 array

__toJson() 보호된 메소드

Convert object attributes to JSON
protected __toJson ( array $array = [] ) : string
$array array array of required attributes
리턴 string

__toXml() 보호된 메소드

Convert object attributes to XML
protected __toXml ( array $array = [], string $rootName = 'item', boolean $addOpenTag = false, boolean $addCdata = true ) : string
$array array Array of required attributes
$rootName string Name of the root element
$addOpenTag boolean Insert
$addCdata boolean Insert CDATA[]
리턴 string

addData() 공개 메소드

Retains previous data in the object.
public addData ( array $array ) : Object
$array array Data
리턴 Object

getData() 공개 메소드

If $key is empty will return all the data as an array Otherwise it will return value of the attribute specified by $key If $index is specified it will assume that attribute data is an array and retrieve corresponding member.
public getData ( string $key = '', string | integer $index = null ) : mixed
$key string key
$index string | integer Index
리턴 mixed

getOrigData() 공개 메소드

Get Original data
public getOrigData ( string $key = null ) : mixed
$key string Key
리턴 mixed

hasData() 공개 메소드

If $key is empty, checks whether there's any data in the object Otherwise checks if the specified attribute is set.
public hasData ( string $key = '' ) : boolean
$key string Key
리턴 boolean

hasDataChangedFor() 공개 메소드

Check if data has changed
public hasDataChangedFor ( string $field ) : boolean
$field string Field
리턴 boolean

init() 공개 메소드

Initialize data
public init ( ) : void
리턴 void

offsetExists() 공개 메소드

Implementation of ArrayAccess::offsetExists()
public offsetExists ( string $offset ) : boolean
$offset string Offset
리턴 boolean

offsetGet() 공개 메소드

Implementation of ArrayAccess::offsetGet()
public offsetGet ( string $offset ) : mixed
$offset string Offset
리턴 mixed

offsetSet() 공개 메소드

Implementation of ArrayAccess::offsetSet()
public offsetSet ( string $offset, mixed $value ) : void
$offset string Offset
$value mixed Value
리턴 void

offsetUnset() 공개 메소드

Implementation of ArrayAccess::offsetUnset()
public offsetUnset ( string $offset ) : void
$offset string Offset
리턴 void

setData() 공개 메소드

$key can be string or array. If $key is string, the attribute value will be overwritten by $value If $key is an array, it will overwrite all the data in the object.
public setData ( string | array $key, mixed $value = null ) : Object
$key string | array Key
$value mixed Value
리턴 Object

setId() 보호된 메소드

Set Id
protected setId ( integer $id = null ) : Object
$id integer Id
리턴 Object

setOrigData() 공개 메소드

Set Original data
public setOrigData ( string $key = null, mixed $data = null ) : Object
$key string Key
$data mixed Data
리턴 Object

toArray() 공개 메소드

Public wrapper for __toArray
public toArray ( array $array = [] ) : array
$array array Data
리턴 array

toJson() 공개 메소드

Public wrapper for __toJson
public toJson ( array $array = [] ) : string
$array array Data
리턴 string

toString() 공개 메소드

Will use $format as an template and substitute {{key}} for attributes
public toString ( string $format = '' ) : string
$format string Format
리턴 string

toXml() 공개 메소드

Public wrapper for __toXml
public toXml ( array $array = [], string $rootName = 'item', boolean $addOpenTag = false, boolean $addCdata = true ) : string
$array array Data
$rootName string Root name
$addOpenTag boolean Insert
$addCdata boolean Insert CDATA[]
리턴 string

underscore() 보호된 메소드

$this->setMyField($value) === $this->setData('my_field', $value) Uses cache to eliminate unneccessary preg_replace
protected underscore ( string $name ) : string
$name string Name
리턴 string

unsetData() 공개 메소드

$key can be a string only. Array will be ignored.
public unsetData ( string $key = null ) : Object
$key string Key
리턴 Object

프로퍼티 상세

$data 보호되어 있는 프로퍼티

Object attributes
protected array $data
리턴 array

$origData 보호되어 있는 프로퍼티

Original data
protected array $origData
리턴 array

$underscoreCache 보호되어 있는 정적으로 프로퍼티

Setter/Getter underscore transformation cache
protected static array $underscoreCache
리턴 array