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
36,600
CeusMedia/Common
src/FS/File/CSS/Parser.php
FS_File_CSS_Parser.parseProperties
static protected function parseProperties( $string ){ $list = array(); foreach( explode( ';', trim( $string ) ) as $line ){ if( !trim( $line ) ) continue; $parts = explode( ':', $line ); $key = array_shift( $parts ); $value = trim( implode( ':', $parts ) ); $list[] = new ADT_CSS_Property( $key, $value ); } return $list; }
php
static protected function parseProperties( $string ){ $list = array(); foreach( explode( ';', trim( $string ) ) as $line ){ if( !trim( $line ) ) continue; $parts = explode( ':', $line ); $key = array_shift( $parts ); $value = trim( implode( ':', $parts ) ); $list[] = new ADT_CSS_Property( $key, $value ); } return $list; }
[ "static", "protected", "function", "parseProperties", "(", "$", "string", ")", "{", "$", "list", "=", "array", "(", ")", ";", "foreach", "(", "explode", "(", "';'", ",", "trim", "(", "$", "string", ")", ")", "as", "$", "line", ")", "{", "if", "(", "!", "trim", "(", "$", "line", ")", ")", "continue", ";", "$", "parts", "=", "explode", "(", "':'", ",", "$", "line", ")", ";", "$", "key", "=", "array_shift", "(", "$", "parts", ")", ";", "$", "value", "=", "trim", "(", "implode", "(", "':'", ",", "$", "parts", ")", ")", ";", "$", "list", "[", "]", "=", "new", "ADT_CSS_Property", "(", "$", "key", ",", "$", "value", ")", ";", "}", "return", "$", "list", ";", "}" ]
Parses CSS properties inside a rule and returns a list of property objects. @access protected @param string $string String of CSS rule properties @return array List of property objects
[ "Parses", "CSS", "properties", "inside", "a", "rule", "and", "returns", "a", "list", "of", "property", "objects", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/CSS/Parser.php#L60-L71
36,601
CeusMedia/Common
src/FS/File/CSS/Parser.php
FS_File_CSS_Parser.parseString
static public function parseString( $string ){ if( substr_count( $string, "{" ) !== substr_count( $string, "}" ) ) // throw Exception( 'Invalid paranthesis' ); $string = preg_replace( '/\/\*.+\*\//sU', '', $string ); $string = preg_replace( '/(\t|\r|\n)/s', '', $string ); $state = (int) ( $buffer = $key = '' ); $sheet = new ADT_CSS_Sheet(); for( $i=0; $i<strlen( $string ); $i++ ){ $char = $string[$i]; if( !$state && $char == '{' ){ $state = (boolean) ( $key = trim( $buffer ) ); $buffer = ''; } else if( $state && $char == '}' ){ $properties = self::parseProperties( $buffer ); foreach( explode( ',', $key ) as $selector ) $sheet->addRule( new ADT_CSS_Rule( $selector, $properties ) ); $state = (boolean) ($buffer = ''); } else $buffer .= $char; } return $sheet; }
php
static public function parseString( $string ){ if( substr_count( $string, "{" ) !== substr_count( $string, "}" ) ) // throw Exception( 'Invalid paranthesis' ); $string = preg_replace( '/\/\*.+\*\//sU', '', $string ); $string = preg_replace( '/(\t|\r|\n)/s', '', $string ); $state = (int) ( $buffer = $key = '' ); $sheet = new ADT_CSS_Sheet(); for( $i=0; $i<strlen( $string ); $i++ ){ $char = $string[$i]; if( !$state && $char == '{' ){ $state = (boolean) ( $key = trim( $buffer ) ); $buffer = ''; } else if( $state && $char == '}' ){ $properties = self::parseProperties( $buffer ); foreach( explode( ',', $key ) as $selector ) $sheet->addRule( new ADT_CSS_Rule( $selector, $properties ) ); $state = (boolean) ($buffer = ''); } else $buffer .= $char; } return $sheet; }
[ "static", "public", "function", "parseString", "(", "$", "string", ")", "{", "if", "(", "substr_count", "(", "$", "string", ",", "\"{\"", ")", "!==", "substr_count", "(", "$", "string", ",", "\"}\"", ")", ")", "// ", "throw", "Exception", "(", "'Invalid paranthesis'", ")", ";", "$", "string", "=", "preg_replace", "(", "'/\\/\\*.+\\*\\//sU'", ",", "''", ",", "$", "string", ")", ";", "$", "string", "=", "preg_replace", "(", "'/(\\t|\\r|\\n)/s'", ",", "''", ",", "$", "string", ")", ";", "$", "state", "=", "(", "int", ")", "(", "$", "buffer", "=", "$", "key", "=", "''", ")", ";", "$", "sheet", "=", "new", "ADT_CSS_Sheet", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "strlen", "(", "$", "string", ")", ";", "$", "i", "++", ")", "{", "$", "char", "=", "$", "string", "[", "$", "i", "]", ";", "if", "(", "!", "$", "state", "&&", "$", "char", "==", "'{'", ")", "{", "$", "state", "=", "(", "boolean", ")", "(", "$", "key", "=", "trim", "(", "$", "buffer", ")", ")", ";", "$", "buffer", "=", "''", ";", "}", "else", "if", "(", "$", "state", "&&", "$", "char", "==", "'}'", ")", "{", "$", "properties", "=", "self", "::", "parseProperties", "(", "$", "buffer", ")", ";", "foreach", "(", "explode", "(", "','", ",", "$", "key", ")", "as", "$", "selector", ")", "$", "sheet", "->", "addRule", "(", "new", "ADT_CSS_Rule", "(", "$", "selector", ",", "$", "properties", ")", ")", ";", "$", "state", "=", "(", "boolean", ")", "(", "$", "buffer", "=", "''", ")", ";", "}", "else", "$", "buffer", ".=", "$", "char", ";", "}", "return", "$", "sheet", ";", "}" ]
Parses a CSS string and returns sheet structure statically. @access public @param string $string CSS string @return ADT_CSS_Sheet
[ "Parses", "a", "CSS", "string", "and", "returns", "sheet", "structure", "statically", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/CSS/Parser.php#L79-L102
36,602
CeusMedia/Common
src/UI/HTML/Paging.php
UI_HTML_Paging.buildSpan
protected function buildSpan( $text, $class = NULL ) { $class = $class ? $this->getOption( 'class_span' )." ".$class : $this->getOption( 'class_span' ); $span = UI_HTML_Tag::create( "span", $text, array( 'class' => $class ) ); return $span; }
php
protected function buildSpan( $text, $class = NULL ) { $class = $class ? $this->getOption( 'class_span' )." ".$class : $this->getOption( 'class_span' ); $span = UI_HTML_Tag::create( "span", $text, array( 'class' => $class ) ); return $span; }
[ "protected", "function", "buildSpan", "(", "$", "text", ",", "$", "class", "=", "NULL", ")", "{", "$", "class", "=", "$", "class", "?", "$", "this", "->", "getOption", "(", "'class_span'", ")", ".", "\" \"", ".", "$", "class", ":", "$", "this", "->", "getOption", "(", "'class_span'", ")", ";", "$", "span", "=", "UI_HTML_Tag", "::", "create", "(", "\"span\"", ",", "$", "text", ",", "array", "(", "'class'", "=>", "$", "class", ")", ")", ";", "return", "$", "span", ";", "}" ]
Builds Span Link of Paging Button. @access protected @param string $text Text or HTML of Paging Button Span @param string $class Additive Style Class of Paging Button Span @return string
[ "Builds", "Span", "Link", "of", "Paging", "Button", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Paging.php#L207-L212
36,603
smasty/Neevo
src/Neevo/Row.php
Row.update
public function update(){ if($this->frozen) throw new NeevoException('Update disabled - cannot get primary key or table.'); if(!empty($this->modified)){ return Statement::createUpdate($this->connection, $this->table, $this->modified) ->where($this->primary, $this->data[$this->primary])->limit(1)->affectedRows(); } return 0; }
php
public function update(){ if($this->frozen) throw new NeevoException('Update disabled - cannot get primary key or table.'); if(!empty($this->modified)){ return Statement::createUpdate($this->connection, $this->table, $this->modified) ->where($this->primary, $this->data[$this->primary])->limit(1)->affectedRows(); } return 0; }
[ "public", "function", "update", "(", ")", "{", "if", "(", "$", "this", "->", "frozen", ")", "throw", "new", "NeevoException", "(", "'Update disabled - cannot get primary key or table.'", ")", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "modified", ")", ")", "{", "return", "Statement", "::", "createUpdate", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "table", ",", "$", "this", "->", "modified", ")", "->", "where", "(", "$", "this", "->", "primary", ",", "$", "this", "->", "data", "[", "$", "this", "->", "primary", "]", ")", "->", "limit", "(", "1", ")", "->", "affectedRows", "(", ")", ";", "}", "return", "0", ";", "}" ]
Updates corresponding database row if available. @throws NeevoException @return int Number of affected rows.
[ "Updates", "corresponding", "database", "row", "if", "available", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/Row.php#L65-L74
36,604
smasty/Neevo
src/Neevo/Row.php
Row.delete
public function delete(){ if($this->frozen) throw new NeevoException('Delete disabled - cannot get primary key or table.'); return Statement::createDelete($this->connection, $this->table) ->where($this->primary, $this->data[$this->primary])->limit(1)->affectedRows(); }
php
public function delete(){ if($this->frozen) throw new NeevoException('Delete disabled - cannot get primary key or table.'); return Statement::createDelete($this->connection, $this->table) ->where($this->primary, $this->data[$this->primary])->limit(1)->affectedRows(); }
[ "public", "function", "delete", "(", ")", "{", "if", "(", "$", "this", "->", "frozen", ")", "throw", "new", "NeevoException", "(", "'Delete disabled - cannot get primary key or table.'", ")", ";", "return", "Statement", "::", "createDelete", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "table", ")", "->", "where", "(", "$", "this", "->", "primary", ",", "$", "this", "->", "data", "[", "$", "this", "->", "primary", "]", ")", "->", "limit", "(", "1", ")", "->", "affectedRows", "(", ")", ";", "}" ]
Deletes corresponding database row if available. @throws NeevoException @return int Number of affected rows.
[ "Deletes", "corresponding", "database", "row", "if", "available", "." ]
3a1bf7e8ce24d453bb27dca3a9aca86852789f11
https://github.com/smasty/Neevo/blob/3a1bf7e8ce24d453bb27dca3a9aca86852789f11/src/Neevo/Row.php#L82-L88
36,605
CeusMedia/Common
src/Alg/HtmlMetaTagReader.php
Alg_HtmlMetaTagReader.getMetaTags
public static function getMetaTags( $string, $transformKeys = 0 ) { $metaTags = array(); preg_match_all( "@<meta.*/?>@", $string, $tags ); if( !$tags ) return array(); foreach( $tags[0] as $tag ) { $attributes = Alg_SgmlTagReader::getAttributes( $tag, self::TRANSFORM_LOWERCASE ); // read HTML Tag Attributes if( !isset( $attributes['content'] ) ) continue; if( isset( $attributes['content'] ) && isset( $attributes['name'] ) ) $key = $attributes['name']; if( isset( $attributes['content'] ) && isset( $attributes['http-equiv'] ) ) $key = $attributes['http-equiv']; if( $transformKeys == self::TRANSFORM_LOWERCASE ) $key = strtolower( $key ); else if( $transformKeys == self::TRANSFORM_UPPERCASE ) $key = strtoupper( $key ); $metaTags[$key] = $attributes['content']; } return $metaTags; }
php
public static function getMetaTags( $string, $transformKeys = 0 ) { $metaTags = array(); preg_match_all( "@<meta.*/?>@", $string, $tags ); if( !$tags ) return array(); foreach( $tags[0] as $tag ) { $attributes = Alg_SgmlTagReader::getAttributes( $tag, self::TRANSFORM_LOWERCASE ); // read HTML Tag Attributes if( !isset( $attributes['content'] ) ) continue; if( isset( $attributes['content'] ) && isset( $attributes['name'] ) ) $key = $attributes['name']; if( isset( $attributes['content'] ) && isset( $attributes['http-equiv'] ) ) $key = $attributes['http-equiv']; if( $transformKeys == self::TRANSFORM_LOWERCASE ) $key = strtolower( $key ); else if( $transformKeys == self::TRANSFORM_UPPERCASE ) $key = strtoupper( $key ); $metaTags[$key] = $attributes['content']; } return $metaTags; }
[ "public", "static", "function", "getMetaTags", "(", "$", "string", ",", "$", "transformKeys", "=", "0", ")", "{", "$", "metaTags", "=", "array", "(", ")", ";", "preg_match_all", "(", "\"@<meta.*/?>@\"", ",", "$", "string", ",", "$", "tags", ")", ";", "if", "(", "!", "$", "tags", ")", "return", "array", "(", ")", ";", "foreach", "(", "$", "tags", "[", "0", "]", "as", "$", "tag", ")", "{", "$", "attributes", "=", "Alg_SgmlTagReader", "::", "getAttributes", "(", "$", "tag", ",", "self", "::", "TRANSFORM_LOWERCASE", ")", ";", "// read HTML Tag Attributes", "if", "(", "!", "isset", "(", "$", "attributes", "[", "'content'", "]", ")", ")", "continue", ";", "if", "(", "isset", "(", "$", "attributes", "[", "'content'", "]", ")", "&&", "isset", "(", "$", "attributes", "[", "'name'", "]", ")", ")", "$", "key", "=", "$", "attributes", "[", "'name'", "]", ";", "if", "(", "isset", "(", "$", "attributes", "[", "'content'", "]", ")", "&&", "isset", "(", "$", "attributes", "[", "'http-equiv'", "]", ")", ")", "$", "key", "=", "$", "attributes", "[", "'http-equiv'", "]", ";", "if", "(", "$", "transformKeys", "==", "self", "::", "TRANSFORM_LOWERCASE", ")", "$", "key", "=", "strtolower", "(", "$", "key", ")", ";", "else", "if", "(", "$", "transformKeys", "==", "self", "::", "TRANSFORM_UPPERCASE", ")", "$", "key", "=", "strtoupper", "(", "$", "key", ")", ";", "$", "metaTags", "[", "$", "key", "]", "=", "$", "attributes", "[", "'content'", "]", ";", "}", "return", "$", "metaTags", ";", "}" ]
Returns Array of Meta Tags from a HTML Page String. @access public @static @param string $string HTML Page String @param int $transformKeys Flag: transform Attribute Keys @return array
[ "Returns", "Array", "of", "Meta", "Tags", "from", "a", "HTML", "Page", "String", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/HtmlMetaTagReader.php#L54-L76
36,606
CeusMedia/Common
src/FS/File/CSS/Converter.php
FS_File_CSS_Converter.toFile
public function toFile( $fileName ){ $css = FS_File_CSS_Converter::convertSheetToString( $this->sheet ); return FS_File_Writer::save( $fileName, $css ); }
php
public function toFile( $fileName ){ $css = FS_File_CSS_Converter::convertSheetToString( $this->sheet ); return FS_File_Writer::save( $fileName, $css ); }
[ "public", "function", "toFile", "(", "$", "fileName", ")", "{", "$", "css", "=", "FS_File_CSS_Converter", "::", "convertSheetToString", "(", "$", "this", "->", "sheet", ")", ";", "return", "FS_File_Writer", "::", "save", "(", "$", "fileName", ",", "$", "css", ")", ";", "}" ]
Writes sheet into file and returns number of written bytes. @access public @param string $fileName Realtive or absolute file URI @return integer Number of bytes written.
[ "Writes", "sheet", "into", "file", "and", "returns", "number", "of", "written", "bytes", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/CSS/Converter.php#L202-L205
36,607
phpactor/source-code-filesystem
lib/Iterator/AppendIterator.php
AppendIterator.valid
public function valid() { if (false === isset($this->iterators[$this->index])) { return false; } return $this->iterators[$this->index]->valid(); }
php
public function valid() { if (false === isset($this->iterators[$this->index])) { return false; } return $this->iterators[$this->index]->valid(); }
[ "public", "function", "valid", "(", ")", "{", "if", "(", "false", "===", "isset", "(", "$", "this", "->", "iterators", "[", "$", "this", "->", "index", "]", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "iterators", "[", "$", "this", "->", "index", "]", "->", "valid", "(", ")", ";", "}" ]
Checks validity of the current element @link http://php.net/manual/en/appenditerator.valid.php @return bool true on success or false on failure. @since 5.1.0
[ "Checks", "validity", "of", "the", "current", "element" ]
9f223092c35b65c86536ccc762741b32ea215549
https://github.com/phpactor/source-code-filesystem/blob/9f223092c35b65c86536ccc762741b32ea215549/lib/Iterator/AppendIterator.php#L53-L60
36,608
phpactor/source-code-filesystem
lib/Iterator/AppendIterator.php
AppendIterator.next
public function next() { $iterator = $this->iterators[$this->index]; $next = $iterator->next(); if (false === $this->valid() && isset($this->iterators[$this->index + 1])) { $this->index++; } }
php
public function next() { $iterator = $this->iterators[$this->index]; $next = $iterator->next(); if (false === $this->valid() && isset($this->iterators[$this->index + 1])) { $this->index++; } }
[ "public", "function", "next", "(", ")", "{", "$", "iterator", "=", "$", "this", "->", "iterators", "[", "$", "this", "->", "index", "]", ";", "$", "next", "=", "$", "iterator", "->", "next", "(", ")", ";", "if", "(", "false", "===", "$", "this", "->", "valid", "(", ")", "&&", "isset", "(", "$", "this", "->", "iterators", "[", "$", "this", "->", "index", "+", "1", "]", ")", ")", "{", "$", "this", "->", "index", "++", ";", "}", "}" ]
Moves to the next element @link http://php.net/manual/en/appenditerator.next.php @return void @since 5.1.0
[ "Moves", "to", "the", "next", "element" ]
9f223092c35b65c86536ccc762741b32ea215549
https://github.com/phpactor/source-code-filesystem/blob/9f223092c35b65c86536ccc762741b32ea215549/lib/Iterator/AppendIterator.php#L90-L98
36,609
CeusMedia/Common
src/FS/File/INI/SectionEditor.php
FS_File_INI_SectionEditor.fillUp
protected function fillUp( $key, $tabs = 5 ) { $key_breaks = $tabs - floor( strlen( $key ) / 8 ); if( $key_breaks < 1 ) $key_breaks = 1; $key = $key.str_repeat( "\t", $key_breaks ); return $key; }
php
protected function fillUp( $key, $tabs = 5 ) { $key_breaks = $tabs - floor( strlen( $key ) / 8 ); if( $key_breaks < 1 ) $key_breaks = 1; $key = $key.str_repeat( "\t", $key_breaks ); return $key; }
[ "protected", "function", "fillUp", "(", "$", "key", ",", "$", "tabs", "=", "5", ")", "{", "$", "key_breaks", "=", "$", "tabs", "-", "floor", "(", "strlen", "(", "$", "key", ")", "/", "8", ")", ";", "if", "(", "$", "key_breaks", "<", "1", ")", "$", "key_breaks", "=", "1", ";", "$", "key", "=", "$", "key", ".", "str_repeat", "(", "\"\\t\"", ",", "$", "key_breaks", ")", ";", "return", "$", "key", ";", "}" ]
Builds uniformed indent between Keys and Values. @access protected @param string $key Key of Property @param int $tabs Amount to Tabs to indent @return string
[ "Builds", "uniformed", "indent", "between", "Keys", "and", "Values", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/INI/SectionEditor.php#L65-L72
36,610
CeusMedia/Common
src/FS/File/INI/SectionEditor.php
FS_File_INI_SectionEditor.removeSection
public function removeSection( $section ) { if( !$this->hasSection( $section ) ) throw new InvalidArgumentException( 'Section "'.$section.'" is not existing.' ); unset( $this->data[$section] ); return is_int( $this->write() ); }
php
public function removeSection( $section ) { if( !$this->hasSection( $section ) ) throw new InvalidArgumentException( 'Section "'.$section.'" is not existing.' ); unset( $this->data[$section] ); return is_int( $this->write() ); }
[ "public", "function", "removeSection", "(", "$", "section", ")", "{", "if", "(", "!", "$", "this", "->", "hasSection", "(", "$", "section", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Section \"'", ".", "$", "section", ".", "'\" is not existing.'", ")", ";", "unset", "(", "$", "this", "->", "data", "[", "$", "section", "]", ")", ";", "return", "is_int", "(", "$", "this", "->", "write", "(", ")", ")", ";", "}" ]
Removes a Section. @access public @param string $section Section of Property @return bool
[ "Removes", "a", "Section", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/INI/SectionEditor.php#L95-L101
36,611
CeusMedia/Common
src/FS/File/INI/SectionEditor.php
FS_File_INI_SectionEditor.setProperty
public function setProperty( $section, $key, $value ) { if( !$this->hasSection( $section ) ) $this->addSection( $section ); $this->data[$section][$key] = $value; return is_int( $this->write() ); }
php
public function setProperty( $section, $key, $value ) { if( !$this->hasSection( $section ) ) $this->addSection( $section ); $this->data[$section][$key] = $value; return is_int( $this->write() ); }
[ "public", "function", "setProperty", "(", "$", "section", ",", "$", "key", ",", "$", "value", ")", "{", "if", "(", "!", "$", "this", "->", "hasSection", "(", "$", "section", ")", ")", "$", "this", "->", "addSection", "(", "$", "section", ")", ";", "$", "this", "->", "data", "[", "$", "section", "]", "[", "$", "key", "]", "=", "$", "value", ";", "return", "is_int", "(", "$", "this", "->", "write", "(", ")", ")", ";", "}" ]
Sets a Property. @access public @param string $section Section of Property @param string $key Key of Property @param string $value Value of Property @return bool
[ "Sets", "a", "Property", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/INI/SectionEditor.php#L111-L117
36,612
CeusMedia/Common
src/FS/File/INI/SectionEditor.php
FS_File_INI_SectionEditor.write
public function write() { $lines = array(); $sections = $this->getSections(); foreach( $sections as $section ) { $lines[] = "[".$section."]"; foreach( $this->data[$section] as $key => $value ) $lines[] = $this->fillUp( $key )."=".$value; } return FS_File_Writer::saveArray( $this->fileName, $lines ); $this->read(); }
php
public function write() { $lines = array(); $sections = $this->getSections(); foreach( $sections as $section ) { $lines[] = "[".$section."]"; foreach( $this->data[$section] as $key => $value ) $lines[] = $this->fillUp( $key )."=".$value; } return FS_File_Writer::saveArray( $this->fileName, $lines ); $this->read(); }
[ "public", "function", "write", "(", ")", "{", "$", "lines", "=", "array", "(", ")", ";", "$", "sections", "=", "$", "this", "->", "getSections", "(", ")", ";", "foreach", "(", "$", "sections", "as", "$", "section", ")", "{", "$", "lines", "[", "]", "=", "\"[\"", ".", "$", "section", ".", "\"]\"", ";", "foreach", "(", "$", "this", "->", "data", "[", "$", "section", "]", "as", "$", "key", "=>", "$", "value", ")", "$", "lines", "[", "]", "=", "$", "this", "->", "fillUp", "(", "$", "key", ")", ".", "\"=\"", ".", "$", "value", ";", "}", "return", "FS_File_Writer", "::", "saveArray", "(", "$", "this", "->", "fileName", ",", "$", "lines", ")", ";", "$", "this", "->", "read", "(", ")", ";", "}" ]
Writes sectioned Property File and returns Number of written Bytes. @access public @return int
[ "Writes", "sectioned", "Property", "File", "and", "returns", "Number", "of", "written", "Bytes", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/INI/SectionEditor.php#L124-L136
36,613
CeusMedia/Common
src/Net/FTP/Writer.php
Net_FTP_Writer.changeRights
public function changeRights( $fileName, $mode ) { if( !is_int( $mode ) ) throw new InvalidArgumentException( 'Mode must be an integer, recommended to be given as octal value' ); $this->connection->checkConnection(); $result = @ftp_chmod( $this->connection->getResource(), $mode, $fileName ); if( FALSE === $result ) throw new RuntimeException( 'Changing rights for "'.$fileName.'" is not possible' ); return $result; }
php
public function changeRights( $fileName, $mode ) { if( !is_int( $mode ) ) throw new InvalidArgumentException( 'Mode must be an integer, recommended to be given as octal value' ); $this->connection->checkConnection(); $result = @ftp_chmod( $this->connection->getResource(), $mode, $fileName ); if( FALSE === $result ) throw new RuntimeException( 'Changing rights for "'.$fileName.'" is not possible' ); return $result; }
[ "public", "function", "changeRights", "(", "$", "fileName", ",", "$", "mode", ")", "{", "if", "(", "!", "is_int", "(", "$", "mode", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Mode must be an integer, recommended to be given as octal value'", ")", ";", "$", "this", "->", "connection", "->", "checkConnection", "(", ")", ";", "$", "result", "=", "@", "ftp_chmod", "(", "$", "this", "->", "connection", "->", "getResource", "(", ")", ",", "$", "mode", ",", "$", "fileName", ")", ";", "if", "(", "FALSE", "===", "$", "result", ")", "throw", "new", "RuntimeException", "(", "'Changing rights for \"'", ".", "$", "fileName", ".", "'\" is not possible'", ")", ";", "return", "$", "result", ";", "}" ]
Changes Rights of File or Folders on FTP Server. @access public @param string $fileName Name of file to change rights for @param integer $mode Mode of rights (i.e. 0755) @return integer Set permissions as integer @throws RuntimeException if impossible to change rights
[ "Changes", "Rights", "of", "File", "or", "Folders", "on", "FTP", "Server", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/FTP/Writer.php#L65-L74
36,614
CeusMedia/Common
src/Net/FTP/Writer.php
Net_FTP_Writer.createFolder
public function createFolder( $folderName ) { $this->connection->checkConnection(); return (bool) ftp_mkdir( $this->connection->getResource(), $folderName ); }
php
public function createFolder( $folderName ) { $this->connection->checkConnection(); return (bool) ftp_mkdir( $this->connection->getResource(), $folderName ); }
[ "public", "function", "createFolder", "(", "$", "folderName", ")", "{", "$", "this", "->", "connection", "->", "checkConnection", "(", ")", ";", "return", "(", "bool", ")", "ftp_mkdir", "(", "$", "this", "->", "connection", "->", "getResource", "(", ")", ",", "$", "folderName", ")", ";", "}" ]
Creates a Folder on FTP Server. @access public @param string $folderName Name of folder to be created @return boolean
[ "Creates", "a", "Folder", "on", "FTP", "Server", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/FTP/Writer.php#L129-L133
36,615
CeusMedia/Common
src/Net/FTP/Writer.php
Net_FTP_Writer.putFile
public function putFile( $fileName, $target ) { $this->connection->checkConnection(); return ftp_put( $this->connection->getResource(), $target, $fileName, $this->connection->mode ); }
php
public function putFile( $fileName, $target ) { $this->connection->checkConnection(); return ftp_put( $this->connection->getResource(), $target, $fileName, $this->connection->mode ); }
[ "public", "function", "putFile", "(", "$", "fileName", ",", "$", "target", ")", "{", "$", "this", "->", "connection", "->", "checkConnection", "(", ")", ";", "return", "ftp_put", "(", "$", "this", "->", "connection", "->", "getResource", "(", ")", ",", "$", "target", ",", "$", "fileName", ",", "$", "this", "->", "connection", "->", "mode", ")", ";", "}" ]
Transferes a File onto FTP Server. @access public @param string $fileName Name of local file @param string $target Name of target file @return boolean
[ "Transferes", "a", "File", "onto", "FTP", "Server", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/FTP/Writer.php#L180-L184
36,616
CeusMedia/Common
src/Net/FTP/Writer.php
Net_FTP_Writer.removeFile
public function removeFile( $fileName ) { $this->connection->checkConnection(); return @ftp_delete( $this->connection->getResource(), $fileName ); }
php
public function removeFile( $fileName ) { $this->connection->checkConnection(); return @ftp_delete( $this->connection->getResource(), $fileName ); }
[ "public", "function", "removeFile", "(", "$", "fileName", ")", "{", "$", "this", "->", "connection", "->", "checkConnection", "(", ")", ";", "return", "@", "ftp_delete", "(", "$", "this", "->", "connection", "->", "getResource", "(", ")", ",", "$", "fileName", ")", ";", "}" ]
Removes a File. @access public @param string $fileName Name of file to be removed @return boolean
[ "Removes", "a", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/FTP/Writer.php#L192-L196
36,617
CeusMedia/Common
src/Net/FTP/Writer.php
Net_FTP_Writer.removeFolder
public function removeFolder( $folderName ) { $this->connection->checkConnection(); $reader = new Net_FTP_Reader( $this->connection ); $list = $reader->getList( $folderName ); foreach( $list as $entry ) { if( $entry['name'] != "." && $entry['name'] != ".." ) { if( $entry['isdir'] ) $this->removeFolder( $folderName."/".$entry['name'], TRUE ); else $this->removeFile( $folderName."/".$entry['name'] ); } } return @ftp_rmdir( $this->connection->getResource(), $folderName ); }
php
public function removeFolder( $folderName ) { $this->connection->checkConnection(); $reader = new Net_FTP_Reader( $this->connection ); $list = $reader->getList( $folderName ); foreach( $list as $entry ) { if( $entry['name'] != "." && $entry['name'] != ".." ) { if( $entry['isdir'] ) $this->removeFolder( $folderName."/".$entry['name'], TRUE ); else $this->removeFile( $folderName."/".$entry['name'] ); } } return @ftp_rmdir( $this->connection->getResource(), $folderName ); }
[ "public", "function", "removeFolder", "(", "$", "folderName", ")", "{", "$", "this", "->", "connection", "->", "checkConnection", "(", ")", ";", "$", "reader", "=", "new", "Net_FTP_Reader", "(", "$", "this", "->", "connection", ")", ";", "$", "list", "=", "$", "reader", "->", "getList", "(", "$", "folderName", ")", ";", "foreach", "(", "$", "list", "as", "$", "entry", ")", "{", "if", "(", "$", "entry", "[", "'name'", "]", "!=", "\".\"", "&&", "$", "entry", "[", "'name'", "]", "!=", "\"..\"", ")", "{", "if", "(", "$", "entry", "[", "'isdir'", "]", ")", "$", "this", "->", "removeFolder", "(", "$", "folderName", ".", "\"/\"", ".", "$", "entry", "[", "'name'", "]", ",", "TRUE", ")", ";", "else", "$", "this", "->", "removeFile", "(", "$", "folderName", ".", "\"/\"", ".", "$", "entry", "[", "'name'", "]", ")", ";", "}", "}", "return", "@", "ftp_rmdir", "(", "$", "this", "->", "connection", "->", "getResource", "(", ")", ",", "$", "folderName", ")", ";", "}" ]
Removes a Folder. @access public @param string $folderName Name of folder to be removed @return boolean
[ "Removes", "a", "Folder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/FTP/Writer.php#L204-L220
36,618
CeusMedia/Common
src/Net/FTP/Writer.php
Net_FTP_Writer.renameFile
public function renameFile( $from, $to ) { $this->connection->checkConnection(); return @ftp_rename( $this->connection->getResource(), $from, $to ); }
php
public function renameFile( $from, $to ) { $this->connection->checkConnection(); return @ftp_rename( $this->connection->getResource(), $from, $to ); }
[ "public", "function", "renameFile", "(", "$", "from", ",", "$", "to", ")", "{", "$", "this", "->", "connection", "->", "checkConnection", "(", ")", ";", "return", "@", "ftp_rename", "(", "$", "this", "->", "connection", "->", "getResource", "(", ")", ",", "$", "from", ",", "$", "to", ")", ";", "}" ]
Renames a File on FTP Server. @access public @param string $from Name of source file @param string $to Name of target file @return boolean
[ "Renames", "a", "File", "on", "FTP", "Server", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/FTP/Writer.php#L229-L233
36,619
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addCondition
public function addCondition( $condition ) { if( is_array( $condition ) ) return $this->addConditions( $condition ); if( in_array( $condition, $this->conditions ) ) return FALSE; $this->conditions[] = $condition; return TRUE; }
php
public function addCondition( $condition ) { if( is_array( $condition ) ) return $this->addConditions( $condition ); if( in_array( $condition, $this->conditions ) ) return FALSE; $this->conditions[] = $condition; return TRUE; }
[ "public", "function", "addCondition", "(", "$", "condition", ")", "{", "if", "(", "is_array", "(", "$", "condition", ")", ")", "return", "$", "this", "->", "addConditions", "(", "$", "condition", ")", ";", "if", "(", "in_array", "(", "$", "condition", ",", "$", "this", "->", "conditions", ")", ")", "return", "FALSE", ";", "$", "this", "->", "conditions", "[", "]", "=", "$", "condition", ";", "return", "TRUE", ";", "}" ]
Adds a Where Condition. @access public @param string $condition Where Condition @return void
[ "Adds", "a", "Where", "Condition", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L83-L91
36,620
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addConditions
public function addConditions( $conditions ) { if( !is_array( $conditions ) ) throw new InvalidArgumentException( 'An Array should be given.' ); foreach( $conditions as $condition ) $this->addCondition( $condition ); }
php
public function addConditions( $conditions ) { if( !is_array( $conditions ) ) throw new InvalidArgumentException( 'An Array should be given.' ); foreach( $conditions as $condition ) $this->addCondition( $condition ); }
[ "public", "function", "addConditions", "(", "$", "conditions", ")", "{", "if", "(", "!", "is_array", "(", "$", "conditions", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'An Array should be given.'", ")", ";", "foreach", "(", "$", "conditions", "as", "$", "condition", ")", "$", "this", "->", "addCondition", "(", "$", "condition", ")", ";", "}" ]
Adds Where Conditions. @access public @param array $conditions Where Conditions @return void
[ "Adds", "Where", "Conditions", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L99-L105
36,621
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addGrouping
public function addGrouping( $grouping ) { if( is_array( $grouping ) ) return $this->addGroupings( $grouping ); if( in_array( $grouping, $this->groupings ) ) return FALSE; $this->groupings[] = $grouping; return TRUE; }
php
public function addGrouping( $grouping ) { if( is_array( $grouping ) ) return $this->addGroupings( $grouping ); if( in_array( $grouping, $this->groupings ) ) return FALSE; $this->groupings[] = $grouping; return TRUE; }
[ "public", "function", "addGrouping", "(", "$", "grouping", ")", "{", "if", "(", "is_array", "(", "$", "grouping", ")", ")", "return", "$", "this", "->", "addGroupings", "(", "$", "grouping", ")", ";", "if", "(", "in_array", "(", "$", "grouping", ",", "$", "this", "->", "groupings", ")", ")", "return", "FALSE", ";", "$", "this", "->", "groupings", "[", "]", "=", "$", "grouping", ";", "return", "TRUE", ";", "}" ]
Adds a Group Condition. @access public @param string $grouping Group Condition @return void
[ "Adds", "a", "Group", "Condition", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L113-L121
36,622
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addGroupings
public function addGroupings( $groupings ) { if( !is_array( $groupings ) ) throw new InvalidArgumentException( 'An Array should be given.' ); foreach( $groupings as $grouping ) $this->addGrouping( $grouping ); }
php
public function addGroupings( $groupings ) { if( !is_array( $groupings ) ) throw new InvalidArgumentException( 'An Array should be given.' ); foreach( $groupings as $grouping ) $this->addGrouping( $grouping ); }
[ "public", "function", "addGroupings", "(", "$", "groupings", ")", "{", "if", "(", "!", "is_array", "(", "$", "groupings", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'An Array should be given.'", ")", ";", "foreach", "(", "$", "groupings", "as", "$", "grouping", ")", "$", "this", "->", "addGrouping", "(", "$", "grouping", ")", ";", "}" ]
Adds Group Conditions. @access public @param array $groupings Group Conditions @return void
[ "Adds", "Group", "Conditions", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L129-L135
36,623
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addHaving
public function addHaving( $having ) { if( is_array( $having ) ) return $this->addHavings( $having ); if( in_array( $having, $this->havings ) ) return FALSE; $this->havings[] = $having; return TRUE; }
php
public function addHaving( $having ) { if( is_array( $having ) ) return $this->addHavings( $having ); if( in_array( $having, $this->havings ) ) return FALSE; $this->havings[] = $having; return TRUE; }
[ "public", "function", "addHaving", "(", "$", "having", ")", "{", "if", "(", "is_array", "(", "$", "having", ")", ")", "return", "$", "this", "->", "addHavings", "(", "$", "having", ")", ";", "if", "(", "in_array", "(", "$", "having", ",", "$", "this", "->", "havings", ")", ")", "return", "FALSE", ";", "$", "this", "->", "havings", "[", "]", "=", "$", "having", ";", "return", "TRUE", ";", "}" ]
Adds a Having condition. @access public @param string $having Having Condition @return void
[ "Adds", "a", "Having", "condition", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L143-L151
36,624
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addHavings
public function addHavings( $havings ) { if( !is_array( $havings ) ) throw new InvalidArgumentException( 'An Array should be given.' ); foreach( $havings as $having ) $this->addHaving( $havings ); }
php
public function addHavings( $havings ) { if( !is_array( $havings ) ) throw new InvalidArgumentException( 'An Array should be given.' ); foreach( $havings as $having ) $this->addHaving( $havings ); }
[ "public", "function", "addHavings", "(", "$", "havings", ")", "{", "if", "(", "!", "is_array", "(", "$", "havings", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'An Array should be given.'", ")", ";", "foreach", "(", "$", "havings", "as", "$", "having", ")", "$", "this", "->", "addHaving", "(", "$", "havings", ")", ";", "}" ]
Adds Havings Conditions. @access public @param array $havings Having Conditions @return void
[ "Adds", "Havings", "Conditions", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L159-L165
36,625
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addKey
public function addKey( $key ) { if( is_array( $key ) ) return $this->addKeys( $key ); if( in_array( $key, $this->keys ) ) return FALSE; $this->keys[] = $key; return TRUE; }
php
public function addKey( $key ) { if( is_array( $key ) ) return $this->addKeys( $key ); if( in_array( $key, $this->keys ) ) return FALSE; $this->keys[] = $key; return TRUE; }
[ "public", "function", "addKey", "(", "$", "key", ")", "{", "if", "(", "is_array", "(", "$", "key", ")", ")", "return", "$", "this", "->", "addKeys", "(", "$", "key", ")", ";", "if", "(", "in_array", "(", "$", "key", ",", "$", "this", "->", "keys", ")", ")", "return", "FALSE", ";", "$", "this", "->", "keys", "[", "]", "=", "$", "key", ";", "return", "TRUE", ";", "}" ]
Adds a Key to search for. @access public @param string $key Key to search for @return void
[ "Adds", "a", "Key", "to", "search", "for", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L173-L181
36,626
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addKeys
public function addKeys( $keys ) { if( !is_array( $keys ) ) throw new InvalidArgumentException( 'An Array should be given.' ); foreach( $keys as $key ) $this->addKey( $key ); }
php
public function addKeys( $keys ) { if( !is_array( $keys ) ) throw new InvalidArgumentException( 'An Array should be given.' ); foreach( $keys as $key ) $this->addKey( $key ); }
[ "public", "function", "addKeys", "(", "$", "keys", ")", "{", "if", "(", "!", "is_array", "(", "$", "keys", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'An Array should be given.'", ")", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "$", "this", "->", "addKey", "(", "$", "key", ")", ";", "}" ]
Adds Keys to search for. @access public @param array $keys Keys to search for @return void
[ "Adds", "Keys", "to", "search", "for", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L189-L195
36,627
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addOrders
public function addOrders( $orders ) { if( !is_array( $orders ) ) throw new InvalidArgumentException( 'An Array should be given.' ); foreach( $orders as $column => $direction ) $this->addOrder( $column, $direction ); }
php
public function addOrders( $orders ) { if( !is_array( $orders ) ) throw new InvalidArgumentException( 'An Array should be given.' ); foreach( $orders as $column => $direction ) $this->addOrder( $column, $direction ); }
[ "public", "function", "addOrders", "(", "$", "orders", ")", "{", "if", "(", "!", "is_array", "(", "$", "orders", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'An Array should be given.'", ")", ";", "foreach", "(", "$", "orders", "as", "$", "column", "=>", "$", "direction", ")", "$", "this", "->", "addOrder", "(", "$", "column", ",", "$", "direction", ")", ";", "}" ]
Adds sort conditions. @access public @param array $orders Sort conditions @return void
[ "Adds", "sort", "conditions", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L215-L221
36,628
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addTable
public function addTable( $table, $prefix = NULL ) { $prefix = $prefix === NULL ? $this->prefix : $prefix; if( is_array( $table ) ) return $this->addTables( $table, $prefix ); if( in_array( $prefix.$table, $this->tables ) ) return FALSE; $this->tables[] = $prefix.$table; return TRUE; }
php
public function addTable( $table, $prefix = NULL ) { $prefix = $prefix === NULL ? $this->prefix : $prefix; if( is_array( $table ) ) return $this->addTables( $table, $prefix ); if( in_array( $prefix.$table, $this->tables ) ) return FALSE; $this->tables[] = $prefix.$table; return TRUE; }
[ "public", "function", "addTable", "(", "$", "table", ",", "$", "prefix", "=", "NULL", ")", "{", "$", "prefix", "=", "$", "prefix", "===", "NULL", "?", "$", "this", "->", "prefix", ":", "$", "prefix", ";", "if", "(", "is_array", "(", "$", "table", ")", ")", "return", "$", "this", "->", "addTables", "(", "$", "table", ",", "$", "prefix", ")", ";", "if", "(", "in_array", "(", "$", "prefix", ".", "$", "table", ",", "$", "this", "->", "tables", ")", ")", "return", "FALSE", ";", "$", "this", "->", "tables", "[", "]", "=", "$", "prefix", ".", "$", "table", ";", "return", "TRUE", ";", "}" ]
Adds a table to search in. @access public @param string $table Table to search in @param string $prefix Prefix to override default prefix @return void
[ "Adds", "a", "table", "to", "search", "in", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L230-L239
36,629
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.addTables
public function addTables( $tables, $prefix = NULL ) { if( !is_array( $tables ) ) throw new InvalidArgumentException( 'An Array should be given.' ); $tables = (array) $tables; foreach( $tables as $table ) $this->addTable( $table, $prefix ); }
php
public function addTables( $tables, $prefix = NULL ) { if( !is_array( $tables ) ) throw new InvalidArgumentException( 'An Array should be given.' ); $tables = (array) $tables; foreach( $tables as $table ) $this->addTable( $table, $prefix ); }
[ "public", "function", "addTables", "(", "$", "tables", ",", "$", "prefix", "=", "NULL", ")", "{", "if", "(", "!", "is_array", "(", "$", "tables", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'An Array should be given.'", ")", ";", "$", "tables", "=", "(", "array", ")", "$", "tables", ";", "foreach", "(", "$", "tables", "as", "$", "table", ")", "$", "this", "->", "addTable", "(", "$", "table", ",", "$", "prefix", ")", ";", "}" ]
Adds tables to search in. @access public @param array $tables Tables to search in @param string $prefix Prefix to override default prefix @return void
[ "Adds", "tables", "to", "search", "in", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L248-L255
36,630
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.buildCountStatement
public function buildCountStatement() { if( !$this->keys ) throw new RuntimeException( 'No Columns defined.' ); if( !$this->tables ) throw new RuntimeException( 'No Tables defined.' ); $tables = array(); $tables = "\nFROM\n\t".implode( ",\n\t", $this->tables ); $conditions = ""; $groupings = ""; $havings = ""; if( $this->conditions ) $conditions = "\nWHERE\n\t".implode( " AND\n\t", $this->conditions ); if( $this->groupings ) $groupings = "\nGROUP BY\n\t".implode( ",\n\t", $this->groupings ); if( $this->havings ) $havings = "\nHAVING\n\t".implode( ",\n\t", $this->havings ); $column = preg_replace( '/(.+)( AS .+)/i', '\\1', $this->keys[0] ); $statement = "SELECT COUNT(".$column.") as rowcount".$tables.$conditions.$groupings.$havings; return $statement; }
php
public function buildCountStatement() { if( !$this->keys ) throw new RuntimeException( 'No Columns defined.' ); if( !$this->tables ) throw new RuntimeException( 'No Tables defined.' ); $tables = array(); $tables = "\nFROM\n\t".implode( ",\n\t", $this->tables ); $conditions = ""; $groupings = ""; $havings = ""; if( $this->conditions ) $conditions = "\nWHERE\n\t".implode( " AND\n\t", $this->conditions ); if( $this->groupings ) $groupings = "\nGROUP BY\n\t".implode( ",\n\t", $this->groupings ); if( $this->havings ) $havings = "\nHAVING\n\t".implode( ",\n\t", $this->havings ); $column = preg_replace( '/(.+)( AS .+)/i', '\\1', $this->keys[0] ); $statement = "SELECT COUNT(".$column.") as rowcount".$tables.$conditions.$groupings.$havings; return $statement; }
[ "public", "function", "buildCountStatement", "(", ")", "{", "if", "(", "!", "$", "this", "->", "keys", ")", "throw", "new", "RuntimeException", "(", "'No Columns defined.'", ")", ";", "if", "(", "!", "$", "this", "->", "tables", ")", "throw", "new", "RuntimeException", "(", "'No Tables defined.'", ")", ";", "$", "tables", "=", "array", "(", ")", ";", "$", "tables", "=", "\"\\nFROM\\n\\t\"", ".", "implode", "(", "\",\\n\\t\"", ",", "$", "this", "->", "tables", ")", ";", "$", "conditions", "=", "\"\"", ";", "$", "groupings", "=", "\"\"", ";", "$", "havings", "=", "\"\"", ";", "if", "(", "$", "this", "->", "conditions", ")", "$", "conditions", "=", "\"\\nWHERE\\n\\t\"", ".", "implode", "(", "\" AND\\n\\t\"", ",", "$", "this", "->", "conditions", ")", ";", "if", "(", "$", "this", "->", "groupings", ")", "$", "groupings", "=", "\"\\nGROUP BY\\n\\t\"", ".", "implode", "(", "\",\\n\\t\"", ",", "$", "this", "->", "groupings", ")", ";", "if", "(", "$", "this", "->", "havings", ")", "$", "havings", "=", "\"\\nHAVING\\n\\t\"", ".", "implode", "(", "\",\\n\\t\"", ",", "$", "this", "->", "havings", ")", ";", "$", "column", "=", "preg_replace", "(", "'/(.+)( AS .+)/i'", ",", "'\\\\1'", ",", "$", "this", "->", "keys", "[", "0", "]", ")", ";", "$", "statement", "=", "\"SELECT COUNT(\"", ".", "$", "column", ".", "\") as rowcount\"", ".", "$", "tables", ".", "$", "conditions", ".", "$", "groupings", ".", "$", "havings", ";", "return", "$", "statement", ";", "}" ]
Builds SQL Statement for counting only. @access public @return string
[ "Builds", "SQL", "Statement", "for", "counting", "only", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L262-L283
36,631
CeusMedia/Common
src/DB/StatementBuilder.php
DB_StatementBuilder.buildSelectStatement
public function buildSelectStatement() { if( !$this->keys ) throw new RuntimeException( 'No Columns defined.' ); if( !$this->tables ) throw new RuntimeException( 'No Tables defined.' ); $tables = array(); $keys = "SELECT\n\t".implode( ",\n\t", $this->keys ); $tables = "\nFROM\n\t".implode( ",\n\t", $this->tables ); $conditions = ""; $groupings = ""; $havings = ""; $limit = ""; if( $this->conditions ) $conditions = "\nWHERE\n\t".implode( " AND\n\t", $this->conditions ); if( $this->groupings ) $groupings = "\nGROUP BY\n\t".implode( ",\n\t", $this->groupings ); if( $this->havings ) $havings = "\nHAVING\n\t".implode( ",\n\t", $this->havings ); $orders = ""; if( count( $this->orders ) ) { $orders = array(); foreach( $this->orders as $column => $direction ) $orders[] = $column." ".$direction; $orders = "\nORDER BY\n\t".implode( ",\n\t", $orders ); } if( $this->limit ) { $limit = "\nLIMIT ".$this->limit; if( $this->offset ) $limit .= "\nOFFSET ".$this->offset; } $statement = $keys.$tables.$conditions.$groupings.$havings.$orders.$limit; return $statement; }
php
public function buildSelectStatement() { if( !$this->keys ) throw new RuntimeException( 'No Columns defined.' ); if( !$this->tables ) throw new RuntimeException( 'No Tables defined.' ); $tables = array(); $keys = "SELECT\n\t".implode( ",\n\t", $this->keys ); $tables = "\nFROM\n\t".implode( ",\n\t", $this->tables ); $conditions = ""; $groupings = ""; $havings = ""; $limit = ""; if( $this->conditions ) $conditions = "\nWHERE\n\t".implode( " AND\n\t", $this->conditions ); if( $this->groupings ) $groupings = "\nGROUP BY\n\t".implode( ",\n\t", $this->groupings ); if( $this->havings ) $havings = "\nHAVING\n\t".implode( ",\n\t", $this->havings ); $orders = ""; if( count( $this->orders ) ) { $orders = array(); foreach( $this->orders as $column => $direction ) $orders[] = $column." ".$direction; $orders = "\nORDER BY\n\t".implode( ",\n\t", $orders ); } if( $this->limit ) { $limit = "\nLIMIT ".$this->limit; if( $this->offset ) $limit .= "\nOFFSET ".$this->offset; } $statement = $keys.$tables.$conditions.$groupings.$havings.$orders.$limit; return $statement; }
[ "public", "function", "buildSelectStatement", "(", ")", "{", "if", "(", "!", "$", "this", "->", "keys", ")", "throw", "new", "RuntimeException", "(", "'No Columns defined.'", ")", ";", "if", "(", "!", "$", "this", "->", "tables", ")", "throw", "new", "RuntimeException", "(", "'No Tables defined.'", ")", ";", "$", "tables", "=", "array", "(", ")", ";", "$", "keys", "=", "\"SELECT\\n\\t\"", ".", "implode", "(", "\",\\n\\t\"", ",", "$", "this", "->", "keys", ")", ";", "$", "tables", "=", "\"\\nFROM\\n\\t\"", ".", "implode", "(", "\",\\n\\t\"", ",", "$", "this", "->", "tables", ")", ";", "$", "conditions", "=", "\"\"", ";", "$", "groupings", "=", "\"\"", ";", "$", "havings", "=", "\"\"", ";", "$", "limit", "=", "\"\"", ";", "if", "(", "$", "this", "->", "conditions", ")", "$", "conditions", "=", "\"\\nWHERE\\n\\t\"", ".", "implode", "(", "\" AND\\n\\t\"", ",", "$", "this", "->", "conditions", ")", ";", "if", "(", "$", "this", "->", "groupings", ")", "$", "groupings", "=", "\"\\nGROUP BY\\n\\t\"", ".", "implode", "(", "\",\\n\\t\"", ",", "$", "this", "->", "groupings", ")", ";", "if", "(", "$", "this", "->", "havings", ")", "$", "havings", "=", "\"\\nHAVING\\n\\t\"", ".", "implode", "(", "\",\\n\\t\"", ",", "$", "this", "->", "havings", ")", ";", "$", "orders", "=", "\"\"", ";", "if", "(", "count", "(", "$", "this", "->", "orders", ")", ")", "{", "$", "orders", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "orders", "as", "$", "column", "=>", "$", "direction", ")", "$", "orders", "[", "]", "=", "$", "column", ".", "\" \"", ".", "$", "direction", ";", "$", "orders", "=", "\"\\nORDER BY\\n\\t\"", ".", "implode", "(", "\",\\n\\t\"", ",", "$", "orders", ")", ";", "}", "if", "(", "$", "this", "->", "limit", ")", "{", "$", "limit", "=", "\"\\nLIMIT \"", ".", "$", "this", "->", "limit", ";", "if", "(", "$", "this", "->", "offset", ")", "$", "limit", ".=", "\"\\nOFFSET \"", ".", "$", "this", "->", "offset", ";", "}", "$", "statement", "=", "$", "keys", ".", "$", "tables", ".", "$", "conditions", ".", "$", "groupings", ".", "$", "havings", ".", "$", "orders", ".", "$", "limit", ";", "return", "$", "statement", ";", "}" ]
Builds SQL Statement. @access public @return string
[ "Builds", "SQL", "Statement", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/StatementBuilder.php#L290-L327
36,632
RhubarbPHP/Scaffold.TokenBasedRestApi
src/Authentication/TokenAuthenticationProvider.php
TokenAuthenticationProvider.isTokenValid
protected function isTokenValid($tokenString) { try { $user = ApiToken::validateToken($tokenString); // We need to make the login provider understand that we're now authenticated. $this->logUserIn($user); } catch (TokenInvalidException $er) { throw new ForceResponseException(new TokenAuthorisationRequiredResponse($this)); } return true; }
php
protected function isTokenValid($tokenString) { try { $user = ApiToken::validateToken($tokenString); // We need to make the login provider understand that we're now authenticated. $this->logUserIn($user); } catch (TokenInvalidException $er) { throw new ForceResponseException(new TokenAuthorisationRequiredResponse($this)); } return true; }
[ "protected", "function", "isTokenValid", "(", "$", "tokenString", ")", "{", "try", "{", "$", "user", "=", "ApiToken", "::", "validateToken", "(", "$", "tokenString", ")", ";", "// We need to make the login provider understand that we're now authenticated.", "$", "this", "->", "logUserIn", "(", "$", "user", ")", ";", "}", "catch", "(", "TokenInvalidException", "$", "er", ")", "{", "throw", "new", "ForceResponseException", "(", "new", "TokenAuthorisationRequiredResponse", "(", "$", "this", ")", ")", ";", "}", "return", "true", ";", "}" ]
Returns true if the token is valid. @param $tokenString @throws \Rhubarb\Crown\Exceptions\ForceResponseException @return mixed
[ "Returns", "true", "if", "the", "token", "is", "valid", "." ]
581deee0eb6a675afa82c55f792a67a7895fdda2
https://github.com/RhubarbPHP/Scaffold.TokenBasedRestApi/blob/581deee0eb6a675afa82c55f792a67a7895fdda2/src/Authentication/TokenAuthenticationProvider.php#L39-L51
36,633
CeusMedia/Common
src/DB/TableReader.php
DB_TableReader.focusForeign
public function focusForeign( $key, $id ) { if( in_array( $key, $this->foreignKeys ) ) { $this->foreignFocuses[$key] = $id; return TRUE; } return FALSE; }
php
public function focusForeign( $key, $id ) { if( in_array( $key, $this->foreignKeys ) ) { $this->foreignFocuses[$key] = $id; return TRUE; } return FALSE; }
[ "public", "function", "focusForeign", "(", "$", "key", ",", "$", "id", ")", "{", "if", "(", "in_array", "(", "$", "key", ",", "$", "this", "->", "foreignKeys", ")", ")", "{", "$", "this", "->", "foreignFocuses", "[", "$", "key", "]", "=", "$", "id", ";", "return", "TRUE", ";", "}", "return", "FALSE", ";", "}" ]
Setting focus on a foreign key ID. @access public @param string $key Foreign Key Name @param int $id Foreign Key ID to focus on @return bool
[ "Setting", "focus", "on", "a", "foreign", "key", "ID", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/TableReader.php#L107-L115
36,634
CeusMedia/Common
src/DB/TableReader.php
DB_TableReader.getAllCount
public function getAllCount( $conditions = array(), $verbose = FALSE ) { if( sizeof( $this->fields ) ) { $conditions = $this->getConditionQuery( $conditions, FALSE, FALSE ); $conditions = $conditions ? ' WHERE '.$conditions : ''; $query = 'SELECT COUNT('.$this->primaryKey.') FROM '.$this->getTableName().$conditions; if( $verbose ) echo '<br/>'.$query; $q = $this->dbc->Execute( $query ); $d = $q->FetchRow(); return $d[0]; } return -1; }
php
public function getAllCount( $conditions = array(), $verbose = FALSE ) { if( sizeof( $this->fields ) ) { $conditions = $this->getConditionQuery( $conditions, FALSE, FALSE ); $conditions = $conditions ? ' WHERE '.$conditions : ''; $query = 'SELECT COUNT('.$this->primaryKey.') FROM '.$this->getTableName().$conditions; if( $verbose ) echo '<br/>'.$query; $q = $this->dbc->Execute( $query ); $d = $q->FetchRow(); return $d[0]; } return -1; }
[ "public", "function", "getAllCount", "(", "$", "conditions", "=", "array", "(", ")", ",", "$", "verbose", "=", "FALSE", ")", "{", "if", "(", "sizeof", "(", "$", "this", "->", "fields", ")", ")", "{", "$", "conditions", "=", "$", "this", "->", "getConditionQuery", "(", "$", "conditions", ",", "FALSE", ",", "FALSE", ")", ";", "$", "conditions", "=", "$", "conditions", "?", "' WHERE '", ".", "$", "conditions", ":", "''", ";", "$", "query", "=", "'SELECT COUNT('", ".", "$", "this", "->", "primaryKey", ".", "') FROM '", ".", "$", "this", "->", "getTableName", "(", ")", ".", "$", "conditions", ";", "if", "(", "$", "verbose", ")", "echo", "'<br/>'", ".", "$", "query", ";", "$", "q", "=", "$", "this", "->", "dbc", "->", "Execute", "(", "$", "query", ")", ";", "$", "d", "=", "$", "q", "->", "FetchRow", "(", ")", ";", "return", "$", "d", "[", "0", "]", ";", "}", "return", "-", "1", ";", "}" ]
Returns count of all entries of this Table. @access public @param array $conditions Array of Condition Strings @param bool $verbose Flag: print Query @return int
[ "Returns", "count", "of", "all", "entries", "of", "this", "Table", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/TableReader.php#L137-L151
36,635
CeusMedia/Common
src/DB/TableReader.php
DB_TableReader.getAllData
public function getAllData( $keys = array(), $conditions = array(), $orders = array(), $limits = array(), $verbose = FALSE ) { if( sizeof( $this->fields ) ) { if( ( is_array( $keys ) && !count( $keys ) ) || ( is_string( $keys ) && !$keys ) ) $keys = array( '*' ); $conditions = $this->getConditionQuery( $conditions, FALSE, FALSE ); $conditions = $conditions ? ' WHERE '.$conditions : ''; $orders = $this->getOrderQuery( $orders ); $limits = $this->getLimitQuery( $limits ); $list = array(); $query = 'SELECT '.implode( ', ', $keys ).' FROM '.$this->getTableName().$conditions.$orders.$limits; if( $verbose ) echo '<br/>'.$query; $q = $this->dbc->Execute( $query ); while( $d = $q->FetchNextObject( FALSE ) ) { $data = array(); foreach( $this->fields as $field ) if( in_array( '*', $keys ) || in_array( $field, $keys ) ) $data[$field] = $d->$field; $list[] = $data; } } return $list; }
php
public function getAllData( $keys = array(), $conditions = array(), $orders = array(), $limits = array(), $verbose = FALSE ) { if( sizeof( $this->fields ) ) { if( ( is_array( $keys ) && !count( $keys ) ) || ( is_string( $keys ) && !$keys ) ) $keys = array( '*' ); $conditions = $this->getConditionQuery( $conditions, FALSE, FALSE ); $conditions = $conditions ? ' WHERE '.$conditions : ''; $orders = $this->getOrderQuery( $orders ); $limits = $this->getLimitQuery( $limits ); $list = array(); $query = 'SELECT '.implode( ', ', $keys ).' FROM '.$this->getTableName().$conditions.$orders.$limits; if( $verbose ) echo '<br/>'.$query; $q = $this->dbc->Execute( $query ); while( $d = $q->FetchNextObject( FALSE ) ) { $data = array(); foreach( $this->fields as $field ) if( in_array( '*', $keys ) || in_array( $field, $keys ) ) $data[$field] = $d->$field; $list[] = $data; } } return $list; }
[ "public", "function", "getAllData", "(", "$", "keys", "=", "array", "(", ")", ",", "$", "conditions", "=", "array", "(", ")", ",", "$", "orders", "=", "array", "(", ")", ",", "$", "limits", "=", "array", "(", ")", ",", "$", "verbose", "=", "FALSE", ")", "{", "if", "(", "sizeof", "(", "$", "this", "->", "fields", ")", ")", "{", "if", "(", "(", "is_array", "(", "$", "keys", ")", "&&", "!", "count", "(", "$", "keys", ")", ")", "||", "(", "is_string", "(", "$", "keys", ")", "&&", "!", "$", "keys", ")", ")", "$", "keys", "=", "array", "(", "'*'", ")", ";", "$", "conditions", "=", "$", "this", "->", "getConditionQuery", "(", "$", "conditions", ",", "FALSE", ",", "FALSE", ")", ";", "$", "conditions", "=", "$", "conditions", "?", "' WHERE '", ".", "$", "conditions", ":", "''", ";", "$", "orders", "=", "$", "this", "->", "getOrderQuery", "(", "$", "orders", ")", ";", "$", "limits", "=", "$", "this", "->", "getLimitQuery", "(", "$", "limits", ")", ";", "$", "list", "=", "array", "(", ")", ";", "$", "query", "=", "'SELECT '", ".", "implode", "(", "', '", ",", "$", "keys", ")", ".", "' FROM '", ".", "$", "this", "->", "getTableName", "(", ")", ".", "$", "conditions", ".", "$", "orders", ".", "$", "limits", ";", "if", "(", "$", "verbose", ")", "echo", "'<br/>'", ".", "$", "query", ";", "$", "q", "=", "$", "this", "->", "dbc", "->", "Execute", "(", "$", "query", ")", ";", "while", "(", "$", "d", "=", "$", "q", "->", "FetchNextObject", "(", "FALSE", ")", ")", "{", "$", "data", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", ")", "if", "(", "in_array", "(", "'*'", ",", "$", "keys", ")", "||", "in_array", "(", "$", "field", ",", "$", "keys", ")", ")", "$", "data", "[", "$", "field", "]", "=", "$", "d", "->", "$", "field", ";", "$", "list", "[", "]", "=", "$", "data", ";", "}", "}", "return", "$", "list", ";", "}" ]
Returns all entries of this Table in an array. @access public @param array $keys Array of Table Keys @param array $conditions Array of Condition Strings (field*) @param array $orders Array of Order Relations (field => ASC|DESC)* @param array $limits Array of Limit Conditions (offset, max)? @param bool $verbose Flag: print Query @return array
[ "Returns", "all", "entries", "of", "this", "Table", "in", "an", "array", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/TableReader.php#L163-L189
36,636
CeusMedia/Common
src/DB/TableReader.php
DB_TableReader.getConditionQuery
protected function getConditionQuery( $conditions, $usePrimary = TRUE, $useForeign = TRUE ) { $new = array(); foreach( $this->fields as $field ) // iterate all Fields if( isset( $conditions[$field] ) ) // if Condition given $new[$field] = $conditions[$field]; // note Condition Pair if( $useForeign && count( $this->foreignFocuses ) ) // if using Foreign Keys foreach( $this->foreignFocuses as $key => $value ) // iterate focused Foreign Keys & is focused Foreign $new[$key] = $value; // note foreign Key Pair if( $usePrimary && $this->isFocused() == 'primary' ) // if using foreign Keys & is focused primary $new[$this->focusKey] = $this->focus; // note primary Key Pair $pattern = '/^(<=|>=|<|>|!=)(.+)/'; $conditions = array(); foreach( $new as $key => $value ) // iterate all noted Pairs { $operation = ' = '; if( preg_match( '/%/', $value ) ) $operation = ' LIKE '; else if( preg_match( $pattern, $value ) ) { $matches = array(); preg_match_all( $pattern, $value, $matches ); $operation = ' '.$matches[1][0].' '; $value = $matches[2][0]; } if( !ini_get( 'magic_quotes_gpc' ) ) { $key = addslashes( $key ); $value = addslashes( $value ); } $conditions[] = '`'.$key.'`'.$operation."'".$value."'"; // create SQL WHERE Condition } $conditions = implode( ' AND ', $conditions ); // combine Conditions with AND return $conditions; }
php
protected function getConditionQuery( $conditions, $usePrimary = TRUE, $useForeign = TRUE ) { $new = array(); foreach( $this->fields as $field ) // iterate all Fields if( isset( $conditions[$field] ) ) // if Condition given $new[$field] = $conditions[$field]; // note Condition Pair if( $useForeign && count( $this->foreignFocuses ) ) // if using Foreign Keys foreach( $this->foreignFocuses as $key => $value ) // iterate focused Foreign Keys & is focused Foreign $new[$key] = $value; // note foreign Key Pair if( $usePrimary && $this->isFocused() == 'primary' ) // if using foreign Keys & is focused primary $new[$this->focusKey] = $this->focus; // note primary Key Pair $pattern = '/^(<=|>=|<|>|!=)(.+)/'; $conditions = array(); foreach( $new as $key => $value ) // iterate all noted Pairs { $operation = ' = '; if( preg_match( '/%/', $value ) ) $operation = ' LIKE '; else if( preg_match( $pattern, $value ) ) { $matches = array(); preg_match_all( $pattern, $value, $matches ); $operation = ' '.$matches[1][0].' '; $value = $matches[2][0]; } if( !ini_get( 'magic_quotes_gpc' ) ) { $key = addslashes( $key ); $value = addslashes( $value ); } $conditions[] = '`'.$key.'`'.$operation."'".$value."'"; // create SQL WHERE Condition } $conditions = implode( ' AND ', $conditions ); // combine Conditions with AND return $conditions; }
[ "protected", "function", "getConditionQuery", "(", "$", "conditions", ",", "$", "usePrimary", "=", "TRUE", ",", "$", "useForeign", "=", "TRUE", ")", "{", "$", "new", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", ")", "// iterate all Fields\r", "if", "(", "isset", "(", "$", "conditions", "[", "$", "field", "]", ")", ")", "// if Condition given\r", "$", "new", "[", "$", "field", "]", "=", "$", "conditions", "[", "$", "field", "]", ";", "// note Condition Pair\r", "if", "(", "$", "useForeign", "&&", "count", "(", "$", "this", "->", "foreignFocuses", ")", ")", "// if using Foreign Keys\r", "foreach", "(", "$", "this", "->", "foreignFocuses", "as", "$", "key", "=>", "$", "value", ")", "// iterate focused Foreign Keys & is focused Foreign\r", "$", "new", "[", "$", "key", "]", "=", "$", "value", ";", "// note foreign Key Pair\r", "if", "(", "$", "usePrimary", "&&", "$", "this", "->", "isFocused", "(", ")", "==", "'primary'", ")", "// if using foreign Keys & is focused primary\r", "$", "new", "[", "$", "this", "->", "focusKey", "]", "=", "$", "this", "->", "focus", ";", "// note primary Key Pair\r", "$", "pattern", "=", "'/^(<=|>=|<|>|!=)(.+)/'", ";", "$", "conditions", "=", "array", "(", ")", ";", "foreach", "(", "$", "new", "as", "$", "key", "=>", "$", "value", ")", "// iterate all noted Pairs\r", "{", "$", "operation", "=", "' = '", ";", "if", "(", "preg_match", "(", "'/%/'", ",", "$", "value", ")", ")", "$", "operation", "=", "' LIKE '", ";", "else", "if", "(", "preg_match", "(", "$", "pattern", ",", "$", "value", ")", ")", "{", "$", "matches", "=", "array", "(", ")", ";", "preg_match_all", "(", "$", "pattern", ",", "$", "value", ",", "$", "matches", ")", ";", "$", "operation", "=", "' '", ".", "$", "matches", "[", "1", "]", "[", "0", "]", ".", "' '", ";", "$", "value", "=", "$", "matches", "[", "2", "]", "[", "0", "]", ";", "}", "if", "(", "!", "ini_get", "(", "'magic_quotes_gpc'", ")", ")", "{", "$", "key", "=", "addslashes", "(", "$", "key", ")", ";", "$", "value", "=", "addslashes", "(", "$", "value", ")", ";", "}", "$", "conditions", "[", "]", "=", "'`'", ".", "$", "key", ".", "'`'", ".", "$", "operation", ".", "\"'\"", ".", "$", "value", ".", "\"'\"", ";", "// create SQL WHERE Condition\r", "}", "$", "conditions", "=", "implode", "(", "' AND '", ",", "$", "conditions", ")", ";", "// combine Conditions with AND\r", "return", "$", "conditions", ";", "}" ]
Builds SQL of given and set Conditions. @access protected @param array $conditions Array of Query Conditions @param bool $usePrimary Flag: use focused Primary Key @param bool $useForeign Flag: use focused Foreign Keys @return string
[ "Builds", "SQL", "of", "given", "and", "set", "Conditions", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/TableReader.php#L199-L235
36,637
CeusMedia/Common
src/DB/TableReader.php
DB_TableReader.getData
public function getData( $first = FALSE, $orders = array(), $limit = array(), $verbose = FALSE ) { $data = array(); if( $this->isFocused() && sizeof( $this->fields ) ) { $conditions = $this->getConditionQuery( array() ); $orders = $this->getOrderQuery( $orders ); $limit = $this->getLimitQuery( $limit ); $query = 'SELECT * FROM '.$this->getTableName().' WHERE '.$conditions.$orders.$limit; if( $verbose ) echo '<br/>'.$query; $q = $this->dbc->Execute( $query ); if( $q->RecordCount() ) { while( $d = $q->FetchNextObject( FALSE ) ) { $line = array(); foreach( $this->fields as $field ) $line[$field] = $d->$field; $data[] = $line; } } } if( count( $data ) && $first ) $data = $data[0]; return $data; }
php
public function getData( $first = FALSE, $orders = array(), $limit = array(), $verbose = FALSE ) { $data = array(); if( $this->isFocused() && sizeof( $this->fields ) ) { $conditions = $this->getConditionQuery( array() ); $orders = $this->getOrderQuery( $orders ); $limit = $this->getLimitQuery( $limit ); $query = 'SELECT * FROM '.$this->getTableName().' WHERE '.$conditions.$orders.$limit; if( $verbose ) echo '<br/>'.$query; $q = $this->dbc->Execute( $query ); if( $q->RecordCount() ) { while( $d = $q->FetchNextObject( FALSE ) ) { $line = array(); foreach( $this->fields as $field ) $line[$field] = $d->$field; $data[] = $line; } } } if( count( $data ) && $first ) $data = $data[0]; return $data; }
[ "public", "function", "getData", "(", "$", "first", "=", "FALSE", ",", "$", "orders", "=", "array", "(", ")", ",", "$", "limit", "=", "array", "(", ")", ",", "$", "verbose", "=", "FALSE", ")", "{", "$", "data", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "isFocused", "(", ")", "&&", "sizeof", "(", "$", "this", "->", "fields", ")", ")", "{", "$", "conditions", "=", "$", "this", "->", "getConditionQuery", "(", "array", "(", ")", ")", ";", "$", "orders", "=", "$", "this", "->", "getOrderQuery", "(", "$", "orders", ")", ";", "$", "limit", "=", "$", "this", "->", "getLimitQuery", "(", "$", "limit", ")", ";", "$", "query", "=", "'SELECT * FROM '", ".", "$", "this", "->", "getTableName", "(", ")", ".", "' WHERE '", ".", "$", "conditions", ".", "$", "orders", ".", "$", "limit", ";", "if", "(", "$", "verbose", ")", "echo", "'<br/>'", ".", "$", "query", ";", "$", "q", "=", "$", "this", "->", "dbc", "->", "Execute", "(", "$", "query", ")", ";", "if", "(", "$", "q", "->", "RecordCount", "(", ")", ")", "{", "while", "(", "$", "d", "=", "$", "q", "->", "FetchNextObject", "(", "FALSE", ")", ")", "{", "$", "line", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", ")", "$", "line", "[", "$", "field", "]", "=", "$", "d", "->", "$", "field", ";", "$", "data", "[", "]", "=", "$", "line", ";", "}", "}", "}", "if", "(", "count", "(", "$", "data", ")", "&&", "$", "first", ")", "$", "data", "=", "$", "data", "[", "0", "]", ";", "return", "$", "data", ";", "}" ]
Returns data of focused primary key. @access public @param array $data array of data to store @return bool
[ "Returns", "data", "of", "focused", "primary", "key", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/TableReader.php#L243-L270
36,638
CeusMedia/Common
src/DB/TableReader.php
DB_TableReader.getFocus
public function getFocus() { if( $this->isFocused() == 'primary' ) return $this->focus; else if( $this->isFocused() == 'foreign' ) return $this->foreignFocuses; return FALSE; }
php
public function getFocus() { if( $this->isFocused() == 'primary' ) return $this->focus; else if( $this->isFocused() == 'foreign' ) return $this->foreignFocuses; return FALSE; }
[ "public", "function", "getFocus", "(", ")", "{", "if", "(", "$", "this", "->", "isFocused", "(", ")", "==", "'primary'", ")", "return", "$", "this", "->", "focus", ";", "else", "if", "(", "$", "this", "->", "isFocused", "(", ")", "==", "'foreign'", ")", "return", "$", "this", "->", "foreignFocuses", ";", "return", "FALSE", ";", "}" ]
Returns current primary focus or foreign focuses. @access public @return mixed
[ "Returns", "current", "primary", "focus", "or", "foreign", "focuses", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/TableReader.php#L297-L304
36,639
CeusMedia/Common
src/DB/TableReader.php
DB_TableReader.getLimitQuery
protected function getLimitQuery( $limits = array() ) { if( is_array( $limits ) && count( $limits ) == 2 ) $limits = ' LIMIT '.$limits[0].', '.$limits[1]; else if( is_int( $limits ) && $limits ) $limits = ' LIMIT 0, '.$limits; else $limits = ''; return $limits; }
php
protected function getLimitQuery( $limits = array() ) { if( is_array( $limits ) && count( $limits ) == 2 ) $limits = ' LIMIT '.$limits[0].', '.$limits[1]; else if( is_int( $limits ) && $limits ) $limits = ' LIMIT 0, '.$limits; else $limits = ''; return $limits; }
[ "protected", "function", "getLimitQuery", "(", "$", "limits", "=", "array", "(", ")", ")", "{", "if", "(", "is_array", "(", "$", "limits", ")", "&&", "count", "(", "$", "limits", ")", "==", "2", ")", "$", "limits", "=", "' LIMIT '", ".", "$", "limits", "[", "0", "]", ".", "', '", ".", "$", "limits", "[", "1", "]", ";", "else", "if", "(", "is_int", "(", "$", "limits", ")", "&&", "$", "limits", ")", "$", "limits", "=", "' LIMIT 0, '", ".", "$", "limits", ";", "else", "$", "limits", "=", "''", ";", "return", "$", "limits", ";", "}" ]
Builds Query Limit. @access protected @param array|int $limits Array of Offet and Limit or just Limit as int, else ignored @return string
[ "Builds", "Query", "Limit", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/TableReader.php#L322-L331
36,640
CeusMedia/Common
src/DB/TableReader.php
DB_TableReader.getOrderQuery
protected function getOrderQuery( $orders = array() ) { if( is_array( $orders ) && count( $orders ) ) { $order = array(); foreach( $orders as $key => $value ) $order[] = $key.' '.$value; $orders = ' ORDER BY '.implode( ', ', $order ); } else $orders = ''; return $orders; }
php
protected function getOrderQuery( $orders = array() ) { if( is_array( $orders ) && count( $orders ) ) { $order = array(); foreach( $orders as $key => $value ) $order[] = $key.' '.$value; $orders = ' ORDER BY '.implode( ', ', $order ); } else $orders = ''; return $orders; }
[ "protected", "function", "getOrderQuery", "(", "$", "orders", "=", "array", "(", ")", ")", "{", "if", "(", "is_array", "(", "$", "orders", ")", "&&", "count", "(", "$", "orders", ")", ")", "{", "$", "order", "=", "array", "(", ")", ";", "foreach", "(", "$", "orders", "as", "$", "key", "=>", "$", "value", ")", "$", "order", "[", "]", "=", "$", "key", ".", "' '", ".", "$", "value", ";", "$", "orders", "=", "' ORDER BY '", ".", "implode", "(", "', '", ",", "$", "order", ")", ";", "}", "else", "$", "orders", "=", "''", ";", "return", "$", "orders", ";", "}" ]
Builds Query Order. @access protected @param array $orders Array of Orders, like array('field1'=>'ASC','field'=>'DESC') @return string
[ "Builds", "Query", "Order", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/TableReader.php#L339-L351
36,641
CeusMedia/Common
src/DB/TableReader.php
DB_TableReader.isFocused
public function isFocused() { if( $this->focus !== FALSE && $this->focusKey ) return 'primary'; if( count( $this->foreignFocuses ) ) return 'foreign'; return FALSE; }
php
public function isFocused() { if( $this->focus !== FALSE && $this->focusKey ) return 'primary'; if( count( $this->foreignFocuses ) ) return 'foreign'; return FALSE; }
[ "public", "function", "isFocused", "(", ")", "{", "if", "(", "$", "this", "->", "focus", "!==", "FALSE", "&&", "$", "this", "->", "focusKey", ")", "return", "'primary'", ";", "if", "(", "count", "(", "$", "this", "->", "foreignFocuses", ")", ")", "return", "'foreign'", ";", "return", "FALSE", ";", "}" ]
Indicates wheter the focus on a key is set. @access public @return bool
[ "Indicates", "wheter", "the", "focus", "on", "a", "key", "is", "set", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/TableReader.php#L378-L385
36,642
CeusMedia/Common
src/DB/TableReader.php
DB_TableReader.setForeignKeys
public function setForeignKeys( $keys ) { $found = TRUE; $this->foreignKeys = array(); foreach( $keys as $key ) { if( !in_array( $key, $this->foreignKeys ) ) $this->foreignKeys[] = $key; else $found = FALSE; } return $found; }
php
public function setForeignKeys( $keys ) { $found = TRUE; $this->foreignKeys = array(); foreach( $keys as $key ) { if( !in_array( $key, $this->foreignKeys ) ) $this->foreignKeys[] = $key; else $found = FALSE; } return $found; }
[ "public", "function", "setForeignKeys", "(", "$", "keys", ")", "{", "$", "found", "=", "TRUE", ";", "$", "this", "->", "foreignKeys", "=", "array", "(", ")", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "if", "(", "!", "in_array", "(", "$", "key", ",", "$", "this", "->", "foreignKeys", ")", ")", "$", "this", "->", "foreignKeys", "[", "]", "=", "$", "key", ";", "else", "$", "found", "=", "FALSE", ";", "}", "return", "$", "found", ";", "}" ]
Setting all foreign keys of this Table. @access public @param array $keys all foreign keys of the Table @return bool
[ "Setting", "all", "foreign", "keys", "of", "this", "Table", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/TableReader.php#L418-L429
36,643
CeusMedia/Common
src/Net/HTTP/CrossDomainProxy.php
Net_HTTP_CrossDomainProxy.forward
public function forward( $throwException = FALSE ) { $query = getEnv( 'QUERY_STRING' ); // get GET Query String $url = $this->url."?".$query; // build Service Request URL return self::requestUrl( $url, $this->username, $this->password, $throwException ); }
php
public function forward( $throwException = FALSE ) { $query = getEnv( 'QUERY_STRING' ); // get GET Query String $url = $this->url."?".$query; // build Service Request URL return self::requestUrl( $url, $this->username, $this->password, $throwException ); }
[ "public", "function", "forward", "(", "$", "throwException", "=", "FALSE", ")", "{", "$", "query", "=", "getEnv", "(", "'QUERY_STRING'", ")", ";", "// get GET Query String", "$", "url", "=", "$", "this", "->", "url", ".", "\"?\"", ".", "$", "query", ";", "// build Service Request URL", "return", "self", "::", "requestUrl", "(", "$", "url", ",", "$", "this", "->", "username", ",", "$", "this", "->", "password", ",", "$", "throwException", ")", ";", "}" ]
Forwards GET or POST Request and returns Response Data. @access public @param bool $throwException Check Service Response for Exception and throw a found Exception further @return string
[ "Forwards", "GET", "or", "POST", "Request", "and", "returns", "Response", "Data", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/CrossDomainProxy.php#L73-L78
36,644
Assasz/yggdrasil
src/Yggdrasil/Utils/Templating/RoutingExtension.php
RoutingExtension.getAsset
public function getAsset(string $path): string { return $this->router->getConfiguration()->getBaseUrl() . ltrim($path, '/'); }
php
public function getAsset(string $path): string { return $this->router->getConfiguration()->getBaseUrl() . ltrim($path, '/'); }
[ "public", "function", "getAsset", "(", "string", "$", "path", ")", ":", "string", "{", "return", "$", "this", "->", "router", "->", "getConfiguration", "(", ")", "->", "getBaseUrl", "(", ")", ".", "ltrim", "(", "$", "path", ",", "'/'", ")", ";", "}" ]
Returns absolute path for requested asset like CSS file @param string $path Path of asset relative to web directory @return string
[ "Returns", "absolute", "path", "for", "requested", "asset", "like", "CSS", "file" ]
bee9bef7713b85799cdd3e9b23dccae33154f3b3
https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Utils/Templating/RoutingExtension.php#L74-L77
36,645
CeusMedia/Common
src/CLI/Output.php
CLI_Output.append
public function append( $string = "", $sleep = 0 ){ $this->sameLine( trim( $this->lastLine ) . $string, $sleep ); }
php
public function append( $string = "", $sleep = 0 ){ $this->sameLine( trim( $this->lastLine ) . $string, $sleep ); }
[ "public", "function", "append", "(", "$", "string", "=", "\"\"", ",", "$", "sleep", "=", "0", ")", "{", "$", "this", "->", "sameLine", "(", "trim", "(", "$", "this", "->", "lastLine", ")", ".", "$", "string", ",", "$", "sleep", ")", ";", "}" ]
Adds text to current line. @access public @param string $string Text to display @param integer $sleep Seconds to sleep afterwards @return void
[ "Adds", "text", "to", "current", "line", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/CLI/Output.php#L52-L54
36,646
CeusMedia/Common
src/CLI/Output.php
CLI_Output.newLine
public function newLine( $string = "", $sleep = 0 ){ $string = Alg_Text_Trimmer::trimCentric( $string, 78 ); // trim string to <80 columns $this->lastLine = $string; print( "\n" . $string ); if( $sleep ) sleep( $sleep ); }
php
public function newLine( $string = "", $sleep = 0 ){ $string = Alg_Text_Trimmer::trimCentric( $string, 78 ); // trim string to <80 columns $this->lastLine = $string; print( "\n" . $string ); if( $sleep ) sleep( $sleep ); }
[ "public", "function", "newLine", "(", "$", "string", "=", "\"\"", ",", "$", "sleep", "=", "0", ")", "{", "$", "string", "=", "Alg_Text_Trimmer", "::", "trimCentric", "(", "$", "string", ",", "78", ")", ";", "// trim string to <80 columns", "$", "this", "->", "lastLine", "=", "$", "string", ";", "print", "(", "\"\\n\"", ".", "$", "string", ")", ";", "if", "(", "$", "sleep", ")", "sleep", "(", "$", "sleep", ")", ";", "}" ]
Display text in new line. @access public @param string $string Text to display @param integer $sleep Seconds to sleep afterwards @return void
[ "Display", "text", "in", "new", "line", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/CLI/Output.php#L63-L69
36,647
CeusMedia/Common
src/CLI/Output.php
CLI_Output.sameLine
public function sameLine( $string = "", $sleep = 0 ){ $string = Alg_Text_Trimmer::trimCentric( $string, 78 ); // trim string to <80 columns $spaces = max( 0, strlen( $this->lastLine ) - strlen( $string ) ); $this->lastLine = $string; $fill = str_repeat( " ", $spaces ); print( "\r" . $string . $fill ); if( $sleep ) sleep( $sleep ); }
php
public function sameLine( $string = "", $sleep = 0 ){ $string = Alg_Text_Trimmer::trimCentric( $string, 78 ); // trim string to <80 columns $spaces = max( 0, strlen( $this->lastLine ) - strlen( $string ) ); $this->lastLine = $string; $fill = str_repeat( " ", $spaces ); print( "\r" . $string . $fill ); if( $sleep ) sleep( $sleep ); }
[ "public", "function", "sameLine", "(", "$", "string", "=", "\"\"", ",", "$", "sleep", "=", "0", ")", "{", "$", "string", "=", "Alg_Text_Trimmer", "::", "trimCentric", "(", "$", "string", ",", "78", ")", ";", "// trim string to <80 columns", "$", "spaces", "=", "max", "(", "0", ",", "strlen", "(", "$", "this", "->", "lastLine", ")", "-", "strlen", "(", "$", "string", ")", ")", ";", "$", "this", "->", "lastLine", "=", "$", "string", ";", "$", "fill", "=", "str_repeat", "(", "\" \"", ",", "$", "spaces", ")", ";", "print", "(", "\"\\r\"", ".", "$", "string", ".", "$", "fill", ")", ";", "if", "(", "$", "sleep", ")", "sleep", "(", "$", "sleep", ")", ";", "}" ]
Display text in current line. @access public @param string $string Text to display @param integer $sleep Seconds to sleep afterwards @return void
[ "Display", "text", "in", "current", "line", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/CLI/Output.php#L78-L86
36,648
CeusMedia/Common
src/DB/MySQL/Connection.php
DB_MySQL_Connection.connectDatabase
public function connectDatabase( $type, $host, $user, $pass, $database = NULL ) { switch( $type ) { case 'connect': $resource = mysql_connect( $host, $user, $pass ); break; case 'pconnect': $resource = mysql_pconnect( $host, $user, $pass ); break; default: throw new InvalidArgumentException( 'Database Connection Type "'.$type.'" is invalid' ); } if( !$resource ) throw new Exception( 'Database Connection failed for User "'.$user.'@'.$host.'"' ); $this->dbc = $resource; if( $database ) return $this->selectDB( $database ); return TRUE; }
php
public function connectDatabase( $type, $host, $user, $pass, $database = NULL ) { switch( $type ) { case 'connect': $resource = mysql_connect( $host, $user, $pass ); break; case 'pconnect': $resource = mysql_pconnect( $host, $user, $pass ); break; default: throw new InvalidArgumentException( 'Database Connection Type "'.$type.'" is invalid' ); } if( !$resource ) throw new Exception( 'Database Connection failed for User "'.$user.'@'.$host.'"' ); $this->dbc = $resource; if( $database ) return $this->selectDB( $database ); return TRUE; }
[ "public", "function", "connectDatabase", "(", "$", "type", ",", "$", "host", ",", "$", "user", ",", "$", "pass", ",", "$", "database", "=", "NULL", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "'connect'", ":", "$", "resource", "=", "mysql_connect", "(", "$", "host", ",", "$", "user", ",", "$", "pass", ")", ";", "break", ";", "case", "'pconnect'", ":", "$", "resource", "=", "mysql_pconnect", "(", "$", "host", ",", "$", "user", ",", "$", "pass", ")", ";", "break", ";", "default", ":", "throw", "new", "InvalidArgumentException", "(", "'Database Connection Type \"'", ".", "$", "type", ".", "'\" is invalid'", ")", ";", "}", "if", "(", "!", "$", "resource", ")", "throw", "new", "Exception", "(", "'Database Connection failed for User \"'", ".", "$", "user", ".", "'@'", ".", "$", "host", ".", "'\"'", ")", ";", "$", "this", "->", "dbc", "=", "$", "resource", ";", "if", "(", "$", "database", ")", "return", "$", "this", "->", "selectDB", "(", "$", "database", ")", ";", "return", "TRUE", ";", "}" ]
Sets up a Database Connection. @access public @param string $type Connection Type (connect|pconnect) @param string $host Database Host Name @param string $user Database User Name @param string $pass Database User Password @param string $database Database to select @return bool Flag: Database Connection established
[ "Sets", "up", "a", "Database", "Connection", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/DB/MySQL/Connection.php#L130-L149
36,649
theodorejb/peachy-sql
lib/PeachySql.php
PeachySql.insertRow
public function insertRow(string $table, array $colVals): InsertResult { $result = $this->insertBatch($table, [$colVals]); $ids = $result->getIds(); $id = empty($ids) ? 0 : $ids[0]; return new InsertResult($id, $result->getAffected()); }
php
public function insertRow(string $table, array $colVals): InsertResult { $result = $this->insertBatch($table, [$colVals]); $ids = $result->getIds(); $id = empty($ids) ? 0 : $ids[0]; return new InsertResult($id, $result->getAffected()); }
[ "public", "function", "insertRow", "(", "string", "$", "table", ",", "array", "$", "colVals", ")", ":", "InsertResult", "{", "$", "result", "=", "$", "this", "->", "insertBatch", "(", "$", "table", ",", "[", "$", "colVals", "]", ")", ";", "$", "ids", "=", "$", "result", "->", "getIds", "(", ")", ";", "$", "id", "=", "empty", "(", "$", "ids", ")", "?", "0", ":", "$", "ids", "[", "0", "]", ";", "return", "new", "InsertResult", "(", "$", "id", ",", "$", "result", "->", "getAffected", "(", ")", ")", ";", "}" ]
Inserts one row
[ "Inserts", "one", "row" ]
f179c6fa6c4293c2713b6b59022f3cfc90890a98
https://github.com/theodorejb/peachy-sql/blob/f179c6fa6c4293c2713b6b59022f3cfc90890a98/lib/PeachySql.php#L66-L72
36,650
theodorejb/peachy-sql
lib/PeachySql.php
PeachySql.insertRows
public function insertRows(string $table, array $colVals, int $identityIncrement = 1): BulkInsertResult { // check whether the query needs to be split into multiple batches $batches = Insert::batchRows($colVals, $this->options->getMaxBoundParams(), $this->options->getMaxInsertRows()); $ids = []; $affected = 0; foreach ($batches as $batch) { $result = $this->insertBatch($table, $batch, $identityIncrement); $ids = array_merge($ids, $result->getIds()); $affected += $result->getAffected(); } return new BulkInsertResult($ids, $affected, count($batches)); }
php
public function insertRows(string $table, array $colVals, int $identityIncrement = 1): BulkInsertResult { // check whether the query needs to be split into multiple batches $batches = Insert::batchRows($colVals, $this->options->getMaxBoundParams(), $this->options->getMaxInsertRows()); $ids = []; $affected = 0; foreach ($batches as $batch) { $result = $this->insertBatch($table, $batch, $identityIncrement); $ids = array_merge($ids, $result->getIds()); $affected += $result->getAffected(); } return new BulkInsertResult($ids, $affected, count($batches)); }
[ "public", "function", "insertRows", "(", "string", "$", "table", ",", "array", "$", "colVals", ",", "int", "$", "identityIncrement", "=", "1", ")", ":", "BulkInsertResult", "{", "// check whether the query needs to be split into multiple batches", "$", "batches", "=", "Insert", "::", "batchRows", "(", "$", "colVals", ",", "$", "this", "->", "options", "->", "getMaxBoundParams", "(", ")", ",", "$", "this", "->", "options", "->", "getMaxInsertRows", "(", ")", ")", ";", "$", "ids", "=", "[", "]", ";", "$", "affected", "=", "0", ";", "foreach", "(", "$", "batches", "as", "$", "batch", ")", "{", "$", "result", "=", "$", "this", "->", "insertBatch", "(", "$", "table", ",", "$", "batch", ",", "$", "identityIncrement", ")", ";", "$", "ids", "=", "array_merge", "(", "$", "ids", ",", "$", "result", "->", "getIds", "(", ")", ")", ";", "$", "affected", "+=", "$", "result", "->", "getAffected", "(", ")", ";", "}", "return", "new", "BulkInsertResult", "(", "$", "ids", ",", "$", "affected", ",", "count", "(", "$", "batches", ")", ")", ";", "}" ]
Insert multiple rows
[ "Insert", "multiple", "rows" ]
f179c6fa6c4293c2713b6b59022f3cfc90890a98
https://github.com/theodorejb/peachy-sql/blob/f179c6fa6c4293c2713b6b59022f3cfc90890a98/lib/PeachySql.php#L77-L91
36,651
theodorejb/peachy-sql
lib/PeachySql.php
PeachySql.updateRows
public function updateRows(string $table, array $set, array $where): int { $update = new Update($this->options); $sqlParams = $update->buildQuery($table, $set, $where); return $this->query($sqlParams->getSql(), $sqlParams->getParams())->getAffected(); }
php
public function updateRows(string $table, array $set, array $where): int { $update = new Update($this->options); $sqlParams = $update->buildQuery($table, $set, $where); return $this->query($sqlParams->getSql(), $sqlParams->getParams())->getAffected(); }
[ "public", "function", "updateRows", "(", "string", "$", "table", ",", "array", "$", "set", ",", "array", "$", "where", ")", ":", "int", "{", "$", "update", "=", "new", "Update", "(", "$", "this", "->", "options", ")", ";", "$", "sqlParams", "=", "$", "update", "->", "buildQuery", "(", "$", "table", ",", "$", "set", ",", "$", "where", ")", ";", "return", "$", "this", "->", "query", "(", "$", "sqlParams", "->", "getSql", "(", ")", ",", "$", "sqlParams", "->", "getParams", "(", ")", ")", "->", "getAffected", "(", ")", ";", "}" ]
Updates the specified columns and values in rows matching the where clause Returns the number of affected rows
[ "Updates", "the", "specified", "columns", "and", "values", "in", "rows", "matching", "the", "where", "clause", "Returns", "the", "number", "of", "affected", "rows" ]
f179c6fa6c4293c2713b6b59022f3cfc90890a98
https://github.com/theodorejb/peachy-sql/blob/f179c6fa6c4293c2713b6b59022f3cfc90890a98/lib/PeachySql.php#L97-L102
36,652
theodorejb/peachy-sql
lib/PeachySql.php
PeachySql.deleteFrom
public function deleteFrom(string $table, array $where): int { $delete = new Delete($this->options); $sqlParams = $delete->buildQuery($table, $where); return $this->query($sqlParams->getSql(), $sqlParams->getParams())->getAffected(); }
php
public function deleteFrom(string $table, array $where): int { $delete = new Delete($this->options); $sqlParams = $delete->buildQuery($table, $where); return $this->query($sqlParams->getSql(), $sqlParams->getParams())->getAffected(); }
[ "public", "function", "deleteFrom", "(", "string", "$", "table", ",", "array", "$", "where", ")", ":", "int", "{", "$", "delete", "=", "new", "Delete", "(", "$", "this", "->", "options", ")", ";", "$", "sqlParams", "=", "$", "delete", "->", "buildQuery", "(", "$", "table", ",", "$", "where", ")", ";", "return", "$", "this", "->", "query", "(", "$", "sqlParams", "->", "getSql", "(", ")", ",", "$", "sqlParams", "->", "getParams", "(", ")", ")", "->", "getAffected", "(", ")", ";", "}" ]
Deletes rows from the table matching the where clause Returns the number of affected rows
[ "Deletes", "rows", "from", "the", "table", "matching", "the", "where", "clause", "Returns", "the", "number", "of", "affected", "rows" ]
f179c6fa6c4293c2713b6b59022f3cfc90890a98
https://github.com/theodorejb/peachy-sql/blob/f179c6fa6c4293c2713b6b59022f3cfc90890a98/lib/PeachySql.php#L108-L113
36,653
CeusMedia/Common
src/Alg/Math/Algebra/Vector/CrossProduct.php
Alg_Math_Algebra_Vector_CrossProduct.produce
public function produce( $vector1, $vector2 ) { if( $vector1->getDimension() != $vector2->getDimension() ) throw new Exception( 'Dimensions of Vectors are not compatible.' ); if( $vector1->getDimension() == 3 ) { $x = $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 2 ) - $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 1 ); $y = $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 0 ) - $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 2 ); $z = $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 1 ) - $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 0 ); $c = new Alg_Math_Algebra_Vector( $x, $y, $z ); } return $c; }
php
public function produce( $vector1, $vector2 ) { if( $vector1->getDimension() != $vector2->getDimension() ) throw new Exception( 'Dimensions of Vectors are not compatible.' ); if( $vector1->getDimension() == 3 ) { $x = $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 2 ) - $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 1 ); $y = $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 0 ) - $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 2 ); $z = $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 1 ) - $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 0 ); $c = new Alg_Math_Algebra_Vector( $x, $y, $z ); } return $c; }
[ "public", "function", "produce", "(", "$", "vector1", ",", "$", "vector2", ")", "{", "if", "(", "$", "vector1", "->", "getDimension", "(", ")", "!=", "$", "vector2", "->", "getDimension", "(", ")", ")", "throw", "new", "Exception", "(", "'Dimensions of Vectors are not compatible.'", ")", ";", "if", "(", "$", "vector1", "->", "getDimension", "(", ")", "==", "3", ")", "{", "$", "x", "=", "$", "vector1", "->", "getValueFromIndex", "(", "1", ")", "*", "$", "vector2", "->", "getValueFromIndex", "(", "2", ")", "-", "$", "vector1", "->", "getValueFromIndex", "(", "2", ")", "*", "$", "vector2", "->", "getValueFromIndex", "(", "1", ")", ";", "$", "y", "=", "$", "vector1", "->", "getValueFromIndex", "(", "2", ")", "*", "$", "vector2", "->", "getValueFromIndex", "(", "0", ")", "-", "$", "vector1", "->", "getValueFromIndex", "(", "0", ")", "*", "$", "vector2", "->", "getValueFromIndex", "(", "2", ")", ";", "$", "z", "=", "$", "vector1", "->", "getValueFromIndex", "(", "0", ")", "*", "$", "vector2", "->", "getValueFromIndex", "(", "1", ")", "-", "$", "vector1", "->", "getValueFromIndex", "(", "1", ")", "*", "$", "vector2", "->", "getValueFromIndex", "(", "0", ")", ";", "$", "c", "=", "new", "Alg_Math_Algebra_Vector", "(", "$", "x", ",", "$", "y", ",", "$", "z", ")", ";", "}", "return", "$", "c", ";", "}" ]
Returns Cross Product of two Vectors @access public @param Alg_Math_Algebra_Vector $vector1 Vector 1 @param Alg_Math_Algebra_Vector $vector2 Vector 2 @return Alg_Math_Algebra_Vector
[ "Returns", "Cross", "Product", "of", "two", "Vectors" ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Algebra/Vector/CrossProduct.php#L59-L71
36,654
janbuecker/sculpin-meta-navigation-bundle
MenuGenerator.php
MenuGenerator.setMenu
protected function setMenu(SourceSet $sourceSet) { // Second loop to set the menu which was initialized during the first loop foreach ($sourceSet->updatedSources() as $source) { /** @var \Sculpin\Core\Source\FileSource $source */ if ($source->isGenerated() || !$source->canBeFormatted()) { // Skip generated sources. // Only takes pages that can be formatted (AKA *.md) continue; } $source->data()->set('menu', $this->menu); } }
php
protected function setMenu(SourceSet $sourceSet) { // Second loop to set the menu which was initialized during the first loop foreach ($sourceSet->updatedSources() as $source) { /** @var \Sculpin\Core\Source\FileSource $source */ if ($source->isGenerated() || !$source->canBeFormatted()) { // Skip generated sources. // Only takes pages that can be formatted (AKA *.md) continue; } $source->data()->set('menu', $this->menu); } }
[ "protected", "function", "setMenu", "(", "SourceSet", "$", "sourceSet", ")", "{", "// Second loop to set the menu which was initialized during the first loop", "foreach", "(", "$", "sourceSet", "->", "updatedSources", "(", ")", "as", "$", "source", ")", "{", "/** @var \\Sculpin\\Core\\Source\\FileSource $source */", "if", "(", "$", "source", "->", "isGenerated", "(", ")", "||", "!", "$", "source", "->", "canBeFormatted", "(", ")", ")", "{", "// Skip generated sources.", "// Only takes pages that can be formatted (AKA *.md)", "continue", ";", "}", "$", "source", "->", "data", "(", ")", "->", "set", "(", "'menu'", ",", "$", "this", "->", "menu", ")", ";", "}", "}" ]
Now that the menu structure has been created, inject it back to the page. @param SourceSet $sourceSet @return void
[ "Now", "that", "the", "menu", "structure", "has", "been", "created", "inject", "it", "back", "to", "the", "page", "." ]
a3b1e2e307292f6b25fdda9f678421beb75bbc57
https://github.com/janbuecker/sculpin-meta-navigation-bundle/blob/a3b1e2e307292f6b25fdda9f678421beb75bbc57/MenuGenerator.php#L106-L120
36,655
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.changeGroup
public function changeGroup( $groupName, $recursive = FALSE ) { if( !$groupName ) throw new InvalidArgumentException( 'Group is missing' ); $number = (int) chgrp( $this->folderName, $groupName ); if( !$recursive ) return $number; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->folderName ), RecursiveIteratorIterator::SELF_FIRST ); foreach( $iterator as $item ) $number += (int) chgrp( $item, $groupName ); return $number; }
php
public function changeGroup( $groupName, $recursive = FALSE ) { if( !$groupName ) throw new InvalidArgumentException( 'Group is missing' ); $number = (int) chgrp( $this->folderName, $groupName ); if( !$recursive ) return $number; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->folderName ), RecursiveIteratorIterator::SELF_FIRST ); foreach( $iterator as $item ) $number += (int) chgrp( $item, $groupName ); return $number; }
[ "public", "function", "changeGroup", "(", "$", "groupName", ",", "$", "recursive", "=", "FALSE", ")", "{", "if", "(", "!", "$", "groupName", ")", "throw", "new", "InvalidArgumentException", "(", "'Group is missing'", ")", ";", "$", "number", "=", "(", "int", ")", "chgrp", "(", "$", "this", "->", "folderName", ",", "$", "groupName", ")", ";", "if", "(", "!", "$", "recursive", ")", "return", "$", "number", ";", "$", "iterator", "=", "new", "RecursiveIteratorIterator", "(", "new", "RecursiveDirectoryIterator", "(", "$", "this", "->", "folderName", ")", ",", "RecursiveIteratorIterator", "::", "SELF_FIRST", ")", ";", "foreach", "(", "$", "iterator", "as", "$", "item", ")", "$", "number", "+=", "(", "int", ")", "chgrp", "(", "$", "item", ",", "$", "groupName", ")", ";", "return", "$", "number", ";", "}" ]
Sets group of current folder. @access public @param string $groupName Group to set @param bool $recursive Flag: change nested files and folders,too @return bool
[ "Sets", "group", "of", "current", "folder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L74-L89
36,656
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.changeMode
public function changeMode( $mode, $recursive = FALSE ) { if( !is_int( $mode ) ) throw new InvalidArgumentException( 'Mode must be of integer' ); $number = (int) chmod( $this->folderName, $mode ); if( !$recursive ) return $number; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->folderName ), RecursiveIteratorIterator::SELF_FIRST ); foreach( $iterator as $item ) $number += (int) chmod( $item, $mode ); return $number; }
php
public function changeMode( $mode, $recursive = FALSE ) { if( !is_int( $mode ) ) throw new InvalidArgumentException( 'Mode must be of integer' ); $number = (int) chmod( $this->folderName, $mode ); if( !$recursive ) return $number; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->folderName ), RecursiveIteratorIterator::SELF_FIRST ); foreach( $iterator as $item ) $number += (int) chmod( $item, $mode ); return $number; }
[ "public", "function", "changeMode", "(", "$", "mode", ",", "$", "recursive", "=", "FALSE", ")", "{", "if", "(", "!", "is_int", "(", "$", "mode", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Mode must be of integer'", ")", ";", "$", "number", "=", "(", "int", ")", "chmod", "(", "$", "this", "->", "folderName", ",", "$", "mode", ")", ";", "if", "(", "!", "$", "recursive", ")", "return", "$", "number", ";", "$", "iterator", "=", "new", "RecursiveIteratorIterator", "(", "new", "RecursiveDirectoryIterator", "(", "$", "this", "->", "folderName", ")", ",", "RecursiveIteratorIterator", "::", "SELF_FIRST", ")", ";", "foreach", "(", "$", "iterator", "as", "$", "item", ")", "$", "number", "+=", "(", "int", ")", "chmod", "(", "$", "item", ",", "$", "mode", ")", ";", "return", "$", "number", ";", "}" ]
Sets permissions on current folder and its containing files and folders. @access public @param int $mode Permission mode, like 0750, 01770, 02755 @param bool $recursive Flag: change nested files and folders,too @return int Number of affected files and folders
[ "Sets", "permissions", "on", "current", "folder", "and", "its", "containing", "files", "and", "folders", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L98-L114
36,657
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.changeOwner
public function changeOwner( $userName, $recursive = FALSE ) { if( !$userName ) throw new InvalidArgumentException( 'User missing' ); $number = (int) chown( $this->folderName, $userName ); if( !$recursive ) return $number; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->folderName ), RecursiveIteratorIterator::SELF_FIRST ); foreach( $iterator as $item ) $number += (int) chown( $item, $userName ); return $number; }
php
public function changeOwner( $userName, $recursive = FALSE ) { if( !$userName ) throw new InvalidArgumentException( 'User missing' ); $number = (int) chown( $this->folderName, $userName ); if( !$recursive ) return $number; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->folderName ), RecursiveIteratorIterator::SELF_FIRST ); foreach( $iterator as $item ) $number += (int) chown( $item, $userName ); return $number; }
[ "public", "function", "changeOwner", "(", "$", "userName", ",", "$", "recursive", "=", "FALSE", ")", "{", "if", "(", "!", "$", "userName", ")", "throw", "new", "InvalidArgumentException", "(", "'User missing'", ")", ";", "$", "number", "=", "(", "int", ")", "chown", "(", "$", "this", "->", "folderName", ",", "$", "userName", ")", ";", "if", "(", "!", "$", "recursive", ")", "return", "$", "number", ";", "$", "iterator", "=", "new", "RecursiveIteratorIterator", "(", "new", "RecursiveDirectoryIterator", "(", "$", "this", "->", "folderName", ")", ",", "RecursiveIteratorIterator", "::", "SELF_FIRST", ")", ";", "foreach", "(", "$", "iterator", "as", "$", "item", ")", "$", "number", "+=", "(", "int", ")", "chown", "(", "$", "item", ",", "$", "userName", ")", ";", "return", "$", "number", ";", "}" ]
Sets owner of current folder. @access public @param string $userName User to set @param bool $recursive Flag: change nested files and folders,too @return bool
[ "Sets", "owner", "of", "current", "folder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L123-L138
36,658
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.copyFolder
public static function copyFolder( $sourceFolder, $targetFolder, $force = FALSE, $skipDotEntries = TRUE ) { if( !self::isFolder( $sourceFolder ) ) // Source Folder not existing throw new RuntimeException( 'Folder "'.$sourceFolder.'" cannot be copied because it is not existing' ); $count = 0; // initialize Object Counter $sourceFolder = self::correctPath( $sourceFolder ); // add Slash to Source Folder $targetFolder = self::correctPath( $targetFolder ); // add Slash to Target Folder if( self::isFolder( $targetFolder ) && !$force ) // Target Folder is existing, not forced throw new RuntimeException( 'Folder "'.$targetFolder.'" is already existing. See Option "force"' ); else if( !self::isFolder( $targetFolder ) ) // Target Folder is not existing $count += (int) self::createFolder( $targetFolder ); // create TargetFolder and count $index = new FS_Folder_Iterator( $sourceFolder, TRUE, TRUE, $skipDotEntries ); // Index of Source Folder foreach( $index as $entry ) { if( $entry->isDot() ) // Dot Folders continue; // skip them if( $entry->isDir() ) // nested Folder { $source = $entry->getPathname(); // Source Folder Name $target = $targetFolder.$entry->getFilename()."/"; // Target Folder Name $count += self::copyFolder( $source, $target, $force, $skipDotEntries ); // copy Folder recursive and count } else if( $entry->isFile() ) // nested File { $targetFile = $targetFolder.$entry->getFilename(); if( file_exists( $targetFile ) && !$force ) throw new RuntimeException( 'File "'.$targetFile.'" is already existing. See Option "force"' ); $count += (int) copy( $entry->getPathname(), $targetFile ); // copy File and count } } return $count; // return Object Count }
php
public static function copyFolder( $sourceFolder, $targetFolder, $force = FALSE, $skipDotEntries = TRUE ) { if( !self::isFolder( $sourceFolder ) ) // Source Folder not existing throw new RuntimeException( 'Folder "'.$sourceFolder.'" cannot be copied because it is not existing' ); $count = 0; // initialize Object Counter $sourceFolder = self::correctPath( $sourceFolder ); // add Slash to Source Folder $targetFolder = self::correctPath( $targetFolder ); // add Slash to Target Folder if( self::isFolder( $targetFolder ) && !$force ) // Target Folder is existing, not forced throw new RuntimeException( 'Folder "'.$targetFolder.'" is already existing. See Option "force"' ); else if( !self::isFolder( $targetFolder ) ) // Target Folder is not existing $count += (int) self::createFolder( $targetFolder ); // create TargetFolder and count $index = new FS_Folder_Iterator( $sourceFolder, TRUE, TRUE, $skipDotEntries ); // Index of Source Folder foreach( $index as $entry ) { if( $entry->isDot() ) // Dot Folders continue; // skip them if( $entry->isDir() ) // nested Folder { $source = $entry->getPathname(); // Source Folder Name $target = $targetFolder.$entry->getFilename()."/"; // Target Folder Name $count += self::copyFolder( $source, $target, $force, $skipDotEntries ); // copy Folder recursive and count } else if( $entry->isFile() ) // nested File { $targetFile = $targetFolder.$entry->getFilename(); if( file_exists( $targetFile ) && !$force ) throw new RuntimeException( 'File "'.$targetFile.'" is already existing. See Option "force"' ); $count += (int) copy( $entry->getPathname(), $targetFile ); // copy File and count } } return $count; // return Object Count }
[ "public", "static", "function", "copyFolder", "(", "$", "sourceFolder", ",", "$", "targetFolder", ",", "$", "force", "=", "FALSE", ",", "$", "skipDotEntries", "=", "TRUE", ")", "{", "if", "(", "!", "self", "::", "isFolder", "(", "$", "sourceFolder", ")", ")", "// Source Folder not existing", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "sourceFolder", ".", "'\" cannot be copied because it is not existing'", ")", ";", "$", "count", "=", "0", ";", "// initialize Object Counter", "$", "sourceFolder", "=", "self", "::", "correctPath", "(", "$", "sourceFolder", ")", ";", "// add Slash to Source Folder", "$", "targetFolder", "=", "self", "::", "correctPath", "(", "$", "targetFolder", ")", ";", "// add Slash to Target Folder", "if", "(", "self", "::", "isFolder", "(", "$", "targetFolder", ")", "&&", "!", "$", "force", ")", "// Target Folder is existing, not forced", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "targetFolder", ".", "'\" is already existing. See Option \"force\"'", ")", ";", "else", "if", "(", "!", "self", "::", "isFolder", "(", "$", "targetFolder", ")", ")", "// Target Folder is not existing", "$", "count", "+=", "(", "int", ")", "self", "::", "createFolder", "(", "$", "targetFolder", ")", ";", "// create TargetFolder and count", "$", "index", "=", "new", "FS_Folder_Iterator", "(", "$", "sourceFolder", ",", "TRUE", ",", "TRUE", ",", "$", "skipDotEntries", ")", ";", "// Index of Source Folder", "foreach", "(", "$", "index", "as", "$", "entry", ")", "{", "if", "(", "$", "entry", "->", "isDot", "(", ")", ")", "// Dot Folders", "continue", ";", "// skip them", "if", "(", "$", "entry", "->", "isDir", "(", ")", ")", "// nested Folder", "{", "$", "source", "=", "$", "entry", "->", "getPathname", "(", ")", ";", "// Source Folder Name", "$", "target", "=", "$", "targetFolder", ".", "$", "entry", "->", "getFilename", "(", ")", ".", "\"/\"", ";", "// Target Folder Name", "$", "count", "+=", "self", "::", "copyFolder", "(", "$", "source", ",", "$", "target", ",", "$", "force", ",", "$", "skipDotEntries", ")", ";", "// copy Folder recursive and count", "}", "else", "if", "(", "$", "entry", "->", "isFile", "(", ")", ")", "// nested File", "{", "$", "targetFile", "=", "$", "targetFolder", ".", "$", "entry", "->", "getFilename", "(", ")", ";", "if", "(", "file_exists", "(", "$", "targetFile", ")", "&&", "!", "$", "force", ")", "throw", "new", "RuntimeException", "(", "'File \"'", ".", "$", "targetFile", ".", "'\" is already existing. See Option \"force\"'", ")", ";", "$", "count", "+=", "(", "int", ")", "copy", "(", "$", "entry", "->", "getPathname", "(", ")", ",", "$", "targetFile", ")", ";", "// copy File and count", "}", "}", "return", "$", "count", ";", "// return Object Count", "}" ]
Copies a Folder recursive to another Path and returns Number of copied Files and Folders. @access public @static @param string $sourceFolder Folder Name of Folder to copy @param string $targetFolder Folder Name to Target Folder @param bool $force Flag: force Copy if file is existing @param bool $skipDotEntries Flag: skip Files and Folders starting with Dot @return int
[ "Copies", "a", "Folder", "recursive", "to", "another", "Path", "and", "returns", "Number", "of", "copied", "Files", "and", "Folders", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L150-L183
36,659
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.createFolder
public static function createFolder( $folderName, $mode = 0770, $userName = NULL, $groupName = NULL ) { if( self::isFolder( $folderName ) ) return FALSE; if( false === @mkdir( $folderName, $mode, TRUE ) ) // create Folder recursive throw new RuntimeException( 'Folder "'.$folderName.'" could not be created' ); chmod( $folderName, $mode ); if( $userName ) // User is set chown( $folderName, $userName ); // change Owner to User if( $groupName ) // Group is set chgrp( $folderName, $groupName ); return TRUE; }
php
public static function createFolder( $folderName, $mode = 0770, $userName = NULL, $groupName = NULL ) { if( self::isFolder( $folderName ) ) return FALSE; if( false === @mkdir( $folderName, $mode, TRUE ) ) // create Folder recursive throw new RuntimeException( 'Folder "'.$folderName.'" could not be created' ); chmod( $folderName, $mode ); if( $userName ) // User is set chown( $folderName, $userName ); // change Owner to User if( $groupName ) // Group is set chgrp( $folderName, $groupName ); return TRUE; }
[ "public", "static", "function", "createFolder", "(", "$", "folderName", ",", "$", "mode", "=", "0770", ",", "$", "userName", "=", "NULL", ",", "$", "groupName", "=", "NULL", ")", "{", "if", "(", "self", "::", "isFolder", "(", "$", "folderName", ")", ")", "return", "FALSE", ";", "if", "(", "false", "===", "@", "mkdir", "(", "$", "folderName", ",", "$", "mode", ",", "TRUE", ")", ")", "// create Folder recursive", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "folderName", ".", "'\" could not be created'", ")", ";", "chmod", "(", "$", "folderName", ",", "$", "mode", ")", ";", "if", "(", "$", "userName", ")", "// User is set", "chown", "(", "$", "folderName", ",", "$", "userName", ")", ";", "// change Owner to User", "if", "(", "$", "groupName", ")", "// Group is set", "chgrp", "(", "$", "folderName", ",", "$", "groupName", ")", ";", "return", "TRUE", ";", "}" ]
Creates a Folder by creating all Folders in Path recursive. @access public @static @param string $folderName Folder to create @param int $mode Permission Mode, default: 0770 @param string $userName User Name @param string $groupName Group Name @return bool
[ "Creates", "a", "Folder", "by", "creating", "all", "Folders", "in", "Path", "recursive", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L195-L207
36,660
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.copy
public function copy( $targetFolder, $force = FALSE, $skipDotEntries = TRUE, $useCopy = FALSE ) { $result = self::copyFolder( $this->folderName, $targetFolder, $force, $skipDotEntries ); if( $result && $useCopy ) $this->folderName = $targetFolder; return $result; }
php
public function copy( $targetFolder, $force = FALSE, $skipDotEntries = TRUE, $useCopy = FALSE ) { $result = self::copyFolder( $this->folderName, $targetFolder, $force, $skipDotEntries ); if( $result && $useCopy ) $this->folderName = $targetFolder; return $result; }
[ "public", "function", "copy", "(", "$", "targetFolder", ",", "$", "force", "=", "FALSE", ",", "$", "skipDotEntries", "=", "TRUE", ",", "$", "useCopy", "=", "FALSE", ")", "{", "$", "result", "=", "self", "::", "copyFolder", "(", "$", "this", "->", "folderName", ",", "$", "targetFolder", ",", "$", "force", ",", "$", "skipDotEntries", ")", ";", "if", "(", "$", "result", "&&", "$", "useCopy", ")", "$", "this", "->", "folderName", "=", "$", "targetFolder", ";", "return", "$", "result", ";", "}" ]
Copies current Folder to another Folder and returns Number of copied Files and Folders. @access public @param string $targetFolder Folder Name of Target Folder @param bool $useCopy Flag: switch current Folder to Copy afterwards @param bool $force Flag: force Copy if file is existing @param bool $skipDotEntries Flag: skip Files and Folders starting with Dot @return int
[ "Copies", "current", "Folder", "to", "another", "Folder", "and", "returns", "Number", "of", "copied", "Files", "and", "Folders", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L218-L224
36,661
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.moveFolder
public static function moveFolder( $sourceFolder, $targetPath, $force = FALSE ) { $sourceName = basename( $sourceFolder ); // Folder Name of Source Folder $sourcePath = dirname( $sourceFolder ); // Path to Source Folder $sourceFolder = self::correctPath( $sourceFolder ); // add Slash to Source Path $targetPath = self::correctPath( $targetPath ); // add Slash to Target Path if( !self::isFolder( $sourcePath ) ) // Path of Source Folder not existing throw new RuntimeException( 'Folder "'.$sourceFolder.'" cannot be moved since it is not existing' ); if( self::isFolder( $targetPath.$sourceName ) && !$force ) // Path of Target Folder is already existing throw new RuntimeException( 'Folder "'.$targetPath.$sourceName.'" is already existing' ); if( !self::isFolder( $targetPath ) ) // Path to Target Folder not existing self::createFolder( $targetPath ); // if( $sourceFolder == $targetPath ) // Source and Target Path are equal return FALSE; // do nothing and return if( FALSE === @rename( $sourceFolder, $targetPath.$sourceName ) ) // move Source Folder to Target Path throw new RuntimeException( 'Folder "'.$sourceFolder.'" cannot be moved to "'.$targetPath.'"' ); return TRUE; }
php
public static function moveFolder( $sourceFolder, $targetPath, $force = FALSE ) { $sourceName = basename( $sourceFolder ); // Folder Name of Source Folder $sourcePath = dirname( $sourceFolder ); // Path to Source Folder $sourceFolder = self::correctPath( $sourceFolder ); // add Slash to Source Path $targetPath = self::correctPath( $targetPath ); // add Slash to Target Path if( !self::isFolder( $sourcePath ) ) // Path of Source Folder not existing throw new RuntimeException( 'Folder "'.$sourceFolder.'" cannot be moved since it is not existing' ); if( self::isFolder( $targetPath.$sourceName ) && !$force ) // Path of Target Folder is already existing throw new RuntimeException( 'Folder "'.$targetPath.$sourceName.'" is already existing' ); if( !self::isFolder( $targetPath ) ) // Path to Target Folder not existing self::createFolder( $targetPath ); // if( $sourceFolder == $targetPath ) // Source and Target Path are equal return FALSE; // do nothing and return if( FALSE === @rename( $sourceFolder, $targetPath.$sourceName ) ) // move Source Folder to Target Path throw new RuntimeException( 'Folder "'.$sourceFolder.'" cannot be moved to "'.$targetPath.'"' ); return TRUE; }
[ "public", "static", "function", "moveFolder", "(", "$", "sourceFolder", ",", "$", "targetPath", ",", "$", "force", "=", "FALSE", ")", "{", "$", "sourceName", "=", "basename", "(", "$", "sourceFolder", ")", ";", "// Folder Name of Source Folder", "$", "sourcePath", "=", "dirname", "(", "$", "sourceFolder", ")", ";", "// Path to Source Folder", "$", "sourceFolder", "=", "self", "::", "correctPath", "(", "$", "sourceFolder", ")", ";", "// add Slash to Source Path", "$", "targetPath", "=", "self", "::", "correctPath", "(", "$", "targetPath", ")", ";", "// add Slash to Target Path", "if", "(", "!", "self", "::", "isFolder", "(", "$", "sourcePath", ")", ")", "// Path of Source Folder not existing", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "sourceFolder", ".", "'\" cannot be moved since it is not existing'", ")", ";", "if", "(", "self", "::", "isFolder", "(", "$", "targetPath", ".", "$", "sourceName", ")", "&&", "!", "$", "force", ")", "// Path of Target Folder is already existing", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "targetPath", ".", "$", "sourceName", ".", "'\" is already existing'", ")", ";", "if", "(", "!", "self", "::", "isFolder", "(", "$", "targetPath", ")", ")", "// Path to Target Folder not existing", "self", "::", "createFolder", "(", "$", "targetPath", ")", ";", "//", "if", "(", "$", "sourceFolder", "==", "$", "targetPath", ")", "// Source and Target Path are equal", "return", "FALSE", ";", "// do nothing and return", "if", "(", "FALSE", "===", "@", "rename", "(", "$", "sourceFolder", ",", "$", "targetPath", ".", "$", "sourceName", ")", ")", "// move Source Folder to Target Path", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "sourceFolder", ".", "'\" cannot be moved to \"'", ".", "$", "targetPath", ".", "'\"'", ")", ";", "return", "TRUE", ";", "}" ]
Moves a Folder to another Path. @access public @static @param string $sourceFolder Folder Name of Source Folder, eg. /path/to/source/folder @param string $targetPath Folder Path of Target Folder, eg. /path/to/target @param string $force Flag: continue if Target Folder is already existing, otherwise break @return bool
[ "Moves", "a", "Folder", "to", "another", "Path", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L235-L252
36,662
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.move
public function move( $folderPath, $force = FALSE ) { if( !$this->moveFolder( $this->folderName, $folderPath, $force ) ) return FALSE; $this->folderName = $folderPath; return TRUE; }
php
public function move( $folderPath, $force = FALSE ) { if( !$this->moveFolder( $this->folderName, $folderPath, $force ) ) return FALSE; $this->folderName = $folderPath; return TRUE; }
[ "public", "function", "move", "(", "$", "folderPath", ",", "$", "force", "=", "FALSE", ")", "{", "if", "(", "!", "$", "this", "->", "moveFolder", "(", "$", "this", "->", "folderName", ",", "$", "folderPath", ",", "$", "force", ")", ")", "return", "FALSE", ";", "$", "this", "->", "folderName", "=", "$", "folderPath", ";", "return", "TRUE", ";", "}" ]
Moves current Folder to another Path. @access public @param string $folderPath Folder Path of Target Folder @param string $force Flag: continue if Target Folder is already existing, otherwise break @return bool
[ "Moves", "current", "Folder", "to", "another", "Path", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L261-L267
36,663
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.rename
public function rename( $folderName ) { if( !$this->renameFolder( $this->folderName, $folderName ) ) return FALSE; $this->folderName = dirname( $this->folderName )."/".basename( $folderName ); return TRUE; }
php
public function rename( $folderName ) { if( !$this->renameFolder( $this->folderName, $folderName ) ) return FALSE; $this->folderName = dirname( $this->folderName )."/".basename( $folderName ); return TRUE; }
[ "public", "function", "rename", "(", "$", "folderName", ")", "{", "if", "(", "!", "$", "this", "->", "renameFolder", "(", "$", "this", "->", "folderName", ",", "$", "folderName", ")", ")", "return", "FALSE", ";", "$", "this", "->", "folderName", "=", "dirname", "(", "$", "this", "->", "folderName", ")", ".", "\"/\"", ".", "basename", "(", "$", "folderName", ")", ";", "return", "TRUE", ";", "}" ]
Renames current Folder. @access public @param string $folderName Folder Name to rename to @return bool
[ "Renames", "current", "Folder", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L275-L281
36,664
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.renameFolder
public static function renameFolder( $sourceFolder, $targetName ) { $targetName = basename( $targetName ); if( !self::isFolder( $sourceFolder ) ) // Source Folder not existing throw new RuntimeException( 'Folder "'.$sourceFolder.'" is not existing' ); $sourcePath = self::correctPath( dirname( $sourceFolder ) ); // Path to Source Folder if( basename( $sourceFolder ) == $targetName ) // Source Name and Target name is equal return FALSE; if( self::isFolder( $sourcePath.$targetName ) ) // Target Folder is already existing throw new RuntimeException( 'Folder "'.$sourcePath.$targetName.'" is already existing' ); if( FALSE === @rename( $sourceFolder, $sourcePath.$targetName ) ) // rename Source Folder to Target Folder throw new RuntimeException( 'Folder "'.$sourceFolder.'" cannot be renamed to "'.$sourcePath.$targetName.'"' ); return TRUE; }
php
public static function renameFolder( $sourceFolder, $targetName ) { $targetName = basename( $targetName ); if( !self::isFolder( $sourceFolder ) ) // Source Folder not existing throw new RuntimeException( 'Folder "'.$sourceFolder.'" is not existing' ); $sourcePath = self::correctPath( dirname( $sourceFolder ) ); // Path to Source Folder if( basename( $sourceFolder ) == $targetName ) // Source Name and Target name is equal return FALSE; if( self::isFolder( $sourcePath.$targetName ) ) // Target Folder is already existing throw new RuntimeException( 'Folder "'.$sourcePath.$targetName.'" is already existing' ); if( FALSE === @rename( $sourceFolder, $sourcePath.$targetName ) ) // rename Source Folder to Target Folder throw new RuntimeException( 'Folder "'.$sourceFolder.'" cannot be renamed to "'.$sourcePath.$targetName.'"' ); return TRUE; }
[ "public", "static", "function", "renameFolder", "(", "$", "sourceFolder", ",", "$", "targetName", ")", "{", "$", "targetName", "=", "basename", "(", "$", "targetName", ")", ";", "if", "(", "!", "self", "::", "isFolder", "(", "$", "sourceFolder", ")", ")", "// Source Folder not existing", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "sourceFolder", ".", "'\" is not existing'", ")", ";", "$", "sourcePath", "=", "self", "::", "correctPath", "(", "dirname", "(", "$", "sourceFolder", ")", ")", ";", "// Path to Source Folder", "if", "(", "basename", "(", "$", "sourceFolder", ")", "==", "$", "targetName", ")", "// Source Name and Target name is equal", "return", "FALSE", ";", "if", "(", "self", "::", "isFolder", "(", "$", "sourcePath", ".", "$", "targetName", ")", ")", "// Target Folder is already existing", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "sourcePath", ".", "$", "targetName", ".", "'\" is already existing'", ")", ";", "if", "(", "FALSE", "===", "@", "rename", "(", "$", "sourceFolder", ",", "$", "sourcePath", ".", "$", "targetName", ")", ")", "// rename Source Folder to Target Folder", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "sourceFolder", ".", "'\" cannot be renamed to \"'", ".", "$", "sourcePath", ".", "$", "targetName", ".", "'\"'", ")", ";", "return", "TRUE", ";", "}" ]
Renames a Folder to another Folder Name. @access public @static @param string $sourceFolder Folder to rename @param string $targetName New Name of Folder @return bool
[ "Renames", "a", "Folder", "to", "another", "Folder", "Name", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L291-L305
36,665
CeusMedia/Common
src/FS/Folder/Editor.php
FS_Folder_Editor.removeFolder
public static function removeFolder( $folderName, $force = FALSE, $strict = TRUE ) { $folderName = self::correctPath( $folderName); $count = 1; // current Folder is first Object if( !file_exists( $folderName ) ) { if( $strict ) throw new RuntimeException( 'Folder "'.$folderName.'" is not existing' ); else return 0; } $index = new DirectoryIterator( $folderName ); foreach( $index as $entry ) { if( !$entry->isDot() ) { if( !$force ) // nested Files or Folders found throw new RuntimeException( 'Folder '.$folderName.' is not empty. See Option "force"' ); if( $entry->isFile() || $entry->isLink() ) { if( FALSE === @unlink( $entry->getPathname() ) ) // remove File and count throw new RuntimeException( 'File "'.$folderName.$entry->getFilename().'" is not removable' ); // throw Exception for File $count ++; } else if( $entry->isDir() ) { $count += self::removeFolder( $entry->getPathname(), $force ); // call Method with nested Folder } } } rmdir( $folderName ); // remove Folder return $count; $dir = dir( $folderName ); // index Folder while( $entry = $dir->read() ) // iterate Objects { if( preg_match( "@^(\.){1,2}$@", $entry ) ) // if is Dot Object continue; // continue $pathName = $folderName.$entry; // Name of nested Object if( !$force ) // nested Files or Folders found throw new RuntimeException( 'Folder '.$folderName.' is not empty. See Option "force"' ); if( is_file( $pathName ) ) // is nested File { if( FALSE === unlink( $pathName ) ) // remove File and count throw new RuntimeException( 'File "'.$pathName.'" is not removable' ); // throw Exception for File $count ++; } if( is_dir( $pathName ) ) // is nested Folder $count += self::removeFolder( $pathName, $force ); // call Method with nested Folder } $dir->close(); // close Directory Handler rmDir( $folderName ); // remove Folder return $count; // return counted Objects }
php
public static function removeFolder( $folderName, $force = FALSE, $strict = TRUE ) { $folderName = self::correctPath( $folderName); $count = 1; // current Folder is first Object if( !file_exists( $folderName ) ) { if( $strict ) throw new RuntimeException( 'Folder "'.$folderName.'" is not existing' ); else return 0; } $index = new DirectoryIterator( $folderName ); foreach( $index as $entry ) { if( !$entry->isDot() ) { if( !$force ) // nested Files or Folders found throw new RuntimeException( 'Folder '.$folderName.' is not empty. See Option "force"' ); if( $entry->isFile() || $entry->isLink() ) { if( FALSE === @unlink( $entry->getPathname() ) ) // remove File and count throw new RuntimeException( 'File "'.$folderName.$entry->getFilename().'" is not removable' ); // throw Exception for File $count ++; } else if( $entry->isDir() ) { $count += self::removeFolder( $entry->getPathname(), $force ); // call Method with nested Folder } } } rmdir( $folderName ); // remove Folder return $count; $dir = dir( $folderName ); // index Folder while( $entry = $dir->read() ) // iterate Objects { if( preg_match( "@^(\.){1,2}$@", $entry ) ) // if is Dot Object continue; // continue $pathName = $folderName.$entry; // Name of nested Object if( !$force ) // nested Files or Folders found throw new RuntimeException( 'Folder '.$folderName.' is not empty. See Option "force"' ); if( is_file( $pathName ) ) // is nested File { if( FALSE === unlink( $pathName ) ) // remove File and count throw new RuntimeException( 'File "'.$pathName.'" is not removable' ); // throw Exception for File $count ++; } if( is_dir( $pathName ) ) // is nested Folder $count += self::removeFolder( $pathName, $force ); // call Method with nested Folder } $dir->close(); // close Directory Handler rmDir( $folderName ); // remove Folder return $count; // return counted Objects }
[ "public", "static", "function", "removeFolder", "(", "$", "folderName", ",", "$", "force", "=", "FALSE", ",", "$", "strict", "=", "TRUE", ")", "{", "$", "folderName", "=", "self", "::", "correctPath", "(", "$", "folderName", ")", ";", "$", "count", "=", "1", ";", "// current Folder is first Object", "if", "(", "!", "file_exists", "(", "$", "folderName", ")", ")", "{", "if", "(", "$", "strict", ")", "throw", "new", "RuntimeException", "(", "'Folder \"'", ".", "$", "folderName", ".", "'\" is not existing'", ")", ";", "else", "return", "0", ";", "}", "$", "index", "=", "new", "DirectoryIterator", "(", "$", "folderName", ")", ";", "foreach", "(", "$", "index", "as", "$", "entry", ")", "{", "if", "(", "!", "$", "entry", "->", "isDot", "(", ")", ")", "{", "if", "(", "!", "$", "force", ")", "// nested Files or Folders found", "throw", "new", "RuntimeException", "(", "'Folder '", ".", "$", "folderName", ".", "' is not empty. See Option \"force\"'", ")", ";", "if", "(", "$", "entry", "->", "isFile", "(", ")", "||", "$", "entry", "->", "isLink", "(", ")", ")", "{", "if", "(", "FALSE", "===", "@", "unlink", "(", "$", "entry", "->", "getPathname", "(", ")", ")", ")", "// remove File and count", "throw", "new", "RuntimeException", "(", "'File \"'", ".", "$", "folderName", ".", "$", "entry", "->", "getFilename", "(", ")", ".", "'\" is not removable'", ")", ";", "// throw Exception for File", "$", "count", "++", ";", "}", "else", "if", "(", "$", "entry", "->", "isDir", "(", ")", ")", "{", "$", "count", "+=", "self", "::", "removeFolder", "(", "$", "entry", "->", "getPathname", "(", ")", ",", "$", "force", ")", ";", "// call Method with nested Folder", "}", "}", "}", "rmdir", "(", "$", "folderName", ")", ";", "// remove Folder", "return", "$", "count", ";", "$", "dir", "=", "dir", "(", "$", "folderName", ")", ";", "// index Folder", "while", "(", "$", "entry", "=", "$", "dir", "->", "read", "(", ")", ")", "// iterate Objects", "{", "if", "(", "preg_match", "(", "\"@^(\\.){1,2}$@\"", ",", "$", "entry", ")", ")", "// if is Dot Object", "continue", ";", "// continue", "$", "pathName", "=", "$", "folderName", ".", "$", "entry", ";", "// Name of nested Object", "if", "(", "!", "$", "force", ")", "// nested Files or Folders found", "throw", "new", "RuntimeException", "(", "'Folder '", ".", "$", "folderName", ".", "' is not empty. See Option \"force\"'", ")", ";", "if", "(", "is_file", "(", "$", "pathName", ")", ")", "// is nested File", "{", "if", "(", "FALSE", "===", "unlink", "(", "$", "pathName", ")", ")", "// remove File and count", "throw", "new", "RuntimeException", "(", "'File \"'", ".", "$", "pathName", ".", "'\" is not removable'", ")", ";", "// throw Exception for File", "$", "count", "++", ";", "}", "if", "(", "is_dir", "(", "$", "pathName", ")", ")", "// is nested Folder", "$", "count", "+=", "self", "::", "removeFolder", "(", "$", "pathName", ",", "$", "force", ")", ";", "// call Method with nested Folder", "}", "$", "dir", "->", "close", "(", ")", ";", "// close Directory Handler", "rmDir", "(", "$", "folderName", ")", ";", "// remove Folder", "return", "$", "count", ";", "// return counted Objects", "}" ]
Removes a Folder recursive and returns Number of removed Folders and Files. Because there where Permission Issues with DirectoryIterator it uses the old 'dir' command. @access public @static @param string $folderName Folder to be removed @param bool $force Flag: force to remove nested Files and Folders @return int
[ "Removes", "a", "Folder", "recursive", "and", "returns", "Number", "of", "removed", "Folders", "and", "Files", ".", "Because", "there", "where", "Permission", "Issues", "with", "DirectoryIterator", "it", "uses", "the", "old", "dir", "command", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/Folder/Editor.php#L327-L381
36,666
ncou/Chiron
src/Chiron/Http/Session/SessionManager.php
SessionManager.destroy
public function destroy(): bool { if (! $this->isStarted()) { $this->start(); } $name = $this->getName(); $params = $this->getCookieParams(); $this->clear(); $destroyed = session_destroy(); if ($destroyed) { call_user_func($this->delete_cookie, $name, $params); } return $destroyed; }
php
public function destroy(): bool { if (! $this->isStarted()) { $this->start(); } $name = $this->getName(); $params = $this->getCookieParams(); $this->clear(); $destroyed = session_destroy(); if ($destroyed) { call_user_func($this->delete_cookie, $name, $params); } return $destroyed; }
[ "public", "function", "destroy", "(", ")", ":", "bool", "{", "if", "(", "!", "$", "this", "->", "isStarted", "(", ")", ")", "{", "$", "this", "->", "start", "(", ")", ";", "}", "$", "name", "=", "$", "this", "->", "getName", "(", ")", ";", "$", "params", "=", "$", "this", "->", "getCookieParams", "(", ")", ";", "$", "this", "->", "clear", "(", ")", ";", "$", "destroyed", "=", "session_destroy", "(", ")", ";", "if", "(", "$", "destroyed", ")", "{", "call_user_func", "(", "$", "this", "->", "delete_cookie", ",", "$", "name", ",", "$", "params", ")", ";", "}", "return", "$", "destroyed", ";", "}" ]
Destroys the session entirely. @return bool @see http://php.net/manual/en/function.session-destroy.php
[ "Destroys", "the", "session", "entirely", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Session/SessionManager.php#L245-L259
36,667
ncou/Chiron
src/Chiron/Http/Session/SessionManager.php
SessionManager.setCookieParams2
public function setCookieParams2(int $lifetime, string $path = null, string $domain = null, bool $secure = false, bool $httpOnly = false): void { session_set_cookie_params($lifetime, $path, $domain, $secure, $httpOnly); }
php
public function setCookieParams2(int $lifetime, string $path = null, string $domain = null, bool $secure = false, bool $httpOnly = false): void { session_set_cookie_params($lifetime, $path, $domain, $secure, $httpOnly); }
[ "public", "function", "setCookieParams2", "(", "int", "$", "lifetime", ",", "string", "$", "path", "=", "null", ",", "string", "$", "domain", "=", "null", ",", "bool", "$", "secure", "=", "false", ",", "bool", "$", "httpOnly", "=", "false", ")", ":", "void", "{", "session_set_cookie_params", "(", "$", "lifetime", ",", "$", "path", ",", "$", "domain", ",", "$", "secure", ",", "$", "httpOnly", ")", ";", "}" ]
Set cookie parameters. @see http://php.net/manual/en/function.session-set-cookie-params.php @param int $lifetime The lifetime of the cookie in seconds. @param string $path The path where information is stored. @param string $domain The domain of the cookie. @param bool $secure The cookie should only be sent over secure connections. @param bool $httpOnly The cookie can only be accessed through the HTTP protocol.
[ "Set", "cookie", "parameters", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Session/SessionManager.php#L369-L372
36,668
ncou/Chiron
src/Chiron/Http/Session/SessionManager.php
SessionManager.regenerateId
public function regenerateId(bool $deleteOldSession = true): bool { if ($this->isStarted()) { return session_regenerate_id($deleteOldSession); } // TODO : ajouter un else et lever une exception si on essaye de faire un regenerate ID alors que la session n'est pas démarrée !!!! return false; }
php
public function regenerateId(bool $deleteOldSession = true): bool { if ($this->isStarted()) { return session_regenerate_id($deleteOldSession); } // TODO : ajouter un else et lever une exception si on essaye de faire un regenerate ID alors que la session n'est pas démarrée !!!! return false; }
[ "public", "function", "regenerateId", "(", "bool", "$", "deleteOldSession", "=", "true", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "isStarted", "(", ")", ")", "{", "return", "session_regenerate_id", "(", "$", "deleteOldSession", ")", ";", "}", "// TODO : ajouter un else et lever une exception si on essaye de faire un regenerate ID alors que la session n'est pas démarrée !!!!", "return", "false", ";", "}" ]
Regenerate id. Regenerate the session ID, using session save handler's native ID generation Can safely be called in the middle of a session. @param bool $deleteOldSession @return bool
[ "Regenerate", "id", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Session/SessionManager.php#L428-L436
36,669
ncou/Chiron
src/Chiron/Http/Session/SessionManager.php
SessionManager.setName
public function setName(string $name): string { if ($this->isStarted()) { throw new LogicException('Cannot change the name of an active session'); } if (! preg_match('/^[a-zA-Z0-9]+$/', $name)) { throw new InvalidArgumentException('Session name provided contains invalid characters; must be alphanumeric only and cannot be empty'); } if (! preg_match('/.*[a-zA-Z]+.*/', $name)) { throw new InvalidArgumentException('Session name cannot be a numeric'); } return session_name($name); }
php
public function setName(string $name): string { if ($this->isStarted()) { throw new LogicException('Cannot change the name of an active session'); } if (! preg_match('/^[a-zA-Z0-9]+$/', $name)) { throw new InvalidArgumentException('Session name provided contains invalid characters; must be alphanumeric only and cannot be empty'); } if (! preg_match('/.*[a-zA-Z]+.*/', $name)) { throw new InvalidArgumentException('Session name cannot be a numeric'); } return session_name($name); }
[ "public", "function", "setName", "(", "string", "$", "name", ")", ":", "string", "{", "if", "(", "$", "this", "->", "isStarted", "(", ")", ")", "{", "throw", "new", "LogicException", "(", "'Cannot change the name of an active session'", ")", ";", "}", "if", "(", "!", "preg_match", "(", "'/^[a-zA-Z0-9]+$/'", ",", "$", "name", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Session name provided contains invalid characters; must be alphanumeric only and cannot be empty'", ")", ";", "}", "if", "(", "!", "preg_match", "(", "'/.*[a-zA-Z]+.*/'", ",", "$", "name", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Session name cannot be a numeric'", ")", ";", "}", "return", "session_name", "(", "$", "name", ")", ";", "}" ]
Sets the current session name. @param string $name The session name to use. @return string @see session_name()
[ "Sets", "the", "current", "session", "name", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Session/SessionManager.php#L447-L462
36,670
ncou/Chiron
src/Chiron/Http/Session/SessionManager.php
SessionManager.destroy2
public static function destroy2() { if (self::status() === \PHP_SESSION_ACTIVE) { //session_unset(); self::flush(); session_destroy(); session_write_close(); // TODO : utiliser 42000 comme nombre au lieu de -1heure => https://github.com/odan/slim-session/blob/master/src/Slim/Session/Adapter/PhpSessionAdapter.php#L39 // delete the session cookie => lifetime = -1h (60 * 60) if (ini_get('session.use_cookies')) { $params = session_get_cookie_params(); setcookie( session_name(), '', time() - 3600, $params['path'], $params['domain'], $params['secure'], $params['httponly'] ); } } //return $this->clear(false); }
php
public static function destroy2() { if (self::status() === \PHP_SESSION_ACTIVE) { //session_unset(); self::flush(); session_destroy(); session_write_close(); // TODO : utiliser 42000 comme nombre au lieu de -1heure => https://github.com/odan/slim-session/blob/master/src/Slim/Session/Adapter/PhpSessionAdapter.php#L39 // delete the session cookie => lifetime = -1h (60 * 60) if (ini_get('session.use_cookies')) { $params = session_get_cookie_params(); setcookie( session_name(), '', time() - 3600, $params['path'], $params['domain'], $params['secure'], $params['httponly'] ); } } //return $this->clear(false); }
[ "public", "static", "function", "destroy2", "(", ")", "{", "if", "(", "self", "::", "status", "(", ")", "===", "\\", "PHP_SESSION_ACTIVE", ")", "{", "//session_unset();", "self", "::", "flush", "(", ")", ";", "session_destroy", "(", ")", ";", "session_write_close", "(", ")", ";", "// TODO : utiliser 42000 comme nombre au lieu de -1heure => https://github.com/odan/slim-session/blob/master/src/Slim/Session/Adapter/PhpSessionAdapter.php#L39", "// delete the session cookie => lifetime = -1h (60 * 60)", "if", "(", "ini_get", "(", "'session.use_cookies'", ")", ")", "{", "$", "params", "=", "session_get_cookie_params", "(", ")", ";", "setcookie", "(", "session_name", "(", ")", ",", "''", ",", "time", "(", ")", "-", "3600", ",", "$", "params", "[", "'path'", "]", ",", "$", "params", "[", "'domain'", "]", ",", "$", "params", "[", "'secure'", "]", ",", "$", "params", "[", "'httponly'", "]", ")", ";", "}", "}", "//return $this->clear(false);", "}" ]
Destroy all session data. @return $this
[ "Destroy", "all", "session", "data", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Session/SessionManager.php#L576-L601
36,671
theodorejb/peachy-sql
lib/Mysql/Statement.php
Statement.close
public function close(): void { if ($this->stmt === null) { throw new \Exception('Statement has already been closed'); } if (!$this->stmt->close()) { throw new SqlException('Failed to close statement', $this->stmt->error_list, $this->query, $this->params); } $this->stmt = null; $this->meta = null; }
php
public function close(): void { if ($this->stmt === null) { throw new \Exception('Statement has already been closed'); } if (!$this->stmt->close()) { throw new SqlException('Failed to close statement', $this->stmt->error_list, $this->query, $this->params); } $this->stmt = null; $this->meta = null; }
[ "public", "function", "close", "(", ")", ":", "void", "{", "if", "(", "$", "this", "->", "stmt", "===", "null", ")", "{", "throw", "new", "\\", "Exception", "(", "'Statement has already been closed'", ")", ";", "}", "if", "(", "!", "$", "this", "->", "stmt", "->", "close", "(", ")", ")", "{", "throw", "new", "SqlException", "(", "'Failed to close statement'", ",", "$", "this", "->", "stmt", "->", "error_list", ",", "$", "this", "->", "query", ",", "$", "this", "->", "params", ")", ";", "}", "$", "this", "->", "stmt", "=", "null", ";", "$", "this", "->", "meta", "=", "null", ";", "}" ]
Closes the prepared statement and deallocates the statement handle. @throws SqlException if failure closing the statement
[ "Closes", "the", "prepared", "statement", "and", "deallocates", "the", "statement", "handle", "." ]
f179c6fa6c4293c2713b6b59022f3cfc90890a98
https://github.com/theodorejb/peachy-sql/blob/f179c6fa6c4293c2713b6b59022f3cfc90890a98/lib/Mysql/Statement.php#L90-L102
36,672
CeusMedia/Common
src/Net/HTTP/Header/Field/Parser.php
Net_HTTP_Header_Field_Parser.decodeQualifiedValues
static public function decodeQualifiedValues( $qualifiedValues, $sortByLength = FALSE ){ $pattern = '/^(\S+)(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/iU'; $parts = preg_split( '/,\s*/', $qualifiedValues ); $codes = array(); foreach( $parts as $part ) if( preg_match ( $pattern, $part, $matches ) ) $codes[$matches[1]] = isset( $matches[2] ) ? (float) $matches[2] : 1.0; $map = array(); foreach( $codes as $code => $quality ){ if( !isset( $map[(string)$quality] ) ) $map[(string)$quality] = array(); $map[(string)$quality][strlen( $code)] = $code; if( $sortByLength ) krsort( $map[(string)$quality] ); // sort inner list by code length } krsort( $map ); // sort outer list by quality $list = array(); foreach( $map as $quality => $codes ) // reduce map to list foreach( $codes as $code ) $list[$code] = (float) $quality; return $list; }
php
static public function decodeQualifiedValues( $qualifiedValues, $sortByLength = FALSE ){ $pattern = '/^(\S+)(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/iU'; $parts = preg_split( '/,\s*/', $qualifiedValues ); $codes = array(); foreach( $parts as $part ) if( preg_match ( $pattern, $part, $matches ) ) $codes[$matches[1]] = isset( $matches[2] ) ? (float) $matches[2] : 1.0; $map = array(); foreach( $codes as $code => $quality ){ if( !isset( $map[(string)$quality] ) ) $map[(string)$quality] = array(); $map[(string)$quality][strlen( $code)] = $code; if( $sortByLength ) krsort( $map[(string)$quality] ); // sort inner list by code length } krsort( $map ); // sort outer list by quality $list = array(); foreach( $map as $quality => $codes ) // reduce map to list foreach( $codes as $code ) $list[$code] = (float) $quality; return $list; }
[ "static", "public", "function", "decodeQualifiedValues", "(", "$", "qualifiedValues", ",", "$", "sortByLength", "=", "FALSE", ")", "{", "$", "pattern", "=", "'/^(\\S+)(?:;\\s*q=(0(?:\\.[0-9]{1,3})?|1(?:\\.0{1,3})?))?$/iU'", ";", "$", "parts", "=", "preg_split", "(", "'/,\\s*/'", ",", "$", "qualifiedValues", ")", ";", "$", "codes", "=", "array", "(", ")", ";", "foreach", "(", "$", "parts", "as", "$", "part", ")", "if", "(", "preg_match", "(", "$", "pattern", ",", "$", "part", ",", "$", "matches", ")", ")", "$", "codes", "[", "$", "matches", "[", "1", "]", "]", "=", "isset", "(", "$", "matches", "[", "2", "]", ")", "?", "(", "float", ")", "$", "matches", "[", "2", "]", ":", "1.0", ";", "$", "map", "=", "array", "(", ")", ";", "foreach", "(", "$", "codes", "as", "$", "code", "=>", "$", "quality", ")", "{", "if", "(", "!", "isset", "(", "$", "map", "[", "(", "string", ")", "$", "quality", "]", ")", ")", "$", "map", "[", "(", "string", ")", "$", "quality", "]", "=", "array", "(", ")", ";", "$", "map", "[", "(", "string", ")", "$", "quality", "]", "[", "strlen", "(", "$", "code", ")", "]", "=", "$", "code", ";", "if", "(", "$", "sortByLength", ")", "krsort", "(", "$", "map", "[", "(", "string", ")", "$", "quality", "]", ")", ";", "// sort inner list by code length", "}", "krsort", "(", "$", "map", ")", ";", "// sort outer list by quality", "$", "list", "=", "array", "(", ")", ";", "foreach", "(", "$", "map", "as", "$", "quality", "=>", "$", "codes", ")", "// reduce map to list", "foreach", "(", "$", "codes", "as", "$", "code", ")", "$", "list", "[", "$", "code", "]", "=", "(", "float", ")", "$", "quality", ";", "return", "$", "list", ";", "}" ]
Tries to decode qualified values into a map of values ordered by their quality. @static @access public @param string $string String of qualified values to decode @param boolean $sortByLength Flag: assume longer key as more qualified for keys with same quality (default: FALSE) @return array Map of qualified values ordered by quality
[ "Tries", "to", "decode", "qualified", "values", "into", "a", "map", "of", "values", "ordered", "by", "their", "quality", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Header/Field/Parser.php#L49-L70
36,673
CeusMedia/Common
src/Net/HTTP/Header/Field/Parser.php
Net_HTTP_Header_Field_Parser.parse
static public function parse( $headerFieldString, $decodeQualifiedValues = FALSE ){ if( !preg_match( '/^\S+:\s*.+$/', trim( $headerFieldString ) ) ) throw new InvalidArgumentException( 'Given string is not an HTTP header' ); list( $key, $value ) = preg_split( '/:/', trim( $headerFieldString ), 2 ); $value = trim( $value ); if( $decodeQualifiedValues ) $value = self::decodeQualifiedValues( $value ); return new Net_HTTP_Header_Field( trim( $key ), $value ); }
php
static public function parse( $headerFieldString, $decodeQualifiedValues = FALSE ){ if( !preg_match( '/^\S+:\s*.+$/', trim( $headerFieldString ) ) ) throw new InvalidArgumentException( 'Given string is not an HTTP header' ); list( $key, $value ) = preg_split( '/:/', trim( $headerFieldString ), 2 ); $value = trim( $value ); if( $decodeQualifiedValues ) $value = self::decodeQualifiedValues( $value ); return new Net_HTTP_Header_Field( trim( $key ), $value ); }
[ "static", "public", "function", "parse", "(", "$", "headerFieldString", ",", "$", "decodeQualifiedValues", "=", "FALSE", ")", "{", "if", "(", "!", "preg_match", "(", "'/^\\S+:\\s*.+$/'", ",", "trim", "(", "$", "headerFieldString", ")", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Given string is not an HTTP header'", ")", ";", "list", "(", "$", "key", ",", "$", "value", ")", "=", "preg_split", "(", "'/:/'", ",", "trim", "(", "$", "headerFieldString", ")", ",", "2", ")", ";", "$", "value", "=", "trim", "(", "$", "value", ")", ";", "if", "(", "$", "decodeQualifiedValues", ")", "$", "value", "=", "self", "::", "decodeQualifiedValues", "(", "$", "value", ")", ";", "return", "new", "Net_HTTP_Header_Field", "(", "trim", "(", "$", "key", ")", ",", "$", "value", ")", ";", "}" ]
Parses a header field string into a header field object. @static @access public @param string $headerFieldString String to header field to parse @param boolean $decodeQualifiedValues Flag: decode qualified values (default: FALSE) @return Net_HTTP_Header_Field Header field object @throws InvalidArgumentException If given string is not a valid header field
[ "Parses", "a", "header", "field", "string", "into", "a", "header", "field", "object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Header/Field/Parser.php#L82-L90
36,674
railken/amethyst-invoice
src/Models/Invoice.php
Invoice.formatPrice
public function formatPrice($price) { $currencies = new ISOCurrencies(); $numberFormatter = new \NumberFormatter($this->locale, \NumberFormatter::CURRENCY); $moneyFormatter = new IntlMoneyFormatter($numberFormatter, $currencies); return $moneyFormatter->format($price); }
php
public function formatPrice($price) { $currencies = new ISOCurrencies(); $numberFormatter = new \NumberFormatter($this->locale, \NumberFormatter::CURRENCY); $moneyFormatter = new IntlMoneyFormatter($numberFormatter, $currencies); return $moneyFormatter->format($price); }
[ "public", "function", "formatPrice", "(", "$", "price", ")", "{", "$", "currencies", "=", "new", "ISOCurrencies", "(", ")", ";", "$", "numberFormatter", "=", "new", "\\", "NumberFormatter", "(", "$", "this", "->", "locale", ",", "\\", "NumberFormatter", "::", "CURRENCY", ")", ";", "$", "moneyFormatter", "=", "new", "IntlMoneyFormatter", "(", "$", "numberFormatter", ",", "$", "currencies", ")", ";", "return", "$", "moneyFormatter", "->", "format", "(", "$", "price", ")", ";", "}" ]
Readable price. @param Money $price @return string
[ "Readable", "price", "." ]
605cf27aaa82aea7328d5e5ae5f69b1e7e86120e
https://github.com/railken/amethyst-invoice/blob/605cf27aaa82aea7328d5e5ae5f69b1e7e86120e/src/Models/Invoice.php#L112-L120
36,675
CeusMedia/Common
src/FS/File/INI.php
FS_File_INI.get
public function get( $key, $section = NULL ) { if( !is_null( $this->sections ) && $this->sections->has( $section ) ) return $this->sections->get( $section )->get( $key ); if( !is_null( $this->pairs ) ) return $this->pairs->get( $key ); return NULL; }
php
public function get( $key, $section = NULL ) { if( !is_null( $this->sections ) && $this->sections->has( $section ) ) return $this->sections->get( $section )->get( $key ); if( !is_null( $this->pairs ) ) return $this->pairs->get( $key ); return NULL; }
[ "public", "function", "get", "(", "$", "key", ",", "$", "section", "=", "NULL", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "sections", ")", "&&", "$", "this", "->", "sections", "->", "has", "(", "$", "section", ")", ")", "return", "$", "this", "->", "sections", "->", "get", "(", "$", "section", ")", "->", "get", "(", "$", "key", ")", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "pairs", ")", ")", "return", "$", "this", "->", "pairs", "->", "get", "(", "$", "key", ")", ";", "return", "NULL", ";", "}" ]
Returns Value by its Key. @access public @param string $key Key @param boolean $section Flag: use Sections @return string|NULL Value if set, NULL otherwise
[ "Returns", "Value", "by", "its", "Key", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/INI.php#L51-L58
36,676
CeusMedia/Common
src/Net/HTTP/Sniffer/Charset.php
Net_HTTP_Sniffer_Charset.getCharsetFromString
public static function getCharsetFromString( $string, $allowed, $default = false ) { if( !$default) $default = $allowed[0]; if( !$string ) return $default; $accepted = preg_split( '/,\s*/', $string ); $currentCharset = $default; $currentQuality = 0; foreach( $accepted as $accept ) { if( !preg_match ( self::$pattern, $accept, $matches ) ) continue; $charsetQuality = isset( $matches[2] ) ? (float) $matches[2] : 1.0; if( $charsetQuality > $currentQuality ) { $currentCharset = strtolower( $matches[1] ); $currentQuality = $charsetQuality; } } return $currentCharset; }
php
public static function getCharsetFromString( $string, $allowed, $default = false ) { if( !$default) $default = $allowed[0]; if( !$string ) return $default; $accepted = preg_split( '/,\s*/', $string ); $currentCharset = $default; $currentQuality = 0; foreach( $accepted as $accept ) { if( !preg_match ( self::$pattern, $accept, $matches ) ) continue; $charsetQuality = isset( $matches[2] ) ? (float) $matches[2] : 1.0; if( $charsetQuality > $currentQuality ) { $currentCharset = strtolower( $matches[1] ); $currentQuality = $charsetQuality; } } return $currentCharset; }
[ "public", "static", "function", "getCharsetFromString", "(", "$", "string", ",", "$", "allowed", ",", "$", "default", "=", "false", ")", "{", "if", "(", "!", "$", "default", ")", "$", "default", "=", "$", "allowed", "[", "0", "]", ";", "if", "(", "!", "$", "string", ")", "return", "$", "default", ";", "$", "accepted", "=", "preg_split", "(", "'/,\\s*/'", ",", "$", "string", ")", ";", "$", "currentCharset", "=", "$", "default", ";", "$", "currentQuality", "=", "0", ";", "foreach", "(", "$", "accepted", "as", "$", "accept", ")", "{", "if", "(", "!", "preg_match", "(", "self", "::", "$", "pattern", ",", "$", "accept", ",", "$", "matches", ")", ")", "continue", ";", "$", "charsetQuality", "=", "isset", "(", "$", "matches", "[", "2", "]", ")", "?", "(", "float", ")", "$", "matches", "[", "2", "]", ":", "1.0", ";", "if", "(", "$", "charsetQuality", ">", "$", "currentQuality", ")", "{", "$", "currentCharset", "=", "strtolower", "(", "$", "matches", "[", "1", "]", ")", ";", "$", "currentQuality", "=", "$", "charsetQuality", ";", "}", "}", "return", "$", "currentCharset", ";", "}" ]
Returns prefered allowed and accepted Character Set from String. @access public @static @param array $allowed Array of Character Sets supported and allowed by the Application @param string $default Default Character Sets supported and allowed by the Application @return string
[ "Returns", "prefered", "allowed", "and", "accepted", "Character", "Set", "from", "String", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Sniffer/Charset.php#L67-L88
36,677
ncou/Chiron
src/Chiron/Handler/Formatter/XmlFormatter.php
XmlFormatter.cleanKeysForXml
private function cleanKeysForXml(array $input): array { $return = []; foreach ($input as $key => $value) { // first remove the line return because the regex using "." pattern prevent to include the line return in the preg_replace. $key = str_replace("\n", '_', $key); $startCharacterPattern = '[A-Z]|_|[a-z]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\x{2FF}]|[\x{370}-\x{37D}]|[\x{37F}-\x{1FFF}]|' . '[\x{200C}-\x{200D}]|[\x{2070}-\x{218F}]|[\x{2C00}-\x{2FEF}]|[\x{3001}-\x{D7FF}]|[\x{F900}-\x{FDCF}]' . '|[\x{FDF0}-\x{FFFD}]|[\x{10000}-\x{EFFFF}]'; $characterPattern = $startCharacterPattern . '|\-|\.|[0-9]|\xB7|[\x{300}-\x{36F}]|[\x{203F}-\x{2040}]'; $key = preg_replace('/(?!' . $characterPattern . ')./u', '_', $key); $key = preg_replace('/^(?!' . $startCharacterPattern . ')./u', '_', $key); if (is_array($value)) { $value = $this->cleanKeysForXml($value); } $return[$key] = $value; } return $return; }
php
private function cleanKeysForXml(array $input): array { $return = []; foreach ($input as $key => $value) { // first remove the line return because the regex using "." pattern prevent to include the line return in the preg_replace. $key = str_replace("\n", '_', $key); $startCharacterPattern = '[A-Z]|_|[a-z]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\x{2FF}]|[\x{370}-\x{37D}]|[\x{37F}-\x{1FFF}]|' . '[\x{200C}-\x{200D}]|[\x{2070}-\x{218F}]|[\x{2C00}-\x{2FEF}]|[\x{3001}-\x{D7FF}]|[\x{F900}-\x{FDCF}]' . '|[\x{FDF0}-\x{FFFD}]|[\x{10000}-\x{EFFFF}]'; $characterPattern = $startCharacterPattern . '|\-|\.|[0-9]|\xB7|[\x{300}-\x{36F}]|[\x{203F}-\x{2040}]'; $key = preg_replace('/(?!' . $characterPattern . ')./u', '_', $key); $key = preg_replace('/^(?!' . $startCharacterPattern . ')./u', '_', $key); if (is_array($value)) { $value = $this->cleanKeysForXml($value); } $return[$key] = $value; } return $return; }
[ "private", "function", "cleanKeysForXml", "(", "array", "$", "input", ")", ":", "array", "{", "$", "return", "=", "[", "]", ";", "foreach", "(", "$", "input", "as", "$", "key", "=>", "$", "value", ")", "{", "// first remove the line return because the regex using \".\" pattern prevent to include the line return in the preg_replace.", "$", "key", "=", "str_replace", "(", "\"\\n\"", ",", "'_'", ",", "$", "key", ")", ";", "$", "startCharacterPattern", "=", "'[A-Z]|_|[a-z]|[\\xC0-\\xD6]|[\\xD8-\\xF6]|[\\xF8-\\x{2FF}]|[\\x{370}-\\x{37D}]|[\\x{37F}-\\x{1FFF}]|'", ".", "'[\\x{200C}-\\x{200D}]|[\\x{2070}-\\x{218F}]|[\\x{2C00}-\\x{2FEF}]|[\\x{3001}-\\x{D7FF}]|[\\x{F900}-\\x{FDCF}]'", ".", "'|[\\x{FDF0}-\\x{FFFD}]|[\\x{10000}-\\x{EFFFF}]'", ";", "$", "characterPattern", "=", "$", "startCharacterPattern", ".", "'|\\-|\\.|[0-9]|\\xB7|[\\x{300}-\\x{36F}]|[\\x{203F}-\\x{2040}]'", ";", "$", "key", "=", "preg_replace", "(", "'/(?!'", ".", "$", "characterPattern", ".", "')./u'", ",", "'_'", ",", "$", "key", ")", ";", "$", "key", "=", "preg_replace", "(", "'/^(?!'", ".", "$", "startCharacterPattern", ".", "')./u'", ",", "'_'", ",", "$", "key", ")", ";", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "value", "=", "$", "this", "->", "cleanKeysForXml", "(", "$", "value", ")", ";", "}", "$", "return", "[", "$", "key", "]", "=", "$", "value", ";", "}", "return", "$", "return", ";", "}" ]
Ensure all keys in this associative array are valid XML tag names by replacing invalid characters with an `_`. @see https://www.w3.org/TR/xml/#sec-common-syn
[ "Ensure", "all", "keys", "in", "this", "associative", "array", "are", "valid", "XML", "tag", "names", "by", "replacing", "invalid", "characters", "with", "an", "_", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Handler/Formatter/XmlFormatter.php#L184-L204
36,678
CeusMedia/Common
src/FS/File/Log/Tracker/ShortReader.php
FS_File_Log_Tracker_ShortReader.getBrowsers
public function getBrowsers() { if( !$this->_open ) { trigger_error( "Log File not read", E_USER_ERROR ); return array(); } $remote_addrs = array(); $browsers = array(); foreach( $this->data as $entry ) { if( $entry['remote_addr'] != $this->skip && $entry['http_user_agent'] ) { if( isset( $remote_addrs[$entry['remote_addr']] ) ) { if( $remote_addrs[$entry['remote_addr']] < $entry['timestamp'] - 30 * 60 ) { if( isset( $browsers[$entry['http_user_agent']] ) ) $browsers[$entry['http_user_agent']] ++; else $browsers[$entry['http_user_agent']] = 1; } $remote_addrs[$entry['remote_addr']] = $entry['timestamp']; } else { if( isset( $browsers[$entry['http_user_agent']] ) ) $browsers[$entry['http_user_agent']] ++; else $browsers[$entry['http_user_agent']] = 1; $remote_addrs[$entry['remote_addr']] = $entry['timestamp']; } } } arsort( $browsers ); $lines = array(); foreach( $browsers as $browser => $count ) $lines[] = "<tr><td>".$browser."</td><td>".$count."</td></tr>"; $lines = implode( "\n\t", $lines ); $content = "<table>".$lines."</table>"; return $content; }
php
public function getBrowsers() { if( !$this->_open ) { trigger_error( "Log File not read", E_USER_ERROR ); return array(); } $remote_addrs = array(); $browsers = array(); foreach( $this->data as $entry ) { if( $entry['remote_addr'] != $this->skip && $entry['http_user_agent'] ) { if( isset( $remote_addrs[$entry['remote_addr']] ) ) { if( $remote_addrs[$entry['remote_addr']] < $entry['timestamp'] - 30 * 60 ) { if( isset( $browsers[$entry['http_user_agent']] ) ) $browsers[$entry['http_user_agent']] ++; else $browsers[$entry['http_user_agent']] = 1; } $remote_addrs[$entry['remote_addr']] = $entry['timestamp']; } else { if( isset( $browsers[$entry['http_user_agent']] ) ) $browsers[$entry['http_user_agent']] ++; else $browsers[$entry['http_user_agent']] = 1; $remote_addrs[$entry['remote_addr']] = $entry['timestamp']; } } } arsort( $browsers ); $lines = array(); foreach( $browsers as $browser => $count ) $lines[] = "<tr><td>".$browser."</td><td>".$count."</td></tr>"; $lines = implode( "\n\t", $lines ); $content = "<table>".$lines."</table>"; return $content; }
[ "public", "function", "getBrowsers", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_open", ")", "{", "trigger_error", "(", "\"Log File not read\"", ",", "E_USER_ERROR", ")", ";", "return", "array", "(", ")", ";", "}", "$", "remote_addrs", "=", "array", "(", ")", ";", "$", "browsers", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "data", "as", "$", "entry", ")", "{", "if", "(", "$", "entry", "[", "'remote_addr'", "]", "!=", "$", "this", "->", "skip", "&&", "$", "entry", "[", "'http_user_agent'", "]", ")", "{", "if", "(", "isset", "(", "$", "remote_addrs", "[", "$", "entry", "[", "'remote_addr'", "]", "]", ")", ")", "{", "if", "(", "$", "remote_addrs", "[", "$", "entry", "[", "'remote_addr'", "]", "]", "<", "$", "entry", "[", "'timestamp'", "]", "-", "30", "*", "60", ")", "{", "if", "(", "isset", "(", "$", "browsers", "[", "$", "entry", "[", "'http_user_agent'", "]", "]", ")", ")", "$", "browsers", "[", "$", "entry", "[", "'http_user_agent'", "]", "]", "++", ";", "else", "$", "browsers", "[", "$", "entry", "[", "'http_user_agent'", "]", "]", "=", "1", ";", "}", "$", "remote_addrs", "[", "$", "entry", "[", "'remote_addr'", "]", "]", "=", "$", "entry", "[", "'timestamp'", "]", ";", "}", "else", "{", "if", "(", "isset", "(", "$", "browsers", "[", "$", "entry", "[", "'http_user_agent'", "]", "]", ")", ")", "$", "browsers", "[", "$", "entry", "[", "'http_user_agent'", "]", "]", "++", ";", "else", "$", "browsers", "[", "$", "entry", "[", "'http_user_agent'", "]", "]", "=", "1", ";", "$", "remote_addrs", "[", "$", "entry", "[", "'remote_addr'", "]", "]", "=", "$", "entry", "[", "'timestamp'", "]", ";", "}", "}", "}", "arsort", "(", "$", "browsers", ")", ";", "$", "lines", "=", "array", "(", ")", ";", "foreach", "(", "$", "browsers", "as", "$", "browser", "=>", "$", "count", ")", "$", "lines", "[", "]", "=", "\"<tr><td>\"", ".", "$", "browser", ".", "\"</td><td>\"", ".", "$", "count", ".", "\"</td></tr>\"", ";", "$", "lines", "=", "implode", "(", "\"\\n\\t\"", ",", "$", "lines", ")", ";", "$", "content", "=", "\"<table>\"", ".", "$", "lines", ".", "\"</table>\"", ";", "return", "$", "content", ";", "}" ]
Returns used Browsers of unique Visitors. @access public @return array
[ "Returns", "used", "Browsers", "of", "unique", "Visitors", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Log/Tracker/ShortReader.php#L66-L107
36,679
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.indentSign
public function indentSign( $offset, $sign = NULL, $factor = NULL ) { extract( self::$channels[$this->channel] ); $sign = $sign ? $sign : $indentSign; $factor = $factor ? $factor : $indentFactor; return str_repeat( $sign, $offset * $factor ); }
php
public function indentSign( $offset, $sign = NULL, $factor = NULL ) { extract( self::$channels[$this->channel] ); $sign = $sign ? $sign : $indentSign; $factor = $factor ? $factor : $indentFactor; return str_repeat( $sign, $offset * $factor ); }
[ "public", "function", "indentSign", "(", "$", "offset", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ")", "{", "extract", "(", "self", "::", "$", "channels", "[", "$", "this", "->", "channel", "]", ")", ";", "$", "sign", "=", "$", "sign", "?", "$", "sign", ":", "$", "indentSign", ";", "$", "factor", "=", "$", "factor", "?", "$", "factor", ":", "$", "indentFactor", ";", "return", "str_repeat", "(", "$", "sign", ",", "$", "offset", "*", "$", "factor", ")", ";", "}" ]
Returns whitespaces. @access public @param int $offset amount of space @param string $sign Space Sign @param int $factor Space Factor @return string
[ "Returns", "whitespaces", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L90-L96
36,680
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printArray
public function printArray( $array, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_array( $array ) ) { extract( self::$channels[$this->channel] ); $space = $this->indentSign( $offset, $sign, $factor ); if( $key !== NULL ) echo $space."[A] ".$key.$lineBreak; foreach( $array as $key => $value ) { if( is_array( $value ) && count( $value ) ) $this->printArray( $value, $offset + 1, $key, $sign, $factor ); else $this->printMixed( $value, $offset + 1, $key, $sign, $factor ); } } else $this->printMixed( $array, $offset, $key, $sign, $factor ); }
php
public function printArray( $array, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_array( $array ) ) { extract( self::$channels[$this->channel] ); $space = $this->indentSign( $offset, $sign, $factor ); if( $key !== NULL ) echo $space."[A] ".$key.$lineBreak; foreach( $array as $key => $value ) { if( is_array( $value ) && count( $value ) ) $this->printArray( $value, $offset + 1, $key, $sign, $factor ); else $this->printMixed( $value, $offset + 1, $key, $sign, $factor ); } } else $this->printMixed( $array, $offset, $key, $sign, $factor ); }
[ "public", "function", "printArray", "(", "$", "array", ",", "$", "offset", "=", "0", ",", "$", "key", "=", "NULL", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ")", "{", "if", "(", "is_array", "(", "$", "array", ")", ")", "{", "extract", "(", "self", "::", "$", "channels", "[", "$", "this", "->", "channel", "]", ")", ";", "$", "space", "=", "$", "this", "->", "indentSign", "(", "$", "offset", ",", "$", "sign", ",", "$", "factor", ")", ";", "if", "(", "$", "key", "!==", "NULL", ")", "echo", "$", "space", ".", "\"[A] \"", ".", "$", "key", ".", "$", "lineBreak", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", "&&", "count", "(", "$", "value", ")", ")", "$", "this", "->", "printArray", "(", "$", "value", ",", "$", "offset", "+", "1", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "$", "this", "->", "printMixed", "(", "$", "value", ",", "$", "offset", "+", "1", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}", "}", "else", "$", "this", "->", "printMixed", "(", "$", "array", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}" ]
Prints out an Array. @access public @param array $array Array variable to print out @param int $offset Intent Offset Level @param string $key Element Key Name @param string $sign Space Sign @param int $factor Space Factor @return void
[ "Prints", "out", "an", "Array", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L108-L126
36,681
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printBoolean
public function printBoolean( $bool, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_bool( $bool ) ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[B] ".$key.$booleanOpen.( $bool ? "TRUE" : "FALSE" ).$booleanClose.$lineBreak; } else $this->printMixed( $bool, $offset, $key, $sign, $factor ); }
php
public function printBoolean( $bool, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_bool( $bool ) ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[B] ".$key.$booleanOpen.( $bool ? "TRUE" : "FALSE" ).$booleanClose.$lineBreak; } else $this->printMixed( $bool, $offset, $key, $sign, $factor ); }
[ "public", "function", "printBoolean", "(", "$", "bool", ",", "$", "offset", "=", "0", ",", "$", "key", "=", "NULL", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ")", "{", "if", "(", "is_bool", "(", "$", "bool", ")", ")", "{", "extract", "(", "self", "::", "$", "channels", "[", "$", "this", "->", "channel", "]", ")", ";", "$", "key", "=", "(", "$", "key", "!==", "NULL", ")", "?", "$", "key", ".", "\" => \"", ":", "\"\"", ";", "$", "space", "=", "$", "this", "->", "indentSign", "(", "$", "offset", ",", "$", "sign", ",", "$", "factor", ")", ";", "echo", "$", "space", ".", "\"[B] \"", ".", "$", "key", ".", "$", "booleanOpen", ".", "(", "$", "bool", "?", "\"TRUE\"", ":", "\"FALSE\"", ")", ".", "$", "booleanClose", ".", "$", "lineBreak", ";", "}", "else", "$", "this", "->", "printMixed", "(", "$", "bool", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}" ]
Prints out a boolean variable. @access public @param bool $bool boolean variable to print out @param int $offset Intent Offset Level @param string $key Element Key Name @param string $sign Space Sign @param int $factor Space Factor @return void
[ "Prints", "out", "a", "boolean", "variable", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L138-L149
36,682
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printDouble
public function printDouble( $double, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { return $this->printFloat( $double, $offset, $key, $sign,$factor ); }
php
public function printDouble( $double, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { return $this->printFloat( $double, $offset, $key, $sign,$factor ); }
[ "public", "function", "printDouble", "(", "$", "double", ",", "$", "offset", "=", "0", ",", "$", "key", "=", "NULL", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ")", "{", "return", "$", "this", "->", "printFloat", "(", "$", "double", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}" ]
Prints out an Double variable. @access public @param double $double double variable to print out @param int $offset Intent Offset Level @param string $key Element Key Name @param string $sign Space Sign @param int $factor Space Factor @return void
[ "Prints", "out", "an", "Double", "variable", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L161-L164
36,683
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printFloat
public function printFloat( $float, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_float( $float ) ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[F] ".$key.$float.$lineBreak; } else $this->printMixed( $float, $offset, $key, $sign, $factor ); }
php
public function printFloat( $float, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_float( $float ) ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[F] ".$key.$float.$lineBreak; } else $this->printMixed( $float, $offset, $key, $sign, $factor ); }
[ "public", "function", "printFloat", "(", "$", "float", ",", "$", "offset", "=", "0", ",", "$", "key", "=", "NULL", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ")", "{", "if", "(", "is_float", "(", "$", "float", ")", ")", "{", "extract", "(", "self", "::", "$", "channels", "[", "$", "this", "->", "channel", "]", ")", ";", "$", "key", "=", "(", "$", "key", "!==", "NULL", ")", "?", "$", "key", ".", "\" => \"", ":", "\"\"", ";", "$", "space", "=", "$", "this", "->", "indentSign", "(", "$", "offset", ",", "$", "sign", ",", "$", "factor", ")", ";", "echo", "$", "space", ".", "\"[F] \"", ".", "$", "key", ".", "$", "float", ".", "$", "lineBreak", ";", "}", "else", "$", "this", "->", "printMixed", "(", "$", "float", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}" ]
Prints out an Float variable. @access public @param float $float float variable to print out @param int $offset Intent Offset Level @param string $key Element Key Name @param string $sign Space Sign @param int $factor Space Factor @return void
[ "Prints", "out", "an", "Float", "variable", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L176-L187
36,684
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printInteger
public function printInteger( $integer, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_int( $integer ) ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[I] ".$key.$integer.$lineBreak; } else $this->printMixed( $integer, $offset, $key, $sign, $factor ); }
php
public function printInteger( $integer, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_int( $integer ) ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[I] ".$key.$integer.$lineBreak; } else $this->printMixed( $integer, $offset, $key, $sign, $factor ); }
[ "public", "function", "printInteger", "(", "$", "integer", ",", "$", "offset", "=", "0", ",", "$", "key", "=", "NULL", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ")", "{", "if", "(", "is_int", "(", "$", "integer", ")", ")", "{", "extract", "(", "self", "::", "$", "channels", "[", "$", "this", "->", "channel", "]", ")", ";", "$", "key", "=", "(", "$", "key", "!==", "NULL", ")", "?", "$", "key", ".", "\" => \"", ":", "\"\"", ";", "$", "space", "=", "$", "this", "->", "indentSign", "(", "$", "offset", ",", "$", "sign", ",", "$", "factor", ")", ";", "echo", "$", "space", ".", "\"[I] \"", ".", "$", "key", ".", "$", "integer", ".", "$", "lineBreak", ";", "}", "else", "$", "this", "->", "printMixed", "(", "$", "integer", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}" ]
Prints out an Integer variable. @access public @param int $integer Integer variable to print out @param int $offset Intent Offset Level @param string $key Element Key Name @param string $sign Space Sign @param int $factor Space Factor @return void
[ "Prints", "out", "an", "Integer", "variable", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L199-L210
36,685
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printJson
public function printJson( $mixed, $sign = NULL, $factor = NULL, $return = FALSE ) { if( $return ) ob_start(); extract( self::$channels[$this->channel] ); $o = new UI_DevOutput(); echo $lineBreak; $space = $this->indentSign( 1, $sign, $factor ); $json = ADT_JSON_Formater::format( $mixed ); $json = str_replace( "\n", $lineBreak, $json ); $json = str_replace( " ", $space, $json ); echo $json; if( $return ) return ob_get_clean(); }
php
public function printJson( $mixed, $sign = NULL, $factor = NULL, $return = FALSE ) { if( $return ) ob_start(); extract( self::$channels[$this->channel] ); $o = new UI_DevOutput(); echo $lineBreak; $space = $this->indentSign( 1, $sign, $factor ); $json = ADT_JSON_Formater::format( $mixed ); $json = str_replace( "\n", $lineBreak, $json ); $json = str_replace( " ", $space, $json ); echo $json; if( $return ) return ob_get_clean(); }
[ "public", "function", "printJson", "(", "$", "mixed", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ",", "$", "return", "=", "FALSE", ")", "{", "if", "(", "$", "return", ")", "ob_start", "(", ")", ";", "extract", "(", "self", "::", "$", "channels", "[", "$", "this", "->", "channel", "]", ")", ";", "$", "o", "=", "new", "UI_DevOutput", "(", ")", ";", "echo", "$", "lineBreak", ";", "$", "space", "=", "$", "this", "->", "indentSign", "(", "1", ",", "$", "sign", ",", "$", "factor", ")", ";", "$", "json", "=", "ADT_JSON_Formater", "::", "format", "(", "$", "mixed", ")", ";", "$", "json", "=", "str_replace", "(", "\"\\n\"", ",", "$", "lineBreak", ",", "$", "json", ")", ";", "$", "json", "=", "str_replace", "(", "\" \"", ",", "$", "space", ",", "$", "json", ")", ";", "echo", "$", "json", ";", "if", "(", "$", "return", ")", "return", "ob_get_clean", "(", ")", ";", "}" ]
Prints out a variable as JSON. @access public @param mixed $mixed variable of every kind to print out @param string $sign Space Sign @param int $factor Space Factor @param boolean $return Flag: Return output instead of printing it @return void
[ "Prints", "out", "a", "variable", "as", "JSON", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L221-L235
36,686
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printMixed
public function printMixed( $mixed, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL, $return = FALSE ) { if( $return ) ob_start(); if( is_object( $mixed ) || gettype( $mixed ) == "object" ) $this->printObject( $mixed, $offset, $key, $sign, $factor ); else if( is_array( $mixed ) ) $this->printArray( $mixed, $offset, $key, $sign, $factor ); else if( is_string( $mixed ) ) $this->printString( $mixed, $offset, $key, $sign, $factor ); else if( is_int($mixed ) ) $this->printInteger( $mixed, $offset, $key, $sign, $factor ); else if( is_float($mixed ) ) $this->printFloat( $mixed, $offset, $key, $sign, $factor ); else if( is_double( $mixed ) ) $this->printDouble( $mixed, $offset, $key, $sign, $factor ); else if( is_resource( $mixed ) ) $this->printResource( $mixed, $offset, $key, $sign, $factor ); else if( is_bool($mixed ) ) $this->printBoolean( $mixed, $offset, $key, $sign, $factor ); else if( $mixed === NULL ) $this->printNull( $mixed, $offset, $key, $sign, $factor ); if( $return ) return ob_get_clean(); }
php
public function printMixed( $mixed, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL, $return = FALSE ) { if( $return ) ob_start(); if( is_object( $mixed ) || gettype( $mixed ) == "object" ) $this->printObject( $mixed, $offset, $key, $sign, $factor ); else if( is_array( $mixed ) ) $this->printArray( $mixed, $offset, $key, $sign, $factor ); else if( is_string( $mixed ) ) $this->printString( $mixed, $offset, $key, $sign, $factor ); else if( is_int($mixed ) ) $this->printInteger( $mixed, $offset, $key, $sign, $factor ); else if( is_float($mixed ) ) $this->printFloat( $mixed, $offset, $key, $sign, $factor ); else if( is_double( $mixed ) ) $this->printDouble( $mixed, $offset, $key, $sign, $factor ); else if( is_resource( $mixed ) ) $this->printResource( $mixed, $offset, $key, $sign, $factor ); else if( is_bool($mixed ) ) $this->printBoolean( $mixed, $offset, $key, $sign, $factor ); else if( $mixed === NULL ) $this->printNull( $mixed, $offset, $key, $sign, $factor ); if( $return ) return ob_get_clean(); }
[ "public", "function", "printMixed", "(", "$", "mixed", ",", "$", "offset", "=", "0", ",", "$", "key", "=", "NULL", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ",", "$", "return", "=", "FALSE", ")", "{", "if", "(", "$", "return", ")", "ob_start", "(", ")", ";", "if", "(", "is_object", "(", "$", "mixed", ")", "||", "gettype", "(", "$", "mixed", ")", "==", "\"object\"", ")", "$", "this", "->", "printObject", "(", "$", "mixed", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "if", "(", "is_array", "(", "$", "mixed", ")", ")", "$", "this", "->", "printArray", "(", "$", "mixed", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "if", "(", "is_string", "(", "$", "mixed", ")", ")", "$", "this", "->", "printString", "(", "$", "mixed", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "if", "(", "is_int", "(", "$", "mixed", ")", ")", "$", "this", "->", "printInteger", "(", "$", "mixed", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "if", "(", "is_float", "(", "$", "mixed", ")", ")", "$", "this", "->", "printFloat", "(", "$", "mixed", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "if", "(", "is_double", "(", "$", "mixed", ")", ")", "$", "this", "->", "printDouble", "(", "$", "mixed", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "if", "(", "is_resource", "(", "$", "mixed", ")", ")", "$", "this", "->", "printResource", "(", "$", "mixed", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "if", "(", "is_bool", "(", "$", "mixed", ")", ")", "$", "this", "->", "printBoolean", "(", "$", "mixed", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "if", "(", "$", "mixed", "===", "NULL", ")", "$", "this", "->", "printNull", "(", "$", "mixed", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "if", "(", "$", "return", ")", "return", "ob_get_clean", "(", ")", ";", "}" ]
Prints out a variable by getting Type and using a suitable Method. @access public @param mixed $mixed variable of every kind to print out @param int $offset Intent Offset Level @param string $key Element Key Name @param string $sign Space Sign @param int $factor Space Factor @param boolean $return Flag: Return output instead of printing it @return void
[ "Prints", "out", "a", "variable", "by", "getting", "Type", "and", "using", "a", "suitable", "Method", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L248-L272
36,687
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printNull
public function printNull( $null, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( $null === NULL ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[N] ".$key.$booleanOpen."NULL".$booleanClose.$lineBreak; } else $this->printMixed( $null, $offset, $key, $sign, $factor ); }
php
public function printNull( $null, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( $null === NULL ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[N] ".$key.$booleanOpen."NULL".$booleanClose.$lineBreak; } else $this->printMixed( $null, $offset, $key, $sign, $factor ); }
[ "public", "function", "printNull", "(", "$", "null", ",", "$", "offset", "=", "0", ",", "$", "key", "=", "NULL", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ")", "{", "if", "(", "$", "null", "===", "NULL", ")", "{", "extract", "(", "self", "::", "$", "channels", "[", "$", "this", "->", "channel", "]", ")", ";", "$", "key", "=", "(", "$", "key", "!==", "NULL", ")", "?", "$", "key", ".", "\" => \"", ":", "\"\"", ";", "$", "space", "=", "$", "this", "->", "indentSign", "(", "$", "offset", ",", "$", "sign", ",", "$", "factor", ")", ";", "echo", "$", "space", ".", "\"[N] \"", ".", "$", "key", ".", "$", "booleanOpen", ".", "\"NULL\"", ".", "$", "booleanClose", ".", "$", "lineBreak", ";", "}", "else", "$", "this", "->", "printMixed", "(", "$", "null", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}" ]
Prints out NULL. @access public @param NULL $null boolean variable to print out @param int $offset Intent Offset Level @param string $key Element Key Name @param string $sign Space Sign @param int $factor Space Factor @return void
[ "Prints", "out", "NULL", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L284-L295
36,688
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printObject
public function printObject( $object, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_object( $object ) || gettype( $object ) == "object" ) { extract( self::$channels[$this->channel] ); $ins_key = ( $key !== NULL ) ? $key." -> " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[O] ".$ins_key."".$highlightOpen.get_class( $object ).$highlightClose.$lineBreak; $vars = get_object_vars( $object ); foreach( $vars as $key => $value ) { if( is_object( $value ) ) $this->printObject( $value, $offset + 1, $key, $sign, $factor ); else if( is_array( $value ) ) $this->printArray( $value, $offset + 1, $key, $sign, $factor ); else $this->printMixed( $value, $offset + 1, $key, $sign, $factor ); } } else $this->printMixed( $object, $offset, $key, $sign, $factor ); }
php
public function printObject( $object, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_object( $object ) || gettype( $object ) == "object" ) { extract( self::$channels[$this->channel] ); $ins_key = ( $key !== NULL ) ? $key." -> " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[O] ".$ins_key."".$highlightOpen.get_class( $object ).$highlightClose.$lineBreak; $vars = get_object_vars( $object ); foreach( $vars as $key => $value ) { if( is_object( $value ) ) $this->printObject( $value, $offset + 1, $key, $sign, $factor ); else if( is_array( $value ) ) $this->printArray( $value, $offset + 1, $key, $sign, $factor ); else $this->printMixed( $value, $offset + 1, $key, $sign, $factor ); } } else $this->printMixed( $object, $offset, $key, $sign, $factor ); }
[ "public", "function", "printObject", "(", "$", "object", ",", "$", "offset", "=", "0", ",", "$", "key", "=", "NULL", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ")", "{", "if", "(", "is_object", "(", "$", "object", ")", "||", "gettype", "(", "$", "object", ")", "==", "\"object\"", ")", "{", "extract", "(", "self", "::", "$", "channels", "[", "$", "this", "->", "channel", "]", ")", ";", "$", "ins_key", "=", "(", "$", "key", "!==", "NULL", ")", "?", "$", "key", ".", "\" -> \"", ":", "\"\"", ";", "$", "space", "=", "$", "this", "->", "indentSign", "(", "$", "offset", ",", "$", "sign", ",", "$", "factor", ")", ";", "echo", "$", "space", ".", "\"[O] \"", ".", "$", "ins_key", ".", "\"\"", ".", "$", "highlightOpen", ".", "get_class", "(", "$", "object", ")", ".", "$", "highlightClose", ".", "$", "lineBreak", ";", "$", "vars", "=", "get_object_vars", "(", "$", "object", ")", ";", "foreach", "(", "$", "vars", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_object", "(", "$", "value", ")", ")", "$", "this", "->", "printObject", "(", "$", "value", ",", "$", "offset", "+", "1", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "if", "(", "is_array", "(", "$", "value", ")", ")", "$", "this", "->", "printArray", "(", "$", "value", ",", "$", "offset", "+", "1", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "else", "$", "this", "->", "printMixed", "(", "$", "value", ",", "$", "offset", "+", "1", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}", "}", "else", "$", "this", "->", "printMixed", "(", "$", "object", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}" ]
Prints out a Object. @access public @param mixed $object Object variable to print out @param int $offset Intent Offset Level @param string $key Element Key Name @param string $sign Space Sign @param int $factor Space Factor @return void
[ "Prints", "out", "a", "Object", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L307-L328
36,689
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printResource
public function printResource( $resource, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_resource( $resource ) ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[R] ".$key.$resource.$lineBreak; } else $this->printMixed( $object, $offset, $key, $sign, $factor ); }
php
public function printResource( $resource, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_resource( $resource ) ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); echo $space."[R] ".$key.$resource.$lineBreak; } else $this->printMixed( $object, $offset, $key, $sign, $factor ); }
[ "public", "function", "printResource", "(", "$", "resource", ",", "$", "offset", "=", "0", ",", "$", "key", "=", "NULL", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ")", "{", "if", "(", "is_resource", "(", "$", "resource", ")", ")", "{", "extract", "(", "self", "::", "$", "channels", "[", "$", "this", "->", "channel", "]", ")", ";", "$", "key", "=", "(", "$", "key", "!==", "NULL", ")", "?", "$", "key", ".", "\" => \"", ":", "\"\"", ";", "$", "space", "=", "$", "this", "->", "indentSign", "(", "$", "offset", ",", "$", "sign", ",", "$", "factor", ")", ";", "echo", "$", "space", ".", "\"[R] \"", ".", "$", "key", ".", "$", "resource", ".", "$", "lineBreak", ";", "}", "else", "$", "this", "->", "printMixed", "(", "$", "object", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}" ]
Prints out a Resource. @access public @param mixed $object Object variable to print out @param int $offset Intent Offset Level @param string $key Element Key Name @param string $sign Space Sign @param int $factor Space Factor @return void
[ "Prints", "out", "a", "Resource", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L340-L351
36,690
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.printString
public function printString( $string, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_string( $string ) ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); if( $lineBreak != "\n" ) $string = htmlspecialchars( $string ); if( strlen( $string > $stringMaxLength ) ) $string = Alg_Text_Trimmer::trimCentric( $string, $stringMaxLength, $stringTrimMask ); echo $space."[S] ".$key.$string.$lineBreak; } else $this->printMixed( $string, $offset, $key, $sign, $factor ); }
php
public function printString( $string, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL ) { if( is_string( $string ) ) { extract( self::$channels[$this->channel] ); $key = ( $key !== NULL ) ? $key." => " : ""; $space = $this->indentSign( $offset, $sign, $factor ); if( $lineBreak != "\n" ) $string = htmlspecialchars( $string ); if( strlen( $string > $stringMaxLength ) ) $string = Alg_Text_Trimmer::trimCentric( $string, $stringMaxLength, $stringTrimMask ); echo $space."[S] ".$key.$string.$lineBreak; } else $this->printMixed( $string, $offset, $key, $sign, $factor ); }
[ "public", "function", "printString", "(", "$", "string", ",", "$", "offset", "=", "0", ",", "$", "key", "=", "NULL", ",", "$", "sign", "=", "NULL", ",", "$", "factor", "=", "NULL", ")", "{", "if", "(", "is_string", "(", "$", "string", ")", ")", "{", "extract", "(", "self", "::", "$", "channels", "[", "$", "this", "->", "channel", "]", ")", ";", "$", "key", "=", "(", "$", "key", "!==", "NULL", ")", "?", "$", "key", ".", "\" => \"", ":", "\"\"", ";", "$", "space", "=", "$", "this", "->", "indentSign", "(", "$", "offset", ",", "$", "sign", ",", "$", "factor", ")", ";", "if", "(", "$", "lineBreak", "!=", "\"\\n\"", ")", "$", "string", "=", "htmlspecialchars", "(", "$", "string", ")", ";", "if", "(", "strlen", "(", "$", "string", ">", "$", "stringMaxLength", ")", ")", "$", "string", "=", "Alg_Text_Trimmer", "::", "trimCentric", "(", "$", "string", ",", "$", "stringMaxLength", ",", "$", "stringTrimMask", ")", ";", "echo", "$", "space", ".", "\"[S] \"", ".", "$", "key", ".", "$", "string", ".", "$", "lineBreak", ";", "}", "else", "$", "this", "->", "printMixed", "(", "$", "string", ",", "$", "offset", ",", "$", "key", ",", "$", "sign", ",", "$", "factor", ")", ";", "}" ]
Prints out a String variable. @access public @param string $string String variable to print out @param int $offset Intent Offset Level @param string $key Element Key Name @param string $sign Space Sign @param int $factor Space Factor @return void
[ "Prints", "out", "a", "String", "variable", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L363-L378
36,691
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.remark
public function remark( $text, $parameters = array() ) { $param = ""; if( is_array( $parameters ) && count( $parameters ) ) { $param = array(); foreach( $parameters as $key => $value ) { if( is_int( $key ) ) $param[] = $value; else $param[] = $key." -> ".$value; } $param = ": ".implode( " | ", $param ); } echo $text.$param; }
php
public function remark( $text, $parameters = array() ) { $param = ""; if( is_array( $parameters ) && count( $parameters ) ) { $param = array(); foreach( $parameters as $key => $value ) { if( is_int( $key ) ) $param[] = $value; else $param[] = $key." -> ".$value; } $param = ": ".implode( " | ", $param ); } echo $text.$param; }
[ "public", "function", "remark", "(", "$", "text", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "$", "param", "=", "\"\"", ";", "if", "(", "is_array", "(", "$", "parameters", ")", "&&", "count", "(", "$", "parameters", ")", ")", "{", "$", "param", "=", "array", "(", ")", ";", "foreach", "(", "$", "parameters", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_int", "(", "$", "key", ")", ")", "$", "param", "[", "]", "=", "$", "value", ";", "else", "$", "param", "[", "]", "=", "$", "key", ".", "\" -> \"", ".", "$", "value", ";", "}", "$", "param", "=", "\": \"", ".", "implode", "(", "\" | \"", ",", "$", "param", ")", ";", "}", "echo", "$", "text", ".", "$", "param", ";", "}" ]
Prints out a String and Parameters. @access public @param string $text String to print out @param array $parameters Associative Array of Parameters to append @return void
[ "Prints", "out", "a", "String", "and", "Parameters", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L387-L403
36,692
CeusMedia/Common
src/UI/DevOutput.php
UI_DevOutput.setChannel
public function setChannel( $channel = NULL ) { if( !is_string( $channel ) ) $channel = 'auto'; $channel = strtolower( $channel ); if( !in_array( $channel, array( 'auto', 'console', 'html' ) ) ) throw new OutOfRangeException( 'Channel type "'.$channel.'" is not supported' ); if( $channel === "auto" ){ $channel = 'html'; if( getEnv( 'PROMPT' ) || getEnv( 'SHELL' ) || $channel == "console" ) $channel = 'console'; } $this->channel = $channel; }
php
public function setChannel( $channel = NULL ) { if( !is_string( $channel ) ) $channel = 'auto'; $channel = strtolower( $channel ); if( !in_array( $channel, array( 'auto', 'console', 'html' ) ) ) throw new OutOfRangeException( 'Channel type "'.$channel.'" is not supported' ); if( $channel === "auto" ){ $channel = 'html'; if( getEnv( 'PROMPT' ) || getEnv( 'SHELL' ) || $channel == "console" ) $channel = 'console'; } $this->channel = $channel; }
[ "public", "function", "setChannel", "(", "$", "channel", "=", "NULL", ")", "{", "if", "(", "!", "is_string", "(", "$", "channel", ")", ")", "$", "channel", "=", "'auto'", ";", "$", "channel", "=", "strtolower", "(", "$", "channel", ")", ";", "if", "(", "!", "in_array", "(", "$", "channel", ",", "array", "(", "'auto'", ",", "'console'", ",", "'html'", ")", ")", ")", "throw", "new", "OutOfRangeException", "(", "'Channel type \"'", ".", "$", "channel", ".", "'\" is not supported'", ")", ";", "if", "(", "$", "channel", "===", "\"auto\"", ")", "{", "$", "channel", "=", "'html'", ";", "if", "(", "getEnv", "(", "'PROMPT'", ")", "||", "getEnv", "(", "'SHELL'", ")", "||", "$", "channel", "==", "\"console\"", ")", "$", "channel", "=", "'console'", ";", "}", "$", "this", "->", "channel", "=", "$", "channel", ";", "}" ]
Sets output channel type. Auto mode assumes HTML at first and will fall back to Console if detected. @access public @param string $channel Type of channel (auto, console, html); @return void @throws OutOfRangeException if an invalid channel type is to be set
[ "Sets", "output", "channel", "type", ".", "Auto", "mode", "assumes", "HTML", "at", "first", "and", "will", "fall", "back", "to", "Console", "if", "detected", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/DevOutput.php#L418-L431
36,693
CeusMedia/Common
src/FS/File/Log/JSON/Reader.php
FS_File_Log_JSON_Reader.getList
public function getList( $reverse = FALSE, $limit = 0 ) { return $this->read( $this->fileName, $reverse, $limit ); }
php
public function getList( $reverse = FALSE, $limit = 0 ) { return $this->read( $this->fileName, $reverse, $limit ); }
[ "public", "function", "getList", "(", "$", "reverse", "=", "FALSE", ",", "$", "limit", "=", "0", ")", "{", "return", "$", "this", "->", "read", "(", "$", "this", "->", "fileName", ",", "$", "reverse", ",", "$", "limit", ")", ";", "}" ]
Returns List of parsed Lines. @access public @param bool $reverse Flag: revert List @param int $limit Optional: limit List @return array
[ "Returns", "List", "of", "parsed", "Lines", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Log/JSON/Reader.php#L63-L66
36,694
CeusMedia/Common
src/FS/File/Log/JSON/Reader.php
FS_File_Log_JSON_Reader.read
public static function read( $fileName, $reverse = FALSE, $limit = 0 ) { $data = array(); if( !file_exists( $fileName ) ) throw new Exception( 'Log File "'.$fileName.'" is not existing.' ); $lines = file( $fileName ); foreach( $lines as $line ) { $line = trim( $line ); if( !$line ) continue; $data[] = json_decode( $line, TRUE ); } if( $reverse ) $data = array_reverse( $data ); if( $limit ) $data = array_slice( $data, 0, $limit ); return $data; }
php
public static function read( $fileName, $reverse = FALSE, $limit = 0 ) { $data = array(); if( !file_exists( $fileName ) ) throw new Exception( 'Log File "'.$fileName.'" is not existing.' ); $lines = file( $fileName ); foreach( $lines as $line ) { $line = trim( $line ); if( !$line ) continue; $data[] = json_decode( $line, TRUE ); } if( $reverse ) $data = array_reverse( $data ); if( $limit ) $data = array_slice( $data, 0, $limit ); return $data; }
[ "public", "static", "function", "read", "(", "$", "fileName", ",", "$", "reverse", "=", "FALSE", ",", "$", "limit", "=", "0", ")", "{", "$", "data", "=", "array", "(", ")", ";", "if", "(", "!", "file_exists", "(", "$", "fileName", ")", ")", "throw", "new", "Exception", "(", "'Log File \"'", ".", "$", "fileName", ".", "'\" is not existing.'", ")", ";", "$", "lines", "=", "file", "(", "$", "fileName", ")", ";", "foreach", "(", "$", "lines", "as", "$", "line", ")", "{", "$", "line", "=", "trim", "(", "$", "line", ")", ";", "if", "(", "!", "$", "line", ")", "continue", ";", "$", "data", "[", "]", "=", "json_decode", "(", "$", "line", ",", "TRUE", ")", ";", "}", "if", "(", "$", "reverse", ")", "$", "data", "=", "array_reverse", "(", "$", "data", ")", ";", "if", "(", "$", "limit", ")", "$", "data", "=", "array_slice", "(", "$", "data", ",", "0", ",", "$", "limit", ")", ";", "return", "$", "data", ";", "}" ]
Reads and returns List of parsed Lines statically. @access public @static @param string $fileName File Name of Log File @param bool $reverse Flag: revert List @param int $limit Optional: limit List @return array
[ "Reads", "and", "returns", "List", "of", "parsed", "Lines", "statically", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Log/JSON/Reader.php#L77-L95
36,695
CeusMedia/Common
src/ADT/PHP/Container.php
ADT_PHP_Container.getClassFromClassName
public function getClassFromClassName( $className, ADT_PHP_Interface $relatedArtefact ) { if( !isset( $this->classNameList[$className] ) ) throw new Exception( 'Unknown class "'.$className.'"' ); $list = $this->classNameList[$className]; $category = $relatedArtefact->getCategory(); $package = $relatedArtefact->getPackage(); if( isset( $list[$category][$package] ) ) // found Class in same Category same Package return $list[$category][$package]; // return Data Object of Class if( isset( $list[$category] ) ) // found Class in same Category but different Package return array_shift( $list[$category] ); // this is a Guess: return Data Object of guessed Class $firstCategory = array_shift( $list ); return array_shift( $firstCategory ); }
php
public function getClassFromClassName( $className, ADT_PHP_Interface $relatedArtefact ) { if( !isset( $this->classNameList[$className] ) ) throw new Exception( 'Unknown class "'.$className.'"' ); $list = $this->classNameList[$className]; $category = $relatedArtefact->getCategory(); $package = $relatedArtefact->getPackage(); if( isset( $list[$category][$package] ) ) // found Class in same Category same Package return $list[$category][$package]; // return Data Object of Class if( isset( $list[$category] ) ) // found Class in same Category but different Package return array_shift( $list[$category] ); // this is a Guess: return Data Object of guessed Class $firstCategory = array_shift( $list ); return array_shift( $firstCategory ); }
[ "public", "function", "getClassFromClassName", "(", "$", "className", ",", "ADT_PHP_Interface", "$", "relatedArtefact", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "classNameList", "[", "$", "className", "]", ")", ")", "throw", "new", "Exception", "(", "'Unknown class \"'", ".", "$", "className", ".", "'\"'", ")", ";", "$", "list", "=", "$", "this", "->", "classNameList", "[", "$", "className", "]", ";", "$", "category", "=", "$", "relatedArtefact", "->", "getCategory", "(", ")", ";", "$", "package", "=", "$", "relatedArtefact", "->", "getPackage", "(", ")", ";", "if", "(", "isset", "(", "$", "list", "[", "$", "category", "]", "[", "$", "package", "]", ")", ")", "// found Class in same Category same Package", "return", "$", "list", "[", "$", "category", "]", "[", "$", "package", "]", ";", "// return Data Object of Class", "if", "(", "isset", "(", "$", "list", "[", "$", "category", "]", ")", ")", "// found Class in same Category but different Package", "return", "array_shift", "(", "$", "list", "[", "$", "category", "]", ")", ";", "// this is a Guess: return Data Object of guessed Class", "$", "firstCategory", "=", "array_shift", "(", "$", "list", ")", ";", "return", "array_shift", "(", "$", "firstCategory", ")", ";", "}" ]
Searches for a Class by its Name in same Category and Package. Otherwise searches in different Packages and finally in different Categories. @access public @param string $className Name of Class to find Data Object for @param ADT_PHP_Interface $relatedArtefact A related Class or Interface (for Package and Category Information) @return ADT_PHP_Class @throws Exception if Class is not known
[ "Searches", "for", "a", "Class", "by", "its", "Name", "in", "same", "Category", "and", "Package", ".", "Otherwise", "searches", "in", "different", "Packages", "and", "finally", "in", "different", "Categories", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/PHP/Container.php#L57-L73
36,696
CeusMedia/Common
src/ADT/PHP/Container.php
ADT_PHP_Container.getInterfaceFromInterfaceName
public function getInterfaceFromInterfaceName( $interfaceName, ADT_PHP_Interface $relatedArtefact ) { if( !isset( $this->interfaceNameList[$interfaceName] ) ) throw new Exception( 'Unknown interface "'.$interfaceName.'"' ); $list = $this->interfaceNameList[$interfaceName]; $category = $relatedArtefact->getCategory(); $package = $relatedArtefact->getPackage(); if( isset( $list[$category][$package] ) ) // found Interface in same Category same Package return $list[$category][$package]; // return Data Object of Interface if( isset( $list[$category] ) ) // found Interface in same Category but different Package return array_shift( $list[$category] ); // this is a Guess: return Data Object of guessed Interface return array_shift( array_shift( $list ) ); }
php
public function getInterfaceFromInterfaceName( $interfaceName, ADT_PHP_Interface $relatedArtefact ) { if( !isset( $this->interfaceNameList[$interfaceName] ) ) throw new Exception( 'Unknown interface "'.$interfaceName.'"' ); $list = $this->interfaceNameList[$interfaceName]; $category = $relatedArtefact->getCategory(); $package = $relatedArtefact->getPackage(); if( isset( $list[$category][$package] ) ) // found Interface in same Category same Package return $list[$category][$package]; // return Data Object of Interface if( isset( $list[$category] ) ) // found Interface in same Category but different Package return array_shift( $list[$category] ); // this is a Guess: return Data Object of guessed Interface return array_shift( array_shift( $list ) ); }
[ "public", "function", "getInterfaceFromInterfaceName", "(", "$", "interfaceName", ",", "ADT_PHP_Interface", "$", "relatedArtefact", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "interfaceNameList", "[", "$", "interfaceName", "]", ")", ")", "throw", "new", "Exception", "(", "'Unknown interface \"'", ".", "$", "interfaceName", ".", "'\"'", ")", ";", "$", "list", "=", "$", "this", "->", "interfaceNameList", "[", "$", "interfaceName", "]", ";", "$", "category", "=", "$", "relatedArtefact", "->", "getCategory", "(", ")", ";", "$", "package", "=", "$", "relatedArtefact", "->", "getPackage", "(", ")", ";", "if", "(", "isset", "(", "$", "list", "[", "$", "category", "]", "[", "$", "package", "]", ")", ")", "// found Interface in same Category same Package", "return", "$", "list", "[", "$", "category", "]", "[", "$", "package", "]", ";", "// return Data Object of Interface", "if", "(", "isset", "(", "$", "list", "[", "$", "category", "]", ")", ")", "// found Interface in same Category but different Package", "return", "array_shift", "(", "$", "list", "[", "$", "category", "]", ")", ";", "// this is a Guess: return Data Object of guessed Interface", "return", "array_shift", "(", "array_shift", "(", "$", "list", ")", ")", ";", "}" ]
Searches for an Interface by its Name in same Category and Package. Otherwise is searches in different Packages and finally in different Categories. @access public @param string $interfaceName Name of Interface to find Data Object for @param ADT_PHP_Interface $relatedArtefact A related Class or Interface (for Package and Category Information) @return ADT_PHP_Interface @throws Exception if Interface is not known
[ "Searches", "for", "an", "Interface", "by", "its", "Name", "in", "same", "Category", "and", "Package", ".", "Otherwise", "is", "searches", "in", "different", "Packages", "and", "finally", "in", "different", "Categories", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/PHP/Container.php#L115-L130
36,697
CeusMedia/Common
src/CLI/Command/ArgumentParser.php
CLI_Command_ArgumentParser.extendPossibleOptionsWithShortcuts
protected function extendPossibleOptionsWithShortcuts() { foreach( $this->shortcuts as $short => $long ) { if( !isset( $this->possibleOptions[$long] ) ) throw new InvalidArgumentException( 'Invalid shortcut to not existing option "'.$long.'" .' ); $this->possibleOptions[$short] = $this->possibleOptions[$long]; } }
php
protected function extendPossibleOptionsWithShortcuts() { foreach( $this->shortcuts as $short => $long ) { if( !isset( $this->possibleOptions[$long] ) ) throw new InvalidArgumentException( 'Invalid shortcut to not existing option "'.$long.'" .' ); $this->possibleOptions[$short] = $this->possibleOptions[$long]; } }
[ "protected", "function", "extendPossibleOptionsWithShortcuts", "(", ")", "{", "foreach", "(", "$", "this", "->", "shortcuts", "as", "$", "short", "=>", "$", "long", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "possibleOptions", "[", "$", "long", "]", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Invalid shortcut to not existing option \"'", ".", "$", "long", ".", "'\" .'", ")", ";", "$", "this", "->", "possibleOptions", "[", "$", "short", "]", "=", "$", "this", "->", "possibleOptions", "[", "$", "long", "]", ";", "}", "}" ]
Extends internal Option List with afore set Shortcut List. @access protected @return void
[ "Extends", "internal", "Option", "List", "with", "afore", "set", "Shortcut", "List", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/CLI/Command/ArgumentParser.php#L59-L67
36,698
CeusMedia/Common
src/CLI/Command/ArgumentParser.php
CLI_Command_ArgumentParser.finishOptions
protected function finishOptions() { foreach( $this->shortcuts as $short => $long ) { if( !array_key_exists( $short, $this->foundOptions ) ) continue; $this->foundOptions[$long] = $this->foundOptions[$short]; unset( $this->foundOptions[$short] ); } }
php
protected function finishOptions() { foreach( $this->shortcuts as $short => $long ) { if( !array_key_exists( $short, $this->foundOptions ) ) continue; $this->foundOptions[$long] = $this->foundOptions[$short]; unset( $this->foundOptions[$short] ); } }
[ "protected", "function", "finishOptions", "(", ")", "{", "foreach", "(", "$", "this", "->", "shortcuts", "as", "$", "short", "=>", "$", "long", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "short", ",", "$", "this", "->", "foundOptions", ")", ")", "continue", ";", "$", "this", "->", "foundOptions", "[", "$", "long", "]", "=", "$", "this", "->", "foundOptions", "[", "$", "short", "]", ";", "unset", "(", "$", "this", "->", "foundOptions", "[", "$", "short", "]", ")", ";", "}", "}" ]
Resolves parsed Option Shortcuts. @access protected @return void
[ "Resolves", "parsed", "Option", "Shortcuts", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/CLI/Command/ArgumentParser.php#L74-L83
36,699
CeusMedia/Common
src/CLI/Command/ArgumentParser.php
CLI_Command_ArgumentParser.onEndOfLine
protected function onEndOfLine( &$status, &$buffer, &$option ) { if( $status == self::STATUS_READ_ARGUMENT ) $this->foundArguments[] = $buffer; else if( $status == self::STATUS_READ_OPTION_VALUE ) // still reading an option value $this->onReadOptionValue( ' ', $status, $buffer, $option ); // close reading and save last option else if( $status == self::STATUS_READ_OPTION_KEY ) { if( !array_key_exists( $option, $this->possibleOptions ) ) throw new InvalidArgumentException( 'Invalid option: '.$option.'.' ); if( $this->possibleOptions[$option] ) throw new RuntimeException( 'Missing value of option "'.$option.'".' ); $this->foundOptions[$option] = TRUE; } if( count( $this->foundArguments ) < $this->numberArguments ) throw new RuntimeException( 'Missing argument.' ); $this->finishOptions(); $this->parsed = TRUE; }
php
protected function onEndOfLine( &$status, &$buffer, &$option ) { if( $status == self::STATUS_READ_ARGUMENT ) $this->foundArguments[] = $buffer; else if( $status == self::STATUS_READ_OPTION_VALUE ) // still reading an option value $this->onReadOptionValue( ' ', $status, $buffer, $option ); // close reading and save last option else if( $status == self::STATUS_READ_OPTION_KEY ) { if( !array_key_exists( $option, $this->possibleOptions ) ) throw new InvalidArgumentException( 'Invalid option: '.$option.'.' ); if( $this->possibleOptions[$option] ) throw new RuntimeException( 'Missing value of option "'.$option.'".' ); $this->foundOptions[$option] = TRUE; } if( count( $this->foundArguments ) < $this->numberArguments ) throw new RuntimeException( 'Missing argument.' ); $this->finishOptions(); $this->parsed = TRUE; }
[ "protected", "function", "onEndOfLine", "(", "&", "$", "status", ",", "&", "$", "buffer", ",", "&", "$", "option", ")", "{", "if", "(", "$", "status", "==", "self", "::", "STATUS_READ_ARGUMENT", ")", "$", "this", "->", "foundArguments", "[", "]", "=", "$", "buffer", ";", "else", "if", "(", "$", "status", "==", "self", "::", "STATUS_READ_OPTION_VALUE", ")", "// still reading an option value", "$", "this", "->", "onReadOptionValue", "(", "' '", ",", "$", "status", ",", "$", "buffer", ",", "$", "option", ")", ";", "// close reading and save last option", "else", "if", "(", "$", "status", "==", "self", "::", "STATUS_READ_OPTION_KEY", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "option", ",", "$", "this", "->", "possibleOptions", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Invalid option: '", ".", "$", "option", ".", "'.'", ")", ";", "if", "(", "$", "this", "->", "possibleOptions", "[", "$", "option", "]", ")", "throw", "new", "RuntimeException", "(", "'Missing value of option \"'", ".", "$", "option", ".", "'\".'", ")", ";", "$", "this", "->", "foundOptions", "[", "$", "option", "]", "=", "TRUE", ";", "}", "if", "(", "count", "(", "$", "this", "->", "foundArguments", ")", "<", "$", "this", "->", "numberArguments", ")", "throw", "new", "RuntimeException", "(", "'Missing argument.'", ")", ";", "$", "this", "->", "finishOptions", "(", ")", ";", "$", "this", "->", "parsed", "=", "TRUE", ";", "}" ]
Handles open Argument or Option at the End of the Argument String. @access protected @param int $status Status Reference @param string $buffer Argument Buffer Reference @param string $option Option Buffer Reference @return void
[ "Handles", "open", "Argument", "or", "Option", "at", "the", "End", "of", "the", "Argument", "String", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/CLI/Command/ArgumentParser.php#L117-L135