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
234,000
wardrobecms/core-archived
src/Wardrobe/Core/Repositories/DbPostRepository.php
DbPostRepository.validatePost
protected function validatePost($title, $slug, $id = null) { $rules = array( 'title' => 'required', 'slug' => 'required|unique:posts,slug', ); if ($id) { $rules['slug'] .= ','.$id; } with($validator = Validator::make(compact('title', 'slug'), $rules))->fails(); return $validator->errors(); }
php
protected function validatePost($title, $slug, $id = null) { $rules = array( 'title' => 'required', 'slug' => 'required|unique:posts,slug', ); if ($id) { $rules['slug'] .= ','.$id; } with($validator = Validator::make(compact('title', 'slug'), $rules))->fails(); return $validator->errors(); }
[ "protected", "function", "validatePost", "(", "$", "title", ",", "$", "slug", ",", "$", "id", "=", "null", ")", "{", "$", "rules", "=", "array", "(", "'title'", "=>", "'required'", ",", "'slug'", "=>", "'required|unique:posts,slug'", ",", ")", ";", "if", "(", "$", "id", ")", "{", "$", "rules", "[", "'slug'", "]", ".=", "','", ".", "$", "id", ";", "}", "with", "(", "$", "validator", "=", "Validator", "::", "make", "(", "compact", "(", "'title'", ",", "'slug'", ")", ",", "$", "rules", ")", ")", "->", "fails", "(", ")", ";", "return", "$", "validator", "->", "errors", "(", ")", ";", "}" ]
Determine if the given post is valid. @param string $title @param string $slug @param int $id @return \Illuminate\Support\MessageBag
[ "Determine", "if", "the", "given", "post", "is", "valid", "." ]
5c0836ea2e6885a428c852dc392073f2a2541c71
https://github.com/wardrobecms/core-archived/blob/5c0836ea2e6885a428c852dc392073f2a2541c71/src/Wardrobe/Core/Repositories/DbPostRepository.php#L276-L291
234,001
MW-Peachy/Peachy
Includes/Peachy.php
Peachy.newWiki
public static function newWiki( $config_name = null, $pgUsername = null, $password = null, $base_url = 'http://en.wikipedia.org/w/api.php', $classname = 'Wiki' ) { pecho( "Loading Peachy (version " . PEACHYVERSION . ")...\n\n", PECHO_NORMAL ); /*$updater = new AutoUpdate(); $Uptodate = $updater->Checkforupdate(); if( !$Uptodate ) $updater->updatePeachy();*/ if( !is_null( $config_name ) ) { $config_params = self::parse_config( $config_name ); } else { $config_params = array( 'username' => $pgUsername, 'password' => $password, 'baseurl' => $base_url, 'method' => 'legacy' ); } if( is_null( $config_params['baseurl'] ) || !isset( $config_params['baseurl'] ) ) { throw new LoginError( array( "MissingParam", "The baseurl parameter was not set." ) ); } if( !isset( $config_params['username'] ) ) { $config_params['nologin'] = true; } if( !isset( $config_params['password'] ) && isset( $config_params['method'] ) && $config_params['method'] == "legacy" ) { $config_params['nologin'] = true; } list( $version, $extensions ) = self::wikiChecks( $config_params['baseurl'] ); Hooks::runHook( 'StartLogin', array( &$config_params, &$extensions ) ); $w = new $classname( $config_params, $extensions, false, null ); $w->mwversion = $version; return $w; }
php
public static function newWiki( $config_name = null, $pgUsername = null, $password = null, $base_url = 'http://en.wikipedia.org/w/api.php', $classname = 'Wiki' ) { pecho( "Loading Peachy (version " . PEACHYVERSION . ")...\n\n", PECHO_NORMAL ); /*$updater = new AutoUpdate(); $Uptodate = $updater->Checkforupdate(); if( !$Uptodate ) $updater->updatePeachy();*/ if( !is_null( $config_name ) ) { $config_params = self::parse_config( $config_name ); } else { $config_params = array( 'username' => $pgUsername, 'password' => $password, 'baseurl' => $base_url, 'method' => 'legacy' ); } if( is_null( $config_params['baseurl'] ) || !isset( $config_params['baseurl'] ) ) { throw new LoginError( array( "MissingParam", "The baseurl parameter was not set." ) ); } if( !isset( $config_params['username'] ) ) { $config_params['nologin'] = true; } if( !isset( $config_params['password'] ) && isset( $config_params['method'] ) && $config_params['method'] == "legacy" ) { $config_params['nologin'] = true; } list( $version, $extensions ) = self::wikiChecks( $config_params['baseurl'] ); Hooks::runHook( 'StartLogin', array( &$config_params, &$extensions ) ); $w = new $classname( $config_params, $extensions, false, null ); $w->mwversion = $version; return $w; }
[ "public", "static", "function", "newWiki", "(", "$", "config_name", "=", "null", ",", "$", "pgUsername", "=", "null", ",", "$", "password", "=", "null", ",", "$", "base_url", "=", "'http://en.wikipedia.org/w/api.php'", ",", "$", "classname", "=", "'Wiki'", ")", "{", "pecho", "(", "\"Loading Peachy (version \"", ".", "PEACHYVERSION", ".", "\")...\\n\\n\"", ",", "PECHO_NORMAL", ")", ";", "/*$updater = new AutoUpdate();\n\t\t$Uptodate = $updater->Checkforupdate();\n\t\tif( !$Uptodate ) $updater->updatePeachy();*/", "if", "(", "!", "is_null", "(", "$", "config_name", ")", ")", "{", "$", "config_params", "=", "self", "::", "parse_config", "(", "$", "config_name", ")", ";", "}", "else", "{", "$", "config_params", "=", "array", "(", "'username'", "=>", "$", "pgUsername", ",", "'password'", "=>", "$", "password", ",", "'baseurl'", "=>", "$", "base_url", ",", "'method'", "=>", "'legacy'", ")", ";", "}", "if", "(", "is_null", "(", "$", "config_params", "[", "'baseurl'", "]", ")", "||", "!", "isset", "(", "$", "config_params", "[", "'baseurl'", "]", ")", ")", "{", "throw", "new", "LoginError", "(", "array", "(", "\"MissingParam\"", ",", "\"The baseurl parameter was not set.\"", ")", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "config_params", "[", "'username'", "]", ")", ")", "{", "$", "config_params", "[", "'nologin'", "]", "=", "true", ";", "}", "if", "(", "!", "isset", "(", "$", "config_params", "[", "'password'", "]", ")", "&&", "isset", "(", "$", "config_params", "[", "'method'", "]", ")", "&&", "$", "config_params", "[", "'method'", "]", "==", "\"legacy\"", ")", "{", "$", "config_params", "[", "'nologin'", "]", "=", "true", ";", "}", "list", "(", "$", "version", ",", "$", "extensions", ")", "=", "self", "::", "wikiChecks", "(", "$", "config_params", "[", "'baseurl'", "]", ")", ";", "Hooks", "::", "runHook", "(", "'StartLogin'", ",", "array", "(", "&", "$", "config_params", ",", "&", "$", "extensions", ")", ")", ";", "$", "w", "=", "new", "$", "classname", "(", "$", "config_params", ",", "$", "extensions", ",", "false", ",", "null", ")", ";", "$", "w", "->", "mwversion", "=", "$", "version", ";", "return", "$", "w", ";", "}" ]
Initializes Peachy, logs in with a either the configuration file or a given username and password @static @access public @param string $config_name Name of the config file stored in the Configs directory, minus the .cfg extension. Default null @param string $pgUsername Username to log in if no config file specified. Default null @param string $password Password to log in with if no config file specified. Default null @param string $base_url URL to api.php if no config file specified. Defaults to English Wikipedia's API. @param string $classname @throws LoginError @return Wiki Instance of the Wiki class, where most functions are stored
[ "Initializes", "Peachy", "logs", "in", "with", "a", "either", "the", "configuration", "file", "or", "a", "given", "username", "and", "password" ]
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Peachy.php#L23-L61
234,002
MW-Peachy/Peachy
Includes/Peachy.php
Peachy.parse_config
private static function parse_config( $config_name ) { global $pgIP; if( !is_file( $config_name ) ) { if( !is_file( $pgIP . 'Configs/' . $config_name . '.cfg' ) ) { throw new BadEntryError( "BadConfig", "A non-existent configuration file was specified." ); } else { $config_name = $pgIP . 'Configs/' . $config_name . '.cfg'; } } $config_params = parse_ini_file( $config_name ); if( isset( $config_params['useconfig'] ) ) { $config_params = $config_params + self::parse_config( $config_params['useconfig'] ); } return $config_params; }
php
private static function parse_config( $config_name ) { global $pgIP; if( !is_file( $config_name ) ) { if( !is_file( $pgIP . 'Configs/' . $config_name . '.cfg' ) ) { throw new BadEntryError( "BadConfig", "A non-existent configuration file was specified." ); } else { $config_name = $pgIP . 'Configs/' . $config_name . '.cfg'; } } $config_params = parse_ini_file( $config_name ); if( isset( $config_params['useconfig'] ) ) { $config_params = $config_params + self::parse_config( $config_params['useconfig'] ); } return $config_params; }
[ "private", "static", "function", "parse_config", "(", "$", "config_name", ")", "{", "global", "$", "pgIP", ";", "if", "(", "!", "is_file", "(", "$", "config_name", ")", ")", "{", "if", "(", "!", "is_file", "(", "$", "pgIP", ".", "'Configs/'", ".", "$", "config_name", ".", "'.cfg'", ")", ")", "{", "throw", "new", "BadEntryError", "(", "\"BadConfig\"", ",", "\"A non-existent configuration file was specified.\"", ")", ";", "}", "else", "{", "$", "config_name", "=", "$", "pgIP", ".", "'Configs/'", ".", "$", "config_name", ".", "'.cfg'", ";", "}", "}", "$", "config_params", "=", "parse_ini_file", "(", "$", "config_name", ")", ";", "if", "(", "isset", "(", "$", "config_params", "[", "'useconfig'", "]", ")", ")", "{", "$", "config_params", "=", "$", "config_params", "+", "self", "::", "parse_config", "(", "$", "config_params", "[", "'useconfig'", "]", ")", ";", "}", "return", "$", "config_params", ";", "}" ]
Checks for config files, parses them. @access private @static @param string $config_name Name of config file @throws BadEntryError @return array Config params
[ "Checks", "for", "config", "files", "parses", "them", "." ]
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Peachy.php#L122-L139
234,003
MW-Peachy/Peachy
Includes/Peachy.php
Peachy.deprecatedWarn
public static function deprecatedWarn($method, $newFunction, $message = null) { if( is_null( $message ) ) { $message = "Warning: $method is deprecated. Please use $newFunction instead."; } $message = "[$message|YELLOW_BAR]\n\n"; pecho( $message, PECHO_WARN, 'cecho' ); }
php
public static function deprecatedWarn($method, $newFunction, $message = null) { if( is_null( $message ) ) { $message = "Warning: $method is deprecated. Please use $newFunction instead."; } $message = "[$message|YELLOW_BAR]\n\n"; pecho( $message, PECHO_WARN, 'cecho' ); }
[ "public", "static", "function", "deprecatedWarn", "(", "$", "method", ",", "$", "newFunction", ",", "$", "message", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "message", ")", ")", "{", "$", "message", "=", "\"Warning: $method is deprecated. Please use $newFunction instead.\"", ";", "}", "$", "message", "=", "\"[$message|YELLOW_BAR]\\n\\n\"", ";", "pecho", "(", "$", "message", ",", "PECHO_WARN", ",", "'cecho'", ")", ";", "}" ]
Function that displays an error message when an End-User attempts to use a function no longer included in Peachy @param null|string $method @param null|string $newFunction @param string $message
[ "Function", "that", "displays", "an", "error", "message", "when", "an", "End", "-", "User", "attempts", "to", "use", "a", "function", "no", "longer", "included", "in", "Peachy" ]
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Peachy.php#L148-L157
234,004
MW-Peachy/Peachy
Includes/Peachy.php
Peachy.getSvnInfo
public static function getSvnInfo() { global $pgIP; // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html $entries = $pgIP . '/.svn/entries'; if( !file_exists( $entries ) ) { return false; } $lines = file( $entries ); if( !count( $lines ) ) { return false; } // check if file is xml (subversion release <= 1.3) or not (subversion release = 1.4) if( preg_match( '/^<\?xml/', $lines[0] ) ) { return false; } // Subversion is release 1.4 or above. if( count( $lines ) < 11 ) { return false; } $info = array( 'checkout-rev' => intval( trim( $lines[3] ) ), 'url' => trim( $lines[4] ), 'repo-url' => trim( $lines[5] ), 'directory-rev' => intval( trim( $lines[10] ) ) ); return $info; }
php
public static function getSvnInfo() { global $pgIP; // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html $entries = $pgIP . '/.svn/entries'; if( !file_exists( $entries ) ) { return false; } $lines = file( $entries ); if( !count( $lines ) ) { return false; } // check if file is xml (subversion release <= 1.3) or not (subversion release = 1.4) if( preg_match( '/^<\?xml/', $lines[0] ) ) { return false; } // Subversion is release 1.4 or above. if( count( $lines ) < 11 ) { return false; } $info = array( 'checkout-rev' => intval( trim( $lines[3] ) ), 'url' => trim( $lines[4] ), 'repo-url' => trim( $lines[5] ), 'directory-rev' => intval( trim( $lines[10] ) ) ); return $info; }
[ "public", "static", "function", "getSvnInfo", "(", ")", "{", "global", "$", "pgIP", ";", "// http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html", "$", "entries", "=", "$", "pgIP", ".", "'/.svn/entries'", ";", "if", "(", "!", "file_exists", "(", "$", "entries", ")", ")", "{", "return", "false", ";", "}", "$", "lines", "=", "file", "(", "$", "entries", ")", ";", "if", "(", "!", "count", "(", "$", "lines", ")", ")", "{", "return", "false", ";", "}", "// check if file is xml (subversion release <= 1.3) or not (subversion release = 1.4)", "if", "(", "preg_match", "(", "'/^<\\?xml/'", ",", "$", "lines", "[", "0", "]", ")", ")", "{", "return", "false", ";", "}", "// Subversion is release 1.4 or above.", "if", "(", "count", "(", "$", "lines", ")", "<", "11", ")", "{", "return", "false", ";", "}", "$", "info", "=", "array", "(", "'checkout-rev'", "=>", "intval", "(", "trim", "(", "$", "lines", "[", "3", "]", ")", ")", ",", "'url'", "=>", "trim", "(", "$", "lines", "[", "4", "]", ")", ",", "'repo-url'", "=>", "trim", "(", "$", "lines", "[", "5", "]", ")", ",", "'directory-rev'", "=>", "intval", "(", "trim", "(", "$", "lines", "[", "10", "]", ")", ")", ")", ";", "return", "$", "info", ";", "}" ]
Checks for and returns an SVN repository version. @return array|bool
[ "Checks", "for", "and", "returns", "an", "SVN", "repository", "version", "." ]
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Peachy.php#L164-L197
234,005
MW-Peachy/Peachy
Plugins/AbuseFilter.php
AbuseFilter.abuselog
public function abuselog( $filter = null, $user = null, $title = null, $limit = null, $start = null, $end = null, $dir = 'older', $prop = array( 'ids', 'filter', 'user', 'ip', 'title', 'action', 'details', 'result', 'timestamp' ) ) { $tArray = array( 'prop' => $prop, '_code' => 'afl', 'afldir' => $dir, '_limit' => $limit, 'list' => 'abuselog', ); if( !is_null( $filter ) ) $tArray['aflfilter'] = $filter; if( !is_null( $user ) ) $tArray['afluser'] = $user; if( !is_null( $title ) ) $tArray['afltitle'] = $title; if( !is_null( $start ) ) $tArray['aflstart'] = $start; if( !is_null( $end ) ) $tArray['aflend'] = $end; pecho( "Getting abuse log...\n\n", PECHO_NORMAL ); return $this->wiki->listHandler( $tArray ); }
php
public function abuselog( $filter = null, $user = null, $title = null, $limit = null, $start = null, $end = null, $dir = 'older', $prop = array( 'ids', 'filter', 'user', 'ip', 'title', 'action', 'details', 'result', 'timestamp' ) ) { $tArray = array( 'prop' => $prop, '_code' => 'afl', 'afldir' => $dir, '_limit' => $limit, 'list' => 'abuselog', ); if( !is_null( $filter ) ) $tArray['aflfilter'] = $filter; if( !is_null( $user ) ) $tArray['afluser'] = $user; if( !is_null( $title ) ) $tArray['afltitle'] = $title; if( !is_null( $start ) ) $tArray['aflstart'] = $start; if( !is_null( $end ) ) $tArray['aflend'] = $end; pecho( "Getting abuse log...\n\n", PECHO_NORMAL ); return $this->wiki->listHandler( $tArray ); }
[ "public", "function", "abuselog", "(", "$", "filter", "=", "null", ",", "$", "user", "=", "null", ",", "$", "title", "=", "null", ",", "$", "limit", "=", "null", ",", "$", "start", "=", "null", ",", "$", "end", "=", "null", ",", "$", "dir", "=", "'older'", ",", "$", "prop", "=", "array", "(", "'ids'", ",", "'filter'", ",", "'user'", ",", "'ip'", ",", "'title'", ",", "'action'", ",", "'details'", ",", "'result'", ",", "'timestamp'", ")", ")", "{", "$", "tArray", "=", "array", "(", "'prop'", "=>", "$", "prop", ",", "'_code'", "=>", "'afl'", ",", "'afldir'", "=>", "$", "dir", ",", "'_limit'", "=>", "$", "limit", ",", "'list'", "=>", "'abuselog'", ",", ")", ";", "if", "(", "!", "is_null", "(", "$", "filter", ")", ")", "$", "tArray", "[", "'aflfilter'", "]", "=", "$", "filter", ";", "if", "(", "!", "is_null", "(", "$", "user", ")", ")", "$", "tArray", "[", "'afluser'", "]", "=", "$", "user", ";", "if", "(", "!", "is_null", "(", "$", "title", ")", ")", "$", "tArray", "[", "'afltitle'", "]", "=", "$", "title", ";", "if", "(", "!", "is_null", "(", "$", "start", ")", ")", "$", "tArray", "[", "'aflstart'", "]", "=", "$", "start", ";", "if", "(", "!", "is_null", "(", "$", "end", ")", ")", "$", "tArray", "[", "'aflend'", "]", "=", "$", "end", ";", "pecho", "(", "\"Getting abuse log...\\n\\n\"", ",", "PECHO_NORMAL", ")", ";", "return", "$", "this", "->", "wiki", "->", "listHandler", "(", "$", "tArray", ")", ";", "}" ]
Returns the abuse filter log @access public @param int $filter Filter ID. Default null @param string $user Show entries by this user. Default null @param string $title Show entries to this title. Default null @param int $limit Number of entries to retrieve. Defautl null @param string $start Timestamp to start at. Default null @param string $end Timestamp to end at. Default null @param string $dir Direction to list. Default older @param array $prop Properties to retrieve. Default array( 'ids', 'filter', 'user', 'ip', 'title', 'action', 'details', 'result', 'timestamp' ) @return array
[ "Returns", "the", "abuse", "filter", "log" ]
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Plugins/AbuseFilter.php#L60-L81
234,006
MW-Peachy/Peachy
Plugins/AbuseFilter.php
AbuseFilter.abusefilters
public function abusefilters( $start = null, $end = null, $dir = 'newer', $enabled = null, $deleted = false, $private = null, $limit = null, $prop = array( 'id', 'description', 'pattern', 'actions', 'hits', 'comments', 'lasteditor', 'lastedittime', 'status', 'private' ) ) { $tArray = array( 'prop' => $prop, '_code' => 'abf', 'abfdir' => $dir, '_limit' => $limit, 'abfshow' => array(), 'list' => 'abusefilters' ); if( !is_null( $enabled ) ) { if( $enabled ) { $tArray['abfshow'][] = 'enabled'; } else { $tArray['abfshow'][] = '!enabled'; } } if( !is_null( $deleted ) ) { if( $deleted ) { $tArray['abfshow'][] = 'deleted'; } else { $tArray['abfshow'][] = '!deleted'; } } if( !is_null( $private ) ) { if( $private ) { $tArray['abfshow'][] = 'private'; } else { $tArray['abfshow'][] = '!private'; } } $tArray['abfshow'] = implode( '|', $tArray['abfshow'] ); if( !is_null( $start ) ) $tArray['abfstartid'] = $start; if( !is_null( $end ) ) $tArray['abfendid'] = $end; pecho( "Getting abuse filter list...\n\n", PECHO_NORMAL ); return $this->wiki->listHandler( $tArray ); }
php
public function abusefilters( $start = null, $end = null, $dir = 'newer', $enabled = null, $deleted = false, $private = null, $limit = null, $prop = array( 'id', 'description', 'pattern', 'actions', 'hits', 'comments', 'lasteditor', 'lastedittime', 'status', 'private' ) ) { $tArray = array( 'prop' => $prop, '_code' => 'abf', 'abfdir' => $dir, '_limit' => $limit, 'abfshow' => array(), 'list' => 'abusefilters' ); if( !is_null( $enabled ) ) { if( $enabled ) { $tArray['abfshow'][] = 'enabled'; } else { $tArray['abfshow'][] = '!enabled'; } } if( !is_null( $deleted ) ) { if( $deleted ) { $tArray['abfshow'][] = 'deleted'; } else { $tArray['abfshow'][] = '!deleted'; } } if( !is_null( $private ) ) { if( $private ) { $tArray['abfshow'][] = 'private'; } else { $tArray['abfshow'][] = '!private'; } } $tArray['abfshow'] = implode( '|', $tArray['abfshow'] ); if( !is_null( $start ) ) $tArray['abfstartid'] = $start; if( !is_null( $end ) ) $tArray['abfendid'] = $end; pecho( "Getting abuse filter list...\n\n", PECHO_NORMAL ); return $this->wiki->listHandler( $tArray ); }
[ "public", "function", "abusefilters", "(", "$", "start", "=", "null", ",", "$", "end", "=", "null", ",", "$", "dir", "=", "'newer'", ",", "$", "enabled", "=", "null", ",", "$", "deleted", "=", "false", ",", "$", "private", "=", "null", ",", "$", "limit", "=", "null", ",", "$", "prop", "=", "array", "(", "'id'", ",", "'description'", ",", "'pattern'", ",", "'actions'", ",", "'hits'", ",", "'comments'", ",", "'lasteditor'", ",", "'lastedittime'", ",", "'status'", ",", "'private'", ")", ")", "{", "$", "tArray", "=", "array", "(", "'prop'", "=>", "$", "prop", ",", "'_code'", "=>", "'abf'", ",", "'abfdir'", "=>", "$", "dir", ",", "'_limit'", "=>", "$", "limit", ",", "'abfshow'", "=>", "array", "(", ")", ",", "'list'", "=>", "'abusefilters'", ")", ";", "if", "(", "!", "is_null", "(", "$", "enabled", ")", ")", "{", "if", "(", "$", "enabled", ")", "{", "$", "tArray", "[", "'abfshow'", "]", "[", "]", "=", "'enabled'", ";", "}", "else", "{", "$", "tArray", "[", "'abfshow'", "]", "[", "]", "=", "'!enabled'", ";", "}", "}", "if", "(", "!", "is_null", "(", "$", "deleted", ")", ")", "{", "if", "(", "$", "deleted", ")", "{", "$", "tArray", "[", "'abfshow'", "]", "[", "]", "=", "'deleted'", ";", "}", "else", "{", "$", "tArray", "[", "'abfshow'", "]", "[", "]", "=", "'!deleted'", ";", "}", "}", "if", "(", "!", "is_null", "(", "$", "private", ")", ")", "{", "if", "(", "$", "private", ")", "{", "$", "tArray", "[", "'abfshow'", "]", "[", "]", "=", "'private'", ";", "}", "else", "{", "$", "tArray", "[", "'abfshow'", "]", "[", "]", "=", "'!private'", ";", "}", "}", "$", "tArray", "[", "'abfshow'", "]", "=", "implode", "(", "'|'", ",", "$", "tArray", "[", "'abfshow'", "]", ")", ";", "if", "(", "!", "is_null", "(", "$", "start", ")", ")", "$", "tArray", "[", "'abfstartid'", "]", "=", "$", "start", ";", "if", "(", "!", "is_null", "(", "$", "end", ")", ")", "$", "tArray", "[", "'abfendid'", "]", "=", "$", "end", ";", "pecho", "(", "\"Getting abuse filter list...\\n\\n\"", ",", "PECHO_NORMAL", ")", ";", "return", "$", "this", "->", "wiki", "->", "listHandler", "(", "$", "tArray", ")", ";", "}" ]
Returns a list of all filters @access public @param int $start Filter ID to start at. Default null @param int $end Filter ID to end at. Default null @param string $dir Direction to list. Default newer @param bool $enabled Only list enabled filters. true => only enabled, false => only disabled, null => all @param bool $deleted Only list deleted filters. true => only deleted, false => only non-deleted, null => all @param bool $private Only list private filters. true => only private, false => only non-private, null => all @param int $limit Number of filters to get. Default null @param array $prop Properties to retrieve. Default array( 'id', 'description', 'pattern', 'actions', 'hits', 'comments', 'lasteditor', 'lastedittime', 'status', 'private' ) @return array
[ "Returns", "a", "list", "of", "all", "filters" ]
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Plugins/AbuseFilter.php#L97-L142
234,007
yeephp/yeephp
Yee/Http/Response.php
Response.status
public function status($status = null) { if (!is_null($status)) { $this->status = (int) $status; } return $this->status; }
php
public function status($status = null) { if (!is_null($status)) { $this->status = (int) $status; } return $this->status; }
[ "public", "function", "status", "(", "$", "status", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "status", ")", ")", "{", "$", "this", "->", "status", "=", "(", "int", ")", "$", "status", ";", "}", "return", "$", "this", "->", "status", ";", "}" ]
DEPRECATION WARNING! Use `getStatus` or `setStatus` instead. Get and set status @param int|null $status @return int
[ "DEPRECATION", "WARNING!", "Use", "getStatus", "or", "setStatus", "instead", "." ]
6107f60ceaf0811a6550872bd669580ac282cb1f
https://github.com/yeephp/yeephp/blob/6107f60ceaf0811a6550872bd669580ac282cb1f/Yee/Http/Response.php#L160-L167
234,008
yeephp/yeephp
Yee/Http/Response.php
Response.header
public function header($name, $value = null) { if (!is_null($value)) { $this->headers->set($name, $value); } return $this->headers->get($name); }
php
public function header($name, $value = null) { if (!is_null($value)) { $this->headers->set($name, $value); } return $this->headers->get($name); }
[ "public", "function", "header", "(", "$", "name", ",", "$", "value", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "value", ")", ")", "{", "$", "this", "->", "headers", "->", "set", "(", "$", "name", ",", "$", "value", ")", ";", "}", "return", "$", "this", "->", "headers", "->", "get", "(", "$", "name", ")", ";", "}" ]
DEPRECATION WARNING! Access `headers` property directly. Get and set header @param string $name Header name @param string|null $value Header value @return string Header value
[ "DEPRECATION", "WARNING!", "Access", "headers", "property", "directly", "." ]
6107f60ceaf0811a6550872bd669580ac282cb1f
https://github.com/yeephp/yeephp/blob/6107f60ceaf0811a6550872bd669580ac282cb1f/Yee/Http/Response.php#L177-L184
234,009
yeephp/yeephp
Yee/Http/Response.php
Response.body
public function body($body = null) { if (!is_null($body)) { $this->write($body, true); } return $this->body; }
php
public function body($body = null) { if (!is_null($body)) { $this->write($body, true); } return $this->body; }
[ "public", "function", "body", "(", "$", "body", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "body", ")", ")", "{", "$", "this", "->", "write", "(", "$", "body", ",", "true", ")", ";", "}", "return", "$", "this", "->", "body", ";", "}" ]
DEPRECATION WARNING! use `getBody` or `setBody` instead. Get and set body @param string|null $body Content of HTTP response body @return string
[ "DEPRECATION", "WARNING!", "use", "getBody", "or", "setBody", "instead", "." ]
6107f60ceaf0811a6550872bd669580ac282cb1f
https://github.com/yeephp/yeephp/blob/6107f60ceaf0811a6550872bd669580ac282cb1f/Yee/Http/Response.php#L214-L221
234,010
yeephp/yeephp
Yee/Http/Response.php
Response.length
public function length($length = null) { if (!is_null($length)) { $this->length = (int) $length; } return $this->length; }
php
public function length($length = null) { if (!is_null($length)) { $this->length = (int) $length; } return $this->length; }
[ "public", "function", "length", "(", "$", "length", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "length", ")", ")", "{", "$", "this", "->", "length", "=", "(", "int", ")", "$", "length", ";", "}", "return", "$", "this", "->", "length", ";", "}" ]
DEPRECATION WARNING! Use `getLength` or `write` or `body` instead. Get and set length @param int|null $length @return int
[ "DEPRECATION", "WARNING!", "Use", "getLength", "or", "write", "or", "body", "instead", "." ]
6107f60ceaf0811a6550872bd669580ac282cb1f
https://github.com/yeephp/yeephp/blob/6107f60ceaf0811a6550872bd669580ac282cb1f/Yee/Http/Response.php#L253-L260
234,011
yeephp/yeephp
Yee/Http/Response.php
Response.getMessageForCode
public static function getMessageForCode($status) { if (isset(self::$messages[$status])) { return self::$messages[$status]; } else { return null; } }
php
public static function getMessageForCode($status) { if (isset(self::$messages[$status])) { return self::$messages[$status]; } else { return null; } }
[ "public", "static", "function", "getMessageForCode", "(", "$", "status", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "messages", "[", "$", "status", "]", ")", ")", "{", "return", "self", "::", "$", "messages", "[", "$", "status", "]", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Get message for HTTP status code @param int $status @return string|null
[ "Get", "message", "for", "HTTP", "status", "code" ]
6107f60ceaf0811a6550872bd669580ac282cb1f
https://github.com/yeephp/yeephp/blob/6107f60ceaf0811a6550872bd669580ac282cb1f/Yee/Http/Response.php#L504-L511
234,012
nfephp-org/sped-console
src/XsdConverter/Naming/Factory.php
Factory.addAvailableNamingStrategy
public static function addAvailableNamingStrategy($name, $className) { $ref = new \ReflectionClass($className); if (!$ref->isSubclassOf(NamingStrategy::class)) { throw new \InvalidArgumentException($className); } self::$strategies[$name] = $ref->getName(); }
php
public static function addAvailableNamingStrategy($name, $className) { $ref = new \ReflectionClass($className); if (!$ref->isSubclassOf(NamingStrategy::class)) { throw new \InvalidArgumentException($className); } self::$strategies[$name] = $ref->getName(); }
[ "public", "static", "function", "addAvailableNamingStrategy", "(", "$", "name", ",", "$", "className", ")", "{", "$", "ref", "=", "new", "\\", "ReflectionClass", "(", "$", "className", ")", ";", "if", "(", "!", "$", "ref", "->", "isSubclassOf", "(", "NamingStrategy", "::", "class", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "$", "className", ")", ";", "}", "self", "::", "$", "strategies", "[", "$", "name", "]", "=", "$", "ref", "->", "getName", "(", ")", ";", "}" ]
Adds a new supported driver. @param string $name Driver's name @param string $className Class name of driver @return void @throws \InvalidArgumentException
[ "Adds", "a", "new", "supported", "driver", "." ]
eaedaa8065744b2e47d8f7c711ae993ff238126f
https://github.com/nfephp-org/sped-console/blob/eaedaa8065744b2e47d8f7c711ae993ff238126f/src/XsdConverter/Naming/Factory.php#L56-L63
234,013
budde377/Part
lib/controller/json/ElementImpl.php
ElementImpl.validValue
protected function validValue(&$val) { if (!is_array($val)) { return $val == null || is_scalar($val) || $val instanceof JsonSerializable; } foreach ($val as $k => $v) { if (!$this->validValue($v)) { $val[$k] = null; } else { $val[$k] = $v; } } return true; }
php
protected function validValue(&$val) { if (!is_array($val)) { return $val == null || is_scalar($val) || $val instanceof JsonSerializable; } foreach ($val as $k => $v) { if (!$this->validValue($v)) { $val[$k] = null; } else { $val[$k] = $v; } } return true; }
[ "protected", "function", "validValue", "(", "&", "$", "val", ")", "{", "if", "(", "!", "is_array", "(", "$", "val", ")", ")", "{", "return", "$", "val", "==", "null", "||", "is_scalar", "(", "$", "val", ")", "||", "$", "val", "instanceof", "JsonSerializable", ";", "}", "foreach", "(", "$", "val", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "!", "$", "this", "->", "validValue", "(", "$", "v", ")", ")", "{", "$", "val", "[", "$", "k", "]", "=", "null", ";", "}", "else", "{", "$", "val", "[", "$", "k", "]", "=", "$", "v", ";", "}", "}", "return", "true", ";", "}" ]
Will check input if it is scalars or elements, or arrays of these @param mixed $val @return bool
[ "Will", "check", "input", "if", "it", "is", "scalars", "or", "elements", "or", "arrays", "of", "these" ]
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/controller/json/ElementImpl.php#L31-L45
234,014
xylemical/php-expressions
src/Context.php
Context.getVariable
public function getVariable($name, $default = null) { if (!array_key_exists($name, $this->variables)) { return $default; } return $this->variables[$name]; }
php
public function getVariable($name, $default = null) { if (!array_key_exists($name, $this->variables)) { return $default; } return $this->variables[$name]; }
[ "public", "function", "getVariable", "(", "$", "name", ",", "$", "default", "=", "null", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "variables", ")", ")", "{", "return", "$", "default", ";", "}", "return", "$", "this", "->", "variables", "[", "$", "name", "]", ";", "}" ]
Get a variable by name, with default support. @param string $name @param mixed $default @return mixed
[ "Get", "a", "variable", "by", "name", "with", "default", "support", "." ]
4dc7c3a4bb3f335a04cb05b0d41871529cfc9b73
https://github.com/xylemical/php-expressions/blob/4dc7c3a4bb3f335a04cb05b0d41871529cfc9b73/src/Context.php#L42-L48
234,015
xylemical/php-expressions
src/Context.php
Context.setVariable
public function setVariable($name, $value) { if (is_null($value)) { unset($this->variables[$name]); } else { $this->variables[$name] = $value; } return $this; }
php
public function setVariable($name, $value) { if (is_null($value)) { unset($this->variables[$name]); } else { $this->variables[$name] = $value; } return $this; }
[ "public", "function", "setVariable", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "is_null", "(", "$", "value", ")", ")", "{", "unset", "(", "$", "this", "->", "variables", "[", "$", "name", "]", ")", ";", "}", "else", "{", "$", "this", "->", "variables", "[", "$", "name", "]", "=", "$", "value", ";", "}", "return", "$", "this", ";", "}" ]
Set a variable value by name. @param string $name @param mixed $value @return static
[ "Set", "a", "variable", "value", "by", "name", "." ]
4dc7c3a4bb3f335a04cb05b0d41871529cfc9b73
https://github.com/xylemical/php-expressions/blob/4dc7c3a4bb3f335a04cb05b0d41871529cfc9b73/src/Context.php#L68-L77
234,016
matrozov/yii2-couchbase
src/Command.php
Command.bindParam
public function bindParam($name, &$value) { $name = ltrim($name, '$'); $this->params[$name] =& $value; return $this; }
php
public function bindParam($name, &$value) { $name = ltrim($name, '$'); $this->params[$name] =& $value; return $this; }
[ "public", "function", "bindParam", "(", "$", "name", ",", "&", "$", "value", ")", "{", "$", "name", "=", "ltrim", "(", "$", "name", ",", "'$'", ")", ";", "$", "this", "->", "params", "[", "$", "name", "]", "=", "&", "$", "value", ";", "return", "$", "this", ";", "}" ]
Binds a parameter to the SQL statement to be executed. @param string|int $name parameter identifier. For a prepared statement using named placeholders, this will be a parameter name of the form `:name`. For a prepared statement using question mark placeholders, this will be the 1-indexed position of the parameter. @param mixed $value the PHP variable to bind to the SQL statement parameter (passed by reference) @return $this the current command being executed @see http://www.php.net/manual/en/function.PDOStatement-bindParam.php
[ "Binds", "a", "parameter", "to", "the", "SQL", "statement", "to", "be", "executed", "." ]
07c2e9d18cb90f873c0d88dcacf6bb532e9d648c
https://github.com/matrozov/yii2-couchbase/blob/07c2e9d18cb90f873c0d88dcacf6bb532e9d648c/src/Command.php#L185-L192
234,017
matrozov/yii2-couchbase
src/Command.php
Command.insert
public function insert($bucketName, $data) { $sql = $this->db->getQueryBuilder()->insert($bucketName, $data); return $this->setSql($sql)->setBucketName($bucketName); }
php
public function insert($bucketName, $data) { $sql = $this->db->getQueryBuilder()->insert($bucketName, $data); return $this->setSql($sql)->setBucketName($bucketName); }
[ "public", "function", "insert", "(", "$", "bucketName", ",", "$", "data", ")", "{", "$", "sql", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "insert", "(", "$", "bucketName", ",", "$", "data", ")", ";", "return", "$", "this", "->", "setSql", "(", "$", "sql", ")", "->", "setBucketName", "(", "$", "bucketName", ")", ";", "}" ]
Creates an INSERT command. For example, ```php $connection->createCommand()->insert('user', [ 'name' => 'Sam', 'age' => 30, ])->execute(); ``` or ``` $id = $connection->createCommand()->insert('user', [ 'name' => 'Sam', 'age' => 30, ])->queryScalar(); ``` The method will properly escape the column names, and bind the values to be inserted. Note that the created command is not executed until [[execute()]] or [[queryScalar()]] is called. @param string $bucketName the bucket that new rows will be inserted into. @param array $data the column data (name => value) to be inserted into the bucket or instance. @return $this the command object itself
[ "Creates", "an", "INSERT", "command", ".", "For", "example" ]
07c2e9d18cb90f873c0d88dcacf6bb532e9d648c
https://github.com/matrozov/yii2-couchbase/blob/07c2e9d18cb90f873c0d88dcacf6bb532e9d648c/src/Command.php#L266-L271
234,018
matrozov/yii2-couchbase
src/Command.php
Command.batchInsert
public function batchInsert($bucketName, $rows) { $sql = $this->db->getQueryBuilder()->batchInsert($bucketName, $rows); return $this->setSql($sql)->setBucketName($bucketName); }
php
public function batchInsert($bucketName, $rows) { $sql = $this->db->getQueryBuilder()->batchInsert($bucketName, $rows); return $this->setSql($sql)->setBucketName($bucketName); }
[ "public", "function", "batchInsert", "(", "$", "bucketName", ",", "$", "rows", ")", "{", "$", "sql", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "batchInsert", "(", "$", "bucketName", ",", "$", "rows", ")", ";", "return", "$", "this", "->", "setSql", "(", "$", "sql", ")", "->", "setBucketName", "(", "$", "bucketName", ")", ";", "}" ]
Creates a batch INSERT command. For example, ```php $connection->createCommand()->batchInsert('user', ['name', 'age'], [ ['Tom', 30], ['Jane', 20], ['Linda', 25], ])->execute(); ``` The method will properly escape the column names, and quote the values to be inserted. Note that the values in each row must match the corresponding column names. Also note that the created command is not executed until [[execute()]] is called. @param string $bucketName the bucket that new rows will be inserted into. @param array $rows the rows to be batch inserted into the bucket. @return $this the command object itself
[ "Creates", "a", "batch", "INSERT", "command", ".", "For", "example" ]
07c2e9d18cb90f873c0d88dcacf6bb532e9d648c
https://github.com/matrozov/yii2-couchbase/blob/07c2e9d18cb90f873c0d88dcacf6bb532e9d648c/src/Command.php#L296-L301
234,019
matrozov/yii2-couchbase
src/Command.php
Command.upsert
public function upsert($bucketName, $id, $data) { $sql = $this->db->getQueryBuilder()->upsert($bucketName, $id, $data); return $this->setSql($sql)->setBucketName($bucketName); }
php
public function upsert($bucketName, $id, $data) { $sql = $this->db->getQueryBuilder()->upsert($bucketName, $id, $data); return $this->setSql($sql)->setBucketName($bucketName); }
[ "public", "function", "upsert", "(", "$", "bucketName", ",", "$", "id", ",", "$", "data", ")", "{", "$", "sql", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "upsert", "(", "$", "bucketName", ",", "$", "id", ",", "$", "data", ")", ";", "return", "$", "this", "->", "setSql", "(", "$", "sql", ")", "->", "setBucketName", "(", "$", "bucketName", ")", ";", "}" ]
Creates an UPSERT command. For example, ```php $connection->createCommand()->upsert('user', 'my-id', ['status' => 1])->execute(); ``` The method will properly escape the column names and bind the values to be updated. Note that the created command is not executed until [[execute()]] is called. @param string $bucketName the bucket to be updated. @param string $id the document id. @param array $data the column data (name => value) to be inserted into the bucket or instance. @return $this the command object itself
[ "Creates", "an", "UPSERT", "command", ".", "For", "example" ]
07c2e9d18cb90f873c0d88dcacf6bb532e9d648c
https://github.com/matrozov/yii2-couchbase/blob/07c2e9d18cb90f873c0d88dcacf6bb532e9d648c/src/Command.php#L349-L354
234,020
matrozov/yii2-couchbase
src/Command.php
Command.delete
public function delete($bucketName, $condition = '', $params = []) { $sql = $this->db->getQueryBuilder()->delete($bucketName, $condition, $params); return $this->setSql($sql)->setBucketName($bucketName)->bindValues($params); }
php
public function delete($bucketName, $condition = '', $params = []) { $sql = $this->db->getQueryBuilder()->delete($bucketName, $condition, $params); return $this->setSql($sql)->setBucketName($bucketName)->bindValues($params); }
[ "public", "function", "delete", "(", "$", "bucketName", ",", "$", "condition", "=", "''", ",", "$", "params", "=", "[", "]", ")", "{", "$", "sql", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "delete", "(", "$", "bucketName", ",", "$", "condition", ",", "$", "params", ")", ";", "return", "$", "this", "->", "setSql", "(", "$", "sql", ")", "->", "setBucketName", "(", "$", "bucketName", ")", "->", "bindValues", "(", "$", "params", ")", ";", "}" ]
Creates a DELETE command. For example, ```php $connection->createCommand()->delete('user', 'status = 0')->execute(); ``` The method will properly escape the bucket and column names. Note that the created command is not executed until [[execute()]] is called. @param string $bucketName the bucket where the data will be deleted from. @param string|array $condition the condition that will be put in the WHERE part. Please refer to [[Query::where()]] on how to specify condition. @param array $params the parameters to be bound to the command @return $this the command object itself @throws Exception
[ "Creates", "a", "DELETE", "command", ".", "For", "example" ]
07c2e9d18cb90f873c0d88dcacf6bb532e9d648c
https://github.com/matrozov/yii2-couchbase/blob/07c2e9d18cb90f873c0d88dcacf6bb532e9d648c/src/Command.php#L376-L381
234,021
matrozov/yii2-couchbase
src/Command.php
Command.buildIndex
public function buildIndex($bucketName, $indexNames) { $sql = $this->db->getQueryBuilder()->buildIndex($bucketName, $indexNames); return $this->setSql($sql)->setBucketName($bucketName); }
php
public function buildIndex($bucketName, $indexNames) { $sql = $this->db->getQueryBuilder()->buildIndex($bucketName, $indexNames); return $this->setSql($sql)->setBucketName($bucketName); }
[ "public", "function", "buildIndex", "(", "$", "bucketName", ",", "$", "indexNames", ")", "{", "$", "sql", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "buildIndex", "(", "$", "bucketName", ",", "$", "indexNames", ")", ";", "return", "$", "this", "->", "setSql", "(", "$", "sql", ")", "->", "setBucketName", "(", "$", "bucketName", ")", ";", "}" ]
Create a SQL command for build index. @param string $bucketName @param string|string[] $indexNames names of index @return $this the command object itself
[ "Create", "a", "SQL", "command", "for", "build", "index", "." ]
07c2e9d18cb90f873c0d88dcacf6bb532e9d648c
https://github.com/matrozov/yii2-couchbase/blob/07c2e9d18cb90f873c0d88dcacf6bb532e9d648c/src/Command.php#L418-L423
234,022
matrozov/yii2-couchbase
src/Command.php
Command.createPrimaryIndex
public function createPrimaryIndex($bucketName, $indexName = null, $options = []) { $sql = $this->db->getQueryBuilder()->createPrimaryIndex($bucketName, $indexName, $options); return $this->setSql($sql)->setBucketName($bucketName); }
php
public function createPrimaryIndex($bucketName, $indexName = null, $options = []) { $sql = $this->db->getQueryBuilder()->createPrimaryIndex($bucketName, $indexName, $options); return $this->setSql($sql)->setBucketName($bucketName); }
[ "public", "function", "createPrimaryIndex", "(", "$", "bucketName", ",", "$", "indexName", "=", "null", ",", "$", "options", "=", "[", "]", ")", "{", "$", "sql", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "createPrimaryIndex", "(", "$", "bucketName", ",", "$", "indexName", ",", "$", "options", ")", ";", "return", "$", "this", "->", "setSql", "(", "$", "sql", ")", "->", "setBucketName", "(", "$", "bucketName", ")", ";", "}" ]
Create a SQL command for creating a new primary index. @param string $bucketName @param string|null $indexName name of primary index (optional) @param array $options @return $this the command object itself
[ "Create", "a", "SQL", "command", "for", "creating", "a", "new", "primary", "index", "." ]
07c2e9d18cb90f873c0d88dcacf6bb532e9d648c
https://github.com/matrozov/yii2-couchbase/blob/07c2e9d18cb90f873c0d88dcacf6bb532e9d648c/src/Command.php#L434-L439
234,023
matrozov/yii2-couchbase
src/Command.php
Command.dropPrimaryIndex
public function dropPrimaryIndex($bucketName) { $sql = $this->db->getQueryBuilder()->dropPrimaryIndex($bucketName); return $this->setSql($sql)->setBucketName($bucketName); }
php
public function dropPrimaryIndex($bucketName) { $sql = $this->db->getQueryBuilder()->dropPrimaryIndex($bucketName); return $this->setSql($sql)->setBucketName($bucketName); }
[ "public", "function", "dropPrimaryIndex", "(", "$", "bucketName", ")", "{", "$", "sql", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "dropPrimaryIndex", "(", "$", "bucketName", ")", ";", "return", "$", "this", "->", "setSql", "(", "$", "sql", ")", "->", "setBucketName", "(", "$", "bucketName", ")", ";", "}" ]
Create a SQL command for dropping an unnamed primary index. @param string $bucketName @return $this the command object itself
[ "Create", "a", "SQL", "command", "for", "dropping", "an", "unnamed", "primary", "index", "." ]
07c2e9d18cb90f873c0d88dcacf6bb532e9d648c
https://github.com/matrozov/yii2-couchbase/blob/07c2e9d18cb90f873c0d88dcacf6bb532e9d648c/src/Command.php#L448-L453
234,024
matrozov/yii2-couchbase
src/Command.php
Command.createIndex
public function createIndex($bucketName, $indexName, $columns, $condition = null, &$params = [], $options = []) { $sql = $this->db->getQueryBuilder()->createIndex($bucketName, $indexName, $columns, $condition, $params, $options); return $this->setSql($sql)->setBucketName($bucketName); }
php
public function createIndex($bucketName, $indexName, $columns, $condition = null, &$params = [], $options = []) { $sql = $this->db->getQueryBuilder()->createIndex($bucketName, $indexName, $columns, $condition, $params, $options); return $this->setSql($sql)->setBucketName($bucketName); }
[ "public", "function", "createIndex", "(", "$", "bucketName", ",", "$", "indexName", ",", "$", "columns", ",", "$", "condition", "=", "null", ",", "&", "$", "params", "=", "[", "]", ",", "$", "options", "=", "[", "]", ")", "{", "$", "sql", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "createIndex", "(", "$", "bucketName", ",", "$", "indexName", ",", "$", "columns", ",", "$", "condition", ",", "$", "params", ",", "$", "options", ")", ";", "return", "$", "this", "->", "setSql", "(", "$", "sql", ")", "->", "setBucketName", "(", "$", "bucketName", ")", ";", "}" ]
Creates a SQL command for creating a new index. @param string $bucketName @param string $indexName @param array $columns @param array|null $condition @param array $params @param array $options @return $this the command object itself @throws Exception
[ "Creates", "a", "SQL", "command", "for", "creating", "a", "new", "index", "." ]
07c2e9d18cb90f873c0d88dcacf6bb532e9d648c
https://github.com/matrozov/yii2-couchbase/blob/07c2e9d18cb90f873c0d88dcacf6bb532e9d648c/src/Command.php#L468-L473
234,025
matrozov/yii2-couchbase
src/Command.php
Command.dropIndex
public function dropIndex($bucketName, $indexName) { $sql = $this->db->getQueryBuilder()->dropIndex($bucketName, $indexName); return $this->setSql($sql)->setBucketName($bucketName); }
php
public function dropIndex($bucketName, $indexName) { $sql = $this->db->getQueryBuilder()->dropIndex($bucketName, $indexName); return $this->setSql($sql)->setBucketName($bucketName); }
[ "public", "function", "dropIndex", "(", "$", "bucketName", ",", "$", "indexName", ")", "{", "$", "sql", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "dropIndex", "(", "$", "bucketName", ",", "$", "indexName", ")", ";", "return", "$", "this", "->", "setSql", "(", "$", "sql", ")", "->", "setBucketName", "(", "$", "bucketName", ")", ";", "}" ]
Creates a SQL command for dropping an index. @param string $bucketName @param string $indexName @return $this the command object itself
[ "Creates", "a", "SQL", "command", "for", "dropping", "an", "index", "." ]
07c2e9d18cb90f873c0d88dcacf6bb532e9d648c
https://github.com/matrozov/yii2-couchbase/blob/07c2e9d18cb90f873c0d88dcacf6bb532e9d648c/src/Command.php#L483-L488
234,026
MW-Peachy/Peachy
Includes/Hooks.php
Hooks.runHook
public static function runHook( $hook_name, $args = array() ) { global $pgHooks; if( !isset( $pgHooks[$hook_name] ) ) return null; if( !is_array( $pgHooks[$hook_name] ) ) { throw new HookError( "Hook assignment for event `$hook_name` is not an array. Syntax is " . '$pgHooks[\'hookname\'][] = "hook_function";' ); } $method = null; foreach( $pgHooks[$hook_name] as $function ){ if( is_array( $function ) ) { if( count( $function ) < 2 ) { throw new HookError( "Not enough parameters in array specified for `$hook_name` hook" ); } elseif( is_object( $function[0] ) ) { $object = $function[0]; $method = $function[1]; if( count( $function ) > 2 ) { $data = $function[2]; } } elseif( is_string( $function[0] ) ) { $method = $function[0]; if( count( $function ) > 1 ) { $data = $function[1]; } } } elseif( is_string( $function ) ) { $method = $function; } if( isset( $data ) ) { $args = array_merge( array( $data ), $args ); } if( isset( $object ) ) { $fncarr = array( $object, $method ); } elseif( is_string( $method ) && in_string( "::", $method ) ) { $fncarr = explode( "::", $method ); } else { $fncarr = $method; } //is_callable( $fncarr ); //Apparently this is a bug. Thanks, MW! if( !is_callable( $fncarr ) ) { throw new BadEntryError( "MissingFunction", "Hook function $fncarr was not defined" ); } $hookRet = call_user_func_array( $fncarr, $args ); if( !is_null( $hookRet ) ) return $hookRet; } }
php
public static function runHook( $hook_name, $args = array() ) { global $pgHooks; if( !isset( $pgHooks[$hook_name] ) ) return null; if( !is_array( $pgHooks[$hook_name] ) ) { throw new HookError( "Hook assignment for event `$hook_name` is not an array. Syntax is " . '$pgHooks[\'hookname\'][] = "hook_function";' ); } $method = null; foreach( $pgHooks[$hook_name] as $function ){ if( is_array( $function ) ) { if( count( $function ) < 2 ) { throw new HookError( "Not enough parameters in array specified for `$hook_name` hook" ); } elseif( is_object( $function[0] ) ) { $object = $function[0]; $method = $function[1]; if( count( $function ) > 2 ) { $data = $function[2]; } } elseif( is_string( $function[0] ) ) { $method = $function[0]; if( count( $function ) > 1 ) { $data = $function[1]; } } } elseif( is_string( $function ) ) { $method = $function; } if( isset( $data ) ) { $args = array_merge( array( $data ), $args ); } if( isset( $object ) ) { $fncarr = array( $object, $method ); } elseif( is_string( $method ) && in_string( "::", $method ) ) { $fncarr = explode( "::", $method ); } else { $fncarr = $method; } //is_callable( $fncarr ); //Apparently this is a bug. Thanks, MW! if( !is_callable( $fncarr ) ) { throw new BadEntryError( "MissingFunction", "Hook function $fncarr was not defined" ); } $hookRet = call_user_func_array( $fncarr, $args ); if( !is_null( $hookRet ) ) return $hookRet; } }
[ "public", "static", "function", "runHook", "(", "$", "hook_name", ",", "$", "args", "=", "array", "(", ")", ")", "{", "global", "$", "pgHooks", ";", "if", "(", "!", "isset", "(", "$", "pgHooks", "[", "$", "hook_name", "]", ")", ")", "return", "null", ";", "if", "(", "!", "is_array", "(", "$", "pgHooks", "[", "$", "hook_name", "]", ")", ")", "{", "throw", "new", "HookError", "(", "\"Hook assignment for event `$hook_name` is not an array. Syntax is \"", ".", "'$pgHooks[\\'hookname\\'][] = \"hook_function\";'", ")", ";", "}", "$", "method", "=", "null", ";", "foreach", "(", "$", "pgHooks", "[", "$", "hook_name", "]", "as", "$", "function", ")", "{", "if", "(", "is_array", "(", "$", "function", ")", ")", "{", "if", "(", "count", "(", "$", "function", ")", "<", "2", ")", "{", "throw", "new", "HookError", "(", "\"Not enough parameters in array specified for `$hook_name` hook\"", ")", ";", "}", "elseif", "(", "is_object", "(", "$", "function", "[", "0", "]", ")", ")", "{", "$", "object", "=", "$", "function", "[", "0", "]", ";", "$", "method", "=", "$", "function", "[", "1", "]", ";", "if", "(", "count", "(", "$", "function", ")", ">", "2", ")", "{", "$", "data", "=", "$", "function", "[", "2", "]", ";", "}", "}", "elseif", "(", "is_string", "(", "$", "function", "[", "0", "]", ")", ")", "{", "$", "method", "=", "$", "function", "[", "0", "]", ";", "if", "(", "count", "(", "$", "function", ")", ">", "1", ")", "{", "$", "data", "=", "$", "function", "[", "1", "]", ";", "}", "}", "}", "elseif", "(", "is_string", "(", "$", "function", ")", ")", "{", "$", "method", "=", "$", "function", ";", "}", "if", "(", "isset", "(", "$", "data", ")", ")", "{", "$", "args", "=", "array_merge", "(", "array", "(", "$", "data", ")", ",", "$", "args", ")", ";", "}", "if", "(", "isset", "(", "$", "object", ")", ")", "{", "$", "fncarr", "=", "array", "(", "$", "object", ",", "$", "method", ")", ";", "}", "elseif", "(", "is_string", "(", "$", "method", ")", "&&", "in_string", "(", "\"::\"", ",", "$", "method", ")", ")", "{", "$", "fncarr", "=", "explode", "(", "\"::\"", ",", "$", "method", ")", ";", "}", "else", "{", "$", "fncarr", "=", "$", "method", ";", "}", "//is_callable( $fncarr ); //Apparently this is a bug. Thanks, MW!", "if", "(", "!", "is_callable", "(", "$", "fncarr", ")", ")", "{", "throw", "new", "BadEntryError", "(", "\"MissingFunction\"", ",", "\"Hook function $fncarr was not defined\"", ")", ";", "}", "$", "hookRet", "=", "call_user_func_array", "(", "$", "fncarr", ",", "$", "args", ")", ";", "if", "(", "!", "is_null", "(", "$", "hookRet", ")", ")", "return", "$", "hookRet", ";", "}", "}" ]
Search for hook functions and run them if defined @param string $hook_name Name of hook to search for @param array $args Arguments to pass to the hook function @throws HookError @throws BadEntryError @return mixed Output of hook function
[ "Search", "for", "hook", "functions", "and", "run", "them", "if", "defined" ]
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Hooks.php#L42-L97
234,027
kaliop-uk/kueueingbundle
Service/MessageConsumer.php
MessageConsumer.getDriverForMessage
protected function getDriverForMessage($message) { $this->loadRegisteredDrivers(); foreach ($this->drivers as $driver) { if ($driver->acceptMessage($message)) return $driver; } throw new \Exception('No driver found to decode message of type: ' . get_class($message)); }
php
protected function getDriverForMessage($message) { $this->loadRegisteredDrivers(); foreach ($this->drivers as $driver) { if ($driver->acceptMessage($message)) return $driver; } throw new \Exception('No driver found to decode message of type: ' . get_class($message)); }
[ "protected", "function", "getDriverForMessage", "(", "$", "message", ")", "{", "$", "this", "->", "loadRegisteredDrivers", "(", ")", ";", "foreach", "(", "$", "this", "->", "drivers", "as", "$", "driver", ")", "{", "if", "(", "$", "driver", "->", "acceptMessage", "(", "$", "message", ")", ")", "return", "$", "driver", ";", "}", "throw", "new", "\\", "Exception", "(", "'No driver found to decode message of type: '", ".", "get_class", "(", "$", "message", ")", ")", ";", "}" ]
Finds a driver appropriate to decode the message @param mixed $message @return DriverInterface @throws \Exception
[ "Finds", "a", "driver", "appropriate", "to", "decode", "the", "message" ]
6a4f9b01ef1f5b8e5cdfad78f7c82b35f1007987
https://github.com/kaliop-uk/kueueingbundle/blob/6a4f9b01ef1f5b8e5cdfad78f7c82b35f1007987/Service/MessageConsumer.php#L134-L143
234,028
kaliop-uk/kueueingbundle
Service/MessageConsumer.php
MessageConsumer.decodeMessageBody
protected function decodeMessageBody(MessageInterface $msg) { // do we accept this type? (nb: this is an optional property) $type = $msg->getContentType(); if ($type == '' && $this->assumedContentType != '') { $type = $this->assumedContentType; } if ($type == '' || !in_array($type, $this->acceptedContentTypes)) { throw new \RuntimeException("Can not decode message with content type: '$type'"); } // then decode it switch ($type) { case 'application/json': $data = json_decode($msg->getBody(), true); if ($error = json_last_error()) { throw new \UnexpectedValueException("Error decoding json payload: " . $error); } return $data; case 'application/x-httpd-php-source': /// @todo should we wrap this in try/catch, ob_start and set_error_handler, or just make sure it is never used? return eval ('return ' . $msg->body . ';'); case 'vnd.php.serialized': return unserialize($msg->body); case 'text/plain': case 'application/octet-stream': return $msg->body; default: throw new \UnexpectedValueException("Serialization format unsupported: " . $type); } }
php
protected function decodeMessageBody(MessageInterface $msg) { // do we accept this type? (nb: this is an optional property) $type = $msg->getContentType(); if ($type == '' && $this->assumedContentType != '') { $type = $this->assumedContentType; } if ($type == '' || !in_array($type, $this->acceptedContentTypes)) { throw new \RuntimeException("Can not decode message with content type: '$type'"); } // then decode it switch ($type) { case 'application/json': $data = json_decode($msg->getBody(), true); if ($error = json_last_error()) { throw new \UnexpectedValueException("Error decoding json payload: " . $error); } return $data; case 'application/x-httpd-php-source': /// @todo should we wrap this in try/catch, ob_start and set_error_handler, or just make sure it is never used? return eval ('return ' . $msg->body . ';'); case 'vnd.php.serialized': return unserialize($msg->body); case 'text/plain': case 'application/octet-stream': return $msg->body; default: throw new \UnexpectedValueException("Serialization format unsupported: " . $type); } }
[ "protected", "function", "decodeMessageBody", "(", "MessageInterface", "$", "msg", ")", "{", "// do we accept this type? (nb: this is an optional property)", "$", "type", "=", "$", "msg", "->", "getContentType", "(", ")", ";", "if", "(", "$", "type", "==", "''", "&&", "$", "this", "->", "assumedContentType", "!=", "''", ")", "{", "$", "type", "=", "$", "this", "->", "assumedContentType", ";", "}", "if", "(", "$", "type", "==", "''", "||", "!", "in_array", "(", "$", "type", ",", "$", "this", "->", "acceptedContentTypes", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "\"Can not decode message with content type: '$type'\"", ")", ";", "}", "// then decode it", "switch", "(", "$", "type", ")", "{", "case", "'application/json'", ":", "$", "data", "=", "json_decode", "(", "$", "msg", "->", "getBody", "(", ")", ",", "true", ")", ";", "if", "(", "$", "error", "=", "json_last_error", "(", ")", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Error decoding json payload: \"", ".", "$", "error", ")", ";", "}", "return", "$", "data", ";", "case", "'application/x-httpd-php-source'", ":", "/// @todo should we wrap this in try/catch, ob_start and set_error_handler, or just make sure it is never used?", "return", "eval", "(", "'return '", ".", "$", "msg", "->", "body", ".", "';'", ")", ";", "case", "'vnd.php.serialized'", ":", "return", "unserialize", "(", "$", "msg", "->", "body", ")", ";", "case", "'text/plain'", ":", "case", "'application/octet-stream'", ":", "return", "$", "msg", "->", "body", ";", "default", ":", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Serialization format unsupported: \"", ".", "$", "type", ")", ";", "}", "}" ]
Works on the basis of the assumed and accepted content types @param MessageInterface $msg @return mixed @throws \RuntimeException @throws \UnexpectedValueException
[ "Works", "on", "the", "basis", "of", "the", "assumed", "and", "accepted", "content", "types" ]
6a4f9b01ef1f5b8e5cdfad78f7c82b35f1007987
https://github.com/kaliop-uk/kueueingbundle/blob/6a4f9b01ef1f5b8e5cdfad78f7c82b35f1007987/Service/MessageConsumer.php#L216-L246
234,029
mrTimofey/laravel-simple-tokens
src/SimpleProvider.php
SimpleProvider.forget
public function forget(string $token): void { $this->cache->forget($this->getCacheKey($token)); }
php
public function forget(string $token): void { $this->cache->forget($this->getCacheKey($token)); }
[ "public", "function", "forget", "(", "string", "$", "token", ")", ":", "void", "{", "$", "this", "->", "cache", "->", "forget", "(", "$", "this", "->", "getCacheKey", "(", "$", "token", ")", ")", ";", "}" ]
Forget token. @param string $token
[ "Forget", "token", "." ]
b481f56167e00d81a70ba019fe88b055600890a8
https://github.com/mrTimofey/laravel-simple-tokens/blob/b481f56167e00d81a70ba019fe88b055600890a8/src/SimpleProvider.php#L71-L74
234,030
mrTimofey/laravel-simple-tokens
src/SimpleProvider.php
SimpleProvider.issueToken
public function issueToken(Authenticatable $user): string { $token = str_random(60); $this->cache->put($this->getCacheKey($token), $user->getAuthIdentifier(), $this->config['token_ttl']); return $token; }
php
public function issueToken(Authenticatable $user): string { $token = str_random(60); $this->cache->put($this->getCacheKey($token), $user->getAuthIdentifier(), $this->config['token_ttl']); return $token; }
[ "public", "function", "issueToken", "(", "Authenticatable", "$", "user", ")", ":", "string", "{", "$", "token", "=", "str_random", "(", "60", ")", ";", "$", "this", "->", "cache", "->", "put", "(", "$", "this", "->", "getCacheKey", "(", "$", "token", ")", ",", "$", "user", "->", "getAuthIdentifier", "(", ")", ",", "$", "this", "->", "config", "[", "'token_ttl'", "]", ")", ";", "return", "$", "token", ";", "}" ]
Create new token for a model instance and store it in cache. @param Authenticatable $user @return string
[ "Create", "new", "token", "for", "a", "model", "instance", "and", "store", "it", "in", "cache", "." ]
b481f56167e00d81a70ba019fe88b055600890a8
https://github.com/mrTimofey/laravel-simple-tokens/blob/b481f56167e00d81a70ba019fe88b055600890a8/src/SimpleProvider.php#L81-L86
234,031
mintware-de/data-model-mapper
src/ObjectMapper.php
ObjectMapper.map
public function map($rawData, $targetClass) { // Deserialize the data try { if ($this->serializer instanceof SerializerInterface === false) { throw new SerializerException("You've to specify a serializer with the setSerializer() method."); } $data = $this->serializer->deserialize($rawData); } catch (\Exception $e) { throw new SerializerException('Deserialize failed: ' . $e->getMessage(), 0, $e); } // Pre initialize the result $result = null; // Check if the target object is a collection of type X if (substr($targetClass, -2) == '[]') { $result = []; foreach ($data as $key => $entryData) { // Map the data recursive $result[] = $this->mapDataToObject($entryData, substr($targetClass, 0, -2)); } } else { // Map the data recursive $result = $this->mapDataToObject($data, $targetClass); } return $result; }
php
public function map($rawData, $targetClass) { // Deserialize the data try { if ($this->serializer instanceof SerializerInterface === false) { throw new SerializerException("You've to specify a serializer with the setSerializer() method."); } $data = $this->serializer->deserialize($rawData); } catch (\Exception $e) { throw new SerializerException('Deserialize failed: ' . $e->getMessage(), 0, $e); } // Pre initialize the result $result = null; // Check if the target object is a collection of type X if (substr($targetClass, -2) == '[]') { $result = []; foreach ($data as $key => $entryData) { // Map the data recursive $result[] = $this->mapDataToObject($entryData, substr($targetClass, 0, -2)); } } else { // Map the data recursive $result = $this->mapDataToObject($data, $targetClass); } return $result; }
[ "public", "function", "map", "(", "$", "rawData", ",", "$", "targetClass", ")", "{", "// Deserialize the data", "try", "{", "if", "(", "$", "this", "->", "serializer", "instanceof", "SerializerInterface", "===", "false", ")", "{", "throw", "new", "SerializerException", "(", "\"You've to specify a serializer with the setSerializer() method.\"", ")", ";", "}", "$", "data", "=", "$", "this", "->", "serializer", "->", "deserialize", "(", "$", "rawData", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "throw", "new", "SerializerException", "(", "'Deserialize failed: '", ".", "$", "e", "->", "getMessage", "(", ")", ",", "0", ",", "$", "e", ")", ";", "}", "// Pre initialize the result", "$", "result", "=", "null", ";", "// Check if the target object is a collection of type X", "if", "(", "substr", "(", "$", "targetClass", ",", "-", "2", ")", "==", "'[]'", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "entryData", ")", "{", "// Map the data recursive", "$", "result", "[", "]", "=", "$", "this", "->", "mapDataToObject", "(", "$", "entryData", ",", "substr", "(", "$", "targetClass", ",", "0", ",", "-", "2", ")", ")", ";", "}", "}", "else", "{", "// Map the data recursive", "$", "result", "=", "$", "this", "->", "mapDataToObject", "(", "$", "data", ",", "$", "targetClass", ")", ";", "}", "return", "$", "result", ";", "}" ]
Maps raw data to a object @param string $rawData The raw data @param string $targetClass The target object class @return mixed The mapped object @throws SerializerException If the data couldn't be deserialized @throws ClassNotFoundException If the target class does not exist @throws PropertyNotAccessibleException If the class property has no public access an no set-Method @throws TypeMismatchException If The type in the raw data does not match the type in the class @throws \ReflectionException If the target class does not exist
[ "Maps", "raw", "data", "to", "a", "object" ]
d7dfbaaee208b0c5feb07ff45166c6b5f00adb14
https://github.com/mintware-de/data-model-mapper/blob/d7dfbaaee208b0c5feb07ff45166c6b5f00adb14/src/ObjectMapper.php#L88-L117
234,032
mintware-de/data-model-mapper
src/ObjectMapper.php
ObjectMapper.setPropertyValue
protected function setPropertyValue($object, \ReflectionProperty $property, $value) { if ($value !== null) { // If the property is public accessible, set the value directly if ($property->isPublic()) { $object->{$property->name} = $value; } else { // If not, use the setter / adder $ucw = ucwords($property->name); if ($property->getDeclaringClass()->hasMethod($method = 'set' . $ucw)) { $object->$method($value); } elseif ($property->getDeclaringClass()->hasMethod($method = 'add' . $ucw)) { $object->$method($value); } } } }
php
protected function setPropertyValue($object, \ReflectionProperty $property, $value) { if ($value !== null) { // If the property is public accessible, set the value directly if ($property->isPublic()) { $object->{$property->name} = $value; } else { // If not, use the setter / adder $ucw = ucwords($property->name); if ($property->getDeclaringClass()->hasMethod($method = 'set' . $ucw)) { $object->$method($value); } elseif ($property->getDeclaringClass()->hasMethod($method = 'add' . $ucw)) { $object->$method($value); } } } }
[ "protected", "function", "setPropertyValue", "(", "$", "object", ",", "\\", "ReflectionProperty", "$", "property", ",", "$", "value", ")", "{", "if", "(", "$", "value", "!==", "null", ")", "{", "// If the property is public accessible, set the value directly", "if", "(", "$", "property", "->", "isPublic", "(", ")", ")", "{", "$", "object", "->", "{", "$", "property", "->", "name", "}", "=", "$", "value", ";", "}", "else", "{", "// If not, use the setter / adder", "$", "ucw", "=", "ucwords", "(", "$", "property", "->", "name", ")", ";", "if", "(", "$", "property", "->", "getDeclaringClass", "(", ")", "->", "hasMethod", "(", "$", "method", "=", "'set'", ".", "$", "ucw", ")", ")", "{", "$", "object", "->", "$", "method", "(", "$", "value", ")", ";", "}", "elseif", "(", "$", "property", "->", "getDeclaringClass", "(", ")", "->", "hasMethod", "(", "$", "method", "=", "'add'", ".", "$", "ucw", ")", ")", "{", "$", "object", "->", "$", "method", "(", "$", "value", ")", ";", "}", "}", "}", "}" ]
Sets a property of an object @param object $object The object @param \ReflectionProperty $property The Property @param mixed $value The new value
[ "Sets", "a", "property", "of", "an", "object" ]
d7dfbaaee208b0c5feb07ff45166c6b5f00adb14
https://github.com/mintware-de/data-model-mapper/blob/d7dfbaaee208b0c5feb07ff45166c6b5f00adb14/src/ObjectMapper.php#L581-L597
234,033
willmorgan/silverstripe-cropperfield
code/Cropper/GenericCropper.php
GenericCropper.getCropDimensions
public function getCropDimensions() { $x = $this->getCropX(); $y = $this->getCropY(); $cropWidth = $this->getCropWidth(); $cropHeight = $this->getCropHeight(); $width = $cropWidth; $height = $cropHeight; // Normalise the width/height with respect to the aspect ratio $maxWidth = $this->getMaxWidth(); $maxHeight = $this->getMaxHeight(); $aspectRatio = $this->getAspectRatio(); if($width < 1 || $height < 1) { throw new \InvalidArgumentException('Values must be over 1'); } // Fix the aspect ratio if the crop is wrong // This must happen first so invalid values can be compensated for if($width / $height != $aspectRatio) { $height = $width / $aspectRatio; } if($width > $maxWidth) { $scaleDownRatio = $cropWidth / $maxWidth; $height = $height / $scaleDownRatio; $width = $maxWidth; } if($height > $maxHeight) { $scaleDownRatio = $cropHeight / $maxHeight; $width = $width / $scaleDownRatio; $height = $maxHeight; } return array( // src_x, src_y 'x' => $x, 'y' => $y, // dst_w, dst_h 'width' => ceil($width), 'height' => ceil($height), // src_w, src_h 'crop_width' => $cropWidth, 'crop_height' => $cropHeight, ); }
php
public function getCropDimensions() { $x = $this->getCropX(); $y = $this->getCropY(); $cropWidth = $this->getCropWidth(); $cropHeight = $this->getCropHeight(); $width = $cropWidth; $height = $cropHeight; // Normalise the width/height with respect to the aspect ratio $maxWidth = $this->getMaxWidth(); $maxHeight = $this->getMaxHeight(); $aspectRatio = $this->getAspectRatio(); if($width < 1 || $height < 1) { throw new \InvalidArgumentException('Values must be over 1'); } // Fix the aspect ratio if the crop is wrong // This must happen first so invalid values can be compensated for if($width / $height != $aspectRatio) { $height = $width / $aspectRatio; } if($width > $maxWidth) { $scaleDownRatio = $cropWidth / $maxWidth; $height = $height / $scaleDownRatio; $width = $maxWidth; } if($height > $maxHeight) { $scaleDownRatio = $cropHeight / $maxHeight; $width = $width / $scaleDownRatio; $height = $maxHeight; } return array( // src_x, src_y 'x' => $x, 'y' => $y, // dst_w, dst_h 'width' => ceil($width), 'height' => ceil($height), // src_w, src_h 'crop_width' => $cropWidth, 'crop_height' => $cropHeight, ); }
[ "public", "function", "getCropDimensions", "(", ")", "{", "$", "x", "=", "$", "this", "->", "getCropX", "(", ")", ";", "$", "y", "=", "$", "this", "->", "getCropY", "(", ")", ";", "$", "cropWidth", "=", "$", "this", "->", "getCropWidth", "(", ")", ";", "$", "cropHeight", "=", "$", "this", "->", "getCropHeight", "(", ")", ";", "$", "width", "=", "$", "cropWidth", ";", "$", "height", "=", "$", "cropHeight", ";", "// Normalise the width/height with respect to the aspect ratio", "$", "maxWidth", "=", "$", "this", "->", "getMaxWidth", "(", ")", ";", "$", "maxHeight", "=", "$", "this", "->", "getMaxHeight", "(", ")", ";", "$", "aspectRatio", "=", "$", "this", "->", "getAspectRatio", "(", ")", ";", "if", "(", "$", "width", "<", "1", "||", "$", "height", "<", "1", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Values must be over 1'", ")", ";", "}", "// Fix the aspect ratio if the crop is wrong", "// This must happen first so invalid values can be compensated for", "if", "(", "$", "width", "/", "$", "height", "!=", "$", "aspectRatio", ")", "{", "$", "height", "=", "$", "width", "/", "$", "aspectRatio", ";", "}", "if", "(", "$", "width", ">", "$", "maxWidth", ")", "{", "$", "scaleDownRatio", "=", "$", "cropWidth", "/", "$", "maxWidth", ";", "$", "height", "=", "$", "height", "/", "$", "scaleDownRatio", ";", "$", "width", "=", "$", "maxWidth", ";", "}", "if", "(", "$", "height", ">", "$", "maxHeight", ")", "{", "$", "scaleDownRatio", "=", "$", "cropHeight", "/", "$", "maxHeight", ";", "$", "width", "=", "$", "width", "/", "$", "scaleDownRatio", ";", "$", "height", "=", "$", "maxHeight", ";", "}", "return", "array", "(", "// src_x, src_y", "'x'", "=>", "$", "x", ",", "'y'", "=>", "$", "y", ",", "// dst_w, dst_h", "'width'", "=>", "ceil", "(", "$", "width", ")", ",", "'height'", "=>", "ceil", "(", "$", "height", ")", ",", "// src_w, src_h", "'crop_width'", "=>", "$", "cropWidth", ",", "'crop_height'", "=>", "$", "cropHeight", ",", ")", ";", "}" ]
Ensure the aspect ratio is respected regardless of any dodgy data. The aspect ratio is otherwise
[ "Ensure", "the", "aspect", "ratio", "is", "respected", "regardless", "of", "any", "dodgy", "data", ".", "The", "aspect", "ratio", "is", "otherwise" ]
855ca4f44dd392b1cf9d36f411a2c145b4b3d975
https://github.com/willmorgan/silverstripe-cropperfield/blob/855ca4f44dd392b1cf9d36f411a2c145b4b3d975/code/Cropper/GenericCropper.php#L176-L224
234,034
willmorgan/silverstripe-cropperfield
code/Cropper/GenericCropper.php
GenericCropper.normaliseFilename
protected function normaliseFilename($absolutePath) { $regex = sprintf( '#^%s#', addslashes(BASE_PATH) . DIRECTORY_SEPARATOR ); return preg_replace($regex, '', $absolutePath); }
php
protected function normaliseFilename($absolutePath) { $regex = sprintf( '#^%s#', addslashes(BASE_PATH) . DIRECTORY_SEPARATOR ); return preg_replace($regex, '', $absolutePath); }
[ "protected", "function", "normaliseFilename", "(", "$", "absolutePath", ")", "{", "$", "regex", "=", "sprintf", "(", "'#^%s#'", ",", "addslashes", "(", "BASE_PATH", ")", ".", "DIRECTORY_SEPARATOR", ")", ";", "return", "preg_replace", "(", "$", "regex", ",", "''", ",", "$", "absolutePath", ")", ";", "}" ]
Convert an absolute path to one relative to the base path @return string
[ "Convert", "an", "absolute", "path", "to", "one", "relative", "to", "the", "base", "path" ]
855ca4f44dd392b1cf9d36f411a2c145b4b3d975
https://github.com/willmorgan/silverstripe-cropperfield/blob/855ca4f44dd392b1cf9d36f411a2c145b4b3d975/code/Cropper/GenericCropper.php#L257-L263
234,035
yarcode/yii2-email-manager
src/EmailManager.php
EmailManager.queue
public function queue($from, $to, $subject, $text, $priority = 0, $files = [], $bcc = null) { if (is_array($bcc)) { $bcc = implode(', ', $bcc); } $model = new Message(); $model->from = $from; $model->to = $to; $model->subject = $subject; $model->text = $text; $model->priority = $priority; $model->files = $files; $model->bcc = $bcc; return $model->save(); }
php
public function queue($from, $to, $subject, $text, $priority = 0, $files = [], $bcc = null) { if (is_array($bcc)) { $bcc = implode(', ', $bcc); } $model = new Message(); $model->from = $from; $model->to = $to; $model->subject = $subject; $model->text = $text; $model->priority = $priority; $model->files = $files; $model->bcc = $bcc; return $model->save(); }
[ "public", "function", "queue", "(", "$", "from", ",", "$", "to", ",", "$", "subject", ",", "$", "text", ",", "$", "priority", "=", "0", ",", "$", "files", "=", "[", "]", ",", "$", "bcc", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "bcc", ")", ")", "{", "$", "bcc", "=", "implode", "(", "', '", ",", "$", "bcc", ")", ";", "}", "$", "model", "=", "new", "Message", "(", ")", ";", "$", "model", "->", "from", "=", "$", "from", ";", "$", "model", "->", "to", "=", "$", "to", ";", "$", "model", "->", "subject", "=", "$", "subject", ";", "$", "model", "->", "text", "=", "$", "text", ";", "$", "model", "->", "priority", "=", "$", "priority", ";", "$", "model", "->", "files", "=", "$", "files", ";", "$", "model", "->", "bcc", "=", "$", "bcc", ";", "return", "$", "model", "->", "save", "(", ")", ";", "}" ]
Queues email message @param $from @param $to @param $subject @param $text @param int $priority @param array $files @param null $bcc @return bool
[ "Queues", "email", "message" ]
4e83eae67199fc2b9eca9f08dcf59cc0440c385a
https://github.com/yarcode/yii2-email-manager/blob/4e83eae67199fc2b9eca9f08dcf59cc0440c385a/src/EmailManager.php#L70-L86
234,036
yarcode/yii2-email-manager
src/EmailManager.php
EmailManager.send
public function send($from, $to, $subject, $text, $files = [], $bcc = null) { $files = $files === null ? [] : $files; return $this->transports[$this->defaultTransport]->send($from, $to, $subject, $text, $files, $bcc); }
php
public function send($from, $to, $subject, $text, $files = [], $bcc = null) { $files = $files === null ? [] : $files; return $this->transports[$this->defaultTransport]->send($from, $to, $subject, $text, $files, $bcc); }
[ "public", "function", "send", "(", "$", "from", ",", "$", "to", ",", "$", "subject", ",", "$", "text", ",", "$", "files", "=", "[", "]", ",", "$", "bcc", "=", "null", ")", "{", "$", "files", "=", "$", "files", "===", "null", "?", "[", "]", ":", "$", "files", ";", "return", "$", "this", "->", "transports", "[", "$", "this", "->", "defaultTransport", "]", "->", "send", "(", "$", "from", ",", "$", "to", ",", "$", "subject", ",", "$", "text", ",", "$", "files", ",", "$", "bcc", ")", ";", "}" ]
Sends email message immediately using default transport @param string $from @param string $to @param string $subject @param string $text @param array $files @param array|string $bcc @return bool
[ "Sends", "email", "message", "immediately", "using", "default", "transport" ]
4e83eae67199fc2b9eca9f08dcf59cc0440c385a
https://github.com/yarcode/yii2-email-manager/blob/4e83eae67199fc2b9eca9f08dcf59cc0440c385a/src/EmailManager.php#L99-L104
234,037
skrz/meta
gen-src/Google/Protobuf/Meta/FileOptionsMeta.php
FileOptionsMeta.create
public static function create() { switch (func_num_args()) { case 0: return new FileOptions(); case 1: return new FileOptions(func_get_arg(0)); case 2: return new FileOptions(func_get_arg(0), func_get_arg(1)); case 3: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2)); case 4: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3)); case 5: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4)); case 6: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5)); case 7: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6)); case 8: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7)); default: throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.'); } }
php
public static function create() { switch (func_num_args()) { case 0: return new FileOptions(); case 1: return new FileOptions(func_get_arg(0)); case 2: return new FileOptions(func_get_arg(0), func_get_arg(1)); case 3: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2)); case 4: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3)); case 5: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4)); case 6: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5)); case 7: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6)); case 8: return new FileOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7)); default: throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.'); } }
[ "public", "static", "function", "create", "(", ")", "{", "switch", "(", "func_num_args", "(", ")", ")", "{", "case", "0", ":", "return", "new", "FileOptions", "(", ")", ";", "case", "1", ":", "return", "new", "FileOptions", "(", "func_get_arg", "(", "0", ")", ")", ";", "case", "2", ":", "return", "new", "FileOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ")", ";", "case", "3", ":", "return", "new", "FileOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ")", ";", "case", "4", ":", "return", "new", "FileOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ")", ";", "case", "5", ":", "return", "new", "FileOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ")", ";", "case", "6", ":", "return", "new", "FileOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ",", "func_get_arg", "(", "5", ")", ")", ";", "case", "7", ":", "return", "new", "FileOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ",", "func_get_arg", "(", "5", ")", ",", "func_get_arg", "(", "6", ")", ")", ";", "case", "8", ":", "return", "new", "FileOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ",", "func_get_arg", "(", "5", ")", ",", "func_get_arg", "(", "6", ")", ",", "func_get_arg", "(", "7", ")", ")", ";", "default", ":", "throw", "new", "\\", "InvalidArgumentException", "(", "'More than 8 arguments supplied, please be reasonable.'", ")", ";", "}", "}" ]
Creates new instance of \Google\Protobuf\FileOptions @throws \InvalidArgumentException @return FileOptions
[ "Creates", "new", "instance", "of", "\\", "Google", "\\", "Protobuf", "\\", "FileOptions" ]
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/FileOptionsMeta.php#L72-L96
234,038
skrz/meta
gen-src/Google/Protobuf/Meta/FileOptionsMeta.php
FileOptionsMeta.reset
public static function reset($object) { if (!($object instanceof FileOptions)) { throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\FileOptions.'); } $object->javaPackage = NULL; $object->javaOuterClassname = NULL; $object->javaMultipleFiles = NULL; $object->javaGenerateEqualsAndHash = NULL; $object->javaStringCheckUtf8 = NULL; $object->optimizeFor = NULL; $object->goPackage = NULL; $object->ccGenericServices = NULL; $object->javaGenericServices = NULL; $object->pyGenericServices = NULL; $object->deprecated = NULL; $object->ccEnableArenas = NULL; $object->objcClassPrefix = NULL; $object->csharpNamespace = NULL; $object->javananoUseDeprecatedPackage = NULL; $object->uninterpretedOption = NULL; }
php
public static function reset($object) { if (!($object instanceof FileOptions)) { throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\FileOptions.'); } $object->javaPackage = NULL; $object->javaOuterClassname = NULL; $object->javaMultipleFiles = NULL; $object->javaGenerateEqualsAndHash = NULL; $object->javaStringCheckUtf8 = NULL; $object->optimizeFor = NULL; $object->goPackage = NULL; $object->ccGenericServices = NULL; $object->javaGenericServices = NULL; $object->pyGenericServices = NULL; $object->deprecated = NULL; $object->ccEnableArenas = NULL; $object->objcClassPrefix = NULL; $object->csharpNamespace = NULL; $object->javananoUseDeprecatedPackage = NULL; $object->uninterpretedOption = NULL; }
[ "public", "static", "function", "reset", "(", "$", "object", ")", "{", "if", "(", "!", "(", "$", "object", "instanceof", "FileOptions", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'You have to pass object of class Google\\Protobuf\\FileOptions.'", ")", ";", "}", "$", "object", "->", "javaPackage", "=", "NULL", ";", "$", "object", "->", "javaOuterClassname", "=", "NULL", ";", "$", "object", "->", "javaMultipleFiles", "=", "NULL", ";", "$", "object", "->", "javaGenerateEqualsAndHash", "=", "NULL", ";", "$", "object", "->", "javaStringCheckUtf8", "=", "NULL", ";", "$", "object", "->", "optimizeFor", "=", "NULL", ";", "$", "object", "->", "goPackage", "=", "NULL", ";", "$", "object", "->", "ccGenericServices", "=", "NULL", ";", "$", "object", "->", "javaGenericServices", "=", "NULL", ";", "$", "object", "->", "pyGenericServices", "=", "NULL", ";", "$", "object", "->", "deprecated", "=", "NULL", ";", "$", "object", "->", "ccEnableArenas", "=", "NULL", ";", "$", "object", "->", "objcClassPrefix", "=", "NULL", ";", "$", "object", "->", "csharpNamespace", "=", "NULL", ";", "$", "object", "->", "javananoUseDeprecatedPackage", "=", "NULL", ";", "$", "object", "->", "uninterpretedOption", "=", "NULL", ";", "}" ]
Resets properties of \Google\Protobuf\FileOptions to default values @param FileOptions $object @throws \InvalidArgumentException @return void
[ "Resets", "properties", "of", "\\", "Google", "\\", "Protobuf", "\\", "FileOptions", "to", "default", "values" ]
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/FileOptionsMeta.php#L109-L130
234,039
yeephp/yeephp
Yee/Router.php
Router.map
public function map(\Yee\Route $route) { list($groupPattern, $groupMiddleware) = $this->processGroups(); $route->setPattern($groupPattern . $route->getPattern()); $this->routes[] = $route; foreach ($groupMiddleware as $middleware) { $route->setMiddleware($middleware); } }
php
public function map(\Yee\Route $route) { list($groupPattern, $groupMiddleware) = $this->processGroups(); $route->setPattern($groupPattern . $route->getPattern()); $this->routes[] = $route; foreach ($groupMiddleware as $middleware) { $route->setMiddleware($middleware); } }
[ "public", "function", "map", "(", "\\", "Yee", "\\", "Route", "$", "route", ")", "{", "list", "(", "$", "groupPattern", ",", "$", "groupMiddleware", ")", "=", "$", "this", "->", "processGroups", "(", ")", ";", "$", "route", "->", "setPattern", "(", "$", "groupPattern", ".", "$", "route", "->", "getPattern", "(", ")", ")", ";", "$", "this", "->", "routes", "[", "]", "=", "$", "route", ";", "foreach", "(", "$", "groupMiddleware", "as", "$", "middleware", ")", "{", "$", "route", "->", "setMiddleware", "(", "$", "middleware", ")", ";", "}", "}" ]
Add a route object to the router @param \Yee\Route $route The Yee Route
[ "Add", "a", "route", "object", "to", "the", "router" ]
6107f60ceaf0811a6550872bd669580ac282cb1f
https://github.com/yeephp/yeephp/blob/6107f60ceaf0811a6550872bd669580ac282cb1f/Yee/Router.php#L126-L137
234,040
yeephp/yeephp
Yee/Router.php
Router.getNamedRoute
public function getNamedRoute($name) { $this->getNamedRoutes(); if ($this->hasNamedRoute($name)) { return $this->namedRoutes[(string) $name]; } else { return null; } }
php
public function getNamedRoute($name) { $this->getNamedRoutes(); if ($this->hasNamedRoute($name)) { return $this->namedRoutes[(string) $name]; } else { return null; } }
[ "public", "function", "getNamedRoute", "(", "$", "name", ")", "{", "$", "this", "->", "getNamedRoutes", "(", ")", ";", "if", "(", "$", "this", "->", "hasNamedRoute", "(", "$", "name", ")", ")", "{", "return", "$", "this", "->", "namedRoutes", "[", "(", "string", ")", "$", "name", "]", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Get named route @param string $name @return \Yee\Route|null
[ "Get", "named", "route" ]
6107f60ceaf0811a6550872bd669580ac282cb1f
https://github.com/yeephp/yeephp/blob/6107f60ceaf0811a6550872bd669580ac282cb1f/Yee/Router.php#L230-L238
234,041
baleen/migrations
src/Delta/Collection/Resolver/AbstractResolver.php
AbstractResolver.cacheGet
private function cacheGet($alias, Collection $collection) { $result = false; if ($this->cacheEnabled) { $hash = spl_object_hash($collection); if (isset($this->cache[$hash]) && array_key_exists($alias, $this->cache[$hash])) { $result = $this->cache[$hash][$alias]; } } return $result; }
php
private function cacheGet($alias, Collection $collection) { $result = false; if ($this->cacheEnabled) { $hash = spl_object_hash($collection); if (isset($this->cache[$hash]) && array_key_exists($alias, $this->cache[$hash])) { $result = $this->cache[$hash][$alias]; } } return $result; }
[ "private", "function", "cacheGet", "(", "$", "alias", ",", "Collection", "$", "collection", ")", "{", "$", "result", "=", "false", ";", "if", "(", "$", "this", "->", "cacheEnabled", ")", "{", "$", "hash", "=", "spl_object_hash", "(", "$", "collection", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "cache", "[", "$", "hash", "]", ")", "&&", "array_key_exists", "(", "$", "alias", ",", "$", "this", "->", "cache", "[", "$", "hash", "]", ")", ")", "{", "$", "result", "=", "$", "this", "->", "cache", "[", "$", "hash", "]", "[", "$", "alias", "]", ";", "}", "}", "return", "$", "result", ";", "}" ]
Gets an alias from the cache. Returns false if nothing could be found, a Delta if the alias was previously resolved to a version, and null if the alias couldn't be resolved in a previous call. @param string $alias @param Collection $collection @return bool|null|DeltaInterface
[ "Gets", "an", "alias", "from", "the", "cache", ".", "Returns", "false", "if", "nothing", "could", "be", "found", "a", "Delta", "if", "the", "alias", "was", "previously", "resolved", "to", "a", "version", "and", "null", "if", "the", "alias", "couldn", "t", "be", "resolved", "in", "a", "previous", "call", "." ]
cfc8c439858cf4f0d4119af9eb67de493da8d95c
https://github.com/baleen/migrations/blob/cfc8c439858cf4f0d4119af9eb67de493da8d95c/src/Delta/Collection/Resolver/AbstractResolver.php#L82-L94
234,042
baleen/migrations
src/Delta/Collection/Resolver/AbstractResolver.php
AbstractResolver.cacheSet
private function cacheSet($alias, $collection, $result) { if (!$this->cacheEnabled) { return null; } $hash = spl_object_hash($collection); if (!isset($this->cache[$hash])) { $this->cache[$hash] = []; // initialize the collection's cache } $this->cache[$hash][$alias] = $result; }
php
private function cacheSet($alias, $collection, $result) { if (!$this->cacheEnabled) { return null; } $hash = spl_object_hash($collection); if (!isset($this->cache[$hash])) { $this->cache[$hash] = []; // initialize the collection's cache } $this->cache[$hash][$alias] = $result; }
[ "private", "function", "cacheSet", "(", "$", "alias", ",", "$", "collection", ",", "$", "result", ")", "{", "if", "(", "!", "$", "this", "->", "cacheEnabled", ")", "{", "return", "null", ";", "}", "$", "hash", "=", "spl_object_hash", "(", "$", "collection", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "cache", "[", "$", "hash", "]", ")", ")", "{", "$", "this", "->", "cache", "[", "$", "hash", "]", "=", "[", "]", ";", "// initialize the collection's cache", "}", "$", "this", "->", "cache", "[", "$", "hash", "]", "[", "$", "alias", "]", "=", "$", "result", ";", "}" ]
Saves the result of resolving an alias against a given collection into the cache. @param string $alias @param \Baleen\Migrations\Delta\Collection\Collection $collection @param null|DeltaInterface $result @return void
[ "Saves", "the", "result", "of", "resolving", "an", "alias", "against", "a", "given", "collection", "into", "the", "cache", "." ]
cfc8c439858cf4f0d4119af9eb67de493da8d95c
https://github.com/baleen/migrations/blob/cfc8c439858cf4f0d4119af9eb67de493da8d95c/src/Delta/Collection/Resolver/AbstractResolver.php#L105-L116
234,043
skrz/meta
gen-src/Google/Protobuf/Meta/FieldOptionsMeta.php
FieldOptionsMeta.create
public static function create() { switch (func_num_args()) { case 0: return new FieldOptions(); case 1: return new FieldOptions(func_get_arg(0)); case 2: return new FieldOptions(func_get_arg(0), func_get_arg(1)); case 3: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2)); case 4: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3)); case 5: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4)); case 6: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5)); case 7: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6)); case 8: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7)); default: throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.'); } }
php
public static function create() { switch (func_num_args()) { case 0: return new FieldOptions(); case 1: return new FieldOptions(func_get_arg(0)); case 2: return new FieldOptions(func_get_arg(0), func_get_arg(1)); case 3: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2)); case 4: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3)); case 5: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4)); case 6: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5)); case 7: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6)); case 8: return new FieldOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7)); default: throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.'); } }
[ "public", "static", "function", "create", "(", ")", "{", "switch", "(", "func_num_args", "(", ")", ")", "{", "case", "0", ":", "return", "new", "FieldOptions", "(", ")", ";", "case", "1", ":", "return", "new", "FieldOptions", "(", "func_get_arg", "(", "0", ")", ")", ";", "case", "2", ":", "return", "new", "FieldOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ")", ";", "case", "3", ":", "return", "new", "FieldOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ")", ";", "case", "4", ":", "return", "new", "FieldOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ")", ";", "case", "5", ":", "return", "new", "FieldOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ")", ";", "case", "6", ":", "return", "new", "FieldOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ",", "func_get_arg", "(", "5", ")", ")", ";", "case", "7", ":", "return", "new", "FieldOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ",", "func_get_arg", "(", "5", ")", ",", "func_get_arg", "(", "6", ")", ")", ";", "case", "8", ":", "return", "new", "FieldOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ",", "func_get_arg", "(", "5", ")", ",", "func_get_arg", "(", "6", ")", ",", "func_get_arg", "(", "7", ")", ")", ";", "default", ":", "throw", "new", "\\", "InvalidArgumentException", "(", "'More than 8 arguments supplied, please be reasonable.'", ")", ";", "}", "}" ]
Creates new instance of \Google\Protobuf\FieldOptions @throws \InvalidArgumentException @return FieldOptions
[ "Creates", "new", "instance", "of", "\\", "Google", "\\", "Protobuf", "\\", "FieldOptions" ]
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/FieldOptionsMeta.php#L63-L87
234,044
skrz/meta
gen-src/Google/Protobuf/Meta/FieldOptionsMeta.php
FieldOptionsMeta.reset
public static function reset($object) { if (!($object instanceof FieldOptions)) { throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\FieldOptions.'); } $object->ctype = NULL; $object->packed = NULL; $object->jstype = NULL; $object->lazy = NULL; $object->deprecated = NULL; $object->weak = NULL; $object->uninterpretedOption = NULL; }
php
public static function reset($object) { if (!($object instanceof FieldOptions)) { throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\FieldOptions.'); } $object->ctype = NULL; $object->packed = NULL; $object->jstype = NULL; $object->lazy = NULL; $object->deprecated = NULL; $object->weak = NULL; $object->uninterpretedOption = NULL; }
[ "public", "static", "function", "reset", "(", "$", "object", ")", "{", "if", "(", "!", "(", "$", "object", "instanceof", "FieldOptions", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'You have to pass object of class Google\\Protobuf\\FieldOptions.'", ")", ";", "}", "$", "object", "->", "ctype", "=", "NULL", ";", "$", "object", "->", "packed", "=", "NULL", ";", "$", "object", "->", "jstype", "=", "NULL", ";", "$", "object", "->", "lazy", "=", "NULL", ";", "$", "object", "->", "deprecated", "=", "NULL", ";", "$", "object", "->", "weak", "=", "NULL", ";", "$", "object", "->", "uninterpretedOption", "=", "NULL", ";", "}" ]
Resets properties of \Google\Protobuf\FieldOptions to default values @param FieldOptions $object @throws \InvalidArgumentException @return void
[ "Resets", "properties", "of", "\\", "Google", "\\", "Protobuf", "\\", "FieldOptions", "to", "default", "values" ]
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/FieldOptionsMeta.php#L100-L112
234,045
skrz/meta
gen-src/Google/Protobuf/Meta/FieldOptionsMeta.php
FieldOptionsMeta.hash
public static function hash($object, $algoOrCtx = 'md5', $raw = FALSE) { if (is_string($algoOrCtx)) { $ctx = hash_init($algoOrCtx); } else { $ctx = $algoOrCtx; } if (isset($object->ctype)) { hash_update($ctx, 'ctype'); hash_update($ctx, (string)$object->ctype); } if (isset($object->packed)) { hash_update($ctx, 'packed'); hash_update($ctx, (string)$object->packed); } if (isset($object->jstype)) { hash_update($ctx, 'jstype'); hash_update($ctx, (string)$object->jstype); } if (isset($object->lazy)) { hash_update($ctx, 'lazy'); hash_update($ctx, (string)$object->lazy); } if (isset($object->deprecated)) { hash_update($ctx, 'deprecated'); hash_update($ctx, (string)$object->deprecated); } if (isset($object->weak)) { hash_update($ctx, 'weak'); hash_update($ctx, (string)$object->weak); } if (isset($object->uninterpretedOption)) { hash_update($ctx, 'uninterpretedOption'); foreach ($object->uninterpretedOption instanceof \Traversable ? $object->uninterpretedOption : (array)$object->uninterpretedOption as $v0) { UninterpretedOptionMeta::hash($v0, $ctx); } } if (is_string($algoOrCtx)) { return hash_final($ctx, $raw); } else { return null; } }
php
public static function hash($object, $algoOrCtx = 'md5', $raw = FALSE) { if (is_string($algoOrCtx)) { $ctx = hash_init($algoOrCtx); } else { $ctx = $algoOrCtx; } if (isset($object->ctype)) { hash_update($ctx, 'ctype'); hash_update($ctx, (string)$object->ctype); } if (isset($object->packed)) { hash_update($ctx, 'packed'); hash_update($ctx, (string)$object->packed); } if (isset($object->jstype)) { hash_update($ctx, 'jstype'); hash_update($ctx, (string)$object->jstype); } if (isset($object->lazy)) { hash_update($ctx, 'lazy'); hash_update($ctx, (string)$object->lazy); } if (isset($object->deprecated)) { hash_update($ctx, 'deprecated'); hash_update($ctx, (string)$object->deprecated); } if (isset($object->weak)) { hash_update($ctx, 'weak'); hash_update($ctx, (string)$object->weak); } if (isset($object->uninterpretedOption)) { hash_update($ctx, 'uninterpretedOption'); foreach ($object->uninterpretedOption instanceof \Traversable ? $object->uninterpretedOption : (array)$object->uninterpretedOption as $v0) { UninterpretedOptionMeta::hash($v0, $ctx); } } if (is_string($algoOrCtx)) { return hash_final($ctx, $raw); } else { return null; } }
[ "public", "static", "function", "hash", "(", "$", "object", ",", "$", "algoOrCtx", "=", "'md5'", ",", "$", "raw", "=", "FALSE", ")", "{", "if", "(", "is_string", "(", "$", "algoOrCtx", ")", ")", "{", "$", "ctx", "=", "hash_init", "(", "$", "algoOrCtx", ")", ";", "}", "else", "{", "$", "ctx", "=", "$", "algoOrCtx", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "ctype", ")", ")", "{", "hash_update", "(", "$", "ctx", ",", "'ctype'", ")", ";", "hash_update", "(", "$", "ctx", ",", "(", "string", ")", "$", "object", "->", "ctype", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "packed", ")", ")", "{", "hash_update", "(", "$", "ctx", ",", "'packed'", ")", ";", "hash_update", "(", "$", "ctx", ",", "(", "string", ")", "$", "object", "->", "packed", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "jstype", ")", ")", "{", "hash_update", "(", "$", "ctx", ",", "'jstype'", ")", ";", "hash_update", "(", "$", "ctx", ",", "(", "string", ")", "$", "object", "->", "jstype", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "lazy", ")", ")", "{", "hash_update", "(", "$", "ctx", ",", "'lazy'", ")", ";", "hash_update", "(", "$", "ctx", ",", "(", "string", ")", "$", "object", "->", "lazy", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "deprecated", ")", ")", "{", "hash_update", "(", "$", "ctx", ",", "'deprecated'", ")", ";", "hash_update", "(", "$", "ctx", ",", "(", "string", ")", "$", "object", "->", "deprecated", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "weak", ")", ")", "{", "hash_update", "(", "$", "ctx", ",", "'weak'", ")", ";", "hash_update", "(", "$", "ctx", ",", "(", "string", ")", "$", "object", "->", "weak", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "uninterpretedOption", ")", ")", "{", "hash_update", "(", "$", "ctx", ",", "'uninterpretedOption'", ")", ";", "foreach", "(", "$", "object", "->", "uninterpretedOption", "instanceof", "\\", "Traversable", "?", "$", "object", "->", "uninterpretedOption", ":", "(", "array", ")", "$", "object", "->", "uninterpretedOption", "as", "$", "v0", ")", "{", "UninterpretedOptionMeta", "::", "hash", "(", "$", "v0", ",", "$", "ctx", ")", ";", "}", "}", "if", "(", "is_string", "(", "$", "algoOrCtx", ")", ")", "{", "return", "hash_final", "(", "$", "ctx", ",", "$", "raw", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Computes hash of \Google\Protobuf\FieldOptions @param object $object @param string|resource $algoOrCtx @param bool $raw @return string|void
[ "Computes", "hash", "of", "\\", "Google", "\\", "Protobuf", "\\", "FieldOptions" ]
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/FieldOptionsMeta.php#L124-L174
234,046
skrz/meta
gen-src/Google/Protobuf/Meta/FieldOptionsMeta.php
FieldOptionsMeta.toProtobuf
public static function toProtobuf($object, $filter = NULL) { $output = ''; if (isset($object->ctype) && ($filter === null || isset($filter['ctype']))) { $output .= "\x08"; $output .= Binary::encodeVarint($object->ctype); } if (isset($object->packed) && ($filter === null || isset($filter['packed']))) { $output .= "\x10"; $output .= Binary::encodeVarint((int)$object->packed); } if (isset($object->jstype) && ($filter === null || isset($filter['jstype']))) { $output .= "\x30"; $output .= Binary::encodeVarint($object->jstype); } if (isset($object->lazy) && ($filter === null || isset($filter['lazy']))) { $output .= "\x28"; $output .= Binary::encodeVarint((int)$object->lazy); } if (isset($object->deprecated) && ($filter === null || isset($filter['deprecated']))) { $output .= "\x18"; $output .= Binary::encodeVarint((int)$object->deprecated); } if (isset($object->weak) && ($filter === null || isset($filter['weak']))) { $output .= "\x50"; $output .= Binary::encodeVarint((int)$object->weak); } if (isset($object->uninterpretedOption) && ($filter === null || isset($filter['uninterpretedOption']))) { foreach ($object->uninterpretedOption instanceof \Traversable ? $object->uninterpretedOption : (array)$object->uninterpretedOption as $k => $v) { $output .= "\xba\x3e"; $buffer = UninterpretedOptionMeta::toProtobuf($v, $filter === null ? null : $filter['uninterpretedOption']); $output .= Binary::encodeVarint(strlen($buffer)); $output .= $buffer; } } return $output; }
php
public static function toProtobuf($object, $filter = NULL) { $output = ''; if (isset($object->ctype) && ($filter === null || isset($filter['ctype']))) { $output .= "\x08"; $output .= Binary::encodeVarint($object->ctype); } if (isset($object->packed) && ($filter === null || isset($filter['packed']))) { $output .= "\x10"; $output .= Binary::encodeVarint((int)$object->packed); } if (isset($object->jstype) && ($filter === null || isset($filter['jstype']))) { $output .= "\x30"; $output .= Binary::encodeVarint($object->jstype); } if (isset($object->lazy) && ($filter === null || isset($filter['lazy']))) { $output .= "\x28"; $output .= Binary::encodeVarint((int)$object->lazy); } if (isset($object->deprecated) && ($filter === null || isset($filter['deprecated']))) { $output .= "\x18"; $output .= Binary::encodeVarint((int)$object->deprecated); } if (isset($object->weak) && ($filter === null || isset($filter['weak']))) { $output .= "\x50"; $output .= Binary::encodeVarint((int)$object->weak); } if (isset($object->uninterpretedOption) && ($filter === null || isset($filter['uninterpretedOption']))) { foreach ($object->uninterpretedOption instanceof \Traversable ? $object->uninterpretedOption : (array)$object->uninterpretedOption as $k => $v) { $output .= "\xba\x3e"; $buffer = UninterpretedOptionMeta::toProtobuf($v, $filter === null ? null : $filter['uninterpretedOption']); $output .= Binary::encodeVarint(strlen($buffer)); $output .= $buffer; } } return $output; }
[ "public", "static", "function", "toProtobuf", "(", "$", "object", ",", "$", "filter", "=", "NULL", ")", "{", "$", "output", "=", "''", ";", "if", "(", "isset", "(", "$", "object", "->", "ctype", ")", "&&", "(", "$", "filter", "===", "null", "||", "isset", "(", "$", "filter", "[", "'ctype'", "]", ")", ")", ")", "{", "$", "output", ".=", "\"\\x08\"", ";", "$", "output", ".=", "Binary", "::", "encodeVarint", "(", "$", "object", "->", "ctype", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "packed", ")", "&&", "(", "$", "filter", "===", "null", "||", "isset", "(", "$", "filter", "[", "'packed'", "]", ")", ")", ")", "{", "$", "output", ".=", "\"\\x10\"", ";", "$", "output", ".=", "Binary", "::", "encodeVarint", "(", "(", "int", ")", "$", "object", "->", "packed", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "jstype", ")", "&&", "(", "$", "filter", "===", "null", "||", "isset", "(", "$", "filter", "[", "'jstype'", "]", ")", ")", ")", "{", "$", "output", ".=", "\"\\x30\"", ";", "$", "output", ".=", "Binary", "::", "encodeVarint", "(", "$", "object", "->", "jstype", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "lazy", ")", "&&", "(", "$", "filter", "===", "null", "||", "isset", "(", "$", "filter", "[", "'lazy'", "]", ")", ")", ")", "{", "$", "output", ".=", "\"\\x28\"", ";", "$", "output", ".=", "Binary", "::", "encodeVarint", "(", "(", "int", ")", "$", "object", "->", "lazy", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "deprecated", ")", "&&", "(", "$", "filter", "===", "null", "||", "isset", "(", "$", "filter", "[", "'deprecated'", "]", ")", ")", ")", "{", "$", "output", ".=", "\"\\x18\"", ";", "$", "output", ".=", "Binary", "::", "encodeVarint", "(", "(", "int", ")", "$", "object", "->", "deprecated", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "weak", ")", "&&", "(", "$", "filter", "===", "null", "||", "isset", "(", "$", "filter", "[", "'weak'", "]", ")", ")", ")", "{", "$", "output", ".=", "\"\\x50\"", ";", "$", "output", ".=", "Binary", "::", "encodeVarint", "(", "(", "int", ")", "$", "object", "->", "weak", ")", ";", "}", "if", "(", "isset", "(", "$", "object", "->", "uninterpretedOption", ")", "&&", "(", "$", "filter", "===", "null", "||", "isset", "(", "$", "filter", "[", "'uninterpretedOption'", "]", ")", ")", ")", "{", "foreach", "(", "$", "object", "->", "uninterpretedOption", "instanceof", "\\", "Traversable", "?", "$", "object", "->", "uninterpretedOption", ":", "(", "array", ")", "$", "object", "->", "uninterpretedOption", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "output", ".=", "\"\\xba\\x3e\"", ";", "$", "buffer", "=", "UninterpretedOptionMeta", "::", "toProtobuf", "(", "$", "v", ",", "$", "filter", "===", "null", "?", "null", ":", "$", "filter", "[", "'uninterpretedOption'", "]", ")", ";", "$", "output", ".=", "Binary", "::", "encodeVarint", "(", "strlen", "(", "$", "buffer", ")", ")", ";", "$", "output", ".=", "$", "buffer", ";", "}", "}", "return", "$", "output", ";", "}" ]
Serialized \Google\Protobuf\FieldOptions to Protocol Buffers message. @param FieldOptions $object @param array $filter @throws \Exception @return string
[ "Serialized", "\\", "Google", "\\", "Protobuf", "\\", "FieldOptions", "to", "Protocol", "Buffers", "message", "." ]
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/FieldOptionsMeta.php#L291-L335
234,047
nymo/silex-twig-breadcrumb-extension
src/nymo/Resources/Library/BreadCrumbCollection.php
BreadCrumbCollection.addItem
public function addItem($linkName, $target = null) { if (is_array($target)) { $target = isset($target['params']) ? $this->urlGen->generate( $target['route'], $target['params'] ) : $this->urlGen->generate($target['route']); } $this->items[] = ["linkName" => $linkName, "target" => $target]; }
php
public function addItem($linkName, $target = null) { if (is_array($target)) { $target = isset($target['params']) ? $this->urlGen->generate( $target['route'], $target['params'] ) : $this->urlGen->generate($target['route']); } $this->items[] = ["linkName" => $linkName, "target" => $target]; }
[ "public", "function", "addItem", "(", "$", "linkName", ",", "$", "target", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "target", ")", ")", "{", "$", "target", "=", "isset", "(", "$", "target", "[", "'params'", "]", ")", "?", "$", "this", "->", "urlGen", "->", "generate", "(", "$", "target", "[", "'route'", "]", ",", "$", "target", "[", "'params'", "]", ")", ":", "$", "this", "->", "urlGen", "->", "generate", "(", "$", "target", "[", "'route'", "]", ")", ";", "}", "$", "this", "->", "items", "[", "]", "=", "[", "\"linkName\"", "=>", "$", "linkName", ",", "\"target\"", "=>", "$", "target", "]", ";", "}" ]
Add new breadcrumb item @param string $linkName @param string|null $target @deprecated since 3.0 will be removed in 3.1 use function addSimpleItem or addRouteItem instead @return void
[ "Add", "new", "breadcrumb", "item" ]
9ddf46710f40ba06b47427d01e5b8c7e6c1d0b56
https://github.com/nymo/silex-twig-breadcrumb-extension/blob/9ddf46710f40ba06b47427d01e5b8c7e6c1d0b56/src/nymo/Resources/Library/BreadCrumbCollection.php#L38-L47
234,048
nymo/silex-twig-breadcrumb-extension
src/nymo/Resources/Library/BreadCrumbCollection.php
BreadCrumbCollection.addSimpleItem
public function addSimpleItem(string $linkName, string $target = null): void { $this->items[] = ["linkName" => $linkName, "target" => $target]; }
php
public function addSimpleItem(string $linkName, string $target = null): void { $this->items[] = ["linkName" => $linkName, "target" => $target]; }
[ "public", "function", "addSimpleItem", "(", "string", "$", "linkName", ",", "string", "$", "target", "=", "null", ")", ":", "void", "{", "$", "this", "->", "items", "[", "]", "=", "[", "\"linkName\"", "=>", "$", "linkName", ",", "\"target\"", "=>", "$", "target", "]", ";", "}" ]
Adds new simple breadcrumb item. Leave target empty to create a breadcrumb item without a link. @param string $linkName @param string|null $target @return void
[ "Adds", "new", "simple", "breadcrumb", "item", ".", "Leave", "target", "empty", "to", "create", "a", "breadcrumb", "item", "without", "a", "link", "." ]
9ddf46710f40ba06b47427d01e5b8c7e6c1d0b56
https://github.com/nymo/silex-twig-breadcrumb-extension/blob/9ddf46710f40ba06b47427d01e5b8c7e6c1d0b56/src/nymo/Resources/Library/BreadCrumbCollection.php#L55-L58
234,049
nymo/silex-twig-breadcrumb-extension
src/nymo/Resources/Library/BreadCrumbCollection.php
BreadCrumbCollection.addRouteItem
public function addRouteItem(string $linkName, array $route): void { $url = isset($route['params']) ? $this->urlGen->generate($route['route'], $route['params']) : $this->urlGen->generate($route['route']); $this->addSimpleItem($linkName, $url); }
php
public function addRouteItem(string $linkName, array $route): void { $url = isset($route['params']) ? $this->urlGen->generate($route['route'], $route['params']) : $this->urlGen->generate($route['route']); $this->addSimpleItem($linkName, $url); }
[ "public", "function", "addRouteItem", "(", "string", "$", "linkName", ",", "array", "$", "route", ")", ":", "void", "{", "$", "url", "=", "isset", "(", "$", "route", "[", "'params'", "]", ")", "?", "$", "this", "->", "urlGen", "->", "generate", "(", "$", "route", "[", "'route'", "]", ",", "$", "route", "[", "'params'", "]", ")", ":", "$", "this", "->", "urlGen", "->", "generate", "(", "$", "route", "[", "'route'", "]", ")", ";", "$", "this", "->", "addSimpleItem", "(", "$", "linkName", ",", "$", "url", ")", ";", "}" ]
Adds new breadcrumb item where target is being generated by the url generator @param string $linkName @param array $route @return void
[ "Adds", "new", "breadcrumb", "item", "where", "target", "is", "being", "generated", "by", "the", "url", "generator" ]
9ddf46710f40ba06b47427d01e5b8c7e6c1d0b56
https://github.com/nymo/silex-twig-breadcrumb-extension/blob/9ddf46710f40ba06b47427d01e5b8c7e6c1d0b56/src/nymo/Resources/Library/BreadCrumbCollection.php#L66-L72
234,050
kss-php/kss-php
lib/Section.php
Section.getTitle
public function getTitle() { $title = ''; $titleComment = $this->getTitleComment(); if (preg_match('/^\s*#+\s*(.+)/', $titleComment, $matches)) { $title = $matches[1]; } elseif (self::isReferenceNumeric($this->getReference())) { return $this->getReference(); } else { $reference = $this->getReferenceParts(); return end($reference); } return $title; }
php
public function getTitle() { $title = ''; $titleComment = $this->getTitleComment(); if (preg_match('/^\s*#+\s*(.+)/', $titleComment, $matches)) { $title = $matches[1]; } elseif (self::isReferenceNumeric($this->getReference())) { return $this->getReference(); } else { $reference = $this->getReferenceParts(); return end($reference); } return $title; }
[ "public", "function", "getTitle", "(", ")", "{", "$", "title", "=", "''", ";", "$", "titleComment", "=", "$", "this", "->", "getTitleComment", "(", ")", ";", "if", "(", "preg_match", "(", "'/^\\s*#+\\s*(.+)/'", ",", "$", "titleComment", ",", "$", "matches", ")", ")", "{", "$", "title", "=", "$", "matches", "[", "1", "]", ";", "}", "elseif", "(", "self", "::", "isReferenceNumeric", "(", "$", "this", "->", "getReference", "(", ")", ")", ")", "{", "return", "$", "this", "->", "getReference", "(", ")", ";", "}", "else", "{", "$", "reference", "=", "$", "this", "->", "getReferenceParts", "(", ")", ";", "return", "end", "(", "$", "reference", ")", ";", "}", "return", "$", "title", ";", "}" ]
Returns the title of the section @return string
[ "Returns", "the", "title", "of", "the", "section" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L108-L123
234,051
kss-php/kss-php
lib/Section.php
Section.getDescription
public function getDescription() { $descriptionSections = array(); foreach ($this->getCommentSections() as $commentSection) { // Anything that is not the section comment or modifiers comment // must be the description comment if ($commentSection != $this->getReferenceComment() && $commentSection != $this->getTitleComment() && $commentSection != $this->getMarkupComment() && $commentSection != $this->getDeprecatedComment() && $commentSection != $this->getExperimentalComment() && $commentSection != $this->getCompatibilityComment() && $commentSection != $this->getModifiersComment() && $commentSection != $this->getParametersComment() ) { $descriptionSections[] = $commentSection; } } return implode("\n\n", $descriptionSections); }
php
public function getDescription() { $descriptionSections = array(); foreach ($this->getCommentSections() as $commentSection) { // Anything that is not the section comment or modifiers comment // must be the description comment if ($commentSection != $this->getReferenceComment() && $commentSection != $this->getTitleComment() && $commentSection != $this->getMarkupComment() && $commentSection != $this->getDeprecatedComment() && $commentSection != $this->getExperimentalComment() && $commentSection != $this->getCompatibilityComment() && $commentSection != $this->getModifiersComment() && $commentSection != $this->getParametersComment() ) { $descriptionSections[] = $commentSection; } } return implode("\n\n", $descriptionSections); }
[ "public", "function", "getDescription", "(", ")", "{", "$", "descriptionSections", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getCommentSections", "(", ")", "as", "$", "commentSection", ")", "{", "// Anything that is not the section comment or modifiers comment", "// must be the description comment", "if", "(", "$", "commentSection", "!=", "$", "this", "->", "getReferenceComment", "(", ")", "&&", "$", "commentSection", "!=", "$", "this", "->", "getTitleComment", "(", ")", "&&", "$", "commentSection", "!=", "$", "this", "->", "getMarkupComment", "(", ")", "&&", "$", "commentSection", "!=", "$", "this", "->", "getDeprecatedComment", "(", ")", "&&", "$", "commentSection", "!=", "$", "this", "->", "getExperimentalComment", "(", ")", "&&", "$", "commentSection", "!=", "$", "this", "->", "getCompatibilityComment", "(", ")", "&&", "$", "commentSection", "!=", "$", "this", "->", "getModifiersComment", "(", ")", "&&", "$", "commentSection", "!=", "$", "this", "->", "getParametersComment", "(", ")", ")", "{", "$", "descriptionSections", "[", "]", "=", "$", "commentSection", ";", "}", "}", "return", "implode", "(", "\"\\n\\n\"", ",", "$", "descriptionSections", ")", ";", "}" ]
Returns the description for the section @return string
[ "Returns", "the", "description", "for", "the", "section" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L130-L151
234,052
kss-php/kss-php
lib/Section.php
Section.getMarkup
public function getMarkup() { if ($this->markup === null) { if ($markupComment = $this->getMarkupComment()) { $this->markup = trim(preg_replace('/^\s*Markup:/i', '', $markupComment)); } } return $this->markup; }
php
public function getMarkup() { if ($this->markup === null) { if ($markupComment = $this->getMarkupComment()) { $this->markup = trim(preg_replace('/^\s*Markup:/i', '', $markupComment)); } } return $this->markup; }
[ "public", "function", "getMarkup", "(", ")", "{", "if", "(", "$", "this", "->", "markup", "===", "null", ")", "{", "if", "(", "$", "markupComment", "=", "$", "this", "->", "getMarkupComment", "(", ")", ")", "{", "$", "this", "->", "markup", "=", "trim", "(", "preg_replace", "(", "'/^\\s*Markup:/i'", ",", "''", ",", "$", "markupComment", ")", ")", ";", "}", "}", "return", "$", "this", "->", "markup", ";", "}" ]
Returns the markup defined in the section @return string
[ "Returns", "the", "markup", "defined", "in", "the", "section" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L158-L167
234,053
kss-php/kss-php
lib/Section.php
Section.getDeprecated
public function getDeprecated() { if ($this->deprecated === null) { if ($deprecatedComment = $this->getDeprecatedComment()) { $this->deprecated = trim(preg_replace('/^\s*Deprecated:/i', '', $deprecatedComment)); } } return $this->deprecated; }
php
public function getDeprecated() { if ($this->deprecated === null) { if ($deprecatedComment = $this->getDeprecatedComment()) { $this->deprecated = trim(preg_replace('/^\s*Deprecated:/i', '', $deprecatedComment)); } } return $this->deprecated; }
[ "public", "function", "getDeprecated", "(", ")", "{", "if", "(", "$", "this", "->", "deprecated", "===", "null", ")", "{", "if", "(", "$", "deprecatedComment", "=", "$", "this", "->", "getDeprecatedComment", "(", ")", ")", "{", "$", "this", "->", "deprecated", "=", "trim", "(", "preg_replace", "(", "'/^\\s*Deprecated:/i'", ",", "''", ",", "$", "deprecatedComment", ")", ")", ";", "}", "}", "return", "$", "this", "->", "deprecated", ";", "}" ]
Returns the deprecation notice defined in the section @return string
[ "Returns", "the", "deprecation", "notice", "defined", "in", "the", "section" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L195-L204
234,054
kss-php/kss-php
lib/Section.php
Section.getExperimental
public function getExperimental() { if ($this->experimental === null) { if ($experimentalComment = $this->getExperimentalComment()) { $this->experimental = trim(preg_replace('/^\s*Experimental:/i', '', $experimentalComment)); } } return $this->experimental; }
php
public function getExperimental() { if ($this->experimental === null) { if ($experimentalComment = $this->getExperimentalComment()) { $this->experimental = trim(preg_replace('/^\s*Experimental:/i', '', $experimentalComment)); } } return $this->experimental; }
[ "public", "function", "getExperimental", "(", ")", "{", "if", "(", "$", "this", "->", "experimental", "===", "null", ")", "{", "if", "(", "$", "experimentalComment", "=", "$", "this", "->", "getExperimentalComment", "(", ")", ")", "{", "$", "this", "->", "experimental", "=", "trim", "(", "preg_replace", "(", "'/^\\s*Experimental:/i'", ",", "''", ",", "$", "experimentalComment", ")", ")", ";", "}", "}", "return", "$", "this", "->", "experimental", ";", "}" ]
Returns the experimental notice defined in the section @return string
[ "Returns", "the", "experimental", "notice", "defined", "in", "the", "section" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L211-L220
234,055
kss-php/kss-php
lib/Section.php
Section.getCompatibility
public function getCompatibility() { if ($this->compatibility === null) { if ($compatibilityComment = $this->getCompatibilityComment()) { $this->compatibility = trim($compatibilityComment); } } return $this->compatibility; }
php
public function getCompatibility() { if ($this->compatibility === null) { if ($compatibilityComment = $this->getCompatibilityComment()) { $this->compatibility = trim($compatibilityComment); } } return $this->compatibility; }
[ "public", "function", "getCompatibility", "(", ")", "{", "if", "(", "$", "this", "->", "compatibility", "===", "null", ")", "{", "if", "(", "$", "compatibilityComment", "=", "$", "this", "->", "getCompatibilityComment", "(", ")", ")", "{", "$", "this", "->", "compatibility", "=", "trim", "(", "$", "compatibilityComment", ")", ";", "}", "}", "return", "$", "this", "->", "compatibility", ";", "}" ]
Returns the compatibility notice defined in the section @return string
[ "Returns", "the", "compatibility", "notice", "defined", "in", "the", "section" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L227-L236
234,056
kss-php/kss-php
lib/Section.php
Section.getModifiers
public function getModifiers() { $lastIndent = null; $modifiers = array(); if ($modiferComment = $this->getModifiersComment()) { $modifierLines = explode("\n", $modiferComment); foreach ($modifierLines as $line) { if (empty($line)) { continue; } preg_match('/^\s*/', $line, $matches); $indent = strlen($matches[0]); if ($lastIndent && $indent > $lastIndent) { $modifier = end($modifiers); $modifier->setDescription($modifier->getDescription() + trim($line)); } else { $lineParts = explode(' - ', $line); $name = trim(array_shift($lineParts)); $description = ''; if (!empty($lineParts)) { $description = trim(implode(' - ', $lineParts)); } $modifier = new Modifier($name, $description); // If the CSS has a markup, pass it to the modifier for the example HTML if ($markup = $this->getMarkup()) { $modifier->setMarkup($markup); } $modifiers[] = $modifier; } } } return $modifiers; }
php
public function getModifiers() { $lastIndent = null; $modifiers = array(); if ($modiferComment = $this->getModifiersComment()) { $modifierLines = explode("\n", $modiferComment); foreach ($modifierLines as $line) { if (empty($line)) { continue; } preg_match('/^\s*/', $line, $matches); $indent = strlen($matches[0]); if ($lastIndent && $indent > $lastIndent) { $modifier = end($modifiers); $modifier->setDescription($modifier->getDescription() + trim($line)); } else { $lineParts = explode(' - ', $line); $name = trim(array_shift($lineParts)); $description = ''; if (!empty($lineParts)) { $description = trim(implode(' - ', $lineParts)); } $modifier = new Modifier($name, $description); // If the CSS has a markup, pass it to the modifier for the example HTML if ($markup = $this->getMarkup()) { $modifier->setMarkup($markup); } $modifiers[] = $modifier; } } } return $modifiers; }
[ "public", "function", "getModifiers", "(", ")", "{", "$", "lastIndent", "=", "null", ";", "$", "modifiers", "=", "array", "(", ")", ";", "if", "(", "$", "modiferComment", "=", "$", "this", "->", "getModifiersComment", "(", ")", ")", "{", "$", "modifierLines", "=", "explode", "(", "\"\\n\"", ",", "$", "modiferComment", ")", ";", "foreach", "(", "$", "modifierLines", "as", "$", "line", ")", "{", "if", "(", "empty", "(", "$", "line", ")", ")", "{", "continue", ";", "}", "preg_match", "(", "'/^\\s*/'", ",", "$", "line", ",", "$", "matches", ")", ";", "$", "indent", "=", "strlen", "(", "$", "matches", "[", "0", "]", ")", ";", "if", "(", "$", "lastIndent", "&&", "$", "indent", ">", "$", "lastIndent", ")", "{", "$", "modifier", "=", "end", "(", "$", "modifiers", ")", ";", "$", "modifier", "->", "setDescription", "(", "$", "modifier", "->", "getDescription", "(", ")", "+", "trim", "(", "$", "line", ")", ")", ";", "}", "else", "{", "$", "lineParts", "=", "explode", "(", "' - '", ",", "$", "line", ")", ";", "$", "name", "=", "trim", "(", "array_shift", "(", "$", "lineParts", ")", ")", ";", "$", "description", "=", "''", ";", "if", "(", "!", "empty", "(", "$", "lineParts", ")", ")", "{", "$", "description", "=", "trim", "(", "implode", "(", "' - '", ",", "$", "lineParts", ")", ")", ";", "}", "$", "modifier", "=", "new", "Modifier", "(", "$", "name", ",", "$", "description", ")", ";", "// If the CSS has a markup, pass it to the modifier for the example HTML", "if", "(", "$", "markup", "=", "$", "this", "->", "getMarkup", "(", ")", ")", "{", "$", "modifier", "->", "setMarkup", "(", "$", "markup", ")", ";", "}", "$", "modifiers", "[", "]", "=", "$", "modifier", ";", "}", "}", "}", "return", "$", "modifiers", ";", "}" ]
Returns the modifiers used in the section @return array
[ "Returns", "the", "modifiers", "used", "in", "the", "section" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L243-L282
234,057
kss-php/kss-php
lib/Section.php
Section.getReference
public function getReference($trimmed = false) { if ($this->reference === null) { $referenceComment = $this->getReferenceComment(); $referenceComment = preg_replace('/\.$/', '', $referenceComment); if (preg_match('/^\s*Styleguide\s+(.*)/i', $referenceComment, $matches)) { $this->reference = trim($matches[1]); } } return ($trimmed && $this->reference !== null) ? self::trimReference($this->reference) : $this->reference; }
php
public function getReference($trimmed = false) { if ($this->reference === null) { $referenceComment = $this->getReferenceComment(); $referenceComment = preg_replace('/\.$/', '', $referenceComment); if (preg_match('/^\s*Styleguide\s+(.*)/i', $referenceComment, $matches)) { $this->reference = trim($matches[1]); } } return ($trimmed && $this->reference !== null) ? self::trimReference($this->reference) : $this->reference; }
[ "public", "function", "getReference", "(", "$", "trimmed", "=", "false", ")", "{", "if", "(", "$", "this", "->", "reference", "===", "null", ")", "{", "$", "referenceComment", "=", "$", "this", "->", "getReferenceComment", "(", ")", ";", "$", "referenceComment", "=", "preg_replace", "(", "'/\\.$/'", ",", "''", ",", "$", "referenceComment", ")", ";", "if", "(", "preg_match", "(", "'/^\\s*Styleguide\\s+(.*)/i'", ",", "$", "referenceComment", ",", "$", "matches", ")", ")", "{", "$", "this", "->", "reference", "=", "trim", "(", "$", "matches", "[", "1", "]", ")", ";", "}", "}", "return", "(", "$", "trimmed", "&&", "$", "this", "->", "reference", "!==", "null", ")", "?", "self", "::", "trimReference", "(", "$", "this", "->", "reference", ")", ":", "$", "this", "->", "reference", ";", "}" ]
Returns the reference number for the section @param boolean $trimmed OPTIONAL @return string
[ "Returns", "the", "reference", "number", "for", "the", "section" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L337-L351
234,058
kss-php/kss-php
lib/Section.php
Section.getReferenceDotDelimited
protected function getReferenceDotDelimited() { if (empty($this->referenceDotDelimited)) { $this->referenceDotDelimited = self::normalizeReference($this->getReference()); } return $this->referenceDotDelimited; }
php
protected function getReferenceDotDelimited() { if (empty($this->referenceDotDelimited)) { $this->referenceDotDelimited = self::normalizeReference($this->getReference()); } return $this->referenceDotDelimited; }
[ "protected", "function", "getReferenceDotDelimited", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "referenceDotDelimited", ")", ")", "{", "$", "this", "->", "referenceDotDelimited", "=", "self", "::", "normalizeReference", "(", "$", "this", "->", "getReference", "(", ")", ")", ";", "}", "return", "$", "this", "->", "referenceDotDelimited", ";", "}" ]
Returns the reference dot delimited @return string
[ "Returns", "the", "reference", "dot", "delimited" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L358-L364
234,059
kss-php/kss-php
lib/Section.php
Section.trimReference
public static function trimReference($reference) { if (substr($reference, -1) == '.' || substr($reference, -1) == '-') { $reference = trim(substr($reference, 0, -1)); } while (preg_match('/(\.0+)$/', $reference, $matches)) { $reference = substr($reference, 0, strlen($matches[1]) * -1); } return $reference; }
php
public static function trimReference($reference) { if (substr($reference, -1) == '.' || substr($reference, -1) == '-') { $reference = trim(substr($reference, 0, -1)); } while (preg_match('/(\.0+)$/', $reference, $matches)) { $reference = substr($reference, 0, strlen($matches[1]) * -1); } return $reference; }
[ "public", "static", "function", "trimReference", "(", "$", "reference", ")", "{", "if", "(", "substr", "(", "$", "reference", ",", "-", "1", ")", "==", "'.'", "||", "substr", "(", "$", "reference", ",", "-", "1", ")", "==", "'-'", ")", "{", "$", "reference", "=", "trim", "(", "substr", "(", "$", "reference", ",", "0", ",", "-", "1", ")", ")", ";", "}", "while", "(", "preg_match", "(", "'/(\\.0+)$/'", ",", "$", "reference", ",", "$", "matches", ")", ")", "{", "$", "reference", "=", "substr", "(", "$", "reference", ",", "0", ",", "strlen", "(", "$", "matches", "[", "1", "]", ")", "*", "-", "1", ")", ";", "}", "return", "$", "reference", ";", "}" ]
Trims off all trailing zeros and periods on a reference @param string $reference @return string
[ "Trims", "off", "all", "trailing", "zeros", "and", "periods", "on", "a", "reference" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L405-L414
234,060
kss-php/kss-php
lib/Section.php
Section.belongsToReference
public function belongsToReference($reference) { $reference = self::trimReference($reference); $reference = self::normalizeReference($reference); return stripos($this->getReferenceDotDelimited() . '.', $reference . '.') === 0; }
php
public function belongsToReference($reference) { $reference = self::trimReference($reference); $reference = self::normalizeReference($reference); return stripos($this->getReferenceDotDelimited() . '.', $reference . '.') === 0; }
[ "public", "function", "belongsToReference", "(", "$", "reference", ")", "{", "$", "reference", "=", "self", "::", "trimReference", "(", "$", "reference", ")", ";", "$", "reference", "=", "self", "::", "normalizeReference", "(", "$", "reference", ")", ";", "return", "stripos", "(", "$", "this", "->", "getReferenceDotDelimited", "(", ")", ".", "'.'", ",", "$", "reference", ".", "'.'", ")", "===", "0", ";", "}" ]
Checks to see if a section belongs to a specified reference @param string $reference @return boolean
[ "Checks", "to", "see", "if", "a", "section", "belongs", "to", "a", "specified", "reference" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L435-L440
234,061
kss-php/kss-php
lib/Section.php
Section.calcDepth
public static function calcDepth($reference) { $reference = self::trimReference($reference); $reference = self::normalizeReference($reference); return substr_count($reference, '.'); }
php
public static function calcDepth($reference) { $reference = self::trimReference($reference); $reference = self::normalizeReference($reference); return substr_count($reference, '.'); }
[ "public", "static", "function", "calcDepth", "(", "$", "reference", ")", "{", "$", "reference", "=", "self", "::", "trimReference", "(", "$", "reference", ")", ";", "$", "reference", "=", "self", "::", "normalizeReference", "(", "$", "reference", ")", ";", "return", "substr_count", "(", "$", "reference", ",", "'.'", ")", ";", "}" ]
Calculates and returns the depth of a section reference @param string $reference @return int
[ "Calculates", "and", "returns", "the", "depth", "of", "a", "section", "reference" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L459-L464
234,062
kss-php/kss-php
lib/Section.php
Section.calcDepthScore
public static function calcDepthScore($reference) { if (!self::isReferenceNumeric($reference)) { return null; } $reference = self::trimReference($reference); $sectionParts = explode('.', $reference); $score = 0; foreach ($sectionParts as $level => $part) { $score += $part * (1 / pow(10, $level)); } return $score; }
php
public static function calcDepthScore($reference) { if (!self::isReferenceNumeric($reference)) { return null; } $reference = self::trimReference($reference); $sectionParts = explode('.', $reference); $score = 0; foreach ($sectionParts as $level => $part) { $score += $part * (1 / pow(10, $level)); } return $score; }
[ "public", "static", "function", "calcDepthScore", "(", "$", "reference", ")", "{", "if", "(", "!", "self", "::", "isReferenceNumeric", "(", "$", "reference", ")", ")", "{", "return", "null", ";", "}", "$", "reference", "=", "self", "::", "trimReference", "(", "$", "reference", ")", ";", "$", "sectionParts", "=", "explode", "(", "'.'", ",", "$", "reference", ")", ";", "$", "score", "=", "0", ";", "foreach", "(", "$", "sectionParts", "as", "$", "level", "=>", "$", "part", ")", "{", "$", "score", "+=", "$", "part", "*", "(", "1", "/", "pow", "(", "10", ",", "$", "level", ")", ")", ";", "}", "return", "$", "score", ";", "}" ]
Calculates and returns the depth score for the section. Useful for sorting sections correctly by their section reference numbers @return int|null
[ "Calculates", "and", "returns", "the", "depth", "score", "for", "the", "section", ".", "Useful", "for", "sorting", "sections", "correctly", "by", "their", "section", "reference", "numbers" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L482-L494
234,063
kss-php/kss-php
lib/Section.php
Section.depthSort
public static function depthSort(Section $a, Section $b) { if ($a->getDepth() == $b->getDepth()) { return self::alphaDepthScoreSort($a, $b); } return $a->getDepth() > $b->getDepth(); }
php
public static function depthSort(Section $a, Section $b) { if ($a->getDepth() == $b->getDepth()) { return self::alphaDepthScoreSort($a, $b); } return $a->getDepth() > $b->getDepth(); }
[ "public", "static", "function", "depthSort", "(", "Section", "$", "a", ",", "Section", "$", "b", ")", "{", "if", "(", "$", "a", "->", "getDepth", "(", ")", "==", "$", "b", "->", "getDepth", "(", ")", ")", "{", "return", "self", "::", "alphaDepthScoreSort", "(", "$", "a", ",", "$", "b", ")", ";", "}", "return", "$", "a", "->", "getDepth", "(", ")", ">", "$", "b", "->", "getDepth", "(", ")", ";", "}" ]
Function to help sort sections by depth and then depth score or alphabetically @param Section $a @param Section $b @return int
[ "Function", "to", "help", "sort", "sections", "by", "depth", "and", "then", "depth", "score", "or", "alphabetically" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L504-L510
234,064
kss-php/kss-php
lib/Section.php
Section.alphaDepthScoreSort
public static function alphaDepthScoreSort(Section $a, Section $b) { $aNumeric = self::isReferenceNumeric($a->getReference()); $bNumeric = self::isReferenceNumeric($b->getReference()); if ($aNumeric && $bNumeric) { return self::depthScoreSort($a, $b); } elseif ($aNumeric) { return -1; } elseif ($bNumeric) { return 1; } else { return strnatcmp( $a->getReferenceDotDelimited(), $b->getReferenceDotDelimited() ); } }
php
public static function alphaDepthScoreSort(Section $a, Section $b) { $aNumeric = self::isReferenceNumeric($a->getReference()); $bNumeric = self::isReferenceNumeric($b->getReference()); if ($aNumeric && $bNumeric) { return self::depthScoreSort($a, $b); } elseif ($aNumeric) { return -1; } elseif ($bNumeric) { return 1; } else { return strnatcmp( $a->getReferenceDotDelimited(), $b->getReferenceDotDelimited() ); } }
[ "public", "static", "function", "alphaDepthScoreSort", "(", "Section", "$", "a", ",", "Section", "$", "b", ")", "{", "$", "aNumeric", "=", "self", "::", "isReferenceNumeric", "(", "$", "a", "->", "getReference", "(", ")", ")", ";", "$", "bNumeric", "=", "self", "::", "isReferenceNumeric", "(", "$", "b", "->", "getReference", "(", ")", ")", ";", "if", "(", "$", "aNumeric", "&&", "$", "bNumeric", ")", "{", "return", "self", "::", "depthScoreSort", "(", "$", "a", ",", "$", "b", ")", ";", "}", "elseif", "(", "$", "aNumeric", ")", "{", "return", "-", "1", ";", "}", "elseif", "(", "$", "bNumeric", ")", "{", "return", "1", ";", "}", "else", "{", "return", "strnatcmp", "(", "$", "a", "->", "getReferenceDotDelimited", "(", ")", ",", "$", "b", "->", "getReferenceDotDelimited", "(", ")", ")", ";", "}", "}" ]
Function to help sort sections either by their depth score if numeric or alphabetically if non-numeric. @param Section $a @param Section $b @return int
[ "Function", "to", "help", "sort", "sections", "either", "by", "their", "depth", "score", "if", "numeric", "or", "alphabetically", "if", "non", "-", "numeric", "." ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L534-L551
234,065
kss-php/kss-php
lib/Section.php
Section.getCommentSections
protected function getCommentSections() { if (empty($this->commentSections) && $this->rawComment) { $this->commentSections = explode("\n\n", $this->rawComment); } return $this->commentSections; }
php
protected function getCommentSections() { if (empty($this->commentSections) && $this->rawComment) { $this->commentSections = explode("\n\n", $this->rawComment); } return $this->commentSections; }
[ "protected", "function", "getCommentSections", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "commentSections", ")", "&&", "$", "this", "->", "rawComment", ")", "{", "$", "this", "->", "commentSections", "=", "explode", "(", "\"\\n\\n\"", ",", "$", "this", "->", "rawComment", ")", ";", "}", "return", "$", "this", "->", "commentSections", ";", "}" ]
Returns the comment block used when creating the section as an array of paragraphs within the comment block @return array
[ "Returns", "the", "comment", "block", "used", "when", "creating", "the", "section", "as", "an", "array", "of", "paragraphs", "within", "the", "comment", "block" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L559-L566
234,066
kss-php/kss-php
lib/Section.php
Section.getTitleComment
protected function getTitleComment() { $titleComment = null; foreach ($this->getCommentSections() as $commentSection) { // Identify the title by the # markdown header syntax if (preg_match('/^\s*#/i', $commentSection)) { $titleComment = $commentSection; break; } } return $titleComment; }
php
protected function getTitleComment() { $titleComment = null; foreach ($this->getCommentSections() as $commentSection) { // Identify the title by the # markdown header syntax if (preg_match('/^\s*#/i', $commentSection)) { $titleComment = $commentSection; break; } } return $titleComment; }
[ "protected", "function", "getTitleComment", "(", ")", "{", "$", "titleComment", "=", "null", ";", "foreach", "(", "$", "this", "->", "getCommentSections", "(", ")", "as", "$", "commentSection", ")", "{", "// Identify the title by the # markdown header syntax", "if", "(", "preg_match", "(", "'/^\\s*#/i'", ",", "$", "commentSection", ")", ")", "{", "$", "titleComment", "=", "$", "commentSection", ";", "break", ";", "}", "}", "return", "$", "titleComment", ";", "}" ]
Gets the title part of the KSS Comment Block @return string
[ "Gets", "the", "title", "part", "of", "the", "KSS", "Comment", "Block" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L573-L586
234,067
kss-php/kss-php
lib/Section.php
Section.getMarkupComment
protected function getMarkupComment() { $markupComment = null; foreach ($this->getCommentSections() as $commentSection) { // Identify the markup comment by the Markup: marker if (preg_match('/^\s*Markup:/i', $commentSection)) { $markupComment = $commentSection; break; } } return $markupComment; }
php
protected function getMarkupComment() { $markupComment = null; foreach ($this->getCommentSections() as $commentSection) { // Identify the markup comment by the Markup: marker if (preg_match('/^\s*Markup:/i', $commentSection)) { $markupComment = $commentSection; break; } } return $markupComment; }
[ "protected", "function", "getMarkupComment", "(", ")", "{", "$", "markupComment", "=", "null", ";", "foreach", "(", "$", "this", "->", "getCommentSections", "(", ")", "as", "$", "commentSection", ")", "{", "// Identify the markup comment by the Markup: marker", "if", "(", "preg_match", "(", "'/^\\s*Markup:/i'", ",", "$", "commentSection", ")", ")", "{", "$", "markupComment", "=", "$", "commentSection", ";", "break", ";", "}", "}", "return", "$", "markupComment", ";", "}" ]
Returns the part of the KSS Comment Block that contains the markup @return string
[ "Returns", "the", "part", "of", "the", "KSS", "Comment", "Block", "that", "contains", "the", "markup" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L593-L606
234,068
kss-php/kss-php
lib/Section.php
Section.getDeprecatedComment
protected function getDeprecatedComment() { $deprecatedComment = null; foreach ($this->getCommentSections() as $commentSection) { // Identify the deprecation notice by the Deprecated: marker if (preg_match('/^\s*Deprecated:/i', $commentSection)) { $deprecatedComment = $commentSection; break; } } return $deprecatedComment; }
php
protected function getDeprecatedComment() { $deprecatedComment = null; foreach ($this->getCommentSections() as $commentSection) { // Identify the deprecation notice by the Deprecated: marker if (preg_match('/^\s*Deprecated:/i', $commentSection)) { $deprecatedComment = $commentSection; break; } } return $deprecatedComment; }
[ "protected", "function", "getDeprecatedComment", "(", ")", "{", "$", "deprecatedComment", "=", "null", ";", "foreach", "(", "$", "this", "->", "getCommentSections", "(", ")", "as", "$", "commentSection", ")", "{", "// Identify the deprecation notice by the Deprecated: marker", "if", "(", "preg_match", "(", "'/^\\s*Deprecated:/i'", ",", "$", "commentSection", ")", ")", "{", "$", "deprecatedComment", "=", "$", "commentSection", ";", "break", ";", "}", "}", "return", "$", "deprecatedComment", ";", "}" ]
Returns the part of the KSS Comment Block that contains the deprecated notice @return string
[ "Returns", "the", "part", "of", "the", "KSS", "Comment", "Block", "that", "contains", "the", "deprecated", "notice" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L614-L627
234,069
kss-php/kss-php
lib/Section.php
Section.getExperimentalComment
protected function getExperimentalComment() { $experimentalComment = null; foreach ($this->getCommentSections() as $commentSection) { // Identify the experimental notice by the Experimental: marker if (preg_match('/^\s*Experimental:/i', $commentSection)) { $experimentalComment = $commentSection; break; } } return $experimentalComment; }
php
protected function getExperimentalComment() { $experimentalComment = null; foreach ($this->getCommentSections() as $commentSection) { // Identify the experimental notice by the Experimental: marker if (preg_match('/^\s*Experimental:/i', $commentSection)) { $experimentalComment = $commentSection; break; } } return $experimentalComment; }
[ "protected", "function", "getExperimentalComment", "(", ")", "{", "$", "experimentalComment", "=", "null", ";", "foreach", "(", "$", "this", "->", "getCommentSections", "(", ")", "as", "$", "commentSection", ")", "{", "// Identify the experimental notice by the Experimental: marker", "if", "(", "preg_match", "(", "'/^\\s*Experimental:/i'", ",", "$", "commentSection", ")", ")", "{", "$", "experimentalComment", "=", "$", "commentSection", ";", "break", ";", "}", "}", "return", "$", "experimentalComment", ";", "}" ]
Returns the part of the KSS Comment Block that contains the experimental notice @return string
[ "Returns", "the", "part", "of", "the", "KSS", "Comment", "Block", "that", "contains", "the", "experimental", "notice" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L635-L648
234,070
kss-php/kss-php
lib/Section.php
Section.getCompatibilityComment
protected function getCompatibilityComment() { $compatibilityComment = null; foreach ($this->getCommentSections() as $commentSection) { // Compatible in IE6+, Firefox 2+, Safari 4+. // Compatibility: IE6+, Firefox 2+, Safari 4+. // Compatibility untested. if (preg_match('/^\s*Compatib(le|ility):?\s+/i', $commentSection)) { $compatibilityComment = $commentSection; break; } } return $compatibilityComment; }
php
protected function getCompatibilityComment() { $compatibilityComment = null; foreach ($this->getCommentSections() as $commentSection) { // Compatible in IE6+, Firefox 2+, Safari 4+. // Compatibility: IE6+, Firefox 2+, Safari 4+. // Compatibility untested. if (preg_match('/^\s*Compatib(le|ility):?\s+/i', $commentSection)) { $compatibilityComment = $commentSection; break; } } return $compatibilityComment; }
[ "protected", "function", "getCompatibilityComment", "(", ")", "{", "$", "compatibilityComment", "=", "null", ";", "foreach", "(", "$", "this", "->", "getCommentSections", "(", ")", "as", "$", "commentSection", ")", "{", "// Compatible in IE6+, Firefox 2+, Safari 4+.", "// Compatibility: IE6+, Firefox 2+, Safari 4+.", "// Compatibility untested.", "if", "(", "preg_match", "(", "'/^\\s*Compatib(le|ility):?\\s+/i'", ",", "$", "commentSection", ")", ")", "{", "$", "compatibilityComment", "=", "$", "commentSection", ";", "break", ";", "}", "}", "return", "$", "compatibilityComment", ";", "}" ]
Returns the part of the KSS Comment Block that contains the compatibility notice @return string
[ "Returns", "the", "part", "of", "the", "KSS", "Comment", "Block", "that", "contains", "the", "compatibility", "notice" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L656-L671
234,071
kss-php/kss-php
lib/Section.php
Section.getReferenceComment
protected function getReferenceComment() { $referenceComment = null; $commentSections = $this->getCommentSections(); $lastLine = end($commentSections); if (preg_match('/^\s*Styleguide \w/i', $lastLine) || preg_match('/^\s*No styleguide reference/i', $lastLine) ) { $referenceComment = $lastLine; } return $referenceComment; }
php
protected function getReferenceComment() { $referenceComment = null; $commentSections = $this->getCommentSections(); $lastLine = end($commentSections); if (preg_match('/^\s*Styleguide \w/i', $lastLine) || preg_match('/^\s*No styleguide reference/i', $lastLine) ) { $referenceComment = $lastLine; } return $referenceComment; }
[ "protected", "function", "getReferenceComment", "(", ")", "{", "$", "referenceComment", "=", "null", ";", "$", "commentSections", "=", "$", "this", "->", "getCommentSections", "(", ")", ";", "$", "lastLine", "=", "end", "(", "$", "commentSections", ")", ";", "if", "(", "preg_match", "(", "'/^\\s*Styleguide \\w/i'", ",", "$", "lastLine", ")", "||", "preg_match", "(", "'/^\\s*No styleguide reference/i'", ",", "$", "lastLine", ")", ")", "{", "$", "referenceComment", "=", "$", "lastLine", ";", "}", "return", "$", "referenceComment", ";", "}" ]
Gets the part of the KSS Comment Block that contains the section reference @return string
[ "Gets", "the", "part", "of", "the", "KSS", "Comment", "Block", "that", "contains", "the", "section", "reference" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L678-L691
234,072
kss-php/kss-php
lib/Section.php
Section.getModifiersComment
protected function getModifiersComment() { $modifiersComment = null; foreach ($this->getCommentSections() as $commentSection) { // Assume that the modifiers section starts with either a class or a // pseudo class if (preg_match('/^\s*(?:\.|:)/', $commentSection)) { $modifiersComment = $commentSection; break; } } return $modifiersComment; }
php
protected function getModifiersComment() { $modifiersComment = null; foreach ($this->getCommentSections() as $commentSection) { // Assume that the modifiers section starts with either a class or a // pseudo class if (preg_match('/^\s*(?:\.|:)/', $commentSection)) { $modifiersComment = $commentSection; break; } } return $modifiersComment; }
[ "protected", "function", "getModifiersComment", "(", ")", "{", "$", "modifiersComment", "=", "null", ";", "foreach", "(", "$", "this", "->", "getCommentSections", "(", ")", "as", "$", "commentSection", ")", "{", "// Assume that the modifiers section starts with either a class or a", "// pseudo class", "if", "(", "preg_match", "(", "'/^\\s*(?:\\.|:)/'", ",", "$", "commentSection", ")", ")", "{", "$", "modifiersComment", "=", "$", "commentSection", ";", "break", ";", "}", "}", "return", "$", "modifiersComment", ";", "}" ]
Returns the part of the KSS Comment Block that contains the modifiers @return string
[ "Returns", "the", "part", "of", "the", "KSS", "Comment", "Block", "that", "contains", "the", "modifiers" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Section.php#L698-L712
234,073
kss-php/kss-php
lib/Parser.php
Parser.addSection
protected function addSection($comment, \splFileObject $file) { $section = new Section($comment, $file); $this->sections[$section->getReference(true)] = $section; $this->sectionsSortedByReference = false; }
php
protected function addSection($comment, \splFileObject $file) { $section = new Section($comment, $file); $this->sections[$section->getReference(true)] = $section; $this->sectionsSortedByReference = false; }
[ "protected", "function", "addSection", "(", "$", "comment", ",", "\\", "splFileObject", "$", "file", ")", "{", "$", "section", "=", "new", "Section", "(", "$", "comment", ",", "$", "file", ")", ";", "$", "this", "->", "sections", "[", "$", "section", "->", "getReference", "(", "true", ")", "]", "=", "$", "section", ";", "$", "this", "->", "sectionsSortedByReference", "=", "false", ";", "}" ]
Adds a section to the Sections collection @param string $comment @param \splFileObject $file
[ "Adds", "a", "section", "to", "the", "Sections", "collection" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Parser.php#L61-L66
234,074
kss-php/kss-php
lib/Parser.php
Parser.getSection
public function getSection($reference) { $reference = Section::trimReference($reference); $reference = strtolower(Section::normalizeReference($reference)); foreach ($this->sections as $sectionKey => $section) { $potentialMatch = strtolower(Section::normalizeReference($sectionKey)); if ($reference === $potentialMatch) { return $section; } } throw new UnexpectedValueException('Section with a reference of ' . $reference . ' cannot be found!'); }
php
public function getSection($reference) { $reference = Section::trimReference($reference); $reference = strtolower(Section::normalizeReference($reference)); foreach ($this->sections as $sectionKey => $section) { $potentialMatch = strtolower(Section::normalizeReference($sectionKey)); if ($reference === $potentialMatch) { return $section; } } throw new UnexpectedValueException('Section with a reference of ' . $reference . ' cannot be found!'); }
[ "public", "function", "getSection", "(", "$", "reference", ")", "{", "$", "reference", "=", "Section", "::", "trimReference", "(", "$", "reference", ")", ";", "$", "reference", "=", "strtolower", "(", "Section", "::", "normalizeReference", "(", "$", "reference", ")", ")", ";", "foreach", "(", "$", "this", "->", "sections", "as", "$", "sectionKey", "=>", "$", "section", ")", "{", "$", "potentialMatch", "=", "strtolower", "(", "Section", "::", "normalizeReference", "(", "$", "sectionKey", ")", ")", ";", "if", "(", "$", "reference", "===", "$", "potentialMatch", ")", "{", "return", "$", "section", ";", "}", "}", "throw", "new", "UnexpectedValueException", "(", "'Section with a reference of '", ".", "$", "reference", ".", "' cannot be found!'", ")", ";", "}" ]
Returns a Section object matching the requested reference. If reference is not found, an empty Section object is returned instead @param string $reference @return Section @throws UnexepectedValueException if reference does not exist
[ "Returns", "a", "Section", "object", "matching", "the", "requested", "reference", ".", "If", "reference", "is", "not", "found", "an", "empty", "Section", "object", "is", "returned", "instead" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Parser.php#L78-L91
234,075
kss-php/kss-php
lib/Parser.php
Parser.getSectionChildren
public function getSectionChildren($reference, $levelsDown = null) { $reference = strtolower(Section::normalizeReference($reference)); $this->sortSections(); $sectionKeys = array_keys($this->sections); $sections = array(); $maxDepth = null; if ($levelsDown !== null) { $maxDepth = Section::calcDepth($reference) + $levelsDown; } $reference = Section::trimReference($reference); $reference .= '.'; foreach ($sectionKeys as $sectionKey) { $testSectionKey = strtolower(Section::normalizeReference($sectionKey)); // Only get sections within that level. Do not get the level itself if (strpos($testSectionKey . '.', $reference) === 0 && $testSectionKey . '.' != $reference ) { $section = $this->sections[$sectionKey]; if ($maxDepth !== null && $section->getDepth() > $maxDepth) { continue; } $sections[$sectionKey] = $section; } } return $sections; }
php
public function getSectionChildren($reference, $levelsDown = null) { $reference = strtolower(Section::normalizeReference($reference)); $this->sortSections(); $sectionKeys = array_keys($this->sections); $sections = array(); $maxDepth = null; if ($levelsDown !== null) { $maxDepth = Section::calcDepth($reference) + $levelsDown; } $reference = Section::trimReference($reference); $reference .= '.'; foreach ($sectionKeys as $sectionKey) { $testSectionKey = strtolower(Section::normalizeReference($sectionKey)); // Only get sections within that level. Do not get the level itself if (strpos($testSectionKey . '.', $reference) === 0 && $testSectionKey . '.' != $reference ) { $section = $this->sections[$sectionKey]; if ($maxDepth !== null && $section->getDepth() > $maxDepth) { continue; } $sections[$sectionKey] = $section; } } return $sections; }
[ "public", "function", "getSectionChildren", "(", "$", "reference", ",", "$", "levelsDown", "=", "null", ")", "{", "$", "reference", "=", "strtolower", "(", "Section", "::", "normalizeReference", "(", "$", "reference", ")", ")", ";", "$", "this", "->", "sortSections", "(", ")", ";", "$", "sectionKeys", "=", "array_keys", "(", "$", "this", "->", "sections", ")", ";", "$", "sections", "=", "array", "(", ")", ";", "$", "maxDepth", "=", "null", ";", "if", "(", "$", "levelsDown", "!==", "null", ")", "{", "$", "maxDepth", "=", "Section", "::", "calcDepth", "(", "$", "reference", ")", "+", "$", "levelsDown", ";", "}", "$", "reference", "=", "Section", "::", "trimReference", "(", "$", "reference", ")", ";", "$", "reference", ".=", "'.'", ";", "foreach", "(", "$", "sectionKeys", "as", "$", "sectionKey", ")", "{", "$", "testSectionKey", "=", "strtolower", "(", "Section", "::", "normalizeReference", "(", "$", "sectionKey", ")", ")", ";", "// Only get sections within that level. Do not get the level itself", "if", "(", "strpos", "(", "$", "testSectionKey", ".", "'.'", ",", "$", "reference", ")", "===", "0", "&&", "$", "testSectionKey", ".", "'.'", "!=", "$", "reference", ")", "{", "$", "section", "=", "$", "this", "->", "sections", "[", "$", "sectionKey", "]", ";", "if", "(", "$", "maxDepth", "!==", "null", "&&", "$", "section", "->", "getDepth", "(", ")", ">", "$", "maxDepth", ")", "{", "continue", ";", "}", "$", "sections", "[", "$", "sectionKey", "]", "=", "$", "section", ";", "}", "}", "return", "$", "sections", ";", "}" ]
Returns an array of children for a specified section reference @param string $reference @param int $levelsDown OPTIONAL @return array
[ "Returns", "an", "array", "of", "children", "for", "a", "specified", "section", "reference" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Parser.php#L132-L163
234,076
kss-php/kss-php
lib/Parser.php
Parser.isKssBlock
public static function isKssBlock($comment) { $commentLines = explode("\n\n", $comment); $lastLine = end($commentLines); return preg_match('/^\s*Styleguide \w/i', $lastLine) || preg_match('/^\s*No styleguide reference/i', $lastLine); }
php
public static function isKssBlock($comment) { $commentLines = explode("\n\n", $comment); $lastLine = end($commentLines); return preg_match('/^\s*Styleguide \w/i', $lastLine) || preg_match('/^\s*No styleguide reference/i', $lastLine); }
[ "public", "static", "function", "isKssBlock", "(", "$", "comment", ")", "{", "$", "commentLines", "=", "explode", "(", "\"\\n\\n\"", ",", "$", "comment", ")", ";", "$", "lastLine", "=", "end", "(", "$", "commentLines", ")", ";", "return", "preg_match", "(", "'/^\\s*Styleguide \\w/i'", ",", "$", "lastLine", ")", "||", "preg_match", "(", "'/^\\s*No styleguide reference/i'", ",", "$", "lastLine", ")", ";", "}" ]
Checks to see if a comment block is a KSS Comment block @param string $comment @return boolean
[ "Checks", "to", "see", "if", "a", "comment", "block", "is", "a", "KSS", "Comment", "block" ]
5431bfb3c3708cfedb6a95fc3413181287d1f776
https://github.com/kss-php/kss-php/blob/5431bfb3c3708cfedb6a95fc3413181287d1f776/lib/Parser.php#L198-L204
234,077
MW-Peachy/Peachy
HTTP.php
HTTP.get
public function get( $url, $data = null, $headers = array(), $verifyssl = null ) { global $argv, $displayGetOutData; if( is_string( $headers ) ) curl_setopt( $this->curl_instance, CURLOPT_HTTPHEADER, array( $headers ) ); else $this->setCurlHeaders( $headers ); $this->setVerifySSL( $verifyssl ); curl_setopt( $this->curl_instance, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $this->curl_instance, CURLOPT_HTTPGET, 1 ); curl_setopt( $this->curl_instance, CURLOPT_POST, 0 ); /*if( !is_null( $this->use_cookie ) ) { curl_setopt($this->curl_instance,CURLOPT_COOKIE, $this->use_cookie); }*/ if( !is_null( $data ) && is_array( $data ) && !empty( $data ) ) { $url .= '?' . http_build_query( $data ); } curl_setopt( $this->curl_instance, CURLOPT_URL, $url ); if( ( !is_null( $argv ) && in_array( 'peachyecho', $argv ) ) || $this->echo ) { if( $displayGetOutData ) { pecho( "GET: $url\n", PECHO_NORMAL ); } } Hooks::runHook( 'HTTPGet', array( &$this, &$url, &$data ) ); return $this->doCurlExecWithRetrys(); }
php
public function get( $url, $data = null, $headers = array(), $verifyssl = null ) { global $argv, $displayGetOutData; if( is_string( $headers ) ) curl_setopt( $this->curl_instance, CURLOPT_HTTPHEADER, array( $headers ) ); else $this->setCurlHeaders( $headers ); $this->setVerifySSL( $verifyssl ); curl_setopt( $this->curl_instance, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $this->curl_instance, CURLOPT_HTTPGET, 1 ); curl_setopt( $this->curl_instance, CURLOPT_POST, 0 ); /*if( !is_null( $this->use_cookie ) ) { curl_setopt($this->curl_instance,CURLOPT_COOKIE, $this->use_cookie); }*/ if( !is_null( $data ) && is_array( $data ) && !empty( $data ) ) { $url .= '?' . http_build_query( $data ); } curl_setopt( $this->curl_instance, CURLOPT_URL, $url ); if( ( !is_null( $argv ) && in_array( 'peachyecho', $argv ) ) || $this->echo ) { if( $displayGetOutData ) { pecho( "GET: $url\n", PECHO_NORMAL ); } } Hooks::runHook( 'HTTPGet', array( &$this, &$url, &$data ) ); return $this->doCurlExecWithRetrys(); }
[ "public", "function", "get", "(", "$", "url", ",", "$", "data", "=", "null", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "verifyssl", "=", "null", ")", "{", "global", "$", "argv", ",", "$", "displayGetOutData", ";", "if", "(", "is_string", "(", "$", "headers", ")", ")", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_HTTPHEADER", ",", "array", "(", "$", "headers", ")", ")", ";", "else", "$", "this", "->", "setCurlHeaders", "(", "$", "headers", ")", ";", "$", "this", "->", "setVerifySSL", "(", "$", "verifyssl", ")", ";", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_FOLLOWLOCATION", ",", "1", ")", ";", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_HTTPGET", ",", "1", ")", ";", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_POST", ",", "0", ")", ";", "/*if( !is_null( $this->use_cookie ) ) {\n\t\t\tcurl_setopt($this->curl_instance,CURLOPT_COOKIE, $this->use_cookie);\n\t\t}*/", "if", "(", "!", "is_null", "(", "$", "data", ")", "&&", "is_array", "(", "$", "data", ")", "&&", "!", "empty", "(", "$", "data", ")", ")", "{", "$", "url", ".=", "'?'", ".", "http_build_query", "(", "$", "data", ")", ";", "}", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_URL", ",", "$", "url", ")", ";", "if", "(", "(", "!", "is_null", "(", "$", "argv", ")", "&&", "in_array", "(", "'peachyecho'", ",", "$", "argv", ")", ")", "||", "$", "this", "->", "echo", ")", "{", "if", "(", "$", "displayGetOutData", ")", "{", "pecho", "(", "\"GET: $url\\n\"", ",", "PECHO_NORMAL", ")", ";", "}", "}", "Hooks", "::", "runHook", "(", "'HTTPGet'", ",", "array", "(", "&", "$", "this", ",", "&", "$", "url", ",", "&", "$", "data", ")", ")", ";", "return", "$", "this", "->", "doCurlExecWithRetrys", "(", ")", ";", "}" ]
Get an url with HTTP GET @access public @param string $url URL to get @param array|null $data Array of data to pass. Gets transformed into the URL inside the function. Default null. @param array $headers Array of headers to pass to curl @param bool $verifyssl override for the global verifyssl value @return bool|string Result
[ "Get", "an", "url", "with", "HTTP", "GET" ]
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/HTTP.php#L230-L261
234,078
MW-Peachy/Peachy
HTTP.php
HTTP.post
public function post($url, $data, $headers = array(), $verifyssl = null) { global $argv, $displayPostOutData; if( is_string( $headers ) ) curl_setopt( $this->curl_instance, CURLOPT_HTTPHEADER, array( $headers ) ); else $this->setCurlHeaders( $headers ); $this->setVerifySSL( $verifyssl ); curl_setopt( $this->curl_instance, CURLOPT_FOLLOWLOCATION, 0 ); curl_setopt( $this->curl_instance, CURLOPT_HTTPGET, 0 ); curl_setopt( $this->curl_instance, CURLOPT_POST, 1 ); curl_setopt( $this->curl_instance, CURLOPT_POSTFIELDS, $data ); /*if( !is_null( $this->use_cookie ) ) { curl_setopt($this->curl_instance,CURLOPT_COOKIE, $this->use_cookie); }*/ curl_setopt( $this->curl_instance, CURLOPT_URL, $url ); if( ( !is_null( $argv ) && in_array( 'peachyecho', $argv ) ) || $this->echo ) { if( $displayPostOutData ) { pecho( "POST: $url\n", PECHO_NORMAL ); } } Hooks::runHook( 'HTTPPost', array( &$this, &$url, &$data ) ); return $this->doCurlExecWithRetrys(); }
php
public function post($url, $data, $headers = array(), $verifyssl = null) { global $argv, $displayPostOutData; if( is_string( $headers ) ) curl_setopt( $this->curl_instance, CURLOPT_HTTPHEADER, array( $headers ) ); else $this->setCurlHeaders( $headers ); $this->setVerifySSL( $verifyssl ); curl_setopt( $this->curl_instance, CURLOPT_FOLLOWLOCATION, 0 ); curl_setopt( $this->curl_instance, CURLOPT_HTTPGET, 0 ); curl_setopt( $this->curl_instance, CURLOPT_POST, 1 ); curl_setopt( $this->curl_instance, CURLOPT_POSTFIELDS, $data ); /*if( !is_null( $this->use_cookie ) ) { curl_setopt($this->curl_instance,CURLOPT_COOKIE, $this->use_cookie); }*/ curl_setopt( $this->curl_instance, CURLOPT_URL, $url ); if( ( !is_null( $argv ) && in_array( 'peachyecho', $argv ) ) || $this->echo ) { if( $displayPostOutData ) { pecho( "POST: $url\n", PECHO_NORMAL ); } } Hooks::runHook( 'HTTPPost', array( &$this, &$url, &$data ) ); return $this->doCurlExecWithRetrys(); }
[ "public", "function", "post", "(", "$", "url", ",", "$", "data", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "verifyssl", "=", "null", ")", "{", "global", "$", "argv", ",", "$", "displayPostOutData", ";", "if", "(", "is_string", "(", "$", "headers", ")", ")", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_HTTPHEADER", ",", "array", "(", "$", "headers", ")", ")", ";", "else", "$", "this", "->", "setCurlHeaders", "(", "$", "headers", ")", ";", "$", "this", "->", "setVerifySSL", "(", "$", "verifyssl", ")", ";", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_FOLLOWLOCATION", ",", "0", ")", ";", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_HTTPGET", ",", "0", ")", ";", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_POST", ",", "1", ")", ";", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_POSTFIELDS", ",", "$", "data", ")", ";", "/*if( !is_null( $this->use_cookie ) ) {\n\t\t\tcurl_setopt($this->curl_instance,CURLOPT_COOKIE, $this->use_cookie);\n\t\t}*/", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_URL", ",", "$", "url", ")", ";", "if", "(", "(", "!", "is_null", "(", "$", "argv", ")", "&&", "in_array", "(", "'peachyecho'", ",", "$", "argv", ")", ")", "||", "$", "this", "->", "echo", ")", "{", "if", "(", "$", "displayPostOutData", ")", "{", "pecho", "(", "\"POST: $url\\n\"", ",", "PECHO_NORMAL", ")", ";", "}", "}", "Hooks", "::", "runHook", "(", "'HTTPPost'", ",", "array", "(", "&", "$", "this", ",", "&", "$", "url", ",", "&", "$", "data", ")", ")", ";", "return", "$", "this", "->", "doCurlExecWithRetrys", "(", ")", ";", "}" ]
Sends data via HTTP POST @access public @param string $url URL to send @param array $data Array of data to pass. @param array $headers Array of headers to pass to curl @param bool|null $verifyssl override for global verifyssl value @return bool|string Result
[ "Sends", "data", "via", "HTTP", "POST" ]
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/HTTP.php#L288-L316
234,079
MW-Peachy/Peachy
HTTP.php
HTTP.download
function download( $url, $local, $headers = array(), $verifyssl = null ) { global $argv; $out = fopen( $local, 'wb' ); if( is_string( $headers ) ) curl_setopt( $this->curl_instance, CURLOPT_HTTPHEADER, array( $headers ) ); else $this->setCurlHeaders( $headers ); $this->setVerifySSL( $verifyssl ); // curl_setopt($this->curl_instance, CURLOPT_FILE, $out); curl_setopt( $this->curl_instance, CURLOPT_HTTPGET, 1 ); curl_setopt( $this->curl_instance, CURLOPT_POST, 0 ); curl_setopt( $this->curl_instance, CURLOPT_URL, $url ); curl_setopt( $this->curl_instance, CURLOPT_HEADER, 0 ); if( ( !is_null( $argv ) && in_array( 'peachyecho', $argv ) ) || $this->echo ) { pecho( "DLOAD: $url\n", PECHO_NORMAL ); } Hooks::runHook( 'HTTPDownload', array( &$this, &$url, &$local ) ); fwrite( $out, $this->doCurlExecWithRetrys() ); fclose( $out ); return true; }
php
function download( $url, $local, $headers = array(), $verifyssl = null ) { global $argv; $out = fopen( $local, 'wb' ); if( is_string( $headers ) ) curl_setopt( $this->curl_instance, CURLOPT_HTTPHEADER, array( $headers ) ); else $this->setCurlHeaders( $headers ); $this->setVerifySSL( $verifyssl ); // curl_setopt($this->curl_instance, CURLOPT_FILE, $out); curl_setopt( $this->curl_instance, CURLOPT_HTTPGET, 1 ); curl_setopt( $this->curl_instance, CURLOPT_POST, 0 ); curl_setopt( $this->curl_instance, CURLOPT_URL, $url ); curl_setopt( $this->curl_instance, CURLOPT_HEADER, 0 ); if( ( !is_null( $argv ) && in_array( 'peachyecho', $argv ) ) || $this->echo ) { pecho( "DLOAD: $url\n", PECHO_NORMAL ); } Hooks::runHook( 'HTTPDownload', array( &$this, &$url, &$local ) ); fwrite( $out, $this->doCurlExecWithRetrys() ); fclose( $out ); return true; }
[ "function", "download", "(", "$", "url", ",", "$", "local", ",", "$", "headers", "=", "array", "(", ")", ",", "$", "verifyssl", "=", "null", ")", "{", "global", "$", "argv", ";", "$", "out", "=", "fopen", "(", "$", "local", ",", "'wb'", ")", ";", "if", "(", "is_string", "(", "$", "headers", ")", ")", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_HTTPHEADER", ",", "array", "(", "$", "headers", ")", ")", ";", "else", "$", "this", "->", "setCurlHeaders", "(", "$", "headers", ")", ";", "$", "this", "->", "setVerifySSL", "(", "$", "verifyssl", ")", ";", "// curl_setopt($this->curl_instance, CURLOPT_FILE, $out);", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_HTTPGET", ",", "1", ")", ";", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_POST", ",", "0", ")", ";", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_URL", ",", "$", "url", ")", ";", "curl_setopt", "(", "$", "this", "->", "curl_instance", ",", "CURLOPT_HEADER", ",", "0", ")", ";", "if", "(", "(", "!", "is_null", "(", "$", "argv", ")", "&&", "in_array", "(", "'peachyecho'", ",", "$", "argv", ")", ")", "||", "$", "this", "->", "echo", ")", "{", "pecho", "(", "\"DLOAD: $url\\n\"", ",", "PECHO_NORMAL", ")", ";", "}", "Hooks", "::", "runHook", "(", "'HTTPDownload'", ",", "array", "(", "&", "$", "this", ",", "&", "$", "url", ",", "&", "$", "local", ")", ")", ";", "fwrite", "(", "$", "out", ",", "$", "this", "->", "doCurlExecWithRetrys", "(", ")", ")", ";", "fclose", "(", "$", "out", ")", ";", "return", "true", ";", "}" ]
Downloads an URL to the local disk @access public @param string $url URL to get @param string $local Local filename to download to @param array $headers Array of headers to pass to curl @param bool|null $verifyssl @return bool
[ "Downloads", "an", "URL", "to", "the", "local", "disk" ]
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/HTTP.php#L330-L356
234,080
fab2s/NodalFlow
src/Nodes/NodeAbstract.php
NodeAbstract.enforceIsATraversable
protected function enforceIsATraversable() { if ($this->isFlow()) { if ($this->isATraversable) { throw new NodalFlowException('Cannot Traverse a Branch'); } return $this; } if ($this->isATraversable) { if (!($this instanceof TraversableNodeInterface)) { throw new NodalFlowException('Cannot Traverse a Node that does not implement TraversableNodeInterface'); } return $this; } if (!($this instanceof ExecNodeInterface)) { throw new NodalFlowException('Cannot Exec a Node that does not implement ExecNodeInterface'); } return $this; }
php
protected function enforceIsATraversable() { if ($this->isFlow()) { if ($this->isATraversable) { throw new NodalFlowException('Cannot Traverse a Branch'); } return $this; } if ($this->isATraversable) { if (!($this instanceof TraversableNodeInterface)) { throw new NodalFlowException('Cannot Traverse a Node that does not implement TraversableNodeInterface'); } return $this; } if (!($this instanceof ExecNodeInterface)) { throw new NodalFlowException('Cannot Exec a Node that does not implement ExecNodeInterface'); } return $this; }
[ "protected", "function", "enforceIsATraversable", "(", ")", "{", "if", "(", "$", "this", "->", "isFlow", "(", ")", ")", "{", "if", "(", "$", "this", "->", "isATraversable", ")", "{", "throw", "new", "NodalFlowException", "(", "'Cannot Traverse a Branch'", ")", ";", "}", "return", "$", "this", ";", "}", "if", "(", "$", "this", "->", "isATraversable", ")", "{", "if", "(", "!", "(", "$", "this", "instanceof", "TraversableNodeInterface", ")", ")", "{", "throw", "new", "NodalFlowException", "(", "'Cannot Traverse a Node that does not implement TraversableNodeInterface'", ")", ";", "}", "return", "$", "this", ";", "}", "if", "(", "!", "(", "$", "this", "instanceof", "ExecNodeInterface", ")", ")", "{", "throw", "new", "NodalFlowException", "(", "'Cannot Exec a Node that does not implement ExecNodeInterface'", ")", ";", "}", "return", "$", "this", ";", "}" ]
Make sure this Node is consistent @throws NodalFlowException @return $this
[ "Make", "sure", "this", "Node", "is", "consistent" ]
da5d458ffea3e6e954d7ee734f938f4be5e46728
https://github.com/fab2s/NodalFlow/blob/da5d458ffea3e6e954d7ee734f938f4be5e46728/src/Nodes/NodeAbstract.php#L189-L212
234,081
budde377/Part
lib/ConfigImpl.php
ConfigImpl.getPostTasks
public function getPostTasks() { if ($this->postTasks != null) { return $this->postTasks; } /** @noinspection PhpUndefinedFieldInspection */ return $this->postTasks = $this->getScripts($this->configFile->postTasks); }
php
public function getPostTasks() { if ($this->postTasks != null) { return $this->postTasks; } /** @noinspection PhpUndefinedFieldInspection */ return $this->postTasks = $this->getScripts($this->configFile->postTasks); }
[ "public", "function", "getPostTasks", "(", ")", "{", "if", "(", "$", "this", "->", "postTasks", "!=", "null", ")", "{", "return", "$", "this", "->", "postTasks", ";", "}", "/** @noinspection PhpUndefinedFieldInspection */", "return", "$", "this", "->", "postTasks", "=", "$", "this", "->", "getScripts", "(", "$", "this", "->", "configFile", "->", "postTasks", ")", ";", "}" ]
Will return PostTasks as an array, with the ClassName as key and the link as value. The link should be relative to a root path provided. @return array
[ "Will", "return", "PostTasks", "as", "an", "array", "with", "the", "ClassName", "as", "key", "and", "the", "link", "as", "value", ".", "The", "link", "should", "be", "relative", "to", "a", "root", "path", "provided", "." ]
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/ConfigImpl.php#L104-L112
234,082
budde377/Part
lib/ConfigImpl.php
ConfigImpl.getPreTasks
public function getPreTasks() { if ($this->preTasks != null) { return $this->preTasks; } /** @noinspection PhpUndefinedFieldInspection */ return $this->preTasks = $this->getScripts($this->configFile->preTasks); }
php
public function getPreTasks() { if ($this->preTasks != null) { return $this->preTasks; } /** @noinspection PhpUndefinedFieldInspection */ return $this->preTasks = $this->getScripts($this->configFile->preTasks); }
[ "public", "function", "getPreTasks", "(", ")", "{", "if", "(", "$", "this", "->", "preTasks", "!=", "null", ")", "{", "return", "$", "this", "->", "preTasks", ";", "}", "/** @noinspection PhpUndefinedFieldInspection */", "return", "$", "this", "->", "preTasks", "=", "$", "this", "->", "getScripts", "(", "$", "this", "->", "configFile", "->", "preTasks", ")", ";", "}" ]
Will return pre tasks as an array, with the ClassName as key and the link as value. The link should be relative to a root path provided. @return array
[ "Will", "return", "pre", "tasks", "as", "an", "array", "with", "the", "ClassName", "as", "key", "and", "the", "link", "as", "value", ".", "The", "link", "should", "be", "relative", "to", "a", "root", "path", "provided", "." ]
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/ConfigImpl.php#L135-L143
234,083
budde377/Part
lib/ConfigImpl.php
ConfigImpl.listTemplateNames
public function listTemplateNames() { $this->setUpTemplate(); $ret = array(); foreach ($this->templates as $key => $val) { $ret[] = $key; } return $ret; }
php
public function listTemplateNames() { $this->setUpTemplate(); $ret = array(); foreach ($this->templates as $key => $val) { $ret[] = $key; } return $ret; }
[ "public", "function", "listTemplateNames", "(", ")", "{", "$", "this", "->", "setUpTemplate", "(", ")", ";", "$", "ret", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "templates", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "ret", "[", "]", "=", "$", "key", ";", "}", "return", "$", "ret", ";", "}" ]
Will return a array containing all possible templates by name. @return array
[ "Will", "return", "a", "array", "containing", "all", "possible", "templates", "by", "name", "." ]
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/ConfigImpl.php#L222-L230
234,084
budde377/Part
lib/ConfigImpl.php
ConfigImpl.getDefaultPages
public function getDefaultPages() { if ($this->defaultPages != null) { return $this->defaultPages; } $this->defaultPages = []; /** @noinspection PhpUndefinedFieldInspection */ if ($this->configFile->defaultPages->getName()) { /** @noinspection PhpUndefinedFieldInspection */ foreach ($this->configFile->defaultPages->page as $page) { $title = (string)$page; $this->defaultPages[$title]["template"] = (string)$page["template"]; $this->defaultPages[$title]["alias"] = (string)$page["alias"]; $this->defaultPages[$title]["id"] = (string)$page["id"]; } } return $this->defaultPages; }
php
public function getDefaultPages() { if ($this->defaultPages != null) { return $this->defaultPages; } $this->defaultPages = []; /** @noinspection PhpUndefinedFieldInspection */ if ($this->configFile->defaultPages->getName()) { /** @noinspection PhpUndefinedFieldInspection */ foreach ($this->configFile->defaultPages->page as $page) { $title = (string)$page; $this->defaultPages[$title]["template"] = (string)$page["template"]; $this->defaultPages[$title]["alias"] = (string)$page["alias"]; $this->defaultPages[$title]["id"] = (string)$page["id"]; } } return $this->defaultPages; }
[ "public", "function", "getDefaultPages", "(", ")", "{", "if", "(", "$", "this", "->", "defaultPages", "!=", "null", ")", "{", "return", "$", "this", "->", "defaultPages", ";", "}", "$", "this", "->", "defaultPages", "=", "[", "]", ";", "/** @noinspection PhpUndefinedFieldInspection */", "if", "(", "$", "this", "->", "configFile", "->", "defaultPages", "->", "getName", "(", ")", ")", "{", "/** @noinspection PhpUndefinedFieldInspection */", "foreach", "(", "$", "this", "->", "configFile", "->", "defaultPages", "->", "page", "as", "$", "page", ")", "{", "$", "title", "=", "(", "string", ")", "$", "page", ";", "$", "this", "->", "defaultPages", "[", "$", "title", "]", "[", "\"template\"", "]", "=", "(", "string", ")", "$", "page", "[", "\"template\"", "]", ";", "$", "this", "->", "defaultPages", "[", "$", "title", "]", "[", "\"alias\"", "]", "=", "(", "string", ")", "$", "page", "[", "\"alias\"", "]", ";", "$", "this", "->", "defaultPages", "[", "$", "title", "]", "[", "\"id\"", "]", "=", "(", "string", ")", "$", "page", "[", "\"id\"", "]", ";", "}", "}", "return", "$", "this", "->", "defaultPages", ";", "}" ]
Will return an array with default pages. Pages hardcoded into the website. The array will have the page title as key and another array, containing alias', as value. @return array
[ "Will", "return", "an", "array", "with", "default", "pages", ".", "Pages", "hardcoded", "into", "the", "website", ".", "The", "array", "will", "have", "the", "page", "title", "as", "key", "and", "another", "array", "containing", "alias", "as", "value", "." ]
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/ConfigImpl.php#L238-L257
234,085
budde377/Part
lib/ConfigImpl.php
ConfigImpl.getAJAXTypeHandlers
public function getAJAXTypeHandlers() { if ($this->ajaxTypeHandlers != null) { return $this->ajaxTypeHandlers; } $this->ajaxTypeHandlers = array(); /** @noinspection PhpUndefinedFieldInspection */ if (!$this->configFile->AJAXTypeHandlers->getName()) { return $this->ajaxTypeHandlers; } /** @noinspection PhpUndefinedFieldInspection */ foreach ($this->configFile->AJAXTypeHandlers->class as $handler) { $class_array = array("class_name" => (string)$handler); if (isset($handler['link'])) { $class_array['link'] = $this->rootPath . "/" . $handler['link']; } $this->ajaxTypeHandlers[] = $class_array; } return $this->ajaxTypeHandlers; }
php
public function getAJAXTypeHandlers() { if ($this->ajaxTypeHandlers != null) { return $this->ajaxTypeHandlers; } $this->ajaxTypeHandlers = array(); /** @noinspection PhpUndefinedFieldInspection */ if (!$this->configFile->AJAXTypeHandlers->getName()) { return $this->ajaxTypeHandlers; } /** @noinspection PhpUndefinedFieldInspection */ foreach ($this->configFile->AJAXTypeHandlers->class as $handler) { $class_array = array("class_name" => (string)$handler); if (isset($handler['link'])) { $class_array['link'] = $this->rootPath . "/" . $handler['link']; } $this->ajaxTypeHandlers[] = $class_array; } return $this->ajaxTypeHandlers; }
[ "public", "function", "getAJAXTypeHandlers", "(", ")", "{", "if", "(", "$", "this", "->", "ajaxTypeHandlers", "!=", "null", ")", "{", "return", "$", "this", "->", "ajaxTypeHandlers", ";", "}", "$", "this", "->", "ajaxTypeHandlers", "=", "array", "(", ")", ";", "/** @noinspection PhpUndefinedFieldInspection */", "if", "(", "!", "$", "this", "->", "configFile", "->", "AJAXTypeHandlers", "->", "getName", "(", ")", ")", "{", "return", "$", "this", "->", "ajaxTypeHandlers", ";", "}", "/** @noinspection PhpUndefinedFieldInspection */", "foreach", "(", "$", "this", "->", "configFile", "->", "AJAXTypeHandlers", "->", "class", "as", "$", "handler", ")", "{", "$", "class_array", "=", "array", "(", "\"class_name\"", "=>", "(", "string", ")", "$", "handler", ")", ";", "if", "(", "isset", "(", "$", "handler", "[", "'link'", "]", ")", ")", "{", "$", "class_array", "[", "'link'", "]", "=", "$", "this", "->", "rootPath", ".", "\"/\"", ".", "$", "handler", "[", "'link'", "]", ";", "}", "$", "this", "->", "ajaxTypeHandlers", "[", "]", "=", "$", "class_array", ";", "}", "return", "$", "this", "->", "ajaxTypeHandlers", ";", "}" ]
Will return AJAXTypeHandlers as an array, with the num key and an array containing "class_name" and "path" as value. The link should be relative to a root path provided. @return array
[ "Will", "return", "AJAXTypeHandlers", "as", "an", "array", "with", "the", "num", "key", "and", "an", "array", "containing", "class_name", "and", "path", "as", "value", ".", "The", "link", "should", "be", "relative", "to", "a", "root", "path", "provided", "." ]
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/ConfigImpl.php#L408-L431
234,086
budde377/Part
lib/ConfigImpl.php
ConfigImpl.listTemplateFolders
public function listTemplateFolders() { $this->setUpTemplate(); $result = []; foreach ($this->templateNamespace as $ns => $paths) { foreach ($paths as $path) { $path = $this->getRootPath() . "/" . $path; if ($ns == "") { $result[] = $path; } else { $result[] = ['path' => $path, 'namespace' => $ns]; } } } return $result; }
php
public function listTemplateFolders() { $this->setUpTemplate(); $result = []; foreach ($this->templateNamespace as $ns => $paths) { foreach ($paths as $path) { $path = $this->getRootPath() . "/" . $path; if ($ns == "") { $result[] = $path; } else { $result[] = ['path' => $path, 'namespace' => $ns]; } } } return $result; }
[ "public", "function", "listTemplateFolders", "(", ")", "{", "$", "this", "->", "setUpTemplate", "(", ")", ";", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "templateNamespace", "as", "$", "ns", "=>", "$", "paths", ")", "{", "foreach", "(", "$", "paths", "as", "$", "path", ")", "{", "$", "path", "=", "$", "this", "->", "getRootPath", "(", ")", ".", "\"/\"", ".", "$", "path", ";", "if", "(", "$", "ns", "==", "\"\"", ")", "{", "$", "result", "[", "]", "=", "$", "path", ";", "}", "else", "{", "$", "result", "[", "]", "=", "[", "'path'", "=>", "$", "path", ",", "'namespace'", "=>", "$", "ns", "]", ";", "}", "}", "}", "return", "$", "result", ";", "}" ]
Lists the folders where to look for other templates. @return string[]
[ "Lists", "the", "folders", "where", "to", "look", "for", "other", "templates", "." ]
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/ConfigImpl.php#L525-L542
234,087
skrz/meta
gen-src/Google/Protobuf/Meta/EnumValueOptionsMeta.php
EnumValueOptionsMeta.create
public static function create() { switch (func_num_args()) { case 0: return new EnumValueOptions(); case 1: return new EnumValueOptions(func_get_arg(0)); case 2: return new EnumValueOptions(func_get_arg(0), func_get_arg(1)); case 3: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2)); case 4: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3)); case 5: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4)); case 6: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5)); case 7: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6)); case 8: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7)); default: throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.'); } }
php
public static function create() { switch (func_num_args()) { case 0: return new EnumValueOptions(); case 1: return new EnumValueOptions(func_get_arg(0)); case 2: return new EnumValueOptions(func_get_arg(0), func_get_arg(1)); case 3: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2)); case 4: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3)); case 5: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4)); case 6: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5)); case 7: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6)); case 8: return new EnumValueOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7)); default: throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.'); } }
[ "public", "static", "function", "create", "(", ")", "{", "switch", "(", "func_num_args", "(", ")", ")", "{", "case", "0", ":", "return", "new", "EnumValueOptions", "(", ")", ";", "case", "1", ":", "return", "new", "EnumValueOptions", "(", "func_get_arg", "(", "0", ")", ")", ";", "case", "2", ":", "return", "new", "EnumValueOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ")", ";", "case", "3", ":", "return", "new", "EnumValueOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ")", ";", "case", "4", ":", "return", "new", "EnumValueOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ")", ";", "case", "5", ":", "return", "new", "EnumValueOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ")", ";", "case", "6", ":", "return", "new", "EnumValueOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ",", "func_get_arg", "(", "5", ")", ")", ";", "case", "7", ":", "return", "new", "EnumValueOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ",", "func_get_arg", "(", "5", ")", ",", "func_get_arg", "(", "6", ")", ")", ";", "case", "8", ":", "return", "new", "EnumValueOptions", "(", "func_get_arg", "(", "0", ")", ",", "func_get_arg", "(", "1", ")", ",", "func_get_arg", "(", "2", ")", ",", "func_get_arg", "(", "3", ")", ",", "func_get_arg", "(", "4", ")", ",", "func_get_arg", "(", "5", ")", ",", "func_get_arg", "(", "6", ")", ",", "func_get_arg", "(", "7", ")", ")", ";", "default", ":", "throw", "new", "\\", "InvalidArgumentException", "(", "'More than 8 arguments supplied, please be reasonable.'", ")", ";", "}", "}" ]
Creates new instance of \Google\Protobuf\EnumValueOptions @throws \InvalidArgumentException @return EnumValueOptions
[ "Creates", "new", "instance", "of", "\\", "Google", "\\", "Protobuf", "\\", "EnumValueOptions" ]
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/EnumValueOptionsMeta.php#L58-L82
234,088
skrz/meta
gen-src/Google/Protobuf/Meta/EnumValueOptionsMeta.php
EnumValueOptionsMeta.reset
public static function reset($object) { if (!($object instanceof EnumValueOptions)) { throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\EnumValueOptions.'); } $object->deprecated = NULL; $object->uninterpretedOption = NULL; }
php
public static function reset($object) { if (!($object instanceof EnumValueOptions)) { throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\EnumValueOptions.'); } $object->deprecated = NULL; $object->uninterpretedOption = NULL; }
[ "public", "static", "function", "reset", "(", "$", "object", ")", "{", "if", "(", "!", "(", "$", "object", "instanceof", "EnumValueOptions", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'You have to pass object of class Google\\Protobuf\\EnumValueOptions.'", ")", ";", "}", "$", "object", "->", "deprecated", "=", "NULL", ";", "$", "object", "->", "uninterpretedOption", "=", "NULL", ";", "}" ]
Resets properties of \Google\Protobuf\EnumValueOptions to default values @param EnumValueOptions $object @throws \InvalidArgumentException @return void
[ "Resets", "properties", "of", "\\", "Google", "\\", "Protobuf", "\\", "EnumValueOptions", "to", "default", "values" ]
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/EnumValueOptionsMeta.php#L95-L102
234,089
bhofstaetter/silverstripe-wkhtmltopdf
code/SS_PDF.php
SS_PDF.setGlobalOptions
public function setGlobalOptions($options = null) { if(!$options) { $css = BASE_PATH . '/themes/' . SSViewer::current_theme() . '/css/pdf.css'; $header = BASE_PATH . '/mysite/templates/Pdf/header.html'; $footer = BASE_PATH . '/mysite/templates/Pdf/footer.html'; $options = array( 'no-outline', 'enable-javascript', 'enable-smart-shrinking', 'encoding' => 'UTF-8', 'dpi' => 150, 'image-dpi' => 150, 'image-quality' => 100, 'user-style-sheet' => $css, 'orientation' => 'Portrait', 'page-height' => '297mm', 'page-width' => '210mm', 'page-size' => 'A4', 'margin-bottom' => 30, 'margin-left' => 10, 'margin-right' => 10, 'margin-top' => 30, 'header-html' => $header, 'footer-html' => $footer, 'binary' => '/usr/local/bin/wkhtmltopdf' ); } $this->globalOptions = $options; $this->pdf = new Pdf($this->globalOptions); }
php
public function setGlobalOptions($options = null) { if(!$options) { $css = BASE_PATH . '/themes/' . SSViewer::current_theme() . '/css/pdf.css'; $header = BASE_PATH . '/mysite/templates/Pdf/header.html'; $footer = BASE_PATH . '/mysite/templates/Pdf/footer.html'; $options = array( 'no-outline', 'enable-javascript', 'enable-smart-shrinking', 'encoding' => 'UTF-8', 'dpi' => 150, 'image-dpi' => 150, 'image-quality' => 100, 'user-style-sheet' => $css, 'orientation' => 'Portrait', 'page-height' => '297mm', 'page-width' => '210mm', 'page-size' => 'A4', 'margin-bottom' => 30, 'margin-left' => 10, 'margin-right' => 10, 'margin-top' => 30, 'header-html' => $header, 'footer-html' => $footer, 'binary' => '/usr/local/bin/wkhtmltopdf' ); } $this->globalOptions = $options; $this->pdf = new Pdf($this->globalOptions); }
[ "public", "function", "setGlobalOptions", "(", "$", "options", "=", "null", ")", "{", "if", "(", "!", "$", "options", ")", "{", "$", "css", "=", "BASE_PATH", ".", "'/themes/'", ".", "SSViewer", "::", "current_theme", "(", ")", ".", "'/css/pdf.css'", ";", "$", "header", "=", "BASE_PATH", ".", "'/mysite/templates/Pdf/header.html'", ";", "$", "footer", "=", "BASE_PATH", ".", "'/mysite/templates/Pdf/footer.html'", ";", "$", "options", "=", "array", "(", "'no-outline'", ",", "'enable-javascript'", ",", "'enable-smart-shrinking'", ",", "'encoding'", "=>", "'UTF-8'", ",", "'dpi'", "=>", "150", ",", "'image-dpi'", "=>", "150", ",", "'image-quality'", "=>", "100", ",", "'user-style-sheet'", "=>", "$", "css", ",", "'orientation'", "=>", "'Portrait'", ",", "'page-height'", "=>", "'297mm'", ",", "'page-width'", "=>", "'210mm'", ",", "'page-size'", "=>", "'A4'", ",", "'margin-bottom'", "=>", "30", ",", "'margin-left'", "=>", "10", ",", "'margin-right'", "=>", "10", ",", "'margin-top'", "=>", "30", ",", "'header-html'", "=>", "$", "header", ",", "'footer-html'", "=>", "$", "footer", ",", "'binary'", "=>", "'/usr/local/bin/wkhtmltopdf'", ")", ";", "}", "$", "this", "->", "globalOptions", "=", "$", "options", ";", "$", "this", "->", "pdf", "=", "new", "Pdf", "(", "$", "this", "->", "globalOptions", ")", ";", "}" ]
Set the global options for all pdfs @param array $options A list with all possible options can be found here http://wkhtmltopdf.org/usage/wkhtmltopdf.txt
[ "Set", "the", "global", "options", "for", "all", "pdfs" ]
47a972c205fdb5f5708c37de1637c5911e0edbe5
https://github.com/bhofstaetter/silverstripe-wkhtmltopdf/blob/47a972c205fdb5f5708c37de1637c5911e0edbe5/code/SS_PDF.php#L24-L55
234,090
bhofstaetter/silverstripe-wkhtmltopdf
code/SS_PDF.php
SS_PDF.setOption
public function setOption($key, $value = null) { $globalOptions = $this->globalOptions; if($value) { $globalOptions[$key] = $value; } else { $globalOptions[] = $key; } $this->setGlobalOptions($globalOptions); $this->pdf = new Pdf($this->globalOptions); }
php
public function setOption($key, $value = null) { $globalOptions = $this->globalOptions; if($value) { $globalOptions[$key] = $value; } else { $globalOptions[] = $key; } $this->setGlobalOptions($globalOptions); $this->pdf = new Pdf($this->globalOptions); }
[ "public", "function", "setOption", "(", "$", "key", ",", "$", "value", "=", "null", ")", "{", "$", "globalOptions", "=", "$", "this", "->", "globalOptions", ";", "if", "(", "$", "value", ")", "{", "$", "globalOptions", "[", "$", "key", "]", "=", "$", "value", ";", "}", "else", "{", "$", "globalOptions", "[", "]", "=", "$", "key", ";", "}", "$", "this", "->", "setGlobalOptions", "(", "$", "globalOptions", ")", ";", "$", "this", "->", "pdf", "=", "new", "Pdf", "(", "$", "this", "->", "globalOptions", ")", ";", "}" ]
Set a specific option for the pdf you are creating @param string $key The name of the option you want to set. A list with all possible options can be found here http://wkhtmltopdf.org/usage/wkhtmltopdf.txt @param string|array $value The value of the option you want to set. Can be left blank.
[ "Set", "a", "specific", "option", "for", "the", "pdf", "you", "are", "creating" ]
47a972c205fdb5f5708c37de1637c5911e0edbe5
https://github.com/bhofstaetter/silverstripe-wkhtmltopdf/blob/47a972c205fdb5f5708c37de1637c5911e0edbe5/code/SS_PDF.php#L65-L76
234,091
bhofstaetter/silverstripe-wkhtmltopdf
code/SS_PDF.php
SS_PDF.removeOption
public function removeOption($key) { $globalOptions = $this->globalOptions; if(array_key_exists($key, $globalOptions)) { unset($globalOptions[$key]); } else if($key = array_search($key, $globalOptions)) { unset($globalOptions[$key]); } $this->setGlobalOptions($globalOptions); $this->pdf = new Pdf($this->globalOptions); }
php
public function removeOption($key) { $globalOptions = $this->globalOptions; if(array_key_exists($key, $globalOptions)) { unset($globalOptions[$key]); } else if($key = array_search($key, $globalOptions)) { unset($globalOptions[$key]); } $this->setGlobalOptions($globalOptions); $this->pdf = new Pdf($this->globalOptions); }
[ "public", "function", "removeOption", "(", "$", "key", ")", "{", "$", "globalOptions", "=", "$", "this", "->", "globalOptions", ";", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "globalOptions", ")", ")", "{", "unset", "(", "$", "globalOptions", "[", "$", "key", "]", ")", ";", "}", "else", "if", "(", "$", "key", "=", "array_search", "(", "$", "key", ",", "$", "globalOptions", ")", ")", "{", "unset", "(", "$", "globalOptions", "[", "$", "key", "]", ")", ";", "}", "$", "this", "->", "setGlobalOptions", "(", "$", "globalOptions", ")", ";", "$", "this", "->", "pdf", "=", "new", "Pdf", "(", "$", "this", "->", "globalOptions", ")", ";", "}" ]
Remove a specific option for the pdf you are creating @param string $key The name of the option you want to set.
[ "Remove", "a", "specific", "option", "for", "the", "pdf", "you", "are", "creating" ]
47a972c205fdb5f5708c37de1637c5911e0edbe5
https://github.com/bhofstaetter/silverstripe-wkhtmltopdf/blob/47a972c205fdb5f5708c37de1637c5911e0edbe5/code/SS_PDF.php#L83-L94
234,092
bhofstaetter/silverstripe-wkhtmltopdf
code/SS_PDF.php
SS_PDF.setFolderName
public function setFolderName($folder = null) { if($folder) { $folder = Folder::find_or_make($folder); $this->folderID = $folder->ID; $folder = str_replace('assets/', '', $folder->Filename); $this->folder = rtrim($this->folder . $folder, '/') . '/'; } }
php
public function setFolderName($folder = null) { if($folder) { $folder = Folder::find_or_make($folder); $this->folderID = $folder->ID; $folder = str_replace('assets/', '', $folder->Filename); $this->folder = rtrim($this->folder . $folder, '/') . '/'; } }
[ "public", "function", "setFolderName", "(", "$", "folder", "=", "null", ")", "{", "if", "(", "$", "folder", ")", "{", "$", "folder", "=", "Folder", "::", "find_or_make", "(", "$", "folder", ")", ";", "$", "this", "->", "folderID", "=", "$", "folder", "->", "ID", ";", "$", "folder", "=", "str_replace", "(", "'assets/'", ",", "''", ",", "$", "folder", "->", "Filename", ")", ";", "$", "this", "->", "folder", "=", "rtrim", "(", "$", "this", "->", "folder", ".", "$", "folder", ",", "'/'", ")", ".", "'/'", ";", "}", "}" ]
Specify the pdf location @param string $folder The name of the desired folder. Creates a new one if folder doesn't exist.
[ "Specify", "the", "pdf", "location" ]
47a972c205fdb5f5708c37de1637c5911e0edbe5
https://github.com/bhofstaetter/silverstripe-wkhtmltopdf/blob/47a972c205fdb5f5708c37de1637c5911e0edbe5/code/SS_PDF.php#L101-L108
234,093
bhofstaetter/silverstripe-wkhtmltopdf
code/SS_PDF.php
SS_PDF.getHtml
static function getHtml($obj, $variables = null, $template = null) { Requirements::clear(); if(!$template) { $template = sprintf("%s_pdf", $obj->ClassName); } $viewer = new SSViewer($template); $html = $viewer->process($obj, $variables); return $html; }
php
static function getHtml($obj, $variables = null, $template = null) { Requirements::clear(); if(!$template) { $template = sprintf("%s_pdf", $obj->ClassName); } $viewer = new SSViewer($template); $html = $viewer->process($obj, $variables); return $html; }
[ "static", "function", "getHtml", "(", "$", "obj", ",", "$", "variables", "=", "null", ",", "$", "template", "=", "null", ")", "{", "Requirements", "::", "clear", "(", ")", ";", "if", "(", "!", "$", "template", ")", "{", "$", "template", "=", "sprintf", "(", "\"%s_pdf\"", ",", "$", "obj", "->", "ClassName", ")", ";", "}", "$", "viewer", "=", "new", "SSViewer", "(", "$", "template", ")", ";", "$", "html", "=", "$", "viewer", "->", "process", "(", "$", "obj", ",", "$", "variables", ")", ";", "return", "$", "html", ";", "}" ]
Generates the html code you need for the pdf @param DataObject $obj The base DataObject for your pdf @param array $variables Array with customisation for your data. @param string $template If submitted the name of the template used to generate the html. If not, the script will look for a template based on your DataObject class e.g. Trainer_pdf @return string The html code for your pdf
[ "Generates", "the", "html", "code", "you", "need", "for", "the", "pdf" ]
47a972c205fdb5f5708c37de1637c5911e0edbe5
https://github.com/bhofstaetter/silverstripe-wkhtmltopdf/blob/47a972c205fdb5f5708c37de1637c5911e0edbe5/code/SS_PDF.php#L119-L129
234,094
bhofstaetter/silverstripe-wkhtmltopdf
code/SS_PDF.php
SS_PDF.add
public function add($content, $type = 'Page', $options = array()) { if($type == 'Page') { $this->pdf->addPage($content, $options); } else if($type == 'Cover') { $this->pdf->addCover($content, $options); } }
php
public function add($content, $type = 'Page', $options = array()) { if($type == 'Page') { $this->pdf->addPage($content, $options); } else if($type == 'Cover') { $this->pdf->addCover($content, $options); } }
[ "public", "function", "add", "(", "$", "content", ",", "$", "type", "=", "'Page'", ",", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "$", "type", "==", "'Page'", ")", "{", "$", "this", "->", "pdf", "->", "addPage", "(", "$", "content", ",", "$", "options", ")", ";", "}", "else", "if", "(", "$", "type", "==", "'Cover'", ")", "{", "$", "this", "->", "pdf", "->", "addCover", "(", "$", "content", ",", "$", "options", ")", ";", "}", "}" ]
Adds a normale page or cover to your pdf @param string $content The html code from your DataObject, a pdf file or any website url @param string $type "Page" for a normal page or if you want to add an cover "Cover" @param array $options Specific options only for that page A list with all possible options can be found here http://wkhtmltopdf.org/usage/wkhtmltopdf.txt
[ "Adds", "a", "normale", "page", "or", "cover", "to", "your", "pdf" ]
47a972c205fdb5f5708c37de1637c5911e0edbe5
https://github.com/bhofstaetter/silverstripe-wkhtmltopdf/blob/47a972c205fdb5f5708c37de1637c5911e0edbe5/code/SS_PDF.php#L139-L145
234,095
bhofstaetter/silverstripe-wkhtmltopdf
code/SS_PDF.php
SS_PDF.save
public function save($filename, $class = 'File') { if(!empty($this->pdf->getError())) { throw new Exception('Could not create PDF: ' . $this->pdf->getError()); } else { $filename = rtrim($class::create()->setName($filename), '.pdf') . '.pdf'; $this->pdf->saveAs($this->folder . $filename); return $this->createFile($filename, $class); } }
php
public function save($filename, $class = 'File') { if(!empty($this->pdf->getError())) { throw new Exception('Could not create PDF: ' . $this->pdf->getError()); } else { $filename = rtrim($class::create()->setName($filename), '.pdf') . '.pdf'; $this->pdf->saveAs($this->folder . $filename); return $this->createFile($filename, $class); } }
[ "public", "function", "save", "(", "$", "filename", ",", "$", "class", "=", "'File'", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "pdf", "->", "getError", "(", ")", ")", ")", "{", "throw", "new", "Exception", "(", "'Could not create PDF: '", ".", "$", "this", "->", "pdf", "->", "getError", "(", ")", ")", ";", "}", "else", "{", "$", "filename", "=", "rtrim", "(", "$", "class", "::", "create", "(", ")", "->", "setName", "(", "$", "filename", ")", ",", "'.pdf'", ")", ".", "'.pdf'", ";", "$", "this", "->", "pdf", "->", "saveAs", "(", "$", "this", "->", "folder", ".", "$", "filename", ")", ";", "return", "$", "this", "->", "createFile", "(", "$", "filename", ",", "$", "class", ")", ";", "}", "}" ]
Saves the pdf file @param string $filename The desired name of the pdf file @param string $class Dataobject class of file @return DataObject The new created pdf file
[ "Saves", "the", "pdf", "file" ]
47a972c205fdb5f5708c37de1637c5911e0edbe5
https://github.com/bhofstaetter/silverstripe-wkhtmltopdf/blob/47a972c205fdb5f5708c37de1637c5911e0edbe5/code/SS_PDF.php#L154-L162
234,096
bhofstaetter/silverstripe-wkhtmltopdf
code/SS_PDF.php
SS_PDF.createFile
protected function createFile($filename, $class) { $filename = trim($filename); $file = $class::create(); $file->setName($filename); $file->Filename = $this->folder . $filename; $file->ParentID = $this->folderID; $file->write(); return $file; }
php
protected function createFile($filename, $class) { $filename = trim($filename); $file = $class::create(); $file->setName($filename); $file->Filename = $this->folder . $filename; $file->ParentID = $this->folderID; $file->write(); return $file; }
[ "protected", "function", "createFile", "(", "$", "filename", ",", "$", "class", ")", "{", "$", "filename", "=", "trim", "(", "$", "filename", ")", ";", "$", "file", "=", "$", "class", "::", "create", "(", ")", ";", "$", "file", "->", "setName", "(", "$", "filename", ")", ";", "$", "file", "->", "Filename", "=", "$", "this", "->", "folder", ".", "$", "filename", ";", "$", "file", "->", "ParentID", "=", "$", "this", "->", "folderID", ";", "$", "file", "->", "write", "(", ")", ";", "return", "$", "file", ";", "}" ]
Creates an File DataObject from the pdf @param string $filename The desired name of the pdf file @param string $class Dataobject class of file @return DataObject Pdf file
[ "Creates", "an", "File", "DataObject", "from", "the", "pdf" ]
47a972c205fdb5f5708c37de1637c5911e0edbe5
https://github.com/bhofstaetter/silverstripe-wkhtmltopdf/blob/47a972c205fdb5f5708c37de1637c5911e0edbe5/code/SS_PDF.php#L171-L179
234,097
bhofstaetter/silverstripe-wkhtmltopdf
code/SS_PDF.php
SS_PDF.preview
public function preview() { if(!empty($this->pdf->getError())) { throw new Exception('Could not create PDF: ' . $this->pdf->getError()); } else { $this->pdf->send(); } die(); }
php
public function preview() { if(!empty($this->pdf->getError())) { throw new Exception('Could not create PDF: ' . $this->pdf->getError()); } else { $this->pdf->send(); } die(); }
[ "public", "function", "preview", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "pdf", "->", "getError", "(", ")", ")", ")", "{", "throw", "new", "Exception", "(", "'Could not create PDF: '", ".", "$", "this", "->", "pdf", "->", "getError", "(", ")", ")", ";", "}", "else", "{", "$", "this", "->", "pdf", "->", "send", "(", ")", ";", "}", "die", "(", ")", ";", "}" ]
Streams the pdf to your browser to preview it
[ "Streams", "the", "pdf", "to", "your", "browser", "to", "preview", "it" ]
47a972c205fdb5f5708c37de1637c5911e0edbe5
https://github.com/bhofstaetter/silverstripe-wkhtmltopdf/blob/47a972c205fdb5f5708c37de1637c5911e0edbe5/code/SS_PDF.php#L184-L192
234,098
bhofstaetter/silverstripe-wkhtmltopdf
code/SS_PDF.php
SS_PDF.download
public function download($filename) { if(!empty($this->pdf->getError())) { throw new Exception('Could not create PDF: ' . $this->pdf->getError()); } else { $filename = rtrim(File::create()->setName($filename), '.pdf') . '.pdf'; $this->pdf->send($filename); } }
php
public function download($filename) { if(!empty($this->pdf->getError())) { throw new Exception('Could not create PDF: ' . $this->pdf->getError()); } else { $filename = rtrim(File::create()->setName($filename), '.pdf') . '.pdf'; $this->pdf->send($filename); } }
[ "public", "function", "download", "(", "$", "filename", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "pdf", "->", "getError", "(", ")", ")", ")", "{", "throw", "new", "Exception", "(", "'Could not create PDF: '", ".", "$", "this", "->", "pdf", "->", "getError", "(", ")", ")", ";", "}", "else", "{", "$", "filename", "=", "rtrim", "(", "File", "::", "create", "(", ")", "->", "setName", "(", "$", "filename", ")", ",", "'.pdf'", ")", ".", "'.pdf'", ";", "$", "this", "->", "pdf", "->", "send", "(", "$", "filename", ")", ";", "}", "}" ]
Forces the download of the pdf
[ "Forces", "the", "download", "of", "the", "pdf" ]
47a972c205fdb5f5708c37de1637c5911e0edbe5
https://github.com/bhofstaetter/silverstripe-wkhtmltopdf/blob/47a972c205fdb5f5708c37de1637c5911e0edbe5/code/SS_PDF.php#L197-L204
234,099
malahierba-lab/public-id
src/PublicId.php
PublicId.publicIdDecode
static public function publicIdDecode($public_id) { $hashids = new Hashids(self::getSalt(), self::getMinLength(), self::getAlphabet()); $id = $hashids->decode($public_id); if (is_array($id) && isset($id[0])) return $id[0]; return null; }
php
static public function publicIdDecode($public_id) { $hashids = new Hashids(self::getSalt(), self::getMinLength(), self::getAlphabet()); $id = $hashids->decode($public_id); if (is_array($id) && isset($id[0])) return $id[0]; return null; }
[ "static", "public", "function", "publicIdDecode", "(", "$", "public_id", ")", "{", "$", "hashids", "=", "new", "Hashids", "(", "self", "::", "getSalt", "(", ")", ",", "self", "::", "getMinLength", "(", ")", ",", "self", "::", "getAlphabet", "(", ")", ")", ";", "$", "id", "=", "$", "hashids", "->", "decode", "(", "$", "public_id", ")", ";", "if", "(", "is_array", "(", "$", "id", ")", "&&", "isset", "(", "$", "id", "[", "0", "]", ")", ")", "return", "$", "id", "[", "0", "]", ";", "return", "null", ";", "}" ]
Decode public id to real id @access public @param string $public_id @return integer|null
[ "Decode", "public", "id", "to", "real", "id" ]
6a39d2c19401edbf3eeac60e88e93c17f202bd0e
https://github.com/malahierba-lab/public-id/blob/6a39d2c19401edbf3eeac60e88e93c17f202bd0e/src/PublicId.php#L16-L26