id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
37,000
CeusMedia/Common
src/FS/Folder/Reader.php
FS_Folder_Reader.getNestedFileCount
public function getNestedFileCount( $pattern = NULL ) { $count = 0; foreach( $this->getNestedFileList( $pattern ) as $entry ) $count++; return $count; }
php
public function getNestedFileCount( $pattern = NULL ) { $count = 0; foreach( $this->getNestedFileList( $pattern ) as $entry ) $count++; return $count; }
[ "public", "function", "getNestedFileCount", "(", "$", "pattern", "=", "NULL", ")", "{", "$", "count", "=", "0", ";", "foreach", "(", "$", "this", "->", "getNestedFileList", "(", "$", "pattern", ")", "as", "$", "entry", ")", "$", "count", "++", ";", "return", "$", "count", ";", "}" ]
Returns Number of all nested Files within current Folder. @access public @param string $pattern RegEx Pattern for Name Filter @return int
[ "Returns", "Number", "of", "all", "nested", "Files", "within", "current", "Folder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Reader.php#L210-L216
37,001
CeusMedia/Common
src/FS/Folder/Reader.php
FS_Folder_Reader.getNestedFolderCount
public function getNestedFolderCount( $pattern = NULL ) { $count = 0; foreach( $this->getNestedFolderList( $pattern ) as $entry ) $count++; return $count; }
php
public function getNestedFolderCount( $pattern = NULL ) { $count = 0; foreach( $this->getNestedFolderList( $pattern ) as $entry ) $count++; return $count; }
[ "public", "function", "getNestedFolderCount", "(", "$", "pattern", "=", "NULL", ")", "{", "$", "count", "=", "0", ";", "foreach", "(", "$", "this", "->", "getNestedFolderList", "(", "$", "pattern", ")", "as", "$", "entry", ")", "$", "count", "++", ";", "return", "$", "count", ";", "}" ]
Returns Number of all nested Folders within current Folder. @access public @param string $pattern RegEx Pattern for Name Filter @return int
[ "Returns", "Number", "of", "all", "nested", "Folders", "within", "current", "Folder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Reader.php#L235-L241
37,002
CeusMedia/Common
src/FS/Folder/Reader.php
FS_Folder_Reader.getNestedSize
public function getNestedSize( $pattern = NULL, $unit = NULL, $precision = NULL ) { $size = 0; foreach( $this->getNestedFileList( $pattern ) as $entry ) $size += $entry->getSize(); if( $unit ) $size = Alg_UnitFormater::formatNumber( $size, $unit, $precision ); return $size; }
php
public function getNestedSize( $pattern = NULL, $unit = NULL, $precision = NULL ) { $size = 0; foreach( $this->getNestedFileList( $pattern ) as $entry ) $size += $entry->getSize(); if( $unit ) $size = Alg_UnitFormater::formatNumber( $size, $unit, $precision ); return $size; }
[ "public", "function", "getNestedSize", "(", "$", "pattern", "=", "NULL", ",", "$", "unit", "=", "NULL", ",", "$", "precision", "=", "NULL", ")", "{", "$", "size", "=", "0", ";", "foreach", "(", "$", "this", "->", "getNestedFileList", "(", "$", "pattern", ")", "as", "$", "entry", ")", "$", "size", "+=", "$", "entry", "->", "getSize", "(", ")", ";", "if", "(", "$", "unit", ")", "$", "size", "=", "Alg_UnitFormater", "::", "formatNumber", "(", "$", "size", ",", "$", "unit", ",", "$", "precision", ")", ";", "return", "$", "size", ";", "}" ]
Returns Size of all nested Files and Folders within current Folder. @access public @param string $pattern RegEx Pattern for Name Filter @param int $unit Unit (SIZE_BYTE|SIZE_KILOBYTE|SIZE_MEGABYTE|SIZE_GIGABYTE) @param int $precision Precision of rounded Size (only if unit is set) @return int
[ "Returns", "Size", "of", "all", "nested", "Files", "and", "Folders", "within", "current", "Folder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Reader.php#L273-L281
37,003
CeusMedia/Common
src/FS/Folder/Reader.php
FS_Folder_Reader.getRealPath
public function getRealPath() { $path = realpath( $this->folderName ); if( FALSE === $path ) throw new RuntimeException( 'Folder "'.$this->folderName.'" is not existing and therefore has no Path' ); return dirname( $path )."/"; }
php
public function getRealPath() { $path = realpath( $this->folderName ); if( FALSE === $path ) throw new RuntimeException( 'Folder "'.$this->folderName.'" is not existing and therefore has no Path' ); return dirname( $path )."/"; }
[ "public", "function", "getRealPath", "(", ")", "{", "$", "path", "=", "realpath", "(", "$", "this", "->", "folderName", ")", ";", "if", "(", "FALSE", "===", "$", "path", ")", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "this", "->", "folderName", ".", "'\" is not existing and therefore has no Path'", ")", ";", "return", "dirname", "(", "$", "path", ")", ".", "\"/\"", ";", "}" ]
Returns absolute Path to Folder. @access public @return string
[ "Returns", "absolute", "Path", "to", "Folder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Reader.php#L298-L304
37,004
CeusMedia/Common
src/FS/Folder/Reader.php
FS_Folder_Reader.getSize
public function getSize( $pattern = NULL, $unit = NULL, $precision = NULL ) { $size = 0; foreach( $this->getFileList( $pattern ) as $entry ) $size += $entry->getSize(); if( $unit ) $size = Alg_UnitFormater::formatBytes( $size, $precision ); return $size; }
php
public function getSize( $pattern = NULL, $unit = NULL, $precision = NULL ) { $size = 0; foreach( $this->getFileList( $pattern ) as $entry ) $size += $entry->getSize(); if( $unit ) $size = Alg_UnitFormater::formatBytes( $size, $precision ); return $size; }
[ "public", "function", "getSize", "(", "$", "pattern", "=", "NULL", ",", "$", "unit", "=", "NULL", ",", "$", "precision", "=", "NULL", ")", "{", "$", "size", "=", "0", ";", "foreach", "(", "$", "this", "->", "getFileList", "(", "$", "pattern", ")", "as", "$", "entry", ")", "$", "size", "+=", "$", "entry", "->", "getSize", "(", ")", ";", "if", "(", "$", "unit", ")", "$", "size", "=", "Alg_UnitFormater", "::", "formatBytes", "(", "$", "size", ",", "$", "precision", ")", ";", "return", "$", "size", ";", "}" ]
Returns Size of Files within current Folder. @access public @param string $pattern RegEx Pattern for Name Filter @param int $unit Unit (SIZE_BYTE|SIZE_KILOBYTE|SIZE_MEGABYTE|SIZE_GIGABYTE) @param int $precision Precision of rounded Size (only if unit is set) @return int
[ "Returns", "Size", "of", "Files", "within", "current", "Folder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Reader.php#L314-L322
37,005
CeusMedia/Common
src/FS/Folder/Reader.php
FS_Folder_Reader.isFolder
public static function isFolder( $path ) { $exists = file_exists( $path ); $isDir = is_dir( $path ); return $exists && $isDir; }
php
public static function isFolder( $path ) { $exists = file_exists( $path ); $isDir = is_dir( $path ); return $exists && $isDir; }
[ "public", "static", "function", "isFolder", "(", "$", "path", ")", "{", "$", "exists", "=", "file_exists", "(", "$", "path", ")", ";", "$", "isDir", "=", "is_dir", "(", "$", "path", ")", ";", "return", "$", "exists", "&&", "$", "isDir", ";", "}" ]
Indicates whether a Path is an existing Folder. @access public @static @param string $path Path to check @return bool
[ "Indicates", "whether", "a", "Path", "is", "an", "existing", "Folder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Reader.php#L331-L336
37,006
FriendsOfSilverStripe/backendmessages
src/WarningMessage.php
WarningMessage.create
public static function create($message, $name = null) { return Message::generic($message, self::$CSSClass, $name); }
php
public static function create($message, $name = null) { return Message::generic($message, self::$CSSClass, $name); }
[ "public", "static", "function", "create", "(", "$", "message", ",", "$", "name", "=", "null", ")", "{", "return", "Message", "::", "generic", "(", "$", "message", ",", "self", "::", "$", "CSSClass", ",", "$", "name", ")", ";", "}" ]
creates a message box. @param string $message @param string $name (optional) @return MessageBoxField
[ "creates", "a", "message", "box", "." ]
6733fd84162fb2b722dcc31ece01f5b36f2f84a4
https://github.com/FriendsOfSilverStripe/backendmessages/blob/6733fd84162fb2b722dcc31ece01f5b36f2f84a4/src/WarningMessage.php#L38-L41
37,007
ethical-jobs/laravel-foundation
src/Laravel/ResponseCacheServiceProvider.php
ResponseCacheServiceProvider.extendConfig
protected function extendConfig() { $source = realpath(__DIR__ . '/../../config/responsecache.php'); $config = $this->app['config']->get('responsecache', []); $this->app['config']->set('responsecache', array_merge($config, require $source)); }
php
protected function extendConfig() { $source = realpath(__DIR__ . '/../../config/responsecache.php'); $config = $this->app['config']->get('responsecache', []); $this->app['config']->set('responsecache', array_merge($config, require $source)); }
[ "protected", "function", "extendConfig", "(", ")", "{", "$", "source", "=", "realpath", "(", "__DIR__", ".", "'/../../config/responsecache.php'", ")", ";", "$", "config", "=", "$", "this", "->", "app", "[", "'config'", "]", "->", "get", "(", "'responsecache'", ",", "[", "]", ")", ";", "$", "this", "->", "app", "[", "'config'", "]", "->", "set", "(", "'responsecache'", ",", "array_merge", "(", "$", "config", ",", "require", "$", "source", ")", ")", ";", "}" ]
Override response cache config @return void
[ "Override", "response", "cache", "config" ]
5f1d3bc45cf6fef149b583e2590fae76dd0df7c3
https://github.com/ethical-jobs/laravel-foundation/blob/5f1d3bc45cf6fef149b583e2590fae76dd0df7c3/src/Laravel/ResponseCacheServiceProvider.php#L40-L47
37,008
CeusMedia/Common
src/Alg/Math/Algebra/Vector.php
Alg_Math_Algebra_Vector.addValue
public function addValue( $value ) { $value = is_int( $value ) ? $value : (float) $value; $this->values[] = $value; $this->dimension++; }
php
public function addValue( $value ) { $value = is_int( $value ) ? $value : (float) $value; $this->values[] = $value; $this->dimension++; }
[ "public", "function", "addValue", "(", "$", "value", ")", "{", "$", "value", "=", "is_int", "(", "$", "value", ")", "?", "$", "value", ":", "(", "float", ")", "$", "value", ";", "$", "this", "->", "values", "[", "]", "=", "$", "value", ";", "$", "this", "->", "dimension", "++", ";", "}" ]
Adds a Value to Vector and increases Dimension @access public @param mixed $value Value to add @return void
[ "Adds", "a", "Value", "to", "Vector", "and", "increases", "Dimension" ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Algebra/Vector.php#L86-L91
37,009
CeusMedia/Common
src/Alg/Math/Algebra/Vector.php
Alg_Math_Algebra_Vector.getValueFromIndex
public function getValueFromIndex( $index ) { $dimension = $this->getDimension(); if( $index < 0 ) throw new OutOfRangeException( 'Vector Index ('.$index.') must be greater than 0.' ); if( $index >= $dimension ) throw new OutOfRangeException( 'Vector Index ('.$index.') must be lower than Vector Dimension ('.$dimension.').' ); return $this->values[$index]; }
php
public function getValueFromIndex( $index ) { $dimension = $this->getDimension(); if( $index < 0 ) throw new OutOfRangeException( 'Vector Index ('.$index.') must be greater than 0.' ); if( $index >= $dimension ) throw new OutOfRangeException( 'Vector Index ('.$index.') must be lower than Vector Dimension ('.$dimension.').' ); return $this->values[$index]; }
[ "public", "function", "getValueFromIndex", "(", "$", "index", ")", "{", "$", "dimension", "=", "$", "this", "->", "getDimension", "(", ")", ";", "if", "(", "$", "index", "<", "0", ")", "throw", "new", "OutOfRangeException", "(", "'Vector Index ('", ".", "$", "index", ".", "') must be greater than 0.'", ")", ";", "if", "(", "$", "index", ">=", "$", "dimension", ")", "throw", "new", "OutOfRangeException", "(", "'Vector Index ('", ".", "$", "index", ".", "') must be lower than Vector Dimension ('", ".", "$", "dimension", ".", "').'", ")", ";", "return", "$", "this", "->", "values", "[", "$", "index", "]", ";", "}" ]
Returns the value of a dimension starting with 0. @access public @param int $index Dimension starting with 0 @return mixed
[ "Returns", "the", "value", "of", "a", "dimension", "starting", "with", "0", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Algebra/Vector.php#L120-L128
37,010
graze/monolog-extensions
src/Graze/Monolog/Handler/WhoopsHandler.php
WhoopsHandler.writeError
protected function writeError(array $record) { $exception = new WhoopsErrorException( $record['message'], $record['level'], 0, $record['context']['file'], $record['context']['line'] ); $this->writeException($exception); }
php
protected function writeError(array $record) { $exception = new WhoopsErrorException( $record['message'], $record['level'], 0, $record['context']['file'], $record['context']['line'] ); $this->writeException($exception); }
[ "protected", "function", "writeError", "(", "array", "$", "record", ")", "{", "$", "exception", "=", "new", "WhoopsErrorException", "(", "$", "record", "[", "'message'", "]", ",", "$", "record", "[", "'level'", "]", ",", "0", ",", "$", "record", "[", "'context'", "]", "[", "'file'", "]", ",", "$", "record", "[", "'context'", "]", "[", "'line'", "]", ")", ";", "$", "this", "->", "writeException", "(", "$", "exception", ")", ";", "}" ]
Whoops only deals with Exceptions. Create a WhoopsErrorException based on the error details and handle that @param array $record
[ "Whoops", "only", "deals", "with", "Exceptions", ".", "Create", "a", "WhoopsErrorException", "based", "on", "the", "error", "details", "and", "handle", "that" ]
91cc36ec690cdeba1c25c2f2c7c832b2974f5db1
https://github.com/graze/monolog-extensions/blob/91cc36ec690cdeba1c25c2f2c7c832b2974f5db1/src/Graze/Monolog/Handler/WhoopsHandler.php#L67-L78
37,011
CeusMedia/Common
src/UI/Image.php
UI_Image.create
public function create( $width, $height, $trueColor = TRUE, $alpha = 0 ) { $resource = $trueColor ? imagecreatetruecolor( $width, $height ) : imagecreate( $width, $height ); $this->type = $trueColor ? IMAGETYPE_PNG : IMAGETYPE_GIF; $this->setResource( $resource, $alpha ); }
php
public function create( $width, $height, $trueColor = TRUE, $alpha = 0 ) { $resource = $trueColor ? imagecreatetruecolor( $width, $height ) : imagecreate( $width, $height ); $this->type = $trueColor ? IMAGETYPE_PNG : IMAGETYPE_GIF; $this->setResource( $resource, $alpha ); }
[ "public", "function", "create", "(", "$", "width", ",", "$", "height", ",", "$", "trueColor", "=", "TRUE", ",", "$", "alpha", "=", "0", ")", "{", "$", "resource", "=", "$", "trueColor", "?", "imagecreatetruecolor", "(", "$", "width", ",", "$", "height", ")", ":", "imagecreate", "(", "$", "width", ",", "$", "height", ")", ";", "$", "this", "->", "type", "=", "$", "trueColor", "?", "IMAGETYPE_PNG", ":", "IMAGETYPE_GIF", ";", "$", "this", "->", "setResource", "(", "$", "resource", ",", "$", "alpha", ")", ";", "}" ]
Creates a new image resource. @access public @param integer $width Width of image @param integer $height Height of image @param boolean $trueColor Flag: create an TrueColor Image (24-bit depth and without fixed palette) @param double $alpha Alpha channel value (0-100) @return void @todo is alpha needed ?
[ "Creates", "a", "new", "image", "resource", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image.php#L87-L92
37,012
CeusMedia/Common
src/UI/Image.php
UI_Image.display
public function display( $sendContentType = TRUE ) { if( $sendContentType ) header( 'Content-type: '.$this->getMimeType() ); switch( $this->getType() ) { case IMAGETYPE_GIF: imagegif( $this->resource ); break; case IMAGETYPE_JPEG: imagejpeg( $this->resource, NULL, $this->quality ); break; case IMAGETYPE_PNG: imagepng( $this->resource ); break; default: header_remove( 'Content-type' ); new UI_Image_Error( 'invalid type' ); } }
php
public function display( $sendContentType = TRUE ) { if( $sendContentType ) header( 'Content-type: '.$this->getMimeType() ); switch( $this->getType() ) { case IMAGETYPE_GIF: imagegif( $this->resource ); break; case IMAGETYPE_JPEG: imagejpeg( $this->resource, NULL, $this->quality ); break; case IMAGETYPE_PNG: imagepng( $this->resource ); break; default: header_remove( 'Content-type' ); new UI_Image_Error( 'invalid type' ); } }
[ "public", "function", "display", "(", "$", "sendContentType", "=", "TRUE", ")", "{", "if", "(", "$", "sendContentType", ")", "header", "(", "'Content-type: '", ".", "$", "this", "->", "getMimeType", "(", ")", ")", ";", "switch", "(", "$", "this", "->", "getType", "(", ")", ")", "{", "case", "IMAGETYPE_GIF", ":", "imagegif", "(", "$", "this", "->", "resource", ")", ";", "break", ";", "case", "IMAGETYPE_JPEG", ":", "imagejpeg", "(", "$", "this", "->", "resource", ",", "NULL", ",", "$", "this", "->", "quality", ")", ";", "break", ";", "case", "IMAGETYPE_PNG", ":", "imagepng", "(", "$", "this", "->", "resource", ")", ";", "break", ";", "default", ":", "header_remove", "(", "'Content-type'", ")", ";", "new", "UI_Image_Error", "(", "'invalid type'", ")", ";", "}", "}" ]
Print binary content to standard output. @access public @param boolean $sendContentType Flag: send HTTP header for image type beforehand, default: yes @return void
[ "Print", "binary", "content", "to", "standard", "output", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image.php#L100-L119
37,013
CeusMedia/Common
src/UI/Image.php
UI_Image.isAnimated
public static function isAnimated( $filePath ){ $content = file_get_contents( $filePath ); $pos1 = 0; $count = 0; while( $count < 2 ) # There is no point in continuing after we find a 2nd frame { $pos1 = strpos( $content, "\x00\x21\xF9\x04", $pos1 ); if( $pos1 === FALSE ) break; $pos2 = strpos( $content, "\x00\x2C", $pos1 ); if( $pos2 === FALSE ) break; else if( $pos1 + 8 == $pos2 ) $count++; $pos1 = $pos2; } return $count > 1; }
php
public static function isAnimated( $filePath ){ $content = file_get_contents( $filePath ); $pos1 = 0; $count = 0; while( $count < 2 ) # There is no point in continuing after we find a 2nd frame { $pos1 = strpos( $content, "\x00\x21\xF9\x04", $pos1 ); if( $pos1 === FALSE ) break; $pos2 = strpos( $content, "\x00\x2C", $pos1 ); if( $pos2 === FALSE ) break; else if( $pos1 + 8 == $pos2 ) $count++; $pos1 = $pos2; } return $count > 1; }
[ "public", "static", "function", "isAnimated", "(", "$", "filePath", ")", "{", "$", "content", "=", "file_get_contents", "(", "$", "filePath", ")", ";", "$", "pos1", "=", "0", ";", "$", "count", "=", "0", ";", "while", "(", "$", "count", "<", "2", ")", "# There is no point in continuing after we find a 2nd frame", "{", "$", "pos1", "=", "strpos", "(", "$", "content", ",", "\"\\x00\\x21\\xF9\\x04\"", ",", "$", "pos1", ")", ";", "if", "(", "$", "pos1", "===", "FALSE", ")", "break", ";", "$", "pos2", "=", "strpos", "(", "$", "content", ",", "\"\\x00\\x2C\"", ",", "$", "pos1", ")", ";", "if", "(", "$", "pos2", "===", "FALSE", ")", "break", ";", "else", "if", "(", "$", "pos1", "+", "8", "==", "$", "pos2", ")", "$", "count", "++", ";", "$", "pos1", "=", "$", "pos2", ";", "}", "return", "$", "count", ">", "1", ";", "}" ]
Indicates whether an Image File is an animated GIF. @access public @static @param string $filePath Path Name of Image File @return boolean TRUE if Image File is an animated GIF
[ "Indicates", "whether", "an", "Image", "File", "is", "an", "animated", "GIF", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image.php#L203-L220
37,014
CeusMedia/Common
src/UI/Image.php
UI_Image.load
public function load( $fileName, $tolerateAnimatedGif = FALSE ) { if( !file_exists( $fileName ) ) throw new RuntimeException( 'Image "'.$fileName.'" is not existing' ); if( !is_readable( $fileName ) ) throw new RuntimeException( 'Image "'.$fileName.'" is not readable' ); $info = getimagesize( $fileName ); if( !$info ) throw new Exception( 'Image "'.$fileName.'" is not of a supported type' ); if( !$tolerateAnimatedGif && self::isAnimated( $fileName ) ) throw new RuntimeException( 'Animated GIFs are not supported' ); if( $this->resource ) imagedestroy( $this->resource ); $this->type = $info[2]; switch( $this->type ) { case IMAGETYPE_GIF: $resource = imagecreatefromgif( $fileName ); break; case IMAGETYPE_JPEG: $resource = imagecreatefromjpeg( $fileName ); break; case IMAGETYPE_PNG: $resource = imagecreatefrompng( $fileName ); break; default: throw new Exception( 'Image type "'.$info['mime'].'" is no supported, detected '.$info[2] ); } $this->fileName = $fileName; $this->setResource( $resource ); }
php
public function load( $fileName, $tolerateAnimatedGif = FALSE ) { if( !file_exists( $fileName ) ) throw new RuntimeException( 'Image "'.$fileName.'" is not existing' ); if( !is_readable( $fileName ) ) throw new RuntimeException( 'Image "'.$fileName.'" is not readable' ); $info = getimagesize( $fileName ); if( !$info ) throw new Exception( 'Image "'.$fileName.'" is not of a supported type' ); if( !$tolerateAnimatedGif && self::isAnimated( $fileName ) ) throw new RuntimeException( 'Animated GIFs are not supported' ); if( $this->resource ) imagedestroy( $this->resource ); $this->type = $info[2]; switch( $this->type ) { case IMAGETYPE_GIF: $resource = imagecreatefromgif( $fileName ); break; case IMAGETYPE_JPEG: $resource = imagecreatefromjpeg( $fileName ); break; case IMAGETYPE_PNG: $resource = imagecreatefrompng( $fileName ); break; default: throw new Exception( 'Image type "'.$info['mime'].'" is no supported, detected '.$info[2] ); } $this->fileName = $fileName; $this->setResource( $resource ); }
[ "public", "function", "load", "(", "$", "fileName", ",", "$", "tolerateAnimatedGif", "=", "FALSE", ")", "{", "if", "(", "!", "file_exists", "(", "$", "fileName", ")", ")", "throw", "new", "RuntimeException", "(", "'Image \"'", ".", "$", "fileName", ".", "'\" is not existing'", ")", ";", "if", "(", "!", "is_readable", "(", "$", "fileName", ")", ")", "throw", "new", "RuntimeException", "(", "'Image \"'", ".", "$", "fileName", ".", "'\" is not readable'", ")", ";", "$", "info", "=", "getimagesize", "(", "$", "fileName", ")", ";", "if", "(", "!", "$", "info", ")", "throw", "new", "Exception", "(", "'Image \"'", ".", "$", "fileName", ".", "'\" is not of a supported type'", ")", ";", "if", "(", "!", "$", "tolerateAnimatedGif", "&&", "self", "::", "isAnimated", "(", "$", "fileName", ")", ")", "throw", "new", "RuntimeException", "(", "'Animated GIFs are not supported'", ")", ";", "if", "(", "$", "this", "->", "resource", ")", "imagedestroy", "(", "$", "this", "->", "resource", ")", ";", "$", "this", "->", "type", "=", "$", "info", "[", "2", "]", ";", "switch", "(", "$", "this", "->", "type", ")", "{", "case", "IMAGETYPE_GIF", ":", "$", "resource", "=", "imagecreatefromgif", "(", "$", "fileName", ")", ";", "break", ";", "case", "IMAGETYPE_JPEG", ":", "$", "resource", "=", "imagecreatefromjpeg", "(", "$", "fileName", ")", ";", "break", ";", "case", "IMAGETYPE_PNG", ":", "$", "resource", "=", "imagecreatefrompng", "(", "$", "fileName", ")", ";", "break", ";", "default", ":", "throw", "new", "Exception", "(", "'Image type \"'", ".", "$", "info", "[", "'mime'", "]", ".", "'\" is no supported, detected '", ".", "$", "info", "[", "2", "]", ")", ";", "}", "$", "this", "->", "fileName", "=", "$", "fileName", ";", "$", "this", "->", "setResource", "(", "$", "resource", ")", ";", "}" ]
Reads an image from file, supporting several file types. @access public @param string $fileName Name of image file @return void @throws RuntimeException if file is not existing @throws RuntimeException if file is not readable @throws RuntimeException if file is not a image @throws Exception if detected image type is not supported @throws Exception if image type is not supported for reading
[ "Reads", "an", "image", "from", "file", "supporting", "several", "file", "types", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image.php#L233-L263
37,015
CeusMedia/Common
src/UI/Image.php
UI_Image.save
public function save( $fileName = NULL, $type = NULL ) { if( !$type ) $type = $this->type; if( !$fileName ) $fileName = $this->fileName; if( !$fileName ) throw new RuntimeException( 'No image file name set' ); switch( $type ) { case IMAGETYPE_GIF: return imagegif( $this->resource, $fileName ); case IMAGETYPE_JPEG: return imagejpeg( $this->resource, $fileName, $this->quality ); case IMAGETYPE_PNG: return imagepng( $this->resource, $fileName ); default: throw new Exception( 'Image type "'.$type.'" is no supported' ); } if( $fileName === $this->fileName ) // if saved to same file $this->load( $this->fileName ); // reload image }
php
public function save( $fileName = NULL, $type = NULL ) { if( !$type ) $type = $this->type; if( !$fileName ) $fileName = $this->fileName; if( !$fileName ) throw new RuntimeException( 'No image file name set' ); switch( $type ) { case IMAGETYPE_GIF: return imagegif( $this->resource, $fileName ); case IMAGETYPE_JPEG: return imagejpeg( $this->resource, $fileName, $this->quality ); case IMAGETYPE_PNG: return imagepng( $this->resource, $fileName ); default: throw new Exception( 'Image type "'.$type.'" is no supported' ); } if( $fileName === $this->fileName ) // if saved to same file $this->load( $this->fileName ); // reload image }
[ "public", "function", "save", "(", "$", "fileName", "=", "NULL", ",", "$", "type", "=", "NULL", ")", "{", "if", "(", "!", "$", "type", ")", "$", "type", "=", "$", "this", "->", "type", ";", "if", "(", "!", "$", "fileName", ")", "$", "fileName", "=", "$", "this", "->", "fileName", ";", "if", "(", "!", "$", "fileName", ")", "throw", "new", "RuntimeException", "(", "'No image file name set'", ")", ";", "switch", "(", "$", "type", ")", "{", "case", "IMAGETYPE_GIF", ":", "return", "imagegif", "(", "$", "this", "->", "resource", ",", "$", "fileName", ")", ";", "case", "IMAGETYPE_JPEG", ":", "return", "imagejpeg", "(", "$", "this", "->", "resource", ",", "$", "fileName", ",", "$", "this", "->", "quality", ")", ";", "case", "IMAGETYPE_PNG", ":", "return", "imagepng", "(", "$", "this", "->", "resource", ",", "$", "fileName", ")", ";", "default", ":", "throw", "new", "Exception", "(", "'Image type \"'", ".", "$", "type", ".", "'\" is no supported'", ")", ";", "}", "if", "(", "$", "fileName", "===", "$", "this", "->", "fileName", ")", "// if saved to same file", "$", "this", "->", "load", "(", "$", "this", "->", "fileName", ")", ";", "// reload image", "}" ]
Writes an image to file. @access public @param string $fileName Name of new image file @param integer $type Type of image (IMAGETYPE_GIF|IMAGETYPE_JPEG|IMAGETYPE_PNG) @return boolean @throws RuntimeException if neither file has been loaded before nor a file name is given @throws Exception if image type is not supported for writing
[ "Writes", "an", "image", "to", "file", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image.php#L285-L306
37,016
CeusMedia/Common
src/UI/Image.php
UI_Image.setResource
public function setResource( $resource ) { if( !is_resource( $resource ) ) throw new InvalidArgumentException( 'Must be a valid image resource' ); if( $this->resource ) imagedestroy( $this->resource ); $this->resource = $resource; $this->width = imagesx( $resource ); $this->height = imagesy( $resource ); if( function_exists( 'imageantialias' ) ) imageantialias( $this->resource, TRUE ); imagealphablending( $this->resource, FALSE ); // disable alpha blending in favour to imagesavealpha( $this->resource, TRUE ); // copying the complete alpha channel }
php
public function setResource( $resource ) { if( !is_resource( $resource ) ) throw new InvalidArgumentException( 'Must be a valid image resource' ); if( $this->resource ) imagedestroy( $this->resource ); $this->resource = $resource; $this->width = imagesx( $resource ); $this->height = imagesy( $resource ); if( function_exists( 'imageantialias' ) ) imageantialias( $this->resource, TRUE ); imagealphablending( $this->resource, FALSE ); // disable alpha blending in favour to imagesavealpha( $this->resource, TRUE ); // copying the complete alpha channel }
[ "public", "function", "setResource", "(", "$", "resource", ")", "{", "if", "(", "!", "is_resource", "(", "$", "resource", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Must be a valid image resource'", ")", ";", "if", "(", "$", "this", "->", "resource", ")", "imagedestroy", "(", "$", "this", "->", "resource", ")", ";", "$", "this", "->", "resource", "=", "$", "resource", ";", "$", "this", "->", "width", "=", "imagesx", "(", "$", "resource", ")", ";", "$", "this", "->", "height", "=", "imagesy", "(", "$", "resource", ")", ";", "if", "(", "function_exists", "(", "'imageantialias'", ")", ")", "imageantialias", "(", "$", "this", "->", "resource", ",", "TRUE", ")", ";", "imagealphablending", "(", "$", "this", "->", "resource", ",", "FALSE", ")", ";", "// disable alpha blending in favour to", "imagesavealpha", "(", "$", "this", "->", "resource", ",", "TRUE", ")", ";", "// copying the complete alpha channel", "}" ]
Binds image resource to this image object. @access public @param resource $resource Image resource @return void
[ "Binds", "image", "resource", "to", "this", "image", "object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image.php#L318-L334
37,017
CeusMedia/Common
src/Net/API/Google/Code/PostCommit.php
Net_API_Google_Code_PostCommit.receiveData
public function receiveData( Net_HTTP_Request_Receiver $request) { $data = $request->getRawPostData(); if( !$data ) throw new RuntimeException( 'No raw POST data received' ); $digest = hash_hmac( "md5", $data, $this->authKey ); $header = array_pop( $request->getHeadersByName( $this->headerName ) ); if( $digest !== $header->getValue() ) throw new RuntimeException( 'Authentication failed' ); return $data; }
php
public function receiveData( Net_HTTP_Request_Receiver $request) { $data = $request->getRawPostData(); if( !$data ) throw new RuntimeException( 'No raw POST data received' ); $digest = hash_hmac( "md5", $data, $this->authKey ); $header = array_pop( $request->getHeadersByName( $this->headerName ) ); if( $digest !== $header->getValue() ) throw new RuntimeException( 'Authentication failed' ); return $data; }
[ "public", "function", "receiveData", "(", "Net_HTTP_Request_Receiver", "$", "request", ")", "{", "$", "data", "=", "$", "request", "->", "getRawPostData", "(", ")", ";", "if", "(", "!", "$", "data", ")", "throw", "new", "RuntimeException", "(", "'No raw POST data received'", ")", ";", "$", "digest", "=", "hash_hmac", "(", "\"md5\"", ",", "$", "data", ",", "$", "this", "->", "authKey", ")", ";", "$", "header", "=", "array_pop", "(", "$", "request", "->", "getHeadersByName", "(", "$", "this", "->", "headerName", ")", ")", ";", "if", "(", "$", "digest", "!==", "$", "header", "->", "getValue", "(", ")", ")", "throw", "new", "RuntimeException", "(", "'Authentication failed'", ")", ";", "return", "$", "data", ";", "}" ]
Receives Data from Google Code Post-Commit Hook and returns JSON string. @access public @return string @throws RuntimeException if raw POST data is empty @throws RuntimeException if Key is invalid
[ "Receives", "Data", "from", "Google", "Code", "Post", "-", "Commit", "Hook", "and", "returns", "JSON", "string", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/API/Google/Code/PostCommit.php#L67-L77
37,018
CeusMedia/Common
src/Net/HTTP/Response/Decompressor.php
Net_HTTP_Response_Decompressor.decompressResponse
public static function decompressResponse( Net_HTTP_Response $response ) { $type = array_pop( $response->getHeader( 'Content-Encoding' ) ); if( $type ) $body = self::decompressString( $response->getBody(), $type ); $response->setBody( $body ); }
php
public static function decompressResponse( Net_HTTP_Response $response ) { $type = array_pop( $response->getHeader( 'Content-Encoding' ) ); if( $type ) $body = self::decompressString( $response->getBody(), $type ); $response->setBody( $body ); }
[ "public", "static", "function", "decompressResponse", "(", "Net_HTTP_Response", "$", "response", ")", "{", "$", "type", "=", "array_pop", "(", "$", "response", "->", "getHeader", "(", "'Content-Encoding'", ")", ")", ";", "if", "(", "$", "type", ")", "$", "body", "=", "self", "::", "decompressString", "(", "$", "response", "->", "getBody", "(", ")", ",", "$", "type", ")", ";", "$", "response", "->", "setBody", "(", "$", "body", ")", ";", "}" ]
Decompresses Content in HTTP Response Object. @access public @param Net_HTTP_Response $response HTTP Response Object @return void
[ "Decompresses", "Content", "in", "HTTP", "Response", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Response/Decompressor.php#L48-L54
37,019
CeusMedia/Common
src/Net/HTTP/Response/Decompressor.php
Net_HTTP_Response_Decompressor.decompressString
public static function decompressString( $content, $type = NULL ) { if( !$type ) return $content; ob_start(); // open a output buffer switch( strtolower( $type ) ) { case 'deflate': $content = self::inflate( $content ); break; case 'gzip': xmp( $content ); $content = self::ungzip( $content ); xmp( $content ); break; default: ob_end_clean(); throw new InvalidArgumentException( 'Decompression method "'.$type.'" is not supported' ); } $output = ob_get_clean(); // close buffer for PHP error messages if( $content === FALSE && $output ) // could not decompress throw new RuntimeException( $output ); // throw exception and carry error message return $content; // return decompressed response Content }
php
public static function decompressString( $content, $type = NULL ) { if( !$type ) return $content; ob_start(); // open a output buffer switch( strtolower( $type ) ) { case 'deflate': $content = self::inflate( $content ); break; case 'gzip': xmp( $content ); $content = self::ungzip( $content ); xmp( $content ); break; default: ob_end_clean(); throw new InvalidArgumentException( 'Decompression method "'.$type.'" is not supported' ); } $output = ob_get_clean(); // close buffer for PHP error messages if( $content === FALSE && $output ) // could not decompress throw new RuntimeException( $output ); // throw exception and carry error message return $content; // return decompressed response Content }
[ "public", "static", "function", "decompressString", "(", "$", "content", ",", "$", "type", "=", "NULL", ")", "{", "if", "(", "!", "$", "type", ")", "return", "$", "content", ";", "ob_start", "(", ")", ";", "// open a output buffer", "switch", "(", "strtolower", "(", "$", "type", ")", ")", "{", "case", "'deflate'", ":", "$", "content", "=", "self", "::", "inflate", "(", "$", "content", ")", ";", "break", ";", "case", "'gzip'", ":", "xmp", "(", "$", "content", ")", ";", "$", "content", "=", "self", "::", "ungzip", "(", "$", "content", ")", ";", "xmp", "(", "$", "content", ")", ";", "break", ";", "default", ":", "ob_end_clean", "(", ")", ";", "throw", "new", "InvalidArgumentException", "(", "'Decompression method \"'", ".", "$", "type", ".", "'\" is not supported'", ")", ";", "}", "$", "output", "=", "ob_get_clean", "(", ")", ";", "// close buffer for PHP error messages", "if", "(", "$", "content", "===", "FALSE", "&&", "$", "output", ")", "// could not decompress", "throw", "new", "RuntimeException", "(", "$", "output", ")", ";", "// throw exception and carry error message", "return", "$", "content", ";", "// return decompressed response Content", "}" ]
Decompresses compressed Response Content. @access public @param string $content Response Content, compressed @param string $type Compression Type used (gzip|deflate) @return string
[ "Decompresses", "compressed", "Response", "Content", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Response/Decompressor.php#L63-L86
37,020
CeusMedia/Common
src/Net/HTTP/Response/Decompressor.php
Net_HTTP_Response_Decompressor.ungzip
public static function ungzip( $content ) { if( function_exists( 'gzdecode' ) ) // if PHP method has been released $content = @gzdecode( $content ); // use it to decompress the data else // otherwise: own implementation { $tmp = tempnam( '/tmp', 'CMC' ); // create temporary file @file_put_contents( $tmp, $content ); // store gzipped data ob_start(); // open output buffer readgzfile( $tmp ); // read the gzip file to std output @unlink( $tmp ); $content = ob_get_clean(); // get decompressed data from output buffer } if( FALSE !== $content ) // gzencode could decompress return $content; // return decompressed data throw new RuntimeException( 'Data not decompressable with gzdecode' ); // throw exception }
php
public static function ungzip( $content ) { if( function_exists( 'gzdecode' ) ) // if PHP method has been released $content = @gzdecode( $content ); // use it to decompress the data else // otherwise: own implementation { $tmp = tempnam( '/tmp', 'CMC' ); // create temporary file @file_put_contents( $tmp, $content ); // store gzipped data ob_start(); // open output buffer readgzfile( $tmp ); // read the gzip file to std output @unlink( $tmp ); $content = ob_get_clean(); // get decompressed data from output buffer } if( FALSE !== $content ) // gzencode could decompress return $content; // return decompressed data throw new RuntimeException( 'Data not decompressable with gzdecode' ); // throw exception }
[ "public", "static", "function", "ungzip", "(", "$", "content", ")", "{", "if", "(", "function_exists", "(", "'gzdecode'", ")", ")", "// if PHP method has been released", "$", "content", "=", "@", "gzdecode", "(", "$", "content", ")", ";", "// use it to decompress the data", "else", "// otherwise: own implementation", "{", "$", "tmp", "=", "tempnam", "(", "'/tmp'", ",", "'CMC'", ")", ";", "// create temporary file", "@", "file_put_contents", "(", "$", "tmp", ",", "$", "content", ")", ";", "// store gzipped data", "ob_start", "(", ")", ";", "// open output buffer", "readgzfile", "(", "$", "tmp", ")", ";", "// read the gzip file to std output", "@", "unlink", "(", "$", "tmp", ")", ";", "$", "content", "=", "ob_get_clean", "(", ")", ";", "// get decompressed data from output buffer", "}", "if", "(", "FALSE", "!==", "$", "content", ")", "// gzencode could decompress", "return", "$", "content", ";", "// return decompressed data", "throw", "new", "RuntimeException", "(", "'Data not decompressable with gzdecode'", ")", ";", "// throw exception", "}" ]
Decompresses gzipped String. Function is missing in some PHP Win Builds. @access public @param string $content Data String to be decompressed @return string
[ "Decompresses", "gzipped", "String", ".", "Function", "is", "missing", "in", "some", "PHP", "Win", "Builds", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Response/Decompressor.php#L94-L110
37,021
CeusMedia/Common
src/FS/File.php
FS_File.getMimeType
public function getMimeType(){ if( function_exists( 'finfo_open' ) ){ $magicFile = ini_get( 'mime_magic.magicfile' ); // $magicFile = str_replace( "\\", "/", $magicFile ); // $magicFile = preg_replace( "@\.mime$@", "", $magicFile ); $fileInfo = finfo_open( FILEINFO_MIME_TYPE, $magicFile ); $mimeType = finfo_file( $fileInfo, realpath( $this->pathName ) ); finfo_close( $fileInfo ); return $mimeType; } else if( substr( PHP_OS, 0, 3 ) != "WIN" ){ $command = 'file -b --mime-type '.escapeshellarg( $this->pathName ); return trim( exec( $command ) ); } else if( function_exists( 'mime_content_type' ) ){ if( $mimeType = mime_content_type( $this->pathName ) ) return $mimeType; } throw new RuntimeException( 'PHP extension Fileinfo is missing' ); }
php
public function getMimeType(){ if( function_exists( 'finfo_open' ) ){ $magicFile = ini_get( 'mime_magic.magicfile' ); // $magicFile = str_replace( "\\", "/", $magicFile ); // $magicFile = preg_replace( "@\.mime$@", "", $magicFile ); $fileInfo = finfo_open( FILEINFO_MIME_TYPE, $magicFile ); $mimeType = finfo_file( $fileInfo, realpath( $this->pathName ) ); finfo_close( $fileInfo ); return $mimeType; } else if( substr( PHP_OS, 0, 3 ) != "WIN" ){ $command = 'file -b --mime-type '.escapeshellarg( $this->pathName ); return trim( exec( $command ) ); } else if( function_exists( 'mime_content_type' ) ){ if( $mimeType = mime_content_type( $this->pathName ) ) return $mimeType; } throw new RuntimeException( 'PHP extension Fileinfo is missing' ); }
[ "public", "function", "getMimeType", "(", ")", "{", "if", "(", "function_exists", "(", "'finfo_open'", ")", ")", "{", "$", "magicFile", "=", "ini_get", "(", "'mime_magic.magicfile'", ")", ";", "//\t\t\t$magicFile\t= str_replace( \"\\\\\", \"/\", $magicFile );", "//\t\t\t$magicFile\t= preg_replace( \"@\\.mime$@\", \"\", $magicFile );", "$", "fileInfo", "=", "finfo_open", "(", "FILEINFO_MIME_TYPE", ",", "$", "magicFile", ")", ";", "$", "mimeType", "=", "finfo_file", "(", "$", "fileInfo", ",", "realpath", "(", "$", "this", "->", "pathName", ")", ")", ";", "finfo_close", "(", "$", "fileInfo", ")", ";", "return", "$", "mimeType", ";", "}", "else", "if", "(", "substr", "(", "PHP_OS", ",", "0", ",", "3", ")", "!=", "\"WIN\"", ")", "{", "$", "command", "=", "'file -b --mime-type '", ".", "escapeshellarg", "(", "$", "this", "->", "pathName", ")", ";", "return", "trim", "(", "exec", "(", "$", "command", ")", ")", ";", "}", "else", "if", "(", "function_exists", "(", "'mime_content_type'", ")", ")", "{", "if", "(", "$", "mimeType", "=", "mime_content_type", "(", "$", "this", "->", "pathName", ")", ")", "return", "$", "mimeType", ";", "}", "throw", "new", "RuntimeException", "(", "'PHP extension Fileinfo is missing'", ")", ";", "}" ]
Returns the MIME type of current File. @access public @return string @throws RuntimeException if Fileinfo is not installed
[ "Returns", "the", "MIME", "type", "of", "current", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File.php#L58-L77
37,022
CeusMedia/Common
src/UI/HTML/Tree/ArrayView.php
UI_HTML_Tree_ArrayView.buildJavaScript
public static function buildJavaScript( $selector, $cookieId = NULL, $animated = "fast", $unique = FALSE, $collapsed = FALSE ) { $options = array(); if( $cookieId ) { $options['persist'] = "cookie"; $options['cookieId'] = $cookieId; } else $options['persist'] = "location"; if( $animated ) $options['animated'] = strtolower( (string) $animated ); if( $unique ) $options['unique'] = "true"; if( $collapsed ) $options['collapsed'] = "true"; return UI_HTML_JQuery::buildPluginCall( "treeview", $selector, $options ); }
php
public static function buildJavaScript( $selector, $cookieId = NULL, $animated = "fast", $unique = FALSE, $collapsed = FALSE ) { $options = array(); if( $cookieId ) { $options['persist'] = "cookie"; $options['cookieId'] = $cookieId; } else $options['persist'] = "location"; if( $animated ) $options['animated'] = strtolower( (string) $animated ); if( $unique ) $options['unique'] = "true"; if( $collapsed ) $options['collapsed'] = "true"; return UI_HTML_JQuery::buildPluginCall( "treeview", $selector, $options ); }
[ "public", "static", "function", "buildJavaScript", "(", "$", "selector", ",", "$", "cookieId", "=", "NULL", ",", "$", "animated", "=", "\"fast\"", ",", "$", "unique", "=", "FALSE", ",", "$", "collapsed", "=", "FALSE", ")", "{", "$", "options", "=", "array", "(", ")", ";", "if", "(", "$", "cookieId", ")", "{", "$", "options", "[", "'persist'", "]", "=", "\"cookie\"", ";", "$", "options", "[", "'cookieId'", "]", "=", "$", "cookieId", ";", "}", "else", "$", "options", "[", "'persist'", "]", "=", "\"location\"", ";", "if", "(", "$", "animated", ")", "$", "options", "[", "'animated'", "]", "=", "strtolower", "(", "(", "string", ")", "$", "animated", ")", ";", "if", "(", "$", "unique", ")", "$", "options", "[", "'unique'", "]", "=", "\"true\"", ";", "if", "(", "$", "collapsed", ")", "$", "options", "[", "'collapsed'", "]", "=", "\"true\"", ";", "return", "UI_HTML_JQuery", "::", "buildPluginCall", "(", "\"treeview\"", ",", "$", "selector", ",", "$", "options", ")", ";", "}" ]
Builds JavaScript to call Plugin. @access public @static @param string $selector JQuery Selector of Tree @param string $cookieId Store Tree in Cookie @param string $animated Speed of Animation (fast|slow) @param bool $unique Flag: open only 1 Node in every Level @param bool $collapsed Flag: start with collapsed Nodes @return string
[ "Builds", "JavaScript", "to", "call", "Plugin", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Tree/ArrayView.php#L75-L93
37,023
CeusMedia/Common
src/Alg/Sort/Selection.php
Alg_Sort_Selection.getLowest
protected static function getLowest( $list, $pos1, $pos2 ) { $lowest = $pos1; for( $i=$pos1; $i<$pos2; $i++ ) if( $list[$lowest] == $list[$i] ) $lowest = $i; return $lowest; }
php
protected static function getLowest( $list, $pos1, $pos2 ) { $lowest = $pos1; for( $i=$pos1; $i<$pos2; $i++ ) if( $list[$lowest] == $list[$i] ) $lowest = $i; return $lowest; }
[ "protected", "static", "function", "getLowest", "(", "$", "list", ",", "$", "pos1", ",", "$", "pos2", ")", "{", "$", "lowest", "=", "$", "pos1", ";", "for", "(", "$", "i", "=", "$", "pos1", ";", "$", "i", "<", "$", "pos2", ";", "$", "i", "++", ")", "if", "(", "$", "list", "[", "$", "lowest", "]", "==", "$", "list", "[", "$", "i", "]", ")", "$", "lowest", "=", "$", "i", ";", "return", "$", "lowest", ";", "}" ]
Finds and returns Position of lowest Element in Bounds. @access protected @static @param array $list List @param int $pos1 Position of lower Bound @param int $pos1 Position of higher Bound @return int
[ "Finds", "and", "returns", "Position", "of", "lowest", "Element", "in", "Bounds", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Sort/Selection.php#L49-L56
37,024
CeusMedia/Common
src/Alg/Sort/Selection.php
Alg_Sort_Selection.sort
public static function sort( $list ) { $n = sizeof( $list ); for( $i=0; $i<= $n -1; $i++ ) { # echo "List: ".implode( ", ", $list )."<br>"; $lowest = self::getLowest( $list, $i, $n ); # echo "<br>$i $lowest<br>"; self::swap( $list, $i, $lowest ); # print_m ($list); } return $list; }
php
public static function sort( $list ) { $n = sizeof( $list ); for( $i=0; $i<= $n -1; $i++ ) { # echo "List: ".implode( ", ", $list )."<br>"; $lowest = self::getLowest( $list, $i, $n ); # echo "<br>$i $lowest<br>"; self::swap( $list, $i, $lowest ); # print_m ($list); } return $list; }
[ "public", "static", "function", "sort", "(", "$", "list", ")", "{", "$", "n", "=", "sizeof", "(", "$", "list", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<=", "$", "n", "-", "1", ";", "$", "i", "++", ")", "{", "#\t\t\techo \"List: \".implode( \", \", $list ).\"<br>\";\r", "$", "lowest", "=", "self", "::", "getLowest", "(", "$", "list", ",", "$", "i", ",", "$", "n", ")", ";", "#\t\t\techo \"<br>$i $lowest<br>\";\r", "self", "::", "swap", "(", "$", "list", ",", "$", "i", ",", "$", "lowest", ")", ";", "#\t\t\tprint_m ($list);\r", "}", "return", "$", "list", ";", "}" ]
Sorts List with Selection Sort. @access public @static @param array $list List to sort @return array
[ "Sorts", "List", "with", "Selection", "Sort", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Sort/Selection.php#L65-L77
37,025
CeusMedia/Common
src/Net/Mail/Header/Section.php
Net_Mail_Header_Section.addFieldPair
public function addFieldPair( $name, $value ) { $field = new Net_Mail_Header_Field( $name, $value ); $this->addField( $field ); }
php
public function addFieldPair( $name, $value ) { $field = new Net_Mail_Header_Field( $name, $value ); $this->addField( $field ); }
[ "public", "function", "addFieldPair", "(", "$", "name", ",", "$", "value", ")", "{", "$", "field", "=", "new", "Net_Mail_Header_Field", "(", "$", "name", ",", "$", "value", ")", ";", "$", "this", "->", "addField", "(", "$", "field", ")", ";", "}" ]
Add a Header Field by pair. @access public @param string $name Header Field Name @param string $value Header Field Value @return void
[ "Add", "a", "Header", "Field", "by", "pair", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Mail/Header/Section.php#L73-L77
37,026
CeusMedia/Common
src/Net/Mail/Header/Section.php
Net_Mail_Header_Section.getField
public function getField( $name ) { if( !$this->hasField( $name ) ) return NULL; $values = $this->getFieldsByName( $name ); return array_shift( $values ); }
php
public function getField( $name ) { if( !$this->hasField( $name ) ) return NULL; $values = $this->getFieldsByName( $name ); return array_shift( $values ); }
[ "public", "function", "getField", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "hasField", "(", "$", "name", ")", ")", "return", "NULL", ";", "$", "values", "=", "$", "this", "->", "getFieldsByName", "(", "$", "name", ")", ";", "return", "array_shift", "(", "$", "values", ")", ";", "}" ]
Returns a Header Field Object by its Name if set. @access public @param string $name Header Field Name @return Net_Mail_Header_Field
[ "Returns", "a", "Header", "Field", "Object", "by", "its", "Name", "if", "set", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Mail/Header/Section.php#L97-L103
37,027
CeusMedia/Common
src/Net/Mail/Header/Section.php
Net_Mail_Header_Section.getFields
public function getFields() { $list = array(); foreach( $this->fields as $name => $fields ) if( count( $fields ) ) foreach( $fields as $field ) $list[] = $field; return $list; }
php
public function getFields() { $list = array(); foreach( $this->fields as $name => $fields ) if( count( $fields ) ) foreach( $fields as $field ) $list[] = $field; return $list; }
[ "public", "function", "getFields", "(", ")", "{", "$", "list", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "name", "=>", "$", "fields", ")", "if", "(", "count", "(", "$", "fields", ")", ")", "foreach", "(", "$", "fields", "as", "$", "field", ")", "$", "list", "[", "]", "=", "$", "field", ";", "return", "$", "list", ";", "}" ]
Returns a List of all set Header Field Objects. @access public @return array
[ "Returns", "a", "List", "of", "all", "set", "Header", "Field", "Objects", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Mail/Header/Section.php#L110-L118
37,028
CeusMedia/Common
src/Net/Mail/Header/Section.php
Net_Mail_Header_Section.getFieldsByName
public function getFieldsByName( $name ) { $name = strtolower( $name ); if( isset( $this->fields[$name] ) ) return $this->fields[$name]; return array(); }
php
public function getFieldsByName( $name ) { $name = strtolower( $name ); if( isset( $this->fields[$name] ) ) return $this->fields[$name]; return array(); }
[ "public", "function", "getFieldsByName", "(", "$", "name", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "fields", "[", "$", "name", "]", ")", ")", "return", "$", "this", "->", "fields", "[", "$", "name", "]", ";", "return", "array", "(", ")", ";", "}" ]
Returns a List of set Header Field Objects for a Header Field Name. @access public @param string $name Header Field Name @return array
[ "Returns", "a", "List", "of", "set", "Header", "Field", "Objects", "for", "a", "Header", "Field", "Name", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Mail/Header/Section.php#L126-L132
37,029
CeusMedia/Common
src/Net/Mail/Header/Section.php
Net_Mail_Header_Section.hasField
public function hasField( $name ) { $name = strtolower( $name ); if( isset( $this->fields[$name] ) ) return (bool) count( $this->fields[$name] ); }
php
public function hasField( $name ) { $name = strtolower( $name ); if( isset( $this->fields[$name] ) ) return (bool) count( $this->fields[$name] ); }
[ "public", "function", "hasField", "(", "$", "name", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "fields", "[", "$", "name", "]", ")", ")", "return", "(", "bool", ")", "count", "(", "$", "this", "->", "fields", "[", "$", "name", "]", ")", ";", "}" ]
Indicates whether a Header Field is set by its Name. @access public @param string $name Header Field Name @return boolean
[ "Indicates", "whether", "a", "Header", "Field", "is", "set", "by", "its", "Name", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Mail/Header/Section.php#L140-L145
37,030
CeusMedia/Common
src/Net/Mail/Header/Section.php
Net_Mail_Header_Section.setField
public function setField( Net_Mail_Header_Field $field, $emptyBefore = TRUE ) { $name = strtolower( $field->getName() ); if( $emptyBefore || !array_key_exists( $name, $this->fields ) ) $this->fields[$name] = array(); $this->fields[$name][] = $field; }
php
public function setField( Net_Mail_Header_Field $field, $emptyBefore = TRUE ) { $name = strtolower( $field->getName() ); if( $emptyBefore || !array_key_exists( $name, $this->fields ) ) $this->fields[$name] = array(); $this->fields[$name][] = $field; }
[ "public", "function", "setField", "(", "Net_Mail_Header_Field", "$", "field", ",", "$", "emptyBefore", "=", "TRUE", ")", "{", "$", "name", "=", "strtolower", "(", "$", "field", "->", "getName", "(", ")", ")", ";", "if", "(", "$", "emptyBefore", "||", "!", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "fields", ")", ")", "$", "this", "->", "fields", "[", "$", "name", "]", "=", "array", "(", ")", ";", "$", "this", "->", "fields", "[", "$", "name", "]", "[", "]", "=", "$", "field", ";", "}" ]
Sets an Header Field Object. @access public @param Net_Mail_Header_Field $field Header Field Object to set @param boolean $emptyBefore Flag: TRUE - set | FALSE - append @return void
[ "Sets", "an", "Header", "Field", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Mail/Header/Section.php#L154-L160
37,031
CeusMedia/Common
src/Net/Mail/Header/Section.php
Net_Mail_Header_Section.setFieldPair
public function setFieldPair( $name, $value, $emptyBefore = TRUE ) { return $this->setField( new Net_Mail_Header_Field( $name, $value ), $emptyBefore ); }
php
public function setFieldPair( $name, $value, $emptyBefore = TRUE ) { return $this->setField( new Net_Mail_Header_Field( $name, $value ), $emptyBefore ); }
[ "public", "function", "setFieldPair", "(", "$", "name", ",", "$", "value", ",", "$", "emptyBefore", "=", "TRUE", ")", "{", "return", "$", "this", "->", "setField", "(", "new", "Net_Mail_Header_Field", "(", "$", "name", ",", "$", "value", ")", ",", "$", "emptyBefore", ")", ";", "}" ]
Sets an Header Field by Name and Value. @access public @param string $name Header Field Name @param string $value Header Field Value @param boolean $emptyBefore Flag: TRUE - set | FALSE - append @return void
[ "Sets", "an", "Header", "Field", "by", "Name", "and", "Value", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Mail/Header/Section.php#L170-L173
37,032
CeusMedia/Common
src/Net/Mail/Header/Section.php
Net_Mail_Header_Section.toArray
public function toArray() { $list = array(); foreach( $this->fields as $name => $fields ) foreach( $fields as $field ) $list[] = $field->toString(); return $list; }
php
public function toArray() { $list = array(); foreach( $this->fields as $name => $fields ) foreach( $fields as $field ) $list[] = $field->toString(); return $list; }
[ "public", "function", "toArray", "(", ")", "{", "$", "list", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "name", "=>", "$", "fields", ")", "foreach", "(", "$", "fields", "as", "$", "field", ")", "$", "list", "[", "]", "=", "$", "field", "->", "toString", "(", ")", ";", "return", "$", "list", ";", "}" ]
Returns all Header Fields as List. @access public @return array
[ "Returns", "all", "Header", "Fields", "as", "List", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Mail/Header/Section.php#L180-L187
37,033
gdbots/ncr-bundle-php
src/Twig/NcrExtension.php
NcrExtension.getNode
public function getNode($ref): ?Node { $nodeRef = $this->toNodeRef($ref); if (!$nodeRef instanceof NodeRef) { return null; } try { return $this->ncrCache->getNode($nodeRef); } catch (NodeNotFound $e) { return null; } catch (\Throwable $e) { if ($this->debug) { throw $e; } $this->logger->error( sprintf( '%s::Unable to process twig "ncr_get_node" function for [{node_ref}].', ClassUtils::getShortName($e) ), ['exception' => $e, 'node_ref' => (string)$nodeRef] ); } return null; }
php
public function getNode($ref): ?Node { $nodeRef = $this->toNodeRef($ref); if (!$nodeRef instanceof NodeRef) { return null; } try { return $this->ncrCache->getNode($nodeRef); } catch (NodeNotFound $e) { return null; } catch (\Throwable $e) { if ($this->debug) { throw $e; } $this->logger->error( sprintf( '%s::Unable to process twig "ncr_get_node" function for [{node_ref}].', ClassUtils::getShortName($e) ), ['exception' => $e, 'node_ref' => (string)$nodeRef] ); } return null; }
[ "public", "function", "getNode", "(", "$", "ref", ")", ":", "?", "Node", "{", "$", "nodeRef", "=", "$", "this", "->", "toNodeRef", "(", "$", "ref", ")", ";", "if", "(", "!", "$", "nodeRef", "instanceof", "NodeRef", ")", "{", "return", "null", ";", "}", "try", "{", "return", "$", "this", "->", "ncrCache", "->", "getNode", "(", "$", "nodeRef", ")", ";", "}", "catch", "(", "NodeNotFound", "$", "e", ")", "{", "return", "null", ";", "}", "catch", "(", "\\", "Throwable", "$", "e", ")", "{", "if", "(", "$", "this", "->", "debug", ")", "{", "throw", "$", "e", ";", "}", "$", "this", "->", "logger", "->", "error", "(", "sprintf", "(", "'%s::Unable to process twig \"ncr_get_node\" function for [{node_ref}].'", ",", "ClassUtils", "::", "getShortName", "(", "$", "e", ")", ")", ",", "[", "'exception'", "=>", "$", "e", ",", "'node_ref'", "=>", "(", "string", ")", "$", "nodeRef", "]", ")", ";", "}", "return", "null", ";", "}" ]
Gets a node from the NcrCache service if it's available. This will NOT make a new request to fetch a node, it must have already been loaded to NcrCache. @param NodeRef|MessageRef|string $ref @return Node @throws \Throwable
[ "Gets", "a", "node", "from", "the", "NcrCache", "service", "if", "it", "s", "available", ".", "This", "will", "NOT", "make", "a", "new", "request", "to", "fetch", "a", "node", "it", "must", "have", "already", "been", "loaded", "to", "NcrCache", "." ]
21bab987b7487baa7cc4ac95c198ac57147f6574
https://github.com/gdbots/ncr-bundle-php/blob/21bab987b7487baa7cc4ac95c198ac57147f6574/src/Twig/NcrExtension.php#L106-L132
37,034
gdbots/ncr-bundle-php
src/Twig/NcrExtension.php
NcrExtension.preloadNode
public function preloadNode($ref, string $namespace = NcrPreloader::DEFAULT_NAMESPACE): void { $nodeRef = $this->toNodeRef($ref); if (!$nodeRef instanceof NodeRef) { return; } $this->ncrPreloader->addNodeRef($nodeRef, $namespace); }
php
public function preloadNode($ref, string $namespace = NcrPreloader::DEFAULT_NAMESPACE): void { $nodeRef = $this->toNodeRef($ref); if (!$nodeRef instanceof NodeRef) { return; } $this->ncrPreloader->addNodeRef($nodeRef, $namespace); }
[ "public", "function", "preloadNode", "(", "$", "ref", ",", "string", "$", "namespace", "=", "NcrPreloader", "::", "DEFAULT_NAMESPACE", ")", ":", "void", "{", "$", "nodeRef", "=", "$", "this", "->", "toNodeRef", "(", "$", "ref", ")", ";", "if", "(", "!", "$", "nodeRef", "instanceof", "NodeRef", ")", "{", "return", ";", "}", "$", "this", "->", "ncrPreloader", "->", "addNodeRef", "(", "$", "nodeRef", ",", "$", "namespace", ")", ";", "}" ]
Preloads a node so it can optionally be rendered later. @param NodeRef|MessageRef|string $ref @param string $namespace
[ "Preloads", "a", "node", "so", "it", "can", "optionally", "be", "rendered", "later", "." ]
21bab987b7487baa7cc4ac95c198ac57147f6574
https://github.com/gdbots/ncr-bundle-php/blob/21bab987b7487baa7cc4ac95c198ac57147f6574/src/Twig/NcrExtension.php#L186-L194
37,035
CeusMedia/Common
src/UI/Image/Modifier.php
UI_Image_Modifier.saveImage
public function saveImage( $type = NULL ) { if( !$this->source ) throw new RuntimeException( 'No image loaded' ); if( !$this->target ) throw new RuntimeException( 'No modification applied' ); if( !$this->targetUri ) throw new RuntimeException( 'No target image URI set' ); $type = $type ? $type : $this->sourceInfo[2]; switch( $type ) { case IMAGETYPE_GIF: return imagegif( $this->target, $this->targetUri ); case IMAGETYPE_JPEG: return imagejpeg( $this->target, $this->targetUri, $this->quality ); case IMAGETYPE_PNG: return imagepng( $this->target, $this->targetUri ); default: throw new Exception( 'Image Type "'.$type.'" is no supported' ); } }
php
public function saveImage( $type = NULL ) { if( !$this->source ) throw new RuntimeException( 'No image loaded' ); if( !$this->target ) throw new RuntimeException( 'No modification applied' ); if( !$this->targetUri ) throw new RuntimeException( 'No target image URI set' ); $type = $type ? $type : $this->sourceInfo[2]; switch( $type ) { case IMAGETYPE_GIF: return imagegif( $this->target, $this->targetUri ); case IMAGETYPE_JPEG: return imagejpeg( $this->target, $this->targetUri, $this->quality ); case IMAGETYPE_PNG: return imagepng( $this->target, $this->targetUri ); default: throw new Exception( 'Image Type "'.$type.'" is no supported' ); } }
[ "public", "function", "saveImage", "(", "$", "type", "=", "NULL", ")", "{", "if", "(", "!", "$", "this", "->", "source", ")", "throw", "new", "RuntimeException", "(", "'No image loaded'", ")", ";", "if", "(", "!", "$", "this", "->", "target", ")", "throw", "new", "RuntimeException", "(", "'No modification applied'", ")", ";", "if", "(", "!", "$", "this", "->", "targetUri", ")", "throw", "new", "RuntimeException", "(", "'No target image URI set'", ")", ";", "$", "type", "=", "$", "type", "?", "$", "type", ":", "$", "this", "->", "sourceInfo", "[", "2", "]", ";", "switch", "(", "$", "type", ")", "{", "case", "IMAGETYPE_GIF", ":", "return", "imagegif", "(", "$", "this", "->", "target", ",", "$", "this", "->", "targetUri", ")", ";", "case", "IMAGETYPE_JPEG", ":", "return", "imagejpeg", "(", "$", "this", "->", "target", ",", "$", "this", "->", "targetUri", ",", "$", "this", "->", "quality", ")", ";", "case", "IMAGETYPE_PNG", ":", "return", "imagepng", "(", "$", "this", "->", "target", ",", "$", "this", "->", "targetUri", ")", ";", "default", ":", "throw", "new", "Exception", "(", "'Image Type \"'", ".", "$", "type", ".", "'\" is no supported'", ")", ";", "}", "}" ]
Saves target image source to image file. @access public @param int $type Output format type @return bool
[ "Saves", "target", "image", "source", "to", "image", "file", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Modifier.php#L98-L118
37,036
spiral/models
src/Traits/EventsTrait.php
EventsTrait.dispatch
protected function dispatch(string $name, Event $event = null): Event { if (empty(self::$dispatchers[static::class])) { //We can bypass dispatcher creation return $event; } return static::getEventDispatcher()->dispatch($name, $event); }
php
protected function dispatch(string $name, Event $event = null): Event { if (empty(self::$dispatchers[static::class])) { //We can bypass dispatcher creation return $event; } return static::getEventDispatcher()->dispatch($name, $event); }
[ "protected", "function", "dispatch", "(", "string", "$", "name", ",", "Event", "$", "event", "=", "null", ")", ":", "Event", "{", "if", "(", "empty", "(", "self", "::", "$", "dispatchers", "[", "static", "::", "class", "]", ")", ")", "{", "//We can bypass dispatcher creation", "return", "$", "event", ";", "}", "return", "static", "::", "getEventDispatcher", "(", ")", "->", "dispatch", "(", "$", "name", ",", "$", "event", ")", ";", "}" ]
Dispatch event. If no dispatched associated even will be returned without dispatching. @param string $name Event name. @param Event|null $event Event class if any. @return Event
[ "Dispatch", "event", ".", "If", "no", "dispatched", "associated", "even", "will", "be", "returned", "without", "dispatching", "." ]
7ad86808c938354dfc2aaaee824d72ee8a15b6fd
https://github.com/spiral/models/blob/7ad86808c938354dfc2aaaee824d72ee8a15b6fd/src/Traits/EventsTrait.php#L35-L43
37,037
spiral/models
src/Traits/EventsTrait.php
EventsTrait.getEventDispatcher
public static function getEventDispatcher(): EventDispatcherInterface { if (isset(self::$dispatchers[static::class])) { return self::$dispatchers[static::class]; } return self::$dispatchers[static::class] = new EventDispatcher(); }
php
public static function getEventDispatcher(): EventDispatcherInterface { if (isset(self::$dispatchers[static::class])) { return self::$dispatchers[static::class]; } return self::$dispatchers[static::class] = new EventDispatcher(); }
[ "public", "static", "function", "getEventDispatcher", "(", ")", ":", "EventDispatcherInterface", "{", "if", "(", "isset", "(", "self", "::", "$", "dispatchers", "[", "static", "::", "class", "]", ")", ")", "{", "return", "self", "::", "$", "dispatchers", "[", "static", "::", "class", "]", ";", "}", "return", "self", "::", "$", "dispatchers", "[", "static", "::", "class", "]", "=", "new", "EventDispatcher", "(", ")", ";", "}" ]
Get class associated event dispatcher or create default one. @return EventDispatcherInterface
[ "Get", "class", "associated", "event", "dispatcher", "or", "create", "default", "one", "." ]
7ad86808c938354dfc2aaaee824d72ee8a15b6fd
https://github.com/spiral/models/blob/7ad86808c938354dfc2aaaee824d72ee8a15b6fd/src/Traits/EventsTrait.php#L61-L68
37,038
CeusMedia/Common
src/FS/File/Arc/Zip.php
File_Arc_ZipTarTemplate.addFile
public function addFile( $fileName ) { if( !file_exists( $fileName ) ) // Make sure the file we are adding exists! throw new Exception( 'File "'.$fileName.'" is not existing' ); if( $this->containsFile( $fileName ) ) // Make sure there are no other files in the archive that have this same fileName throw new Exception( 'File "'.$fileName.'" already existing in TAR' ); $fileName = str_replace( "\\", "/", $fileName ); $fileName = str_replace( "./", "", $fileName ); $fileInfo = stat( $fileName ); // Get file information $file = new File_Reader( $fileName ); $this->numFiles++; // Add file to processed data $activeFile = &$this->files[]; $activeFile['name'] = $fileName; $activeFile['mode'] = $fileInfo['mode']; $activeFile['user_id'] = $fileInfo['uid']; $activeFile['group_id'] = $fileInfo['gid']; $activeFile['size'] = $fileInfo['size']; $activeFile['time'] = $fileInfo['mtime']; # $activeFile['checksum'] = $checksum; $activeFile['user_name'] = ''; $activeFile['group_name'] = ''; $activeFile['file'] = $file->readString(); // Read in the file's contents return TRUE; }
php
public function addFile( $fileName ) { if( !file_exists( $fileName ) ) // Make sure the file we are adding exists! throw new Exception( 'File "'.$fileName.'" is not existing' ); if( $this->containsFile( $fileName ) ) // Make sure there are no other files in the archive that have this same fileName throw new Exception( 'File "'.$fileName.'" already existing in TAR' ); $fileName = str_replace( "\\", "/", $fileName ); $fileName = str_replace( "./", "", $fileName ); $fileInfo = stat( $fileName ); // Get file information $file = new File_Reader( $fileName ); $this->numFiles++; // Add file to processed data $activeFile = &$this->files[]; $activeFile['name'] = $fileName; $activeFile['mode'] = $fileInfo['mode']; $activeFile['user_id'] = $fileInfo['uid']; $activeFile['group_id'] = $fileInfo['gid']; $activeFile['size'] = $fileInfo['size']; $activeFile['time'] = $fileInfo['mtime']; # $activeFile['checksum'] = $checksum; $activeFile['user_name'] = ''; $activeFile['group_name'] = ''; $activeFile['file'] = $file->readString(); // Read in the file's contents return TRUE; }
[ "public", "function", "addFile", "(", "$", "fileName", ")", "{", "if", "(", "!", "file_exists", "(", "$", "fileName", ")", ")", "// Make sure the file we are adding exists!", "throw", "new", "Exception", "(", "'File \"'", ".", "$", "fileName", ".", "'\" is not existing'", ")", ";", "if", "(", "$", "this", "->", "containsFile", "(", "$", "fileName", ")", ")", "// Make sure there are no other files in the archive that have this same fileName", "throw", "new", "Exception", "(", "'File \"'", ".", "$", "fileName", ".", "'\" already existing in TAR'", ")", ";", "$", "fileName", "=", "str_replace", "(", "\"\\\\\"", ",", "\"/\"", ",", "$", "fileName", ")", ";", "$", "fileName", "=", "str_replace", "(", "\"./\"", ",", "\"\"", ",", "$", "fileName", ")", ";", "$", "fileInfo", "=", "stat", "(", "$", "fileName", ")", ";", "// Get file information", "$", "file", "=", "new", "File_Reader", "(", "$", "fileName", ")", ";", "$", "this", "->", "numFiles", "++", ";", "// Add file to processed data", "$", "activeFile", "=", "&", "$", "this", "->", "files", "[", "]", ";", "$", "activeFile", "[", "'name'", "]", "=", "$", "fileName", ";", "$", "activeFile", "[", "'mode'", "]", "=", "$", "fileInfo", "[", "'mode'", "]", ";", "$", "activeFile", "[", "'user_id'", "]", "=", "$", "fileInfo", "[", "'uid'", "]", ";", "$", "activeFile", "[", "'group_id'", "]", "=", "$", "fileInfo", "[", "'gid'", "]", ";", "$", "activeFile", "[", "'size'", "]", "=", "$", "fileInfo", "[", "'size'", "]", ";", "$", "activeFile", "[", "'time'", "]", "=", "$", "fileInfo", "[", "'mtime'", "]", ";", "#\t\t$activeFile['checksum']\t\t= $checksum;", "$", "activeFile", "[", "'user_name'", "]", "=", "''", ";", "$", "activeFile", "[", "'group_name'", "]", "=", "''", ";", "$", "activeFile", "[", "'file'", "]", "=", "$", "file", "->", "readString", "(", ")", ";", "// Read in the file's contents", "return", "TRUE", ";", "}" ]
Adds a File to the TAR Archive by its Path, depending on current working Directory. @access public @param stromg $fileName Path of File to add @return bool
[ "Adds", "a", "File", "to", "the", "TAR", "Archive", "by", "its", "Path", "depending", "on", "current", "working", "Directory", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Arc/Zip.php#L162-L187
37,039
CeusMedia/Common
src/FS/File/Arc/Zip.php
File_Arc_ZipTarTemplate.extract
public function extract( $targetPath = NULL ) { $counter = 0; if( $targetPath ) { $cwd = getCwd(); Folder_Editor::createFolder( $targetPath ); chdir( $targetPath ); } foreach( $this->folders as $folder ) Folder_Editor::createFolder( $folder['name'] ); foreach( $this->files as $file ) { if( $folder = dirname( $file['name'] ) ) Folder_Editor::createFolder( $folder ); $counter += (int)(bool) File_Writer::save( $file['name'], $file['file'] ); } if( $targetPath ) chDir( $cwd ); return $counter; }
php
public function extract( $targetPath = NULL ) { $counter = 0; if( $targetPath ) { $cwd = getCwd(); Folder_Editor::createFolder( $targetPath ); chdir( $targetPath ); } foreach( $this->folders as $folder ) Folder_Editor::createFolder( $folder['name'] ); foreach( $this->files as $file ) { if( $folder = dirname( $file['name'] ) ) Folder_Editor::createFolder( $folder ); $counter += (int)(bool) File_Writer::save( $file['name'], $file['file'] ); } if( $targetPath ) chDir( $cwd ); return $counter; }
[ "public", "function", "extract", "(", "$", "targetPath", "=", "NULL", ")", "{", "$", "counter", "=", "0", ";", "if", "(", "$", "targetPath", ")", "{", "$", "cwd", "=", "getCwd", "(", ")", ";", "Folder_Editor", "::", "createFolder", "(", "$", "targetPath", ")", ";", "chdir", "(", "$", "targetPath", ")", ";", "}", "foreach", "(", "$", "this", "->", "folders", "as", "$", "folder", ")", "Folder_Editor", "::", "createFolder", "(", "$", "folder", "[", "'name'", "]", ")", ";", "foreach", "(", "$", "this", "->", "files", "as", "$", "file", ")", "{", "if", "(", "$", "folder", "=", "dirname", "(", "$", "file", "[", "'name'", "]", ")", ")", "Folder_Editor", "::", "createFolder", "(", "$", "folder", ")", ";", "$", "counter", "+=", "(", "int", ")", "(", "bool", ")", "File_Writer", "::", "save", "(", "$", "file", "[", "'name'", "]", ",", "$", "file", "[", "'file'", "]", ")", ";", "}", "if", "(", "$", "targetPath", ")", "chDir", "(", "$", "cwd", ")", ";", "return", "$", "counter", ";", "}" ]
Extracts all Folders and Files to a Path and returns Number of extracted Files. @access public @param string $targetPath Path to extract to @return int Number of extracted Files
[ "Extracts", "all", "Folders", "and", "Files", "to", "a", "Path", "and", "returns", "Number", "of", "extracted", "Files", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Arc/Zip.php#L240-L260
37,040
CeusMedia/Common
src/XML/XSL/Transformator.php
XML_XSL_Transformator.transform
public function transform() { if( !( $this->xml && $this->xsl ) ) throw new InvalidArgumentException( 'XML and XSL must be set.' ); $xml = DOMDocument::loadXML( $this->xml ); $xsl = DOMDocument::loadXML( $this->xsl ); $proc = new XSLTProcessor(); $proc->importStyleSheet( $xsl ); $result = $proc->transformToXML( $xml ); return $result; }
php
public function transform() { if( !( $this->xml && $this->xsl ) ) throw new InvalidArgumentException( 'XML and XSL must be set.' ); $xml = DOMDocument::loadXML( $this->xml ); $xsl = DOMDocument::loadXML( $this->xsl ); $proc = new XSLTProcessor(); $proc->importStyleSheet( $xsl ); $result = $proc->transformToXML( $xml ); return $result; }
[ "public", "function", "transform", "(", ")", "{", "if", "(", "!", "(", "$", "this", "->", "xml", "&&", "$", "this", "->", "xsl", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'XML and XSL must be set.'", ")", ";", "$", "xml", "=", "DOMDocument", "::", "loadXML", "(", "$", "this", "->", "xml", ")", ";", "$", "xsl", "=", "DOMDocument", "::", "loadXML", "(", "$", "this", "->", "xsl", ")", ";", "$", "proc", "=", "new", "XSLTProcessor", "(", ")", ";", "$", "proc", "->", "importStyleSheet", "(", "$", "xsl", ")", ";", "$", "result", "=", "$", "proc", "->", "transformToXML", "(", "$", "xml", ")", ";", "return", "$", "result", ";", "}" ]
Transforms loaded XML and XSL and returns Result. @access public @return string
[ "Transforms", "loaded", "XML", "and", "XSL", "and", "returns", "Result", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/XSL/Transformator.php#L78-L88
37,041
CeusMedia/Common
src/XML/XSL/Transformator.php
XML_XSL_Transformator.transformToFile
public function transformToFile( $outFile = false ) { $result = $this->transform(); $writer = new FS_File_Writer( $outFile ); return $writer->writeString( $result ); }
php
public function transformToFile( $outFile = false ) { $result = $this->transform(); $writer = new FS_File_Writer( $outFile ); return $writer->writeString( $result ); }
[ "public", "function", "transformToFile", "(", "$", "outFile", "=", "false", ")", "{", "$", "result", "=", "$", "this", "->", "transform", "(", ")", ";", "$", "writer", "=", "new", "FS_File_Writer", "(", "$", "outFile", ")", ";", "return", "$", "writer", "->", "writeString", "(", "$", "result", ")", ";", "}" ]
Transforms XML with XSLT. @access public @param string $xmlFile File Name of XML File @param string $xsltFile File Name of XSLT File @param string $outFile File Name for Output @return string
[ "Transforms", "XML", "with", "XSLT", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/XSL/Transformator.php#L98-L103
37,042
CeusMedia/Common
src/ADT/String.php
ADT_String.capitalize
public function capitalize( $delimiter = NULL ) { $oldString = $this->string; if( $delimiter === NULL ){ $this->string = ucfirst( $this->string ); return $this->string !== $oldString; } else{ return $this->capitalizeWords( $delimiter ); } }
php
public function capitalize( $delimiter = NULL ) { $oldString = $this->string; if( $delimiter === NULL ){ $this->string = ucfirst( $this->string ); return $this->string !== $oldString; } else{ return $this->capitalizeWords( $delimiter ); } }
[ "public", "function", "capitalize", "(", "$", "delimiter", "=", "NULL", ")", "{", "$", "oldString", "=", "$", "this", "->", "string", ";", "if", "(", "$", "delimiter", "===", "NULL", ")", "{", "$", "this", "->", "string", "=", "ucfirst", "(", "$", "this", "->", "string", ")", ";", "return", "$", "this", "->", "string", "!==", "$", "oldString", ";", "}", "else", "{", "return", "$", "this", "->", "capitalizeWords", "(", "$", "delimiter", ")", ";", "}", "}" ]
Changes first letter or every delimited word to upper case and returns TRUE of there were changes. @access public @param string $delimiter Capitalize every word separated by delimiter @return bool At least 1 character has been changed
[ "Changes", "first", "letter", "or", "every", "delimited", "word", "to", "upper", "case", "and", "returns", "TRUE", "of", "there", "were", "changes", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L65-L75
37,043
CeusMedia/Common
src/ADT/String.php
ADT_String.capitalizeWords
public function capitalizeWords( $delimiter = NULL ) { $oldString = $this->string; if( !$delimiter || preg_match( "/ +/", $delimiter ) ){ $this->string = ucwords( $oldString ); return $this->string !== $oldString; } else{ $token = md5( (string) microtime( TRUE ) ); $work = str_replace( " ", "{".$token."}", $oldString ); $work = str_replace( $delimiter, " ", $work ); $work = ucwords( $work ); $work = str_replace( " ", $delimiter, $work ); $this->string = str_replace( "{".$token."}", " ", $work ); return $this->string !== $oldString; } }
php
public function capitalizeWords( $delimiter = NULL ) { $oldString = $this->string; if( !$delimiter || preg_match( "/ +/", $delimiter ) ){ $this->string = ucwords( $oldString ); return $this->string !== $oldString; } else{ $token = md5( (string) microtime( TRUE ) ); $work = str_replace( " ", "{".$token."}", $oldString ); $work = str_replace( $delimiter, " ", $work ); $work = ucwords( $work ); $work = str_replace( " ", $delimiter, $work ); $this->string = str_replace( "{".$token."}", " ", $work ); return $this->string !== $oldString; } }
[ "public", "function", "capitalizeWords", "(", "$", "delimiter", "=", "NULL", ")", "{", "$", "oldString", "=", "$", "this", "->", "string", ";", "if", "(", "!", "$", "delimiter", "||", "preg_match", "(", "\"/ +/\"", ",", "$", "delimiter", ")", ")", "{", "$", "this", "->", "string", "=", "ucwords", "(", "$", "oldString", ")", ";", "return", "$", "this", "->", "string", "!==", "$", "oldString", ";", "}", "else", "{", "$", "token", "=", "md5", "(", "(", "string", ")", "microtime", "(", "TRUE", ")", ")", ";", "$", "work", "=", "str_replace", "(", "\" \"", ",", "\"{\"", ".", "$", "token", ".", "\"}\"", ",", "$", "oldString", ")", ";", "$", "work", "=", "str_replace", "(", "$", "delimiter", ",", "\" \"", ",", "$", "work", ")", ";", "$", "work", "=", "ucwords", "(", "$", "work", ")", ";", "$", "work", "=", "str_replace", "(", "\" \"", ",", "$", "delimiter", ",", "$", "work", ")", ";", "$", "this", "->", "string", "=", "str_replace", "(", "\"{\"", ".", "$", "token", ".", "\"}\"", ",", "\" \"", ",", "$", "work", ")", ";", "return", "$", "this", "->", "string", "!==", "$", "oldString", ";", "}", "}" ]
Changes first letter of every word to upper case and returns TRUE of there were changes. @access public @return bool At least 1 character has been changed @param string $delimiter Capitalize every word separated by delimiter
[ "Changes", "first", "letter", "of", "every", "word", "to", "upper", "case", "and", "returns", "TRUE", "of", "there", "were", "changes", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L83-L99
37,044
CeusMedia/Common
src/ADT/String.php
ADT_String.compareTo
public function compareTo( $string, $caseSense = TRUE ) { $method = $caseSense ? "strcmp" : "strcasecmp"; return call_user_func( $method, $this->string, $string ); }
php
public function compareTo( $string, $caseSense = TRUE ) { $method = $caseSense ? "strcmp" : "strcasecmp"; return call_user_func( $method, $this->string, $string ); }
[ "public", "function", "compareTo", "(", "$", "string", ",", "$", "caseSense", "=", "TRUE", ")", "{", "$", "method", "=", "$", "caseSense", "?", "\"strcmp\"", ":", "\"strcasecmp\"", ";", "return", "call_user_func", "(", "$", "method", ",", "$", "this", "->", "string", ",", "$", "string", ")", ";", "}" ]
Compares this string to another string. Returns negative value is this string is less, positive of this string is greater and 0 if both are equal. @access public @param string $string String to compare to @param bool $caseSense Flag: be case sensitive @return int Indicator for which string is less, 0 if equal @see http://www.php.net/manual/en/function.strcmp.php @see http://www.php.net/manual/en/function.strcasecmp.php
[ "Compares", "this", "string", "to", "another", "string", ".", "Returns", "negative", "value", "is", "this", "string", "is", "less", "positive", "of", "this", "string", "is", "greater", "and", "0", "if", "both", "are", "equal", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L111-L115
37,045
CeusMedia/Common
src/ADT/String.php
ADT_String.escape
public function escape() { $length = $this->getLength(); $this->string = addslashes( $this->string ); return $this->getLength() - $length; }
php
public function escape() { $length = $this->getLength(); $this->string = addslashes( $this->string ); return $this->getLength() - $length; }
[ "public", "function", "escape", "(", ")", "{", "$", "length", "=", "$", "this", "->", "getLength", "(", ")", ";", "$", "this", "->", "string", "=", "addslashes", "(", "$", "this", "->", "string", ")", ";", "return", "$", "this", "->", "getLength", "(", ")", "-", "$", "length", ";", "}" ]
Escapes this string by adding slashes. @access public @return int Number of added slashes
[ "Escapes", "this", "string", "by", "adding", "slashes", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L150-L155
37,046
CeusMedia/Common
src/ADT/String.php
ADT_String.extend
public function extend( $length, $string = " ", $left = FALSE, $right = TRUE ) { if( !is_int( $length ) ) throw new InvalidArgumentException( 'Length must be integer' ); if( $length < $this->getLength() ) throw new InvalidArgumentException( 'Length cannot be lower than string length' ); if( !is_string( $string ) && !( $string instanceof ADT_String ) ) throw new InvalidArgumentException( 'Padding string must be of string' ); if( !$string ) throw new InvalidArgumentException( 'Padding string cannot be empty' ); $oldLength = $this->getLength(); $mode = STR_PAD_RIGHT; if( $right && $left ) $mode = STR_PAD_BOTH; else if( $left ) $mode = STR_PAD_LEFT; else if( !$right ) throw new InvalidArgumentException( 'No mode given, set left and/or right to TRUE' ); $this->string = str_pad( $this->string, $length, (string) $string, $mode ); return $this->getLength() - $oldLength; }
php
public function extend( $length, $string = " ", $left = FALSE, $right = TRUE ) { if( !is_int( $length ) ) throw new InvalidArgumentException( 'Length must be integer' ); if( $length < $this->getLength() ) throw new InvalidArgumentException( 'Length cannot be lower than string length' ); if( !is_string( $string ) && !( $string instanceof ADT_String ) ) throw new InvalidArgumentException( 'Padding string must be of string' ); if( !$string ) throw new InvalidArgumentException( 'Padding string cannot be empty' ); $oldLength = $this->getLength(); $mode = STR_PAD_RIGHT; if( $right && $left ) $mode = STR_PAD_BOTH; else if( $left ) $mode = STR_PAD_LEFT; else if( !$right ) throw new InvalidArgumentException( 'No mode given, set left and/or right to TRUE' ); $this->string = str_pad( $this->string, $length, (string) $string, $mode ); return $this->getLength() - $oldLength; }
[ "public", "function", "extend", "(", "$", "length", ",", "$", "string", "=", "\" \"", ",", "$", "left", "=", "FALSE", ",", "$", "right", "=", "TRUE", ")", "{", "if", "(", "!", "is_int", "(", "$", "length", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Length must be integer'", ")", ";", "if", "(", "$", "length", "<", "$", "this", "->", "getLength", "(", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Length cannot be lower than string length'", ")", ";", "if", "(", "!", "is_string", "(", "$", "string", ")", "&&", "!", "(", "$", "string", "instanceof", "ADT_String", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Padding string must be of string'", ")", ";", "if", "(", "!", "$", "string", ")", "throw", "new", "InvalidArgumentException", "(", "'Padding string cannot be empty'", ")", ";", "$", "oldLength", "=", "$", "this", "->", "getLength", "(", ")", ";", "$", "mode", "=", "STR_PAD_RIGHT", ";", "if", "(", "$", "right", "&&", "$", "left", ")", "$", "mode", "=", "STR_PAD_BOTH", ";", "else", "if", "(", "$", "left", ")", "$", "mode", "=", "STR_PAD_LEFT", ";", "else", "if", "(", "!", "$", "right", ")", "throw", "new", "InvalidArgumentException", "(", "'No mode given, set left and/or right to TRUE'", ")", ";", "$", "this", "->", "string", "=", "str_pad", "(", "$", "this", "->", "string", ",", "$", "length", ",", "(", "string", ")", "$", "string", ",", "$", "mode", ")", ";", "return", "$", "this", "->", "getLength", "(", ")", "-", "$", "oldLength", ";", "}" ]
Extends this string with another and returns number of added characters. If left and right is set, @access public @param int $length Length of resulting string @param string $string String to extend with @param bool $left Extend left side @param bool $right Extend right side
[ "Extends", "this", "string", "with", "another", "and", "returns", "number", "of", "added", "characters", ".", "If", "left", "and", "right", "is", "set" ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L166-L187
37,047
CeusMedia/Common
src/ADT/String.php
ADT_String.hasSubstring
public function hasSubstring( $string, $offset = 0, $limit = NULL ) { return (bool) $this->countSubstring( $string, $offset, $limit ); }
php
public function hasSubstring( $string, $offset = 0, $limit = NULL ) { return (bool) $this->countSubstring( $string, $offset, $limit ); }
[ "public", "function", "hasSubstring", "(", "$", "string", ",", "$", "offset", "=", "0", ",", "$", "limit", "=", "NULL", ")", "{", "return", "(", "bool", ")", "$", "this", "->", "countSubstring", "(", "$", "string", ",", "$", "offset", ",", "$", "limit", ")", ";", "}" ]
Indicates whether a string is existing in this string within borders of offset and limit. @access public @param string $string String to find @param int $offset Offset to start at @param int $limit Number of characters after offset @return bool Found or not
[ "Indicates", "whether", "a", "string", "is", "existing", "in", "this", "string", "within", "borders", "of", "offset", "and", "limit", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L245-L248
37,048
CeusMedia/Common
src/ADT/String.php
ADT_String.hyphenate
public function hyphenate( $characters = array( ' ' ), $hyphen = '-' ){ $string = $this->string; foreach( $characters as $character ){ $pattern = '/'.preg_quote( $character, '/' ).'+/s'; $string = preg_replace( $pattern, $hyphen, $string ); } return $string; }
php
public function hyphenate( $characters = array( ' ' ), $hyphen = '-' ){ $string = $this->string; foreach( $characters as $character ){ $pattern = '/'.preg_quote( $character, '/' ).'+/s'; $string = preg_replace( $pattern, $hyphen, $string ); } return $string; }
[ "public", "function", "hyphenate", "(", "$", "characters", "=", "array", "(", "' '", ")", ",", "$", "hyphen", "=", "'-'", ")", "{", "$", "string", "=", "$", "this", "->", "string", ";", "foreach", "(", "$", "characters", "as", "$", "character", ")", "{", "$", "pattern", "=", "'/'", ".", "preg_quote", "(", "$", "character", ",", "'/'", ")", ".", "'+/s'", ";", "$", "string", "=", "preg_replace", "(", "$", "pattern", ",", "$", "hyphen", ",", "$", "string", ")", ";", "}", "return", "$", "string", ";", "}" ]
Replaces whitespace by hyphen. @access public @param array $characters List of characters to replace by hyphen @param string $hyphen Hyphen character to replace given characters with @return bool string
[ "Replaces", "whitespace", "by", "hyphen", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L257-L264
37,049
CeusMedia/Common
src/ADT/String.php
ADT_String.repeat
public function repeat( $multiplier ) { if( !is_int( $multiplier ) ) throw new InvalidArgumentException( 'Multiplier must be integer' ); if( $multiplier < 0 ) throw new InvalidArgumentException( 'Multiplier must be atleast 0' ); $length = $this->getLength(); $this->string = str_repeat( $this->string, $multiplier + 1 ); return $this->getLength() - $length; }
php
public function repeat( $multiplier ) { if( !is_int( $multiplier ) ) throw new InvalidArgumentException( 'Multiplier must be integer' ); if( $multiplier < 0 ) throw new InvalidArgumentException( 'Multiplier must be atleast 0' ); $length = $this->getLength(); $this->string = str_repeat( $this->string, $multiplier + 1 ); return $this->getLength() - $length; }
[ "public", "function", "repeat", "(", "$", "multiplier", ")", "{", "if", "(", "!", "is_int", "(", "$", "multiplier", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Multiplier must be integer'", ")", ";", "if", "(", "$", "multiplier", "<", "0", ")", "throw", "new", "InvalidArgumentException", "(", "'Multiplier must be atleast 0'", ")", ";", "$", "length", "=", "$", "this", "->", "getLength", "(", ")", ";", "$", "this", "->", "string", "=", "str_repeat", "(", "$", "this", "->", "string", ",", "$", "multiplier", "+", "1", ")", ";", "return", "$", "this", "->", "getLength", "(", ")", "-", "$", "length", ";", "}" ]
Repeats this string. If the multiplier is 1 the string will be doubled. If the multiplier is 0 there will be no effect. Negative multipliers are not allowed. @access public @param int $multiplier @return int Number of added characters
[ "Repeats", "this", "string", ".", "If", "the", "multiplier", "is", "1", "the", "string", "will", "be", "doubled", ".", "If", "the", "multiplier", "is", "0", "there", "will", "be", "no", "effect", ".", "Negative", "multipliers", "are", "not", "allowed", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L300-L309
37,050
CeusMedia/Common
src/ADT/String.php
ADT_String.reverse
public function reverse() { $oldString = $this->string; $this->string = strrev( $this->string ); return $this->string !== $oldString; }
php
public function reverse() { $oldString = $this->string; $this->string = strrev( $this->string ); return $this->string !== $oldString; }
[ "public", "function", "reverse", "(", ")", "{", "$", "oldString", "=", "$", "this", "->", "string", ";", "$", "this", "->", "string", "=", "strrev", "(", "$", "this", "->", "string", ")", ";", "return", "$", "this", "->", "string", "!==", "$", "oldString", ";", "}" ]
Reverses this string. @access public @return bool At least 1 character has been changed
[ "Reverses", "this", "string", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L338-L343
37,051
CeusMedia/Common
src/ADT/String.php
ADT_String.split
public function split( $delimiter ) { if( is_int( $delimiter ) ) $list = str_split( $this->string, $delimiter ); else if( is_string( $delimiter ) ) $list = explode( $delimiter, $this->string ); return new ArrayObject( $list ); }
php
public function split( $delimiter ) { if( is_int( $delimiter ) ) $list = str_split( $this->string, $delimiter ); else if( is_string( $delimiter ) ) $list = explode( $delimiter, $this->string ); return new ArrayObject( $list ); }
[ "public", "function", "split", "(", "$", "delimiter", ")", "{", "if", "(", "is_int", "(", "$", "delimiter", ")", ")", "$", "list", "=", "str_split", "(", "$", "this", "->", "string", ",", "$", "delimiter", ")", ";", "else", "if", "(", "is_string", "(", "$", "delimiter", ")", ")", "$", "list", "=", "explode", "(", "$", "delimiter", ",", "$", "this", "->", "string", ")", ";", "return", "new", "ArrayObject", "(", "$", "list", ")", ";", "}" ]
Splits this string into an array either by a delimiter string or an number of characters. @access public @param mixed $delimiter Delimiter String or number of characters @return ArrayObject @see http://www.php.net/manual/en/function.explode.php @see http://www.php.net/manual/en/function.str-split.php
[ "Splits", "this", "string", "into", "an", "array", "either", "by", "a", "delimiter", "string", "or", "an", "number", "of", "characters", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L353-L360
37,052
CeusMedia/Common
src/ADT/String.php
ADT_String.toLowerCase
public function toLowerCase( $firstOnly = FALSE ) { $oldString = $this->string; if( $firstOnly && !function_exists( 'lcfirst' ) ) { $this->string = strtolower( substr( $this->string, 0, 1 ) ).substr( $this->string, 1 ); return $this->string !== $oldString; } $method = $firstOnly ? "lcfirst" : "strtolower"; $this->string = call_user_func( $method, $this->string ); $this->string = strtolower( $this->string ); return $this->string !== $oldString; }
php
public function toLowerCase( $firstOnly = FALSE ) { $oldString = $this->string; if( $firstOnly && !function_exists( 'lcfirst' ) ) { $this->string = strtolower( substr( $this->string, 0, 1 ) ).substr( $this->string, 1 ); return $this->string !== $oldString; } $method = $firstOnly ? "lcfirst" : "strtolower"; $this->string = call_user_func( $method, $this->string ); $this->string = strtolower( $this->string ); return $this->string !== $oldString; }
[ "public", "function", "toLowerCase", "(", "$", "firstOnly", "=", "FALSE", ")", "{", "$", "oldString", "=", "$", "this", "->", "string", ";", "if", "(", "$", "firstOnly", "&&", "!", "function_exists", "(", "'lcfirst'", ")", ")", "{", "$", "this", "->", "string", "=", "strtolower", "(", "substr", "(", "$", "this", "->", "string", ",", "0", ",", "1", ")", ")", ".", "substr", "(", "$", "this", "->", "string", ",", "1", ")", ";", "return", "$", "this", "->", "string", "!==", "$", "oldString", ";", "}", "$", "method", "=", "$", "firstOnly", "?", "\"lcfirst\"", ":", "\"strtolower\"", ";", "$", "this", "->", "string", "=", "call_user_func", "(", "$", "method", ",", "$", "this", "->", "string", ")", ";", "$", "this", "->", "string", "=", "strtolower", "(", "$", "this", "->", "string", ")", ";", "return", "$", "this", "->", "string", "!==", "$", "oldString", ";", "}" ]
Changes all upper case characters to lower case. @param bool Only change first letter (=lcfirst) @return bool At least 1 character has been changed @see http://www.php.net/manual/en/function.strtolower.php @see http://www.php.net/manual/en/function.lcfirst.php
[ "Changes", "all", "upper", "case", "characters", "to", "lower", "case", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L386-L398
37,053
CeusMedia/Common
src/ADT/String.php
ADT_String.toUpperCase
public function toUpperCase( $firstOnly = FALSE ) { $oldString = $this->string; $method = $firstOnly ? "ucfirst" : "strtoupper"; $this->string = call_user_func( $method, $this->string ); return $this->string !== $oldString; }
php
public function toUpperCase( $firstOnly = FALSE ) { $oldString = $this->string; $method = $firstOnly ? "ucfirst" : "strtoupper"; $this->string = call_user_func( $method, $this->string ); return $this->string !== $oldString; }
[ "public", "function", "toUpperCase", "(", "$", "firstOnly", "=", "FALSE", ")", "{", "$", "oldString", "=", "$", "this", "->", "string", ";", "$", "method", "=", "$", "firstOnly", "?", "\"ucfirst\"", ":", "\"strtoupper\"", ";", "$", "this", "->", "string", "=", "call_user_func", "(", "$", "method", ",", "$", "this", "->", "string", ")", ";", "return", "$", "this", "->", "string", "!==", "$", "oldString", ";", "}" ]
Changes all lower case characters to upper case. @param bool Only change first letter (=ucfirst) @return bool At least 1 character has been changed @see http://www.php.net/manual/en/function.strtoupper.php @see http://www.php.net/manual/en/function.ucfirst.php
[ "Changes", "all", "lower", "case", "characters", "to", "upper", "case", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L407-L413
37,054
CeusMedia/Common
src/ADT/String.php
ADT_String.trim
public function trim( $left = TRUE, $right = TRUE ) { $length = $this->getLength(); if( $left && $right ) $this->string = trim( $this->string ); else if( $left ) $this->string = ltrim( $this->string ); else if( $right ) $this->string = rtrim( $this->string ); return $length - $this->getLength(); }
php
public function trim( $left = TRUE, $right = TRUE ) { $length = $this->getLength(); if( $left && $right ) $this->string = trim( $this->string ); else if( $left ) $this->string = ltrim( $this->string ); else if( $right ) $this->string = rtrim( $this->string ); return $length - $this->getLength(); }
[ "public", "function", "trim", "(", "$", "left", "=", "TRUE", ",", "$", "right", "=", "TRUE", ")", "{", "$", "length", "=", "$", "this", "->", "getLength", "(", ")", ";", "if", "(", "$", "left", "&&", "$", "right", ")", "$", "this", "->", "string", "=", "trim", "(", "$", "this", "->", "string", ")", ";", "else", "if", "(", "$", "left", ")", "$", "this", "->", "string", "=", "ltrim", "(", "$", "this", "->", "string", ")", ";", "else", "if", "(", "$", "right", ")", "$", "this", "->", "string", "=", "rtrim", "(", "$", "this", "->", "string", ")", ";", "return", "$", "length", "-", "$", "this", "->", "getLength", "(", ")", ";", "}" ]
Trims this String and returns number of removed characters. @access public @param bool $left Remove from left side @param bool $right Remove from right side @return int Number of removed characters
[ "Trims", "this", "String", "and", "returns", "number", "of", "removed", "characters", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L422-L432
37,055
CeusMedia/Common
src/ADT/String.php
ADT_String.unescape
public function unescape() { $length = $this->getLength(); $this->string = stripslashes( $this->string ); return $length - $this->getLength(); }
php
public function unescape() { $length = $this->getLength(); $this->string = stripslashes( $this->string ); return $length - $this->getLength(); }
[ "public", "function", "unescape", "(", ")", "{", "$", "length", "=", "$", "this", "->", "getLength", "(", ")", ";", "$", "this", "->", "string", "=", "stripslashes", "(", "$", "this", "->", "string", ")", ";", "return", "$", "length", "-", "$", "this", "->", "getLength", "(", ")", ";", "}" ]
Unescapes this string by removing slashes. @access public @return int Number of removed slashes
[ "Unescapes", "this", "string", "by", "removing", "slashes", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L439-L444
37,056
CeusMedia/Common
src/ADT/String.php
ADT_String.wrap
public function wrap( $left = NULL, $right = NULL ) { $length = $this->getLength(); $this->string = (string) $left . $this->string . (string) $right; return $this->getLength() - $length; }
php
public function wrap( $left = NULL, $right = NULL ) { $length = $this->getLength(); $this->string = (string) $left . $this->string . (string) $right; return $this->getLength() - $length; }
[ "public", "function", "wrap", "(", "$", "left", "=", "NULL", ",", "$", "right", "=", "NULL", ")", "{", "$", "length", "=", "$", "this", "->", "getLength", "(", ")", ";", "$", "this", "->", "string", "=", "(", "string", ")", "$", "left", ".", "$", "this", "->", "string", ".", "(", "string", ")", "$", "right", ";", "return", "$", "this", "->", "getLength", "(", ")", "-", "$", "length", ";", "}" ]
Wraps this string into a left and a right string and returns number of added characters. @access public @param string $left String to add left @param string $right String to add right @return int Number of added characters
[ "Wraps", "this", "string", "into", "a", "left", "and", "a", "right", "string", "and", "returns", "number", "of", "added", "characters", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/String.php#L453-L458
37,057
theodorejb/peachy-sql
lib/Mysql/Options.php
Options.escapeIdentifier
public function escapeIdentifier(string $identifier): string { if ($identifier === '') { throw new \InvalidArgumentException('Identifier cannot be blank'); } $escaper = function ($identifier) { return '`' . str_replace('`', '``', $identifier) . '`'; }; $qualifiedIdentifiers = array_map($escaper, explode('.', $identifier)); return implode('.', $qualifiedIdentifiers); }
php
public function escapeIdentifier(string $identifier): string { if ($identifier === '') { throw new \InvalidArgumentException('Identifier cannot be blank'); } $escaper = function ($identifier) { return '`' . str_replace('`', '``', $identifier) . '`'; }; $qualifiedIdentifiers = array_map($escaper, explode('.', $identifier)); return implode('.', $qualifiedIdentifiers); }
[ "public", "function", "escapeIdentifier", "(", "string", "$", "identifier", ")", ":", "string", "{", "if", "(", "$", "identifier", "===", "''", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Identifier cannot be blank'", ")", ";", "}", "$", "escaper", "=", "function", "(", "$", "identifier", ")", "{", "return", "'`'", ".", "str_replace", "(", "'`'", ",", "'``'", ",", "$", "identifier", ")", ".", "'`'", ";", "}", ";", "$", "qualifiedIdentifiers", "=", "array_map", "(", "$", "escaper", ",", "explode", "(", "'.'", ",", "$", "identifier", ")", ")", ";", "return", "implode", "(", "'.'", ",", "$", "qualifiedIdentifiers", ")", ";", "}" ]
use backticks to delimit identifiers since not everyone uses ANSI mode
[ "use", "backticks", "to", "delimit", "identifiers", "since", "not", "everyone", "uses", "ANSI", "mode" ]
f179c6fa6c4293c2713b6b59022f3cfc90890a98
https://github.com/theodorejb/peachy-sql/blob/f179c6fa6c4293c2713b6b59022f3cfc90890a98/lib/Mysql/Options.php#L17-L26
37,058
CeusMedia/Common
src/FS/File/CSS/Writer.php
FS_File_CSS_Writer.save
static public function save( $fileName, ADT_CSS_Sheet $sheet ){ $css = FS_File_CSS_Converter::convertSheetToString( $sheet ); // return FS_File_Writer::save( $fileName, $css ); // }
php
static public function save( $fileName, ADT_CSS_Sheet $sheet ){ $css = FS_File_CSS_Converter::convertSheetToString( $sheet ); // return FS_File_Writer::save( $fileName, $css ); // }
[ "static", "public", "function", "save", "(", "$", "fileName", ",", "ADT_CSS_Sheet", "$", "sheet", ")", "{", "$", "css", "=", "FS_File_CSS_Converter", "::", "convertSheetToString", "(", "$", "sheet", ")", ";", "// ", "return", "FS_File_Writer", "::", "save", "(", "$", "fileName", ",", "$", "css", ")", ";", "// ", "}" ]
Save a sheet structure into a file statically. @access public @static @param string $fileName Relative or absolute file URI @param ADT_CSS_Sheet $sheet Sheet structure @return void
[ "Save", "a", "sheet", "structure", "into", "a", "file", "statically", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/CSS/Writer.php#L73-L76
37,059
CeusMedia/Common
src/FS/File/CSS/Writer.php
FS_File_CSS_Writer.write
public function write( ADT_CSS_Sheet $sheet ){ if( !$this->fileName ) throw new RuntimeException( 'No CSS file set yet' ); return self::save( $this->fileName, $sheet ); }
php
public function write( ADT_CSS_Sheet $sheet ){ if( !$this->fileName ) throw new RuntimeException( 'No CSS file set yet' ); return self::save( $this->fileName, $sheet ); }
[ "public", "function", "write", "(", "ADT_CSS_Sheet", "$", "sheet", ")", "{", "if", "(", "!", "$", "this", "->", "fileName", ")", "throw", "new", "RuntimeException", "(", "'No CSS file set yet'", ")", ";", "return", "self", "::", "save", "(", "$", "this", "->", "fileName", ",", "$", "sheet", ")", ";", "}" ]
Writes a sheet structure to the current CSS file. @access public @param ADT_CSS_Sheet $sheet Sheet structure @return void @throws RuntimeException if no CSS file is set, yet.
[ "Writes", "a", "sheet", "structure", "to", "the", "current", "CSS", "file", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/CSS/Writer.php#L95-L99
37,060
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.addAddress
public function addAddress( $streetAddress, $extendedAddress, $locality, $region, $postCode, $countryName, $postOfficeBox = NULL, $types = NULL ) { if( is_string( $types ) ) $types = explode( ",", $types ); $this->types['adr'][] = array( 'postOfficeBox' => $postOfficeBox, 'extendedAddress' => $extendedAddress, 'streetAddress' => $streetAddress, 'locality' => $locality, 'region' => $region, 'postCode' => $postCode, 'countryName' => $countryName, 'types' => $types, ); }
php
public function addAddress( $streetAddress, $extendedAddress, $locality, $region, $postCode, $countryName, $postOfficeBox = NULL, $types = NULL ) { if( is_string( $types ) ) $types = explode( ",", $types ); $this->types['adr'][] = array( 'postOfficeBox' => $postOfficeBox, 'extendedAddress' => $extendedAddress, 'streetAddress' => $streetAddress, 'locality' => $locality, 'region' => $region, 'postCode' => $postCode, 'countryName' => $countryName, 'types' => $types, ); }
[ "public", "function", "addAddress", "(", "$", "streetAddress", ",", "$", "extendedAddress", ",", "$", "locality", ",", "$", "region", ",", "$", "postCode", ",", "$", "countryName", ",", "$", "postOfficeBox", "=", "NULL", ",", "$", "types", "=", "NULL", ")", "{", "if", "(", "is_string", "(", "$", "types", ")", ")", "$", "types", "=", "explode", "(", "\",\"", ",", "$", "types", ")", ";", "$", "this", "->", "types", "[", "'adr'", "]", "[", "]", "=", "array", "(", "'postOfficeBox'", "=>", "$", "postOfficeBox", ",", "'extendedAddress'", "=>", "$", "extendedAddress", ",", "'streetAddress'", "=>", "$", "streetAddress", ",", "'locality'", "=>", "$", "locality", ",", "'region'", "=>", "$", "region", ",", "'postCode'", "=>", "$", "postCode", ",", "'countryName'", "=>", "$", "countryName", ",", "'types'", "=>", "$", "types", ",", ")", ";", "}" ]
Adds an Address. @access public @param string $streetAddress Street and Number @param string $extendedAddress ... @param string $locality City or Location @param string $region Region or State @param string $postCode Post Code @param string $countryName Country @param string $postOfficeBox Post Office Box ID @param array $types List of Address Types @return void
[ "Adds", "an", "Address", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L94-L108
37,061
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.addEmail
public function addEmail( $address, $types = NULL ) { if( is_string( $types ) ) $types = explode( ",", $types ); $this->types['email'][$address] = $types; }
php
public function addEmail( $address, $types = NULL ) { if( is_string( $types ) ) $types = explode( ",", $types ); $this->types['email'][$address] = $types; }
[ "public", "function", "addEmail", "(", "$", "address", ",", "$", "types", "=", "NULL", ")", "{", "if", "(", "is_string", "(", "$", "types", ")", ")", "$", "types", "=", "explode", "(", "\",\"", ",", "$", "types", ")", ";", "$", "this", "->", "types", "[", "'email'", "]", "[", "$", "address", "]", "=", "$", "types", ";", "}" ]
Adds an Email Address. @access public @param string $address Email Address @param array $types List of Address Types @return void
[ "Adds", "an", "Email", "Address", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L117-L122
37,062
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.addGeoTag
public function addGeoTag( $latitude, $longitude, $types = NULL ) { if( is_string( $types ) ) $types = explode( ",", $types ); $this->types['geo'][] = array( 'latitude' => $latitude, 'longitude' => $longitude, 'types' => $types, ); }
php
public function addGeoTag( $latitude, $longitude, $types = NULL ) { if( is_string( $types ) ) $types = explode( ",", $types ); $this->types['geo'][] = array( 'latitude' => $latitude, 'longitude' => $longitude, 'types' => $types, ); }
[ "public", "function", "addGeoTag", "(", "$", "latitude", ",", "$", "longitude", ",", "$", "types", "=", "NULL", ")", "{", "if", "(", "is_string", "(", "$", "types", ")", ")", "$", "types", "=", "explode", "(", "\",\"", ",", "$", "types", ")", ";", "$", "this", "->", "types", "[", "'geo'", "]", "[", "]", "=", "array", "(", "'latitude'", "=>", "$", "latitude", ",", "'longitude'", "=>", "$", "longitude", ",", "'types'", "=>", "$", "types", ",", ")", ";", "}" ]
Adds Geo Tags. @access public @param string $latitude Latitude @param string $longitude Longitude @param array $types List of Address Types @return void
[ "Adds", "Geo", "Tags", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L132-L141
37,063
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.addPhone
public function addPhone( $number, $types = NULL ) { if( is_string( $types ) ) $types = explode( ",", $types ); $this->types['tel'][$number] = $types; }
php
public function addPhone( $number, $types = NULL ) { if( is_string( $types ) ) $types = explode( ",", $types ); $this->types['tel'][$number] = $types; }
[ "public", "function", "addPhone", "(", "$", "number", ",", "$", "types", "=", "NULL", ")", "{", "if", "(", "is_string", "(", "$", "types", ")", ")", "$", "types", "=", "explode", "(", "\",\"", ",", "$", "types", ")", ";", "$", "this", "->", "types", "[", "'tel'", "]", "[", "$", "number", "]", "=", "$", "types", ";", "}" ]
Adds a Phone Number. @access public @param string $number Phone Number @param array $types List of Address Types @return void
[ "Adds", "a", "Phone", "Number", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L161-L166
37,064
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.addUrl
public function addUrl( $url, $types = NULL ) { if( is_string( $types ) ) $types = explode( ",", $types ); $this->types['url'][$url] = $types; }
php
public function addUrl( $url, $types = NULL ) { if( is_string( $types ) ) $types = explode( ",", $types ); $this->types['url'][$url] = $types; }
[ "public", "function", "addUrl", "(", "$", "url", ",", "$", "types", "=", "NULL", ")", "{", "if", "(", "is_string", "(", "$", "types", ")", ")", "$", "types", "=", "explode", "(", "\",\"", ",", "$", "types", ")", ";", "$", "this", "->", "types", "[", "'url'", "]", "[", "$", "url", "]", "=", "$", "types", ";", "}" ]
Adds an URL of a Website. @access public @param string $url Website URL @param array $types List of Address Types @return void
[ "Adds", "an", "URL", "of", "a", "Website", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L175-L180
37,065
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.fromJson
public function fromJson( $json ) { $this->__construct(); $data = json_decode( $json, TRUE ); foreach( $this->types as $key => $value ) if( isset( $data[$key] ) ) $this->types[$key] = $data[$key]; }
php
public function fromJson( $json ) { $this->__construct(); $data = json_decode( $json, TRUE ); foreach( $this->types as $key => $value ) if( isset( $data[$key] ) ) $this->types[$key] = $data[$key]; }
[ "public", "function", "fromJson", "(", "$", "json", ")", "{", "$", "this", "->", "__construct", "(", ")", ";", "$", "data", "=", "json_decode", "(", "$", "json", ",", "TRUE", ")", ";", "foreach", "(", "$", "this", "->", "types", "as", "$", "key", "=>", "$", "value", ")", "if", "(", "isset", "(", "$", "data", "[", "$", "key", "]", ")", ")", "$", "this", "->", "types", "[", "$", "key", "]", "=", "$", "data", "[", "$", "key", "]", ";", "}" ]
Imports VCard from JSON String. @access public @param string $json JSON String @return void
[ "Imports", "VCard", "from", "JSON", "String", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L200-L207
37,066
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.getNameField
public function getNameField( $key ) { if( !array_key_exists( $key, $this->types['n'] ) ) throw new InvalidArgumentException( 'Name Key "'.$key.'" is invalid.' ); return $this->types['n'][$key]; }
php
public function getNameField( $key ) { if( !array_key_exists( $key, $this->types['n'] ) ) throw new InvalidArgumentException( 'Name Key "'.$key.'" is invalid.' ); return $this->types['n'][$key]; }
[ "public", "function", "getNameField", "(", "$", "key", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "types", "[", "'n'", "]", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Name Key \"'", ".", "$", "key", ".", "'\" is invalid.'", ")", ";", "return", "$", "this", "->", "types", "[", "'n'", "]", "[", "$", "key", "]", ";", "}" ]
Returns a specific Name Field by its Key. @access public @param string $key Field Key @return string
[ "Returns", "a", "specific", "Name", "Field", "by", "its", "Key", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L267-L272
37,067
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.getOrganisationField
public function getOrganisationField( $key ) { if( !array_key_exists( $key, $this->types['org'] ) ) throw new InvalidArgumentException( 'Organisation Key "'.$key.'" is invalid.' ); return $this->types['org'][$key]; }
php
public function getOrganisationField( $key ) { if( !array_key_exists( $key, $this->types['org'] ) ) throw new InvalidArgumentException( 'Organisation Key "'.$key.'" is invalid.' ); return $this->types['org'][$key]; }
[ "public", "function", "getOrganisationField", "(", "$", "key", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "types", "[", "'org'", "]", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Organisation Key \"'", ".", "$", "key", ".", "'\" is invalid.'", ")", ";", "return", "$", "this", "->", "types", "[", "'org'", "]", "[", "$", "key", "]", ";", "}" ]
Returns a specific Organisation Field by its Key. @access public @param string $key Field Key @return string
[ "Returns", "a", "specific", "Organisation", "Field", "by", "its", "Key", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L300-L305
37,068
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.setName
public function setName( $familyName, $givenName, $additionalNames = NULL, $honorificPrefixes = NULL, $honorificSuffixes = NULL ) { $this->types['n'] = array( 'familyName' => $familyName, 'givenName' => $givenName, 'additionalNames' => $additionalNames, 'honorificPrefixes' => $honorificPrefixes, 'honorificSuffixes' => $honorificSuffixes, ); }
php
public function setName( $familyName, $givenName, $additionalNames = NULL, $honorificPrefixes = NULL, $honorificSuffixes = NULL ) { $this->types['n'] = array( 'familyName' => $familyName, 'givenName' => $givenName, 'additionalNames' => $additionalNames, 'honorificPrefixes' => $honorificPrefixes, 'honorificSuffixes' => $honorificSuffixes, ); }
[ "public", "function", "setName", "(", "$", "familyName", ",", "$", "givenName", ",", "$", "additionalNames", "=", "NULL", ",", "$", "honorificPrefixes", "=", "NULL", ",", "$", "honorificSuffixes", "=", "NULL", ")", "{", "$", "this", "->", "types", "[", "'n'", "]", "=", "array", "(", "'familyName'", "=>", "$", "familyName", ",", "'givenName'", "=>", "$", "givenName", ",", "'additionalNames'", "=>", "$", "additionalNames", ",", "'honorificPrefixes'", "=>", "$", "honorificPrefixes", ",", "'honorificSuffixes'", "=>", "$", "honorificSuffixes", ",", ")", ";", "}" ]
Sets Name with several Fields. @access public @param string $familyName Family Name @param string $givenName Given first Name @param string $additionalNames Further given Names @param string $honorificPrefixes Prefixes like Prof. Dr. @param string $honorificSuffixes Suffixes @return void
[ "Sets", "Name", "with", "several", "Fields", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L389-L398
37,069
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.toArray
public function toArray() { return array( 'address' => $this->types['adr'], 'email' => $this->types['email'], 'formatedName' => $this->types['fn'], 'geo' => $this->types['geo'], 'name' => $this->types['n'], 'nickname' => $this->types['nickname'], 'organisation' => $this->types['org'], 'role' => $this->types['role'], 'telephone' => $this->types['tel'], 'title' => $this->types['title'], 'url' => $this->types['url'], ); }
php
public function toArray() { return array( 'address' => $this->types['adr'], 'email' => $this->types['email'], 'formatedName' => $this->types['fn'], 'geo' => $this->types['geo'], 'name' => $this->types['n'], 'nickname' => $this->types['nickname'], 'organisation' => $this->types['org'], 'role' => $this->types['role'], 'telephone' => $this->types['tel'], 'title' => $this->types['title'], 'url' => $this->types['url'], ); }
[ "public", "function", "toArray", "(", ")", "{", "return", "array", "(", "'address'", "=>", "$", "this", "->", "types", "[", "'adr'", "]", ",", "'email'", "=>", "$", "this", "->", "types", "[", "'email'", "]", ",", "'formatedName'", "=>", "$", "this", "->", "types", "[", "'fn'", "]", ",", "'geo'", "=>", "$", "this", "->", "types", "[", "'geo'", "]", ",", "'name'", "=>", "$", "this", "->", "types", "[", "'n'", "]", ",", "'nickname'", "=>", "$", "this", "->", "types", "[", "'nickname'", "]", ",", "'organisation'", "=>", "$", "this", "->", "types", "[", "'org'", "]", ",", "'role'", "=>", "$", "this", "->", "types", "[", "'role'", "]", ",", "'telephone'", "=>", "$", "this", "->", "types", "[", "'tel'", "]", ",", "'title'", "=>", "$", "this", "->", "types", "[", "'title'", "]", ",", "'url'", "=>", "$", "this", "->", "types", "[", "'url'", "]", ",", ")", ";", "}" ]
Exports VCard to an Array. @access public @return string
[ "Exports", "VCard", "to", "an", "Array", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L442-L457
37,070
CeusMedia/Common
src/ADT/VCard.php
ADT_VCard.toString
public function toString( $charsetIn = NULL, $charsetOut = NULL ) { return FS_File_VCard_Builder::build( $this, $charsetIn, $charsetOut ); }
php
public function toString( $charsetIn = NULL, $charsetOut = NULL ) { return FS_File_VCard_Builder::build( $this, $charsetIn, $charsetOut ); }
[ "public", "function", "toString", "(", "$", "charsetIn", "=", "NULL", ",", "$", "charsetOut", "=", "NULL", ")", "{", "return", "FS_File_VCard_Builder", "::", "build", "(", "$", "this", ",", "$", "charsetIn", ",", "$", "charsetOut", ")", ";", "}" ]
Exports VCard to a String. @access public @param string $charsetIn Charset to convert from @param string $charsetOut Charset to convert to @return string
[ "Exports", "VCard", "to", "a", "String", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/VCard.php#L476-L479
37,071
CeusMedia/Common
src/CLI/ArgumentParser.php
CLI_ArgumentParser.addShortCut
public function addShortCut( $short, $long ) { if( !isset( $this->shortcuts[$short] ) ) $this->shortcuts[$short] = $long; else trigger_error( "Shortcut '".$short."' is already set", E_USER_ERROR ); }
php
public function addShortCut( $short, $long ) { if( !isset( $this->shortcuts[$short] ) ) $this->shortcuts[$short] = $long; else trigger_error( "Shortcut '".$short."' is already set", E_USER_ERROR ); }
[ "public", "function", "addShortCut", "(", "$", "short", ",", "$", "long", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "shortcuts", "[", "$", "short", "]", ")", ")", "$", "this", "->", "shortcuts", "[", "$", "short", "]", "=", "$", "long", ";", "else", "trigger_error", "(", "\"Shortcut '\"", ".", "$", "short", ".", "\"' is already set\"", ",", "E_USER_ERROR", ")", ";", "}" ]
Adds Shortcut. @access public @param string $short Key of Shortcut @param string $long Long form of Shortcut @return void
[ "Adds", "Shortcut", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/CLI/ArgumentParser.php#L52-L58
37,072
CeusMedia/Common
src/CLI/ArgumentParser.php
CLI_ArgumentParser.parseArguments
public function parseArguments( $fallBackOnEmptyPair = FALSE ) { $request = new CLI_RequestReceiver( $fallBackOnEmptyPair ); $arguments = $request->getAll(); $commands = array(); $parameters = array(); foreach( $request->getAll() as $key => $value ){ if( is_numeric( $key ) ) $commands[] = $value; else $parameters[$key] = $value; } $script = array_shift( $commands ); $list = array(); foreach( $parameters as $key => $value ){ $reverse = array_flip( $this->shortcuts ); if( in_array( $key, array_keys( $this->shortcuts ) ) ) $key = $this->shortcuts[$key]; $list[$key] = $value; } # $this->set( "__file", __FILE__ ); # $this->set( "__class", get_class( $this ) ); $this->set( "path", getCwd() ); $this->set( "script", $script ); $this->set( "commands", $commands ); $this->set( "parameters", $list ); }
php
public function parseArguments( $fallBackOnEmptyPair = FALSE ) { $request = new CLI_RequestReceiver( $fallBackOnEmptyPair ); $arguments = $request->getAll(); $commands = array(); $parameters = array(); foreach( $request->getAll() as $key => $value ){ if( is_numeric( $key ) ) $commands[] = $value; else $parameters[$key] = $value; } $script = array_shift( $commands ); $list = array(); foreach( $parameters as $key => $value ){ $reverse = array_flip( $this->shortcuts ); if( in_array( $key, array_keys( $this->shortcuts ) ) ) $key = $this->shortcuts[$key]; $list[$key] = $value; } # $this->set( "__file", __FILE__ ); # $this->set( "__class", get_class( $this ) ); $this->set( "path", getCwd() ); $this->set( "script", $script ); $this->set( "commands", $commands ); $this->set( "parameters", $list ); }
[ "public", "function", "parseArguments", "(", "$", "fallBackOnEmptyPair", "=", "FALSE", ")", "{", "$", "request", "=", "new", "CLI_RequestReceiver", "(", "$", "fallBackOnEmptyPair", ")", ";", "$", "arguments", "=", "$", "request", "->", "getAll", "(", ")", ";", "$", "commands", "=", "array", "(", ")", ";", "$", "parameters", "=", "array", "(", ")", ";", "foreach", "(", "$", "request", "->", "getAll", "(", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_numeric", "(", "$", "key", ")", ")", "$", "commands", "[", "]", "=", "$", "value", ";", "else", "$", "parameters", "[", "$", "key", "]", "=", "$", "value", ";", "}", "$", "script", "=", "array_shift", "(", "$", "commands", ")", ";", "$", "list", "=", "array", "(", ")", ";", "foreach", "(", "$", "parameters", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "reverse", "=", "array_flip", "(", "$", "this", "->", "shortcuts", ")", ";", "if", "(", "in_array", "(", "$", "key", ",", "array_keys", "(", "$", "this", "->", "shortcuts", ")", ")", ")", "$", "key", "=", "$", "this", "->", "shortcuts", "[", "$", "key", "]", ";", "$", "list", "[", "$", "key", "]", "=", "$", "value", ";", "}", "#\t\t$this->set( \"__file\", __FILE__ );\r", "#\t\t$this->set( \"__class\", get_class( $this ) );\r", "$", "this", "->", "set", "(", "\"path\"", ",", "getCwd", "(", ")", ")", ";", "$", "this", "->", "set", "(", "\"script\"", ",", "$", "script", ")", ";", "$", "this", "->", "set", "(", "\"commands\"", ",", "$", "commands", ")", ";", "$", "this", "->", "set", "(", "\"parameters\"", ",", "$", "list", ")", ";", "}" ]
Parses Arguments of called Script. @access public @return void
[ "Parses", "Arguments", "of", "called", "Script", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/CLI/ArgumentParser.php#L65-L91
37,073
CeusMedia/Common
src/CLI/Server/Cron/Job.php
CLI_Server_Cron_Job.checkMaturity
protected function checkMaturity() { $time = time(); $c_minute = date( "i", $time ); $c_hour = date( "H", $time ); $c_day = date( "d", $time ); $c_month = date( "m", $time ); $c_weekday = date( "w", $time ); $j_minute = (array) $this->getOption( 'minute' ); $j_hour = (array) $this->getOption( 'hour' ); $j_day = (array) $this->getOption( 'day' ); $j_month = (array) $this->getOption( 'month' ); $j_weekday = (array) $this->getOption( 'weekday' ); if( $j_weekday[0] == "*" || in_array( $c_weekday, $j_weekday ) ) if( $j_month[0] == "*" || in_array( $c_month, $j_month ) ) if( $j_day[0] == "*" || in_array( $c_day, $j_day ) ) if( $j_hour[0] == "*" || in_array( $c_hour, $j_hour ) ) if( $j_minute[0] == "*" || in_array( $c_minute, $j_minute ) ) return true; return false; }
php
protected function checkMaturity() { $time = time(); $c_minute = date( "i", $time ); $c_hour = date( "H", $time ); $c_day = date( "d", $time ); $c_month = date( "m", $time ); $c_weekday = date( "w", $time ); $j_minute = (array) $this->getOption( 'minute' ); $j_hour = (array) $this->getOption( 'hour' ); $j_day = (array) $this->getOption( 'day' ); $j_month = (array) $this->getOption( 'month' ); $j_weekday = (array) $this->getOption( 'weekday' ); if( $j_weekday[0] == "*" || in_array( $c_weekday, $j_weekday ) ) if( $j_month[0] == "*" || in_array( $c_month, $j_month ) ) if( $j_day[0] == "*" || in_array( $c_day, $j_day ) ) if( $j_hour[0] == "*" || in_array( $c_hour, $j_hour ) ) if( $j_minute[0] == "*" || in_array( $c_minute, $j_minute ) ) return true; return false; }
[ "protected", "function", "checkMaturity", "(", ")", "{", "$", "time", "=", "time", "(", ")", ";", "$", "c_minute", "=", "date", "(", "\"i\"", ",", "$", "time", ")", ";", "$", "c_hour", "=", "date", "(", "\"H\"", ",", "$", "time", ")", ";", "$", "c_day", "=", "date", "(", "\"d\"", ",", "$", "time", ")", ";", "$", "c_month", "=", "date", "(", "\"m\"", ",", "$", "time", ")", ";", "$", "c_weekday", "=", "date", "(", "\"w\"", ",", "$", "time", ")", ";", "$", "j_minute", "=", "(", "array", ")", "$", "this", "->", "getOption", "(", "'minute'", ")", ";", "$", "j_hour", "=", "(", "array", ")", "$", "this", "->", "getOption", "(", "'hour'", ")", ";", "$", "j_day", "=", "(", "array", ")", "$", "this", "->", "getOption", "(", "'day'", ")", ";", "$", "j_month", "=", "(", "array", ")", "$", "this", "->", "getOption", "(", "'month'", ")", ";", "$", "j_weekday", "=", "(", "array", ")", "$", "this", "->", "getOption", "(", "'weekday'", ")", ";", "if", "(", "$", "j_weekday", "[", "0", "]", "==", "\"*\"", "||", "in_array", "(", "$", "c_weekday", ",", "$", "j_weekday", ")", ")", "if", "(", "$", "j_month", "[", "0", "]", "==", "\"*\"", "||", "in_array", "(", "$", "c_month", ",", "$", "j_month", ")", ")", "if", "(", "$", "j_day", "[", "0", "]", "==", "\"*\"", "||", "in_array", "(", "$", "c_day", ",", "$", "j_day", ")", ")", "if", "(", "$", "j_hour", "[", "0", "]", "==", "\"*\"", "||", "in_array", "(", "$", "c_hour", ",", "$", "j_hour", ")", ")", "if", "(", "$", "j_minute", "[", "0", "]", "==", "\"*\"", "||", "in_array", "(", "$", "c_minute", ",", "$", "j_minute", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
Indicates whether this job is mature. @access protected @return bool
[ "Indicates", "whether", "this", "job", "is", "mature", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/CLI/Server/Cron/Job.php#L59-L80
37,074
ncou/Chiron
src/Chiron/Http/Middleware/RequestIdMiddleware.php
RequestIdMiddleware.process
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $uuid = $request->getHeader(self::HEADER_NAME); // generate an "unique user id" if not already present. if (empty($uuid)) { $uuid = $this->uuid(); $request = $request->withHeader(self::HEADER_NAME, $uuid); } $response = $handler->handle($request); // persist the unique id in the response header list. $response = $response->withHeader(self::HEADER_NAME, $uuid); return $response; }
php
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $uuid = $request->getHeader(self::HEADER_NAME); // generate an "unique user id" if not already present. if (empty($uuid)) { $uuid = $this->uuid(); $request = $request->withHeader(self::HEADER_NAME, $uuid); } $response = $handler->handle($request); // persist the unique id in the response header list. $response = $response->withHeader(self::HEADER_NAME, $uuid); return $response; }
[ "public", "function", "process", "(", "ServerRequestInterface", "$", "request", ",", "RequestHandlerInterface", "$", "handler", ")", ":", "ResponseInterface", "{", "$", "uuid", "=", "$", "request", "->", "getHeader", "(", "self", "::", "HEADER_NAME", ")", ";", "// generate an \"unique user id\" if not already present.", "if", "(", "empty", "(", "$", "uuid", ")", ")", "{", "$", "uuid", "=", "$", "this", "->", "uuid", "(", ")", ";", "$", "request", "=", "$", "request", "->", "withHeader", "(", "self", "::", "HEADER_NAME", ",", "$", "uuid", ")", ";", "}", "$", "response", "=", "$", "handler", "->", "handle", "(", "$", "request", ")", ";", "// persist the unique id in the response header list.", "$", "response", "=", "$", "response", "->", "withHeader", "(", "self", "::", "HEADER_NAME", ",", "$", "uuid", ")", ";", "return", "$", "response", ";", "}" ]
Add a unique ID for each HTTP request. @param ServerRequestInterface $request request @param RequestHandlerInterface $handler @return object ResponseInterface
[ "Add", "a", "unique", "ID", "for", "each", "HTTP", "request", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Middleware/RequestIdMiddleware.php#L27-L43
37,075
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.where
public function where($expr, $value = true){ if((is_array($expr) || $expr instanceof Traversable) && $value === true){ foreach($expr as $key => $val) $this->where($key, $val); return $this; } if($this->validateConditions()) return $this; $this->resetState(); // Simple format if(strpos($expr, '%') === false){ $field = trim($expr); $this->conditions[] = array( 'simple' => true, 'field' => $field, 'value' => $value, 'glue' => 'AND' ); if($value instanceof self) $this->subqueries[] = $value; return $this; } // Format with modifiers $args = func_get_args(); array_shift($args); preg_match_all('~%(bin|sub|b|i|f|s|d|a|l)?~i', $expr, $matches); $this->conditions[] = array( 'simple' => false, 'expr' => $expr, 'modifiers' => $matches[0], 'types' => $matches[1], 'values' => $args, 'glue' => 'AND' ); foreach($args as $arg){ if($arg instanceof self) $this->subqueries[] = $arg; } return $this; }
php
public function where($expr, $value = true){ if((is_array($expr) || $expr instanceof Traversable) && $value === true){ foreach($expr as $key => $val) $this->where($key, $val); return $this; } if($this->validateConditions()) return $this; $this->resetState(); // Simple format if(strpos($expr, '%') === false){ $field = trim($expr); $this->conditions[] = array( 'simple' => true, 'field' => $field, 'value' => $value, 'glue' => 'AND' ); if($value instanceof self) $this->subqueries[] = $value; return $this; } // Format with modifiers $args = func_get_args(); array_shift($args); preg_match_all('~%(bin|sub|b|i|f|s|d|a|l)?~i', $expr, $matches); $this->conditions[] = array( 'simple' => false, 'expr' => $expr, 'modifiers' => $matches[0], 'types' => $matches[1], 'values' => $args, 'glue' => 'AND' ); foreach($args as $arg){ if($arg instanceof self) $this->subqueries[] = $arg; } return $this; }
[ "public", "function", "where", "(", "$", "expr", ",", "$", "value", "=", "true", ")", "{", "if", "(", "(", "is_array", "(", "$", "expr", ")", "||", "$", "expr", "instanceof", "Traversable", ")", "&&", "$", "value", "===", "true", ")", "{", "foreach", "(", "$", "expr", "as", "$", "key", "=>", "$", "val", ")", "$", "this", "->", "where", "(", "$", "key", ",", "$", "val", ")", ";", "return", "$", "this", ";", "}", "if", "(", "$", "this", "->", "validateConditions", "(", ")", ")", "return", "$", "this", ";", "$", "this", "->", "resetState", "(", ")", ";", "// Simple format", "if", "(", "strpos", "(", "$", "expr", ",", "'%'", ")", "===", "false", ")", "{", "$", "field", "=", "trim", "(", "$", "expr", ")", ";", "$", "this", "->", "conditions", "[", "]", "=", "array", "(", "'simple'", "=>", "true", ",", "'field'", "=>", "$", "field", ",", "'value'", "=>", "$", "value", ",", "'glue'", "=>", "'AND'", ")", ";", "if", "(", "$", "value", "instanceof", "self", ")", "$", "this", "->", "subqueries", "[", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}", "// Format with modifiers", "$", "args", "=", "func_get_args", "(", ")", ";", "array_shift", "(", "$", "args", ")", ";", "preg_match_all", "(", "'~%(bin|sub|b|i|f|s|d|a|l)?~i'", ",", "$", "expr", ",", "$", "matches", ")", ";", "$", "this", "->", "conditions", "[", "]", "=", "array", "(", "'simple'", "=>", "false", ",", "'expr'", "=>", "$", "expr", ",", "'modifiers'", "=>", "$", "matches", "[", "0", "]", ",", "'types'", "=>", "$", "matches", "[", "1", "]", ",", "'values'", "=>", "$", "args", ",", "'glue'", "=>", "'AND'", ")", ";", "foreach", "(", "$", "args", "as", "$", "arg", ")", "{", "if", "(", "$", "arg", "instanceof", "self", ")", "$", "this", "->", "subqueries", "[", "]", "=", "$", "arg", ";", "}", "return", "$", "this", ";", "}" ]
Sets WHERE condition. Accepts infinite arguments. More calls append conditions with 'AND' operator. Conditions can also be specified by calling and() / or() methods the same way as where(). Corresponding operator will be used. Accepts associative array in field => value form. @param string|array|Traversable $expr @param mixed $value @return BaseStatement fluent interface
[ "Sets", "WHERE", "condition", ".", "Accepts", "infinite", "arguments", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L162-L204
37,076
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.order
public function order($rule, $order = null){ if($this->validateConditions()) return $this; $this->resetState(); if(is_array($rule) || $rule instanceof Traversable){ foreach($rule as $key => $val){ $this->order($key, $val); } return $this; } $this->sorting[] = array($rule, $order); return $this; }
php
public function order($rule, $order = null){ if($this->validateConditions()) return $this; $this->resetState(); if(is_array($rule) || $rule instanceof Traversable){ foreach($rule as $key => $val){ $this->order($key, $val); } return $this; } $this->sorting[] = array($rule, $order); return $this; }
[ "public", "function", "order", "(", "$", "rule", ",", "$", "order", "=", "null", ")", "{", "if", "(", "$", "this", "->", "validateConditions", "(", ")", ")", "return", "$", "this", ";", "$", "this", "->", "resetState", "(", ")", ";", "if", "(", "is_array", "(", "$", "rule", ")", "||", "$", "rule", "instanceof", "Traversable", ")", "{", "foreach", "(", "$", "rule", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "this", "->", "order", "(", "$", "key", ",", "$", "val", ")", ";", "}", "return", "$", "this", ";", "}", "$", "this", "->", "sorting", "[", "]", "=", "array", "(", "$", "rule", ",", "$", "order", ")", ";", "return", "$", "this", ";", "}" ]
Defines order. More calls append rules. @param string|array|Traversable $rule @param string $order Use constants - Manager::ASC, Manager::DESC @return BaseStatement fluent interface
[ "Defines", "order", ".", "More", "calls", "append", "rules", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L213-L228
37,077
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.limit
public function limit($limit, $offset = null){ if($this->validateConditions()) return $this; $this->resetState(); $this->limit = array($limit, ($offset !== null && $this->type === Manager::STMT_SELECT) ? $offset : null); return $this; }
php
public function limit($limit, $offset = null){ if($this->validateConditions()) return $this; $this->resetState(); $this->limit = array($limit, ($offset !== null && $this->type === Manager::STMT_SELECT) ? $offset : null); return $this; }
[ "public", "function", "limit", "(", "$", "limit", ",", "$", "offset", "=", "null", ")", "{", "if", "(", "$", "this", "->", "validateConditions", "(", ")", ")", "return", "$", "this", ";", "$", "this", "->", "resetState", "(", ")", ";", "$", "this", "->", "limit", "=", "array", "(", "$", "limit", ",", "(", "$", "offset", "!==", "null", "&&", "$", "this", "->", "type", "===", "Manager", "::", "STMT_SELECT", ")", "?", "$", "offset", ":", "null", ")", ";", "return", "$", "this", ";", "}" ]
Sets LIMIT and OFFSET clauses. @param int $limit @param int $offset @return BaseStatement fluent interface
[ "Sets", "LIMIT", "and", "OFFSET", "clauses", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L237-L245
37,078
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.rand
public function rand(){ if($this->validateConditions()) return $this; $this->resetState(); $this->connection->getDriver()->randomizeOrder($this); return $this; }
php
public function rand(){ if($this->validateConditions()) return $this; $this->resetState(); $this->connection->getDriver()->randomizeOrder($this); return $this; }
[ "public", "function", "rand", "(", ")", "{", "if", "(", "$", "this", "->", "validateConditions", "(", ")", ")", "return", "$", "this", ";", "$", "this", "->", "resetState", "(", ")", ";", "$", "this", "->", "connection", "->", "getDriver", "(", ")", "->", "randomizeOrder", "(", "$", "this", ")", ";", "return", "$", "this", ";", "}" ]
Randomizes order. Removes any other order clause. @return BaseStatement fluent interface
[ "Randomizes", "order", ".", "Removes", "any", "other", "order", "clause", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L252-L259
37,079
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.dump
public function dump($return = false){ $sql = PHP_SAPI === 'cli' ? preg_replace('/\s+/', ' ', $this->parse()) . "\n" : Manager::highlightSql($this->parse()); if(!$return) echo $sql; return $return ? $sql : $this; }
php
public function dump($return = false){ $sql = PHP_SAPI === 'cli' ? preg_replace('/\s+/', ' ', $this->parse()) . "\n" : Manager::highlightSql($this->parse()); if(!$return) echo $sql; return $return ? $sql : $this; }
[ "public", "function", "dump", "(", "$", "return", "=", "false", ")", "{", "$", "sql", "=", "PHP_SAPI", "===", "'cli'", "?", "preg_replace", "(", "'/\\s+/'", ",", "' '", ",", "$", "this", "->", "parse", "(", ")", ")", ".", "\"\\n\"", ":", "Manager", "::", "highlightSql", "(", "$", "this", "->", "parse", "(", ")", ")", ";", "if", "(", "!", "$", "return", ")", "echo", "$", "sql", ";", "return", "$", "return", "?", "$", "sql", ":", "$", "this", ";", "}" ]
Prints out syntax highlighted statement. @param bool $return @return string|BaseStatement fluent interface
[ "Prints", "out", "syntax", "highlighted", "statement", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L267-L274
37,080
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.run
public function run(){ if(!$this->performed) $start = microtime(true); try{ $query = $this->performed ? $this->resultSet : $this->connection->getDriver()->runQuery(preg_replace('/\s+/', ' ', $this->parse())); } catch(DriverException $e){ throw new NeevoException('Query failed. ' . $e->getMessage(), $e->getCode(), $e->getSql(), $e); } if(!$this->performed) $this->time = microtime(true) - $start; $this->performed = true; $this->resultSet = $query; $this->notifyObservers(isset($this->type) ? self::$eventTable[$this->type] : ObserverInterface::QUERY); return $query; }
php
public function run(){ if(!$this->performed) $start = microtime(true); try{ $query = $this->performed ? $this->resultSet : $this->connection->getDriver()->runQuery(preg_replace('/\s+/', ' ', $this->parse())); } catch(DriverException $e){ throw new NeevoException('Query failed. ' . $e->getMessage(), $e->getCode(), $e->getSql(), $e); } if(!$this->performed) $this->time = microtime(true) - $start; $this->performed = true; $this->resultSet = $query; $this->notifyObservers(isset($this->type) ? self::$eventTable[$this->type] : ObserverInterface::QUERY); return $query; }
[ "public", "function", "run", "(", ")", "{", "if", "(", "!", "$", "this", "->", "performed", ")", "$", "start", "=", "microtime", "(", "true", ")", ";", "try", "{", "$", "query", "=", "$", "this", "->", "performed", "?", "$", "this", "->", "resultSet", ":", "$", "this", "->", "connection", "->", "getDriver", "(", ")", "->", "runQuery", "(", "preg_replace", "(", "'/\\s+/'", ",", "' '", ",", "$", "this", "->", "parse", "(", ")", ")", ")", ";", "}", "catch", "(", "DriverException", "$", "e", ")", "{", "throw", "new", "NeevoException", "(", "'Query failed. '", ".", "$", "e", "->", "getMessage", "(", ")", ",", "$", "e", "->", "getCode", "(", ")", ",", "$", "e", "->", "getSql", "(", ")", ",", "$", "e", ")", ";", "}", "if", "(", "!", "$", "this", "->", "performed", ")", "$", "this", "->", "time", "=", "microtime", "(", "true", ")", "-", "$", "start", ";", "$", "this", "->", "performed", "=", "true", ";", "$", "this", "->", "resultSet", "=", "$", "query", ";", "$", "this", "->", "notifyObservers", "(", "isset", "(", "$", "this", "->", "type", ")", "?", "self", "::", "$", "eventTable", "[", "$", "this", "->", "type", "]", ":", "ObserverInterface", "::", "QUERY", ")", ";", "return", "$", "query", ";", "}" ]
Performs the statement. @return resource|bool
[ "Performs", "the", "statement", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L281-L303
37,081
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.parse
public function parse(){ if($this->hasCircularReferences($this)) throw new RuntimeException('Circular reference found in the query tree, cannot parse the query.'); $this->connection->connect(); $parser = $this->connection->getParser(); $instance = new $parser($this); return $instance->parse(); }
php
public function parse(){ if($this->hasCircularReferences($this)) throw new RuntimeException('Circular reference found in the query tree, cannot parse the query.'); $this->connection->connect(); $parser = $this->connection->getParser(); $instance = new $parser($this); return $instance->parse(); }
[ "public", "function", "parse", "(", ")", "{", "if", "(", "$", "this", "->", "hasCircularReferences", "(", "$", "this", ")", ")", "throw", "new", "RuntimeException", "(", "'Circular reference found in the query tree, cannot parse the query.'", ")", ";", "$", "this", "->", "connection", "->", "connect", "(", ")", ";", "$", "parser", "=", "$", "this", "->", "connection", "->", "getParser", "(", ")", ";", "$", "instance", "=", "new", "$", "parser", "(", "$", "this", ")", ";", "return", "$", "instance", "->", "parse", "(", ")", ";", "}" ]
Builds the SQL statement from the instance. @return string The SQL statement @internal
[ "Builds", "the", "SQL", "statement", "from", "the", "instance", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L320-L329
37,082
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.getPrimaryKey
public function getPrimaryKey(){ $table = $this->getTable(); if(!$table) return null; $key = null; $cached = $this->connection->getCache()->fetch($table . '_primaryKey'); if($cached === null){ try{ $key = $this->connection->getDriver() ->getPrimaryKey($table, isset($this->resultSet) ? $this->resultSet : null); } catch(NeevoException $e){ return null; } $this->connection->getCache()->store($table . '_primaryKey', $key); return $key === '' ? null : $key; } return $cached === '' ? null : $cached; }
php
public function getPrimaryKey(){ $table = $this->getTable(); if(!$table) return null; $key = null; $cached = $this->connection->getCache()->fetch($table . '_primaryKey'); if($cached === null){ try{ $key = $this->connection->getDriver() ->getPrimaryKey($table, isset($this->resultSet) ? $this->resultSet : null); } catch(NeevoException $e){ return null; } $this->connection->getCache()->store($table . '_primaryKey', $key); return $key === '' ? null : $key; } return $cached === '' ? null : $cached; }
[ "public", "function", "getPrimaryKey", "(", ")", "{", "$", "table", "=", "$", "this", "->", "getTable", "(", ")", ";", "if", "(", "!", "$", "table", ")", "return", "null", ";", "$", "key", "=", "null", ";", "$", "cached", "=", "$", "this", "->", "connection", "->", "getCache", "(", ")", "->", "fetch", "(", "$", "table", ".", "'_primaryKey'", ")", ";", "if", "(", "$", "cached", "===", "null", ")", "{", "try", "{", "$", "key", "=", "$", "this", "->", "connection", "->", "getDriver", "(", ")", "->", "getPrimaryKey", "(", "$", "table", ",", "isset", "(", "$", "this", "->", "resultSet", ")", "?", "$", "this", "->", "resultSet", ":", "null", ")", ";", "}", "catch", "(", "NeevoException", "$", "e", ")", "{", "return", "null", ";", "}", "$", "this", "->", "connection", "->", "getCache", "(", ")", "->", "store", "(", "$", "table", ".", "'_primaryKey'", ",", "$", "key", ")", ";", "return", "$", "key", "===", "''", "?", "null", ":", "$", "key", ";", "}", "return", "$", "cached", "===", "''", "?", "null", ":", "$", "cached", ";", "}" ]
Returns the name of the PRIMARY KEY column. @return string|null
[ "Returns", "the", "name", "of", "the", "PRIMARY", "KEY", "column", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L432-L450
37,083
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.resetState
protected function resetState(){ $this->performed = false; $this->resultSet = null; $this->time = null; }
php
protected function resetState(){ $this->performed = false; $this->resultSet = null; $this->time = null; }
[ "protected", "function", "resetState", "(", ")", "{", "$", "this", "->", "performed", "=", "false", ";", "$", "this", "->", "resultSet", "=", "null", ";", "$", "this", "->", "time", "=", "null", ";", "}" ]
Resets the state of the statement.
[ "Resets", "the", "state", "of", "the", "statement", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L465-L469
37,084
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.validateConditions
protected function validateConditions(){ if(empty($this->stmtConditions)) return false; foreach($this->stmtConditions as $cond){ if($cond) continue; else return true; } return false; }
php
protected function validateConditions(){ if(empty($this->stmtConditions)) return false; foreach($this->stmtConditions as $cond){ if($cond) continue; else return true; } return false; }
[ "protected", "function", "validateConditions", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "stmtConditions", ")", ")", "return", "false", ";", "foreach", "(", "$", "this", "->", "stmtConditions", "as", "$", "cond", ")", "{", "if", "(", "$", "cond", ")", "continue", ";", "else", "return", "true", ";", "}", "return", "false", ";", "}" ]
Validates the current statement condition. @return bool
[ "Validates", "the", "current", "statement", "condition", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L476-L484
37,085
smasty/Neevo
src/Neevo/BaseStatement.php
BaseStatement.hasCircularReferences
protected function hasCircularReferences($parent, $visited = array()){ foreach($parent->subqueries as $child){ if(isset($visited[spl_object_hash($child)])) return true; $visited[spl_object_hash($child)] = true; if($this->hasCircularReferences($child, $visited)) return true; array_pop($visited); } return false; }
php
protected function hasCircularReferences($parent, $visited = array()){ foreach($parent->subqueries as $child){ if(isset($visited[spl_object_hash($child)])) return true; $visited[spl_object_hash($child)] = true; if($this->hasCircularReferences($child, $visited)) return true; array_pop($visited); } return false; }
[ "protected", "function", "hasCircularReferences", "(", "$", "parent", ",", "$", "visited", "=", "array", "(", ")", ")", "{", "foreach", "(", "$", "parent", "->", "subqueries", "as", "$", "child", ")", "{", "if", "(", "isset", "(", "$", "visited", "[", "spl_object_hash", "(", "$", "child", ")", "]", ")", ")", "return", "true", ";", "$", "visited", "[", "spl_object_hash", "(", "$", "child", ")", "]", "=", "true", ";", "if", "(", "$", "this", "->", "hasCircularReferences", "(", "$", "child", ",", "$", "visited", ")", ")", "return", "true", ";", "array_pop", "(", "$", "visited", ")", ";", "}", "return", "false", ";", "}" ]
Checks the query tree for circular references. @param BaseStatement $parent @param array $visited @return bool True if circular reference found.
[ "Checks", "the", "query", "tree", "for", "circular", "references", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/BaseStatement.php#L493-L503
37,086
ncou/Chiron
src/Chiron/Handler/Formatter/PlainTextFormatter.php
PlainTextFormatter.format
public function format(ServerRequestInterface $request, Throwable $e): string { // This class doesn't show debug information, so by default we hide the php exception behind a neutral http 500 error. if (! $e instanceof HttpException) { $e = new \Chiron\Http\Exception\Server\InternalServerErrorHttpException(); } return trim($this->arrayToPlainText($e->toArray())); }
php
public function format(ServerRequestInterface $request, Throwable $e): string { // This class doesn't show debug information, so by default we hide the php exception behind a neutral http 500 error. if (! $e instanceof HttpException) { $e = new \Chiron\Http\Exception\Server\InternalServerErrorHttpException(); } return trim($this->arrayToPlainText($e->toArray())); }
[ "public", "function", "format", "(", "ServerRequestInterface", "$", "request", ",", "Throwable", "$", "e", ")", ":", "string", "{", "// This class doesn't show debug information, so by default we hide the php exception behind a neutral http 500 error.", "if", "(", "!", "$", "e", "instanceof", "HttpException", ")", "{", "$", "e", "=", "new", "\\", "Chiron", "\\", "Http", "\\", "Exception", "\\", "Server", "\\", "InternalServerErrorHttpException", "(", ")", ";", "}", "return", "trim", "(", "$", "this", "->", "arrayToPlainText", "(", "$", "e", "->", "toArray", "(", ")", ")", ")", ";", "}" ]
Render Plain-Text error. @param \Throwable $e @return string
[ "Render", "Plain", "-", "Text", "error", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Handler/Formatter/PlainTextFormatter.php#L20-L28
37,087
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.getConfigValue
public static function getConfigValue( $config, $key, $default = NULL ) { if( !isset( $config[$key] ) ) return $default; $value = trim( $config[$key] ); if( preg_match( '/^[A-Z_]+$/', $value ) ) $value = constant( $value ); else if( preg_match( '/^[0-9]+$/', $value ) ) $value = (int) $value; else if( preg_match( '/^[0-9.]+$/', $value ) ) $value = (real) $value; else if( empty( $value ) ) return $default; return $value; }
php
public static function getConfigValue( $config, $key, $default = NULL ) { if( !isset( $config[$key] ) ) return $default; $value = trim( $config[$key] ); if( preg_match( '/^[A-Z_]+$/', $value ) ) $value = constant( $value ); else if( preg_match( '/^[0-9]+$/', $value ) ) $value = (int) $value; else if( preg_match( '/^[0-9.]+$/', $value ) ) $value = (real) $value; else if( empty( $value ) ) return $default; return $value; }
[ "public", "static", "function", "getConfigValue", "(", "$", "config", ",", "$", "key", ",", "$", "default", "=", "NULL", ")", "{", "if", "(", "!", "isset", "(", "$", "config", "[", "$", "key", "]", ")", ")", "return", "$", "default", ";", "$", "value", "=", "trim", "(", "$", "config", "[", "$", "key", "]", ")", ";", "if", "(", "preg_match", "(", "'/^[A-Z_]+$/'", ",", "$", "value", ")", ")", "$", "value", "=", "constant", "(", "$", "value", ")", ";", "else", "if", "(", "preg_match", "(", "'/^[0-9]+$/'", ",", "$", "value", ")", ")", "$", "value", "=", "(", "int", ")", "$", "value", ";", "else", "if", "(", "preg_match", "(", "'/^[0-9.]+$/'", ",", "$", "value", ")", ")", "$", "value", "=", "(", "real", ")", "$", "value", ";", "else", "if", "(", "empty", "(", "$", "value", ")", ")", "return", "$", "default", ";", "return", "$", "value", ";", "}" ]
Returns the interpreted Value of a Configuration Parameter. @access public @static @param array $config Configuration Data @param string $key Parameter Key @param mixed $default Default Value to set if empty or not set @return mixed
[ "Returns", "the", "interpreted", "Value", "of", "a", "Configuration", "Parameter", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L51-L65
37,088
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.getSubConfig
public static function getSubConfig( $config, $prefix ) { $data = array(); $length = strlen( $prefix ); foreach( $config as $key => $value ) if( substr( $key, 0, $length ) == $prefix ) $data[substr( $key, $length )] = $value; return $data; }
php
public static function getSubConfig( $config, $prefix ) { $data = array(); $length = strlen( $prefix ); foreach( $config as $key => $value ) if( substr( $key, 0, $length ) == $prefix ) $data[substr( $key, $length )] = $value; return $data; }
[ "public", "static", "function", "getSubConfig", "(", "$", "config", ",", "$", "prefix", ")", "{", "$", "data", "=", "array", "(", ")", ";", "$", "length", "=", "strlen", "(", "$", "prefix", ")", ";", "foreach", "(", "$", "config", "as", "$", "key", "=>", "$", "value", ")", "if", "(", "substr", "(", "$", "key", ",", "0", ",", "$", "length", ")", "==", "$", "prefix", ")", "$", "data", "[", "substr", "(", "$", "key", ",", "$", "length", ")", "]", "=", "$", "value", ";", "return", "$", "data", ";", "}" ]
Returns a Configuration Subset with a Prefix @access protected @static @param array $config Configuration Data @param string $prefix Parameter Prefix, must end mit a Point @return array
[ "Returns", "a", "Configuration", "Subset", "with", "a", "Prefix" ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L75-L83
37,089
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.setAxis
public static function setAxis( $object, $config, $data ) { $object->setColor( self::getConfigValue( $config, 'color', 'black' ) ); $object->setWeight( self::getConfigValue( $config, 'weight', 1 ) ); $object->SetTextLabelInterval( self::getConfigValue( $config, 'label.interval', 1 ) ); $object->SetLabelAngle( self::getConfigValue( $config, 'label.angle', 0 ) ); self::setTitle( $object->title, self::getSubConfig( $config, 'title.' ) ); self::setFont( $object, self::getSubConfig( $config, 'label.' ) ); $labels = self::getConfigValue( $config, 'label.data' ); if( $labels ) { if( !isset( $data[$labels] ) ) throw new Exception( 'Data source "'.$labels.'" is not available.' ); $object->setTickLabels( $data[$labels] ); } $grace = self::getConfigValue( $config, 'scale.grace', 0 ); if( $grace ) $object->scale->setGrace( $grace ); }
php
public static function setAxis( $object, $config, $data ) { $object->setColor( self::getConfigValue( $config, 'color', 'black' ) ); $object->setWeight( self::getConfigValue( $config, 'weight', 1 ) ); $object->SetTextLabelInterval( self::getConfigValue( $config, 'label.interval', 1 ) ); $object->SetLabelAngle( self::getConfigValue( $config, 'label.angle', 0 ) ); self::setTitle( $object->title, self::getSubConfig( $config, 'title.' ) ); self::setFont( $object, self::getSubConfig( $config, 'label.' ) ); $labels = self::getConfigValue( $config, 'label.data' ); if( $labels ) { if( !isset( $data[$labels] ) ) throw new Exception( 'Data source "'.$labels.'" is not available.' ); $object->setTickLabels( $data[$labels] ); } $grace = self::getConfigValue( $config, 'scale.grace', 0 ); if( $grace ) $object->scale->setGrace( $grace ); }
[ "public", "static", "function", "setAxis", "(", "$", "object", ",", "$", "config", ",", "$", "data", ")", "{", "$", "object", "->", "setColor", "(", "self", "::", "getConfigValue", "(", "$", "config", ",", "'color'", ",", "'black'", ")", ")", ";", "$", "object", "->", "setWeight", "(", "self", "::", "getConfigValue", "(", "$", "config", ",", "'weight'", ",", "1", ")", ")", ";", "$", "object", "->", "SetTextLabelInterval", "(", "self", "::", "getConfigValue", "(", "$", "config", ",", "'label.interval'", ",", "1", ")", ")", ";", "$", "object", "->", "SetLabelAngle", "(", "self", "::", "getConfigValue", "(", "$", "config", ",", "'label.angle'", ",", "0", ")", ")", ";", "self", "::", "setTitle", "(", "$", "object", "->", "title", ",", "self", "::", "getSubConfig", "(", "$", "config", ",", "'title.'", ")", ")", ";", "self", "::", "setFont", "(", "$", "object", ",", "self", "::", "getSubConfig", "(", "$", "config", ",", "'label.'", ")", ")", ";", "$", "labels", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'label.data'", ")", ";", "if", "(", "$", "labels", ")", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "$", "labels", "]", ")", ")", "throw", "new", "Exception", "(", "'Data source \"'", ".", "$", "labels", ".", "'\" is not available.'", ")", ";", "$", "object", "->", "setTickLabels", "(", "$", "data", "[", "$", "labels", "]", ")", ";", "}", "$", "grace", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'scale.grace'", ",", "0", ")", ";", "if", "(", "$", "grace", ")", "$", "object", "->", "scale", "->", "setGrace", "(", "$", "grace", ")", ";", "}" ]
Adds an Axis to the JpGraph Graph Object. @access public @static @param Graph $object JpGraph Graph Object @param array $config Configuration Data @param array $data Graph Data @return void
[ "Adds", "an", "Axis", "to", "the", "JpGraph", "Graph", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L94-L113
37,090
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.setFont
public static function setFont( $object, $config ) { $name = self::getConfigValue( $config, 'font.name' ); $type = self::getConfigValue( $config, 'font.type', FS_NORMAL ); $size = self::getConfigValue( $config, 'font.size', 10 ); if( $name ) $object->setFont( $name, $type, $size ); }
php
public static function setFont( $object, $config ) { $name = self::getConfigValue( $config, 'font.name' ); $type = self::getConfigValue( $config, 'font.type', FS_NORMAL ); $size = self::getConfigValue( $config, 'font.size', 10 ); if( $name ) $object->setFont( $name, $type, $size ); }
[ "public", "static", "function", "setFont", "(", "$", "object", ",", "$", "config", ")", "{", "$", "name", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'font.name'", ")", ";", "$", "type", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'font.type'", ",", "FS_NORMAL", ")", ";", "$", "size", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'font.size'", ",", "10", ")", ";", "if", "(", "$", "name", ")", "$", "object", "->", "setFont", "(", "$", "name", ",", "$", "type", ",", "$", "size", ")", ";", "}" ]
Sets the Font of a JpGraph Object. @access public @static @param mixed $object JpGraph Object @param array $config Configuration Data @return void
[ "Sets", "the", "Font", "of", "a", "JpGraph", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L123-L130
37,091
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.setFrame
public static function setFrame( $object, $config ) { $frameShow = self::getConfigValue( $config, 'frame.show', FALSE ); $frameColor = self::getConfigValue( $config, 'frame.color', array( 0, 0, 0 ) ); $frameWidth = self::getConfigValue( $config, 'frame.width', 1 ); $object->setFrame( $frameShow, $frameColor, $frameWidth ); #$graph->SetFrameBevel(12,true,'black'); }
php
public static function setFrame( $object, $config ) { $frameShow = self::getConfigValue( $config, 'frame.show', FALSE ); $frameColor = self::getConfigValue( $config, 'frame.color', array( 0, 0, 0 ) ); $frameWidth = self::getConfigValue( $config, 'frame.width', 1 ); $object->setFrame( $frameShow, $frameColor, $frameWidth ); #$graph->SetFrameBevel(12,true,'black'); }
[ "public", "static", "function", "setFrame", "(", "$", "object", ",", "$", "config", ")", "{", "$", "frameShow", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'frame.show'", ",", "FALSE", ")", ";", "$", "frameColor", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'frame.color'", ",", "array", "(", "0", ",", "0", ",", "0", ")", ")", ";", "$", "frameWidth", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'frame.width'", ",", "1", ")", ";", "$", "object", "->", "setFrame", "(", "$", "frameShow", ",", "$", "frameColor", ",", "$", "frameWidth", ")", ";", "#$graph->SetFrameBevel(12,true,'black'); \t\t", "}" ]
Sets the Frame of a JpGraph Graph Object. @access public @static @param Graph $object JpGraph Graph Object @param array $config Configuration Data @return void
[ "Sets", "the", "Frame", "of", "a", "JpGraph", "Graph", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L140-L147
37,092
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.setGrid
public static function setGrid( $object, $config ) { $showMajor = self::getConfigValue( $config, "show.major", FALSE ); $showMinor = self::getConfigValue( $config, "show.minor", FALSE ); $object->show( $showMajor, $showMinor ); $object->setWeight( self::getConfigValue( $config, "weight", 1 ) ); $object->setLineStyle( self::getConfigValue( $config, "line.style", 'solid' ) ); if( $showMajor || $showMinor ) { $color1 = self::getConfigValue( $config, "color.1", FALSE ); $color2 = self::getConfigValue( $config, "color.2", FALSE ); $object->setColor( $color1, $color2 ); $fill = self::getConfigValue( $config, "fill.show", FALSE ); if( $fill ) { $color1 = self::getConfigValue( $config, "fill.color.1" ); $color2 = self::getConfigValue( $config, "fill.color.2" ); $object->setFill( $fill, $color1, $color2 ); } } }
php
public static function setGrid( $object, $config ) { $showMajor = self::getConfigValue( $config, "show.major", FALSE ); $showMinor = self::getConfigValue( $config, "show.minor", FALSE ); $object->show( $showMajor, $showMinor ); $object->setWeight( self::getConfigValue( $config, "weight", 1 ) ); $object->setLineStyle( self::getConfigValue( $config, "line.style", 'solid' ) ); if( $showMajor || $showMinor ) { $color1 = self::getConfigValue( $config, "color.1", FALSE ); $color2 = self::getConfigValue( $config, "color.2", FALSE ); $object->setColor( $color1, $color2 ); $fill = self::getConfigValue( $config, "fill.show", FALSE ); if( $fill ) { $color1 = self::getConfigValue( $config, "fill.color.1" ); $color2 = self::getConfigValue( $config, "fill.color.2" ); $object->setFill( $fill, $color1, $color2 ); } } }
[ "public", "static", "function", "setGrid", "(", "$", "object", ",", "$", "config", ")", "{", "$", "showMajor", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "\"show.major\"", ",", "FALSE", ")", ";", "$", "showMinor", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "\"show.minor\"", ",", "FALSE", ")", ";", "$", "object", "->", "show", "(", "$", "showMajor", ",", "$", "showMinor", ")", ";", "$", "object", "->", "setWeight", "(", "self", "::", "getConfigValue", "(", "$", "config", ",", "\"weight\"", ",", "1", ")", ")", ";", "$", "object", "->", "setLineStyle", "(", "self", "::", "getConfigValue", "(", "$", "config", ",", "\"line.style\"", ",", "'solid'", ")", ")", ";", "if", "(", "$", "showMajor", "||", "$", "showMinor", ")", "{", "$", "color1", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "\"color.1\"", ",", "FALSE", ")", ";", "$", "color2", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "\"color.2\"", ",", "FALSE", ")", ";", "$", "object", "->", "setColor", "(", "$", "color1", ",", "$", "color2", ")", ";", "$", "fill", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "\"fill.show\"", ",", "FALSE", ")", ";", "if", "(", "$", "fill", ")", "{", "$", "color1", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "\"fill.color.1\"", ")", ";", "$", "color2", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "\"fill.color.2\"", ")", ";", "$", "object", "->", "setFill", "(", "$", "fill", ",", "$", "color1", ",", "$", "color2", ")", ";", "}", "}", "}" ]
Sets the Grid of a JpGraph Grid Object. @access public @static @param Grid $object JpGraph Grid Object @param array $config Configuration Data @return void
[ "Sets", "the", "Grid", "of", "a", "JpGraph", "Grid", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L157-L177
37,093
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.setLegend
public static function setLegend( $graph, $config ) { if( !self::getConfigValue( $config, 'show' ) ) { $graph->legend->hide(); return; } $graph->legend->setLayout( self::getConfigValue( $config, 'layout', LEGEND_VERT ) ); $shadowShow = self::getConfigValue( $config, 'shadow.show', FALSE ); $shadowWidth = self::getConfigValue( $config, 'shadow.width', 2 ); $shadowColor = self::getConfigValue( $config, 'shadow.color', 'gray' ); $graph->legend->setShadow( FALSE ); if( $shadowShow ) $graph->legend->setShadow( $shadowColor, $shadowWidth ); $color = self::getConfigValue( $config, 'color', 'black' ); $frameColor = self::getConfigValue( $config, 'frame.color', 'black' ); $graph->legend->setColor( $color, $frameColor ); $graph->legend->setFrameWeight( self::getConfigValue( $config, 'frame.weight', 1 ) ); $posX = self::getConfigValue( $config, 'pos.x', 0 ); $posY = self::getConfigValue( $config, 'pos.y', 0 ); $posAlignH = self::getConfigValue( $config, 'pos.align.h', 'right' ); $posAlignV = self::getConfigValue( $config, 'pos.align.v', 'top' ); $graph->legend->pos( $posX, $posY, $posAlignH, $posAlignV ); $fillColor = self::getConfigValue( $config, 'fill.color', NULL ); $graph->legend->setFillColor( $fillColor ); self::setFont( $graph->legend, $config ); }
php
public static function setLegend( $graph, $config ) { if( !self::getConfigValue( $config, 'show' ) ) { $graph->legend->hide(); return; } $graph->legend->setLayout( self::getConfigValue( $config, 'layout', LEGEND_VERT ) ); $shadowShow = self::getConfigValue( $config, 'shadow.show', FALSE ); $shadowWidth = self::getConfigValue( $config, 'shadow.width', 2 ); $shadowColor = self::getConfigValue( $config, 'shadow.color', 'gray' ); $graph->legend->setShadow( FALSE ); if( $shadowShow ) $graph->legend->setShadow( $shadowColor, $shadowWidth ); $color = self::getConfigValue( $config, 'color', 'black' ); $frameColor = self::getConfigValue( $config, 'frame.color', 'black' ); $graph->legend->setColor( $color, $frameColor ); $graph->legend->setFrameWeight( self::getConfigValue( $config, 'frame.weight', 1 ) ); $posX = self::getConfigValue( $config, 'pos.x', 0 ); $posY = self::getConfigValue( $config, 'pos.y', 0 ); $posAlignH = self::getConfigValue( $config, 'pos.align.h', 'right' ); $posAlignV = self::getConfigValue( $config, 'pos.align.v', 'top' ); $graph->legend->pos( $posX, $posY, $posAlignH, $posAlignV ); $fillColor = self::getConfigValue( $config, 'fill.color', NULL ); $graph->legend->setFillColor( $fillColor ); self::setFont( $graph->legend, $config ); }
[ "public", "static", "function", "setLegend", "(", "$", "graph", ",", "$", "config", ")", "{", "if", "(", "!", "self", "::", "getConfigValue", "(", "$", "config", ",", "'show'", ")", ")", "{", "$", "graph", "->", "legend", "->", "hide", "(", ")", ";", "return", ";", "}", "$", "graph", "->", "legend", "->", "setLayout", "(", "self", "::", "getConfigValue", "(", "$", "config", ",", "'layout'", ",", "LEGEND_VERT", ")", ")", ";", "$", "shadowShow", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'shadow.show'", ",", "FALSE", ")", ";", "$", "shadowWidth", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'shadow.width'", ",", "2", ")", ";", "$", "shadowColor", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'shadow.color'", ",", "'gray'", ")", ";", "$", "graph", "->", "legend", "->", "setShadow", "(", "FALSE", ")", ";", "if", "(", "$", "shadowShow", ")", "$", "graph", "->", "legend", "->", "setShadow", "(", "$", "shadowColor", ",", "$", "shadowWidth", ")", ";", "$", "color", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'color'", ",", "'black'", ")", ";", "$", "frameColor", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'frame.color'", ",", "'black'", ")", ";", "$", "graph", "->", "legend", "->", "setColor", "(", "$", "color", ",", "$", "frameColor", ")", ";", "$", "graph", "->", "legend", "->", "setFrameWeight", "(", "self", "::", "getConfigValue", "(", "$", "config", ",", "'frame.weight'", ",", "1", ")", ")", ";", "$", "posX", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'pos.x'", ",", "0", ")", ";", "$", "posY", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'pos.y'", ",", "0", ")", ";", "$", "posAlignH", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'pos.align.h'", ",", "'right'", ")", ";", "$", "posAlignV", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'pos.align.v'", ",", "'top'", ")", ";", "$", "graph", "->", "legend", "->", "pos", "(", "$", "posX", ",", "$", "posY", ",", "$", "posAlignH", ",", "$", "posAlignV", ")", ";", "$", "fillColor", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'fill.color'", ",", "NULL", ")", ";", "$", "graph", "->", "legend", "->", "setFillColor", "(", "$", "fillColor", ")", ";", "self", "::", "setFont", "(", "$", "graph", "->", "legend", ",", "$", "config", ")", ";", "}" ]
Sets the Grid of a JpGraph Graph Object. @access public @static @param Graph $object JpGraph Graph Object @param array $config Configuration Data @return void
[ "Sets", "the", "Grid", "of", "a", "JpGraph", "Graph", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L187-L219
37,094
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.setMark
public static function setMark( $object, $config ) { $show = self::getConfigValue( $config, 'mark.show' ); $type = self::getConfigValue( $config, 'mark.type' ); $file = self::getConfigValue( $config, 'mark.file' ); $scale = self::getConfigValue( $config, 'mark.scale' ); $width = self::getConfigValue( $config, 'mark.width' ); $fillColor = self::getConfigValue( $config, 'mark.fill.color' ); $object->mark->show( $show ); if( $type && $file && $scale ) $object->mark->setType( $type, $file, $scale ); else if( $type && $file ) $object->mark->setType( $type, $file ); elseif( $type ) $object->mark->setType( $type ); if( $width ) $object->mark->setWidth( $width ); if( $fillColor ) $object->mark->setFillColor( $fillColor ); }
php
public static function setMark( $object, $config ) { $show = self::getConfigValue( $config, 'mark.show' ); $type = self::getConfigValue( $config, 'mark.type' ); $file = self::getConfigValue( $config, 'mark.file' ); $scale = self::getConfigValue( $config, 'mark.scale' ); $width = self::getConfigValue( $config, 'mark.width' ); $fillColor = self::getConfigValue( $config, 'mark.fill.color' ); $object->mark->show( $show ); if( $type && $file && $scale ) $object->mark->setType( $type, $file, $scale ); else if( $type && $file ) $object->mark->setType( $type, $file ); elseif( $type ) $object->mark->setType( $type ); if( $width ) $object->mark->setWidth( $width ); if( $fillColor ) $object->mark->setFillColor( $fillColor ); }
[ "public", "static", "function", "setMark", "(", "$", "object", ",", "$", "config", ")", "{", "$", "show", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'mark.show'", ")", ";", "$", "type", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'mark.type'", ")", ";", "$", "file", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'mark.file'", ")", ";", "$", "scale", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'mark.scale'", ")", ";", "$", "width", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'mark.width'", ")", ";", "$", "fillColor", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'mark.fill.color'", ")", ";", "$", "object", "->", "mark", "->", "show", "(", "$", "show", ")", ";", "if", "(", "$", "type", "&&", "$", "file", "&&", "$", "scale", ")", "$", "object", "->", "mark", "->", "setType", "(", "$", "type", ",", "$", "file", ",", "$", "scale", ")", ";", "else", "if", "(", "$", "type", "&&", "$", "file", ")", "$", "object", "->", "mark", "->", "setType", "(", "$", "type", ",", "$", "file", ")", ";", "elseif", "(", "$", "type", ")", "$", "object", "->", "mark", "->", "setType", "(", "$", "type", ")", ";", "if", "(", "$", "width", ")", "$", "object", "->", "mark", "->", "setWidth", "(", "$", "width", ")", ";", "if", "(", "$", "fillColor", ")", "$", "object", "->", "mark", "->", "setFillColor", "(", "$", "fillColor", ")", ";", "}" ]
Sets the Marks of a JpGraph Plot Object. @access public @static @param mixed $object JpGraph Plot Object @param array $config Configuration Data @return void
[ "Sets", "the", "Marks", "of", "a", "JpGraph", "Plot", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L229-L249
37,095
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.setShadow
public static function setShadow( $object, $config ) { $shadowShow = self::getConfigValue( $config, 'shadow.show', TRUE ); $shadowWidth = self::getConfigValue( $config, 'shadow.width', 5 ); $shadowColor = self::getConfigValue( $config, 'shadow.color', array(102,102,102) ); $object->setShadow( $shadowShow, $shadowWidth, $shadowColor ); }
php
public static function setShadow( $object, $config ) { $shadowShow = self::getConfigValue( $config, 'shadow.show', TRUE ); $shadowWidth = self::getConfigValue( $config, 'shadow.width', 5 ); $shadowColor = self::getConfigValue( $config, 'shadow.color', array(102,102,102) ); $object->setShadow( $shadowShow, $shadowWidth, $shadowColor ); }
[ "public", "static", "function", "setShadow", "(", "$", "object", ",", "$", "config", ")", "{", "$", "shadowShow", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'shadow.show'", ",", "TRUE", ")", ";", "$", "shadowWidth", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'shadow.width'", ",", "5", ")", ";", "$", "shadowColor", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'shadow.color'", ",", "array", "(", "102", ",", "102", ",", "102", ")", ")", ";", "$", "object", "->", "setShadow", "(", "$", "shadowShow", ",", "$", "shadowWidth", ",", "$", "shadowColor", ")", ";", "}" ]
Sets Shadow of a JpGraph Object. @access public @static @param mixed $object JpGraph Object @param array $config Configuration Data @return void
[ "Sets", "Shadow", "of", "a", "JpGraph", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L259-L265
37,096
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.setSubTitle
public static function setSubTitle( $graph, $config ) { if( empty( $config['subtitle'] ) ) return; $graph->subtitle->Set( $config['subtitle'] ); self::setFont( $graph->subtitle, self::getSubConfig( $config, 'subtitle.' ) ); }
php
public static function setSubTitle( $graph, $config ) { if( empty( $config['subtitle'] ) ) return; $graph->subtitle->Set( $config['subtitle'] ); self::setFont( $graph->subtitle, self::getSubConfig( $config, 'subtitle.' ) ); }
[ "public", "static", "function", "setSubTitle", "(", "$", "graph", ",", "$", "config", ")", "{", "if", "(", "empty", "(", "$", "config", "[", "'subtitle'", "]", ")", ")", "return", ";", "$", "graph", "->", "subtitle", "->", "Set", "(", "$", "config", "[", "'subtitle'", "]", ")", ";", "self", "::", "setFont", "(", "$", "graph", "->", "subtitle", ",", "self", "::", "getSubConfig", "(", "$", "config", ",", "'subtitle.'", ")", ")", ";", "}" ]
Sets Subtitle of a JpGraph Graph Object. @access public @static @param Graph $graph JpGraph Graph Object @param array $config Configuration Data @return void
[ "Sets", "Subtitle", "of", "a", "JpGraph", "Graph", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L275-L281
37,097
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.setTitle
public static function setTitle( $graph, $config ) { if( empty( $config['title'] ) ) return; $graph->title->Set( $config['title'] ); self::setFont( $graph->title, self::getSubConfig( $config, 'title.' ) ); }
php
public static function setTitle( $graph, $config ) { if( empty( $config['title'] ) ) return; $graph->title->Set( $config['title'] ); self::setFont( $graph->title, self::getSubConfig( $config, 'title.' ) ); }
[ "public", "static", "function", "setTitle", "(", "$", "graph", ",", "$", "config", ")", "{", "if", "(", "empty", "(", "$", "config", "[", "'title'", "]", ")", ")", "return", ";", "$", "graph", "->", "title", "->", "Set", "(", "$", "config", "[", "'title'", "]", ")", ";", "self", "::", "setFont", "(", "$", "graph", "->", "title", ",", "self", "::", "getSubConfig", "(", "$", "config", ",", "'title.'", ")", ")", ";", "}" ]
Sets Title of a JpGraph Graph Object. @access public @static @param Graph $graph JpGraph Graph Object @param array $config Configuration Data @return void
[ "Sets", "Title", "of", "a", "JpGraph", "Graph", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L291-L297
37,098
CeusMedia/Common
src/UI/Image/Graph/Components.php
UI_Image_Graph_Components.setValue
public static function setValue( $object, $config ) { $show = self::getConfigValue( $config, 'value.show' ); $weight = self::getConfigValue( $config, 'value.weight' ); $fillColor = self::getConfigValue( $config, 'value.fill.color' ); $object->value->show( (bool) $show ); if( $show ) self::setFont( $object, $config ); }
php
public static function setValue( $object, $config ) { $show = self::getConfigValue( $config, 'value.show' ); $weight = self::getConfigValue( $config, 'value.weight' ); $fillColor = self::getConfigValue( $config, 'value.fill.color' ); $object->value->show( (bool) $show ); if( $show ) self::setFont( $object, $config ); }
[ "public", "static", "function", "setValue", "(", "$", "object", ",", "$", "config", ")", "{", "$", "show", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'value.show'", ")", ";", "$", "weight", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'value.weight'", ")", ";", "$", "fillColor", "=", "self", "::", "getConfigValue", "(", "$", "config", ",", "'value.fill.color'", ")", ";", "$", "object", "->", "value", "->", "show", "(", "(", "bool", ")", "$", "show", ")", ";", "if", "(", "$", "show", ")", "self", "::", "setFont", "(", "$", "object", ",", "$", "config", ")", ";", "}" ]
Sets Value Style of a JpGraph Plot Object. @access public @static @param Graph $object JpGraph Plot Object @param array $config Configuration Data @return void
[ "Sets", "Value", "Style", "of", "a", "JpGraph", "Plot", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Graph/Components.php#L307-L315
37,099
CeusMedia/Common
src/DB/StatementCollection.php
DB_StatementCollection.addComponent
public function addComponent( $name, $data = array() ) { if( !method_exists( $this, $name ) ) throw new BadMethodCallException( 'Component "'.$name.'" is not defined.' ); $array = $this->$name( $data ); if( count( $array ) ) { if( isset( $array[0] ) ) $this->builder->addKeys( $array[0] ); if( isset( $array[1] ) ) $this->builder->addTables( $array[1] ); if( isset( $array[2] ) ) $this->builder->addConditions( $array[2] ); if( isset( $array[3] ) ) $this->builder->addGroupings( $array[3] ); } }
php
public function addComponent( $name, $data = array() ) { if( !method_exists( $this, $name ) ) throw new BadMethodCallException( 'Component "'.$name.'" is not defined.' ); $array = $this->$name( $data ); if( count( $array ) ) { if( isset( $array[0] ) ) $this->builder->addKeys( $array[0] ); if( isset( $array[1] ) ) $this->builder->addTables( $array[1] ); if( isset( $array[2] ) ) $this->builder->addConditions( $array[2] ); if( isset( $array[3] ) ) $this->builder->addGroupings( $array[3] ); } }
[ "public", "function", "addComponent", "(", "$", "name", ",", "$", "data", "=", "array", "(", ")", ")", "{", "if", "(", "!", "method_exists", "(", "$", "this", ",", "$", "name", ")", ")", "throw", "new", "BadMethodCallException", "(", "'Component \"'", ".", "$", "name", ".", "'\" is not defined.'", ")", ";", "$", "array", "=", "$", "this", "->", "$", "name", "(", "$", "data", ")", ";", "if", "(", "count", "(", "$", "array", ")", ")", "{", "if", "(", "isset", "(", "$", "array", "[", "0", "]", ")", ")", "$", "this", "->", "builder", "->", "addKeys", "(", "$", "array", "[", "0", "]", ")", ";", "if", "(", "isset", "(", "$", "array", "[", "1", "]", ")", ")", "$", "this", "->", "builder", "->", "addTables", "(", "$", "array", "[", "1", "]", ")", ";", "if", "(", "isset", "(", "$", "array", "[", "2", "]", ")", ")", "$", "this", "->", "builder", "->", "addConditions", "(", "$", "array", "[", "2", "]", ")", ";", "if", "(", "isset", "(", "$", "array", "[", "3", "]", ")", ")", "$", "this", "->", "builder", "->", "addGroupings", "(", "$", "array", "[", "3", "]", ")", ";", "}", "}" ]
Add a parameterized Component to Statement Builder. @access public @param string $name Name of collected Statement Component @param array $data Parameters for Statement Component @return void
[ "Add", "a", "parameterized", "Component", "to", "Statement", "Builder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementCollection.php#L61-L77