PHP Class DbPatch_Command_Patch_Abstract

Author: Sandy Pleyte
Author: Martijn De Letter
Author: Rudi de Vries
Datei anzeigen Open project: dbpatch/dbpatch

Protected Properties

Property Type Description
$config null | DbPatch_Core_Config
$data array
$db null | Zend_Db_Adapter_Abstract
$writer null | DbPatch_Core_Writer

Public Methods

Method Description
__construct ( array $values = null ) : void Creates a new value object
__get ( string $name ) : mixed Returns the value requested.
__isset ( string $name ) : boolean Check if a value isset
__set ( string $name, mixed $value ) Sets the value provided.
apply ( ) : void
getConfig ( ) : DbPatch_Core_Config | null
getContents ( ) : string
getDb ( ) : null | DbPatch_Core_Db
getFields ( ) : array Returns the field names of the data array.
getHash ( ) : string Retrieve a file hash
getType ( ) : void
getWriter ( ) : DbPatch_Core_Writer | null
loadFromArray ( array $values ) : void Load the values from an array provided.
setConfig ( DbPatch_Core_Config $config ) : DbPatch_Command_Patch_Abstract
setDb ( DbPatch_Core_Db $db ) : DbPatch_Command_Patch_Abstract
setWriter ( DbPatch_Core_Writer $writer ) : DbPatch_Command_Patch_Abstract
show ( ) : void Echo contents of the patch
toArray ( ) : array Returns the objects values as an array.

Protected Methods

Method Description
fileExists ( string $filename ) : boolean
from_camel_case ( string $str ) : string Translates a camel case string into a string with underscores (e.g. firstName -> first_name)
getComment ( integer $lineNumber ) : string Extract the first line of comment out of a patch file
getPatchFilename ( string $patchPrefix, string $extension, integer $patchNumberSize = 4 ) : string
getPatchNumberSize ( string $patchDirectory ) : integer
to_camel_case ( string $str, boolean $capitalise_first_char = false ) : string Translates a string with underscores into camel case (e.g. first_name -> firstName)
writeFile ( string $filename, string $content ) : void Create empty patch

Method Details

__construct() public method

Creates a new value object
public __construct ( array $values = null ) : void
$values array the values to fill the value object with. If left empty we're creating an empty value object.
return void

__get() public method

Returns the value requested.
public __get ( string $name ) : mixed
$name string the name of the property
return mixed the value

__isset() public method

Check if a value isset
public __isset ( string $name ) : boolean
$name string Name of the property
return boolean

__set() public method

Sets the value provided.
public __set ( string $name, mixed $value )
$name string name of the property
$value mixed the value

apply() abstract public method

abstract public apply ( ) : void
return void

fileExists() protected method

protected fileExists ( string $filename ) : boolean
$filename string
return boolean

from_camel_case() protected method

Translates a camel case string into a string with underscores (e.g. firstName -> first_name)
protected from_camel_case ( string $str ) : string
$str string String in camel case format
return string $str Translated into underscore format

getComment() protected method

Extract the first line of comment out of a patch file
protected getComment ( integer $lineNumber ) : string
$lineNumber integer Line number where the comment is
return string

getConfig() public method

public getConfig ( ) : DbPatch_Core_Config | null
return DbPatch_Core_Config | null

getContents() abstract public method

abstract public getContents ( ) : string
return string

getDb() public method

public getDb ( ) : null | DbPatch_Core_Db
return null | DbPatch_Core_Db

getFields() public method

Returns the field names of the data array.
public getFields ( ) : array
return array

getHash() public method

Retrieve a file hash
public getHash ( ) : string
return string

getPatchFilename() protected method

protected getPatchFilename ( string $patchPrefix, string $extension, integer $patchNumberSize = 4 ) : string
$patchPrefix string
$extension string
$patchNumberSize integer
return string

getPatchNumberSize() protected method

protected getPatchNumberSize ( string $patchDirectory ) : integer
$patchDirectory string
return integer

getType() abstract public method

abstract public getType ( ) : void
return void

getWriter() public method

public getWriter ( ) : DbPatch_Core_Writer | null
return DbPatch_Core_Writer | null

loadFromArray() public method

Load the values from an array provided.
public loadFromArray ( array $values ) : void
$values array the values we're using to set the values in the value object
return void

setConfig() public method

public setConfig ( DbPatch_Core_Config $config ) : DbPatch_Command_Patch_Abstract
$config DbPatch_Core_Config
return DbPatch_Command_Patch_Abstract

setDb() public method

public setDb ( DbPatch_Core_Db $db ) : DbPatch_Command_Patch_Abstract
$db DbPatch_Core_Db
return DbPatch_Command_Patch_Abstract

setWriter() public method

public setWriter ( DbPatch_Core_Writer $writer ) : DbPatch_Command_Patch_Abstract
$writer DbPatch_Core_Writer
return DbPatch_Command_Patch_Abstract

show() public method

Echo contents of the patch
public show ( ) : void
return void

toArray() public method

Returns the objects values as an array.
public toArray ( ) : array
return array

to_camel_case() protected method

Translates a string with underscores into camel case (e.g. first_name -> firstName)
protected to_camel_case ( string $str, boolean $capitalise_first_char = false ) : string
$str string String in underscore format
$capitalise_first_char boolean If true, capitalise the first char in $str
return string $str translated into camel caps

writeFile() protected method

Create empty patch
protected writeFile ( string $filename, string $content ) : void
$filename string
$content string
return void

Property Details

$config protected_oe property

protected null|DbPatch_Core_Config $config
return null | DbPatch_Core_Config

$data protected_oe property

protected array $data
return array

$db protected_oe property

protected null|Zend_Db_Adapter_Abstract $db
return null | Zend_Db_Adapter_Abstract

$writer protected_oe property

protected null|DbPatch_Core_Writer $writer
return null | DbPatch_Core_Writer