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
18,100
ClanCats/Core
src/classes/CCEvent.php
CCEvent.fire
public static function fire( $event, $params = array() ) { if ( !array_key_exists( $event, static::$events ) ) { return; } $event = static::$events[$event]; $return = array(); if ( array_key_exists( 'before', $event ) ) { $return['before'] = static::call( $event['before'], $params ); } if ( array_key_exists( 'callbacks', $event ) ) { $return['main'] = static::call( $event['callbacks'], $params ); } if ( array_key_exists( 'after', $event ) ) { $return['after'] = static::call( $event['after'], $params ); } return static::pack( $return ); }
php
public static function fire( $event, $params = array() ) { if ( !array_key_exists( $event, static::$events ) ) { return; } $event = static::$events[$event]; $return = array(); if ( array_key_exists( 'before', $event ) ) { $return['before'] = static::call( $event['before'], $params ); } if ( array_key_exists( 'callbacks', $event ) ) { $return['main'] = static::call( $event['callbacks'], $params ); } if ( array_key_exists( 'after', $event ) ) { $return['after'] = static::call( $event['after'], $params ); } return static::pack( $return ); }
[ "public", "static", "function", "fire", "(", "$", "event", ",", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "event", ",", "static", "::", "$", "events", ")", ")", "{", "return", ";", "}", "$", "event", "=", "static", "::", "$", "events", "[", "$", "event", "]", ";", "$", "return", "=", "array", "(", ")", ";", "if", "(", "array_key_exists", "(", "'before'", ",", "$", "event", ")", ")", "{", "$", "return", "[", "'before'", "]", "=", "static", "::", "call", "(", "$", "event", "[", "'before'", "]", ",", "$", "params", ")", ";", "}", "if", "(", "array_key_exists", "(", "'callbacks'", ",", "$", "event", ")", ")", "{", "$", "return", "[", "'main'", "]", "=", "static", "::", "call", "(", "$", "event", "[", "'callbacks'", "]", ",", "$", "params", ")", ";", "}", "if", "(", "array_key_exists", "(", "'after'", ",", "$", "event", ")", ")", "{", "$", "return", "[", "'after'", "]", "=", "static", "::", "call", "(", "$", "event", "[", "'after'", "]", ",", "$", "params", ")", ";", "}", "return", "static", "::", "pack", "(", "$", "return", ")", ";", "}" ]
fire an event @param string $event @param array $params @return array
[ "fire", "an", "event" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCEvent.php#L95-L117
18,101
ClanCats/Core
src/classes/CCEvent.php
CCEvent.pass
public static function pass( $event, $param = null ) { if ( !array_key_exists( $event, static::$events ) ) { return $param; } $event = static::$events[$event]; if ( array_key_exists( 'before', $event ) ) { $param = static::call( $event['before'], $param, true ); } if ( array_key_exists( 'callbacks', $event ) ) { $param = static::call( $event['callbacks'], $param, true ); } if ( array_key_exists( 'after', $event ) ) { $param = static::call( $event['after'], $param, true ); } return $param; }
php
public static function pass( $event, $param = null ) { if ( !array_key_exists( $event, static::$events ) ) { return $param; } $event = static::$events[$event]; if ( array_key_exists( 'before', $event ) ) { $param = static::call( $event['before'], $param, true ); } if ( array_key_exists( 'callbacks', $event ) ) { $param = static::call( $event['callbacks'], $param, true ); } if ( array_key_exists( 'after', $event ) ) { $param = static::call( $event['after'], $param, true ); } return $param; }
[ "public", "static", "function", "pass", "(", "$", "event", ",", "$", "param", "=", "null", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "event", ",", "static", "::", "$", "events", ")", ")", "{", "return", "$", "param", ";", "}", "$", "event", "=", "static", "::", "$", "events", "[", "$", "event", "]", ";", "if", "(", "array_key_exists", "(", "'before'", ",", "$", "event", ")", ")", "{", "$", "param", "=", "static", "::", "call", "(", "$", "event", "[", "'before'", "]", ",", "$", "param", ",", "true", ")", ";", "}", "if", "(", "array_key_exists", "(", "'callbacks'", ",", "$", "event", ")", ")", "{", "$", "param", "=", "static", "::", "call", "(", "$", "event", "[", "'callbacks'", "]", ",", "$", "param", ",", "true", ")", ";", "}", "if", "(", "array_key_exists", "(", "'after'", ",", "$", "event", ")", ")", "{", "$", "param", "=", "static", "::", "call", "(", "$", "event", "[", "'after'", "]", ",", "$", "param", ",", "true", ")", ";", "}", "return", "$", "param", ";", "}" ]
pass an var to an event the diffrence to fire is that the param gets modified by each event @param string $event @param mixed $param @return mixed
[ "pass", "an", "var", "to", "an", "event", "the", "diffrence", "to", "fire", "is", "that", "the", "param", "gets", "modified", "by", "each", "event" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCEvent.php#L127-L148
18,102
ClanCats/Core
src/classes/CCEvent.php
CCEvent.call
protected static function call( $callbacks, $params, $pass = false ) { $response = array(); if ( $pass ) { $response = $params; } foreach ( $callbacks as $callback ) { if ( $pass ) { $response = call_user_func_array( $callback, array( $response ) ); } else { $response[] = call_user_func_array( $callback, $params ); } } return $response; }
php
protected static function call( $callbacks, $params, $pass = false ) { $response = array(); if ( $pass ) { $response = $params; } foreach ( $callbacks as $callback ) { if ( $pass ) { $response = call_user_func_array( $callback, array( $response ) ); } else { $response[] = call_user_func_array( $callback, $params ); } } return $response; }
[ "protected", "static", "function", "call", "(", "$", "callbacks", ",", "$", "params", ",", "$", "pass", "=", "false", ")", "{", "$", "response", "=", "array", "(", ")", ";", "if", "(", "$", "pass", ")", "{", "$", "response", "=", "$", "params", ";", "}", "foreach", "(", "$", "callbacks", "as", "$", "callback", ")", "{", "if", "(", "$", "pass", ")", "{", "$", "response", "=", "call_user_func_array", "(", "$", "callback", ",", "array", "(", "$", "response", ")", ")", ";", "}", "else", "{", "$", "response", "[", "]", "=", "call_user_func_array", "(", "$", "callback", ",", "$", "params", ")", ";", "}", "}", "return", "$", "response", ";", "}" ]
call an callback array @param array $callbacks @param array $params @param bool $pass @retrun array
[ "call", "an", "callback", "array" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCEvent.php#L158-L176
18,103
ClanCats/Core
src/classes/CCEvent.php
CCEvent.pack
protected static function pack( $responses ) { return array_merge( CCArr::get( 'before', $responses, array() ), CCArr::get( 'main', $responses, array() ), CCArr::get( 'after', $responses, array() ) ); }
php
protected static function pack( $responses ) { return array_merge( CCArr::get( 'before', $responses, array() ), CCArr::get( 'main', $responses, array() ), CCArr::get( 'after', $responses, array() ) ); }
[ "protected", "static", "function", "pack", "(", "$", "responses", ")", "{", "return", "array_merge", "(", "CCArr", "::", "get", "(", "'before'", ",", "$", "responses", ",", "array", "(", ")", ")", ",", "CCArr", "::", "get", "(", "'main'", ",", "$", "responses", ",", "array", "(", ")", ")", ",", "CCArr", "::", "get", "(", "'after'", ",", "$", "responses", ",", "array", "(", ")", ")", ")", ";", "}" ]
packs all responses into one array @param array $responses @return array
[ "packs", "all", "responses", "into", "one", "array" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCEvent.php#L184-L186
18,104
titon/db
src/Titon/Db/Behavior/TimestampBehavior.php
TimestampBehavior.preSave
public function preSave(Event $event, Query $query, $id, array &$data) { $data[$this->getConfig($query->getType() === Query::UPDATE ? 'updateField' : 'createField')] = time(); return true; }
php
public function preSave(Event $event, Query $query, $id, array &$data) { $data[$this->getConfig($query->getType() === Query::UPDATE ? 'updateField' : 'createField')] = time(); return true; }
[ "public", "function", "preSave", "(", "Event", "$", "event", ",", "Query", "$", "query", ",", "$", "id", ",", "array", "&", "$", "data", ")", "{", "$", "data", "[", "$", "this", "->", "getConfig", "(", "$", "query", "->", "getType", "(", ")", "===", "Query", "::", "UPDATE", "?", "'updateField'", ":", "'createField'", ")", "]", "=", "time", "(", ")", ";", "return", "true", ";", "}" ]
Append the current timestamp to the data. @param \Titon\Event\Event $event @param \Titon\Db\Query $query @param int|int[] $id @param array $data @return bool
[ "Append", "the", "current", "timestamp", "to", "the", "data", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/TimestampBehavior.php#L42-L46
18,105
andrelohmann/silverstripe-geolocation
code/models/fieldtypes/Location.php
Location.getSQLFilter
public function getSQLFilter($radius, $scale = 'km'){ // set Latitude and Longditude Columnnames GeoFunctions::$Latitude = $this->name.'Latitude'; GeoFunctions::$Longditude = $this->name.'Longditude'; return GeoFunctions::getSQLSquare($this->getLatitude(), $this->getLongditude(), $radius, $scale); }
php
public function getSQLFilter($radius, $scale = 'km'){ // set Latitude and Longditude Columnnames GeoFunctions::$Latitude = $this->name.'Latitude'; GeoFunctions::$Longditude = $this->name.'Longditude'; return GeoFunctions::getSQLSquare($this->getLatitude(), $this->getLongditude(), $radius, $scale); }
[ "public", "function", "getSQLFilter", "(", "$", "radius", ",", "$", "scale", "=", "'km'", ")", "{", "// set Latitude and Longditude Columnnames", "GeoFunctions", "::", "$", "Latitude", "=", "$", "this", "->", "name", ".", "'Latitude'", ";", "GeoFunctions", "::", "$", "Longditude", "=", "$", "this", "->", "name", ".", "'Longditude'", ";", "return", "GeoFunctions", "::", "getSQLSquare", "(", "$", "this", "->", "getLatitude", "(", ")", ",", "$", "this", "->", "getLongditude", "(", ")", ",", "$", "radius", ",", "$", "scale", ")", ";", "}" ]
return a SQL Bounce for WHERE Clause
[ "return", "a", "SQL", "Bounce", "for", "WHERE", "Clause" ]
124062008d8fa25b631bf5bb69b2ca79b53ef81b
https://github.com/andrelohmann/silverstripe-geolocation/blob/124062008d8fa25b631bf5bb69b2ca79b53ef81b/code/models/fieldtypes/Location.php#L194-L200
18,106
andrelohmann/silverstripe-geolocation
code/models/fieldtypes/Location.php
Location.getDistanceFromLocation
public function getDistanceFromLocation(Location $location, $scale = 'km'){ return GeoFunctions::getDistance($this->getLatitude(), $this->getLongditude(), $location->getLatitude(), $location->getLongditude(), $scale); }
php
public function getDistanceFromLocation(Location $location, $scale = 'km'){ return GeoFunctions::getDistance($this->getLatitude(), $this->getLongditude(), $location->getLatitude(), $location->getLongditude(), $scale); }
[ "public", "function", "getDistanceFromLocation", "(", "Location", "$", "location", ",", "$", "scale", "=", "'km'", ")", "{", "return", "GeoFunctions", "::", "getDistance", "(", "$", "this", "->", "getLatitude", "(", ")", ",", "$", "this", "->", "getLongditude", "(", ")", ",", "$", "location", "->", "getLatitude", "(", ")", ",", "$", "location", "->", "getLongditude", "(", ")", ",", "$", "scale", ")", ";", "}" ]
return the Distance to the given location
[ "return", "the", "Distance", "to", "the", "given", "location" ]
124062008d8fa25b631bf5bb69b2ca79b53ef81b
https://github.com/andrelohmann/silverstripe-geolocation/blob/124062008d8fa25b631bf5bb69b2ca79b53ef81b/code/models/fieldtypes/Location.php#L220-L222
18,107
ClanCats/Core
src/classes/CCContainer.php
CCContainer.is_callable
public static function is_callable( $key ) { if ( is_callable( $key ) ) { return true; } if ( array_key_exists( $key, static::$_container ) ) { return true; } return false; }
php
public static function is_callable( $key ) { if ( is_callable( $key ) ) { return true; } if ( array_key_exists( $key, static::$_container ) ) { return true; } return false; }
[ "public", "static", "function", "is_callable", "(", "$", "key", ")", "{", "if", "(", "is_callable", "(", "$", "key", ")", ")", "{", "return", "true", ";", "}", "if", "(", "array_key_exists", "(", "$", "key", ",", "static", "::", "$", "_container", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Is this callable @param string $key @return bool
[ "Is", "this", "callable" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCContainer.php#L49-L62
18,108
ClanCats/Core
src/classes/CCContainer.php
CCContainer.call
public static function call() { $arguments = func_get_args(); // get the key $key = array_shift( $arguments ); // container call if ( is_string( $key ) && array_key_exists( $key, static::$_container ) && is_callable( static::$_container[$key] ) ) { return call_user_func_array( static::$_container[$key], $arguments ); } if ( !is_callable( $key ) ) { throw new CCException( "CCContainer::call - Cannot call '".$key."' invalid callback." ); } // default callback return call_user_func_array( $key, $arguments ); }
php
public static function call() { $arguments = func_get_args(); // get the key $key = array_shift( $arguments ); // container call if ( is_string( $key ) && array_key_exists( $key, static::$_container ) && is_callable( static::$_container[$key] ) ) { return call_user_func_array( static::$_container[$key], $arguments ); } if ( !is_callable( $key ) ) { throw new CCException( "CCContainer::call - Cannot call '".$key."' invalid callback." ); } // default callback return call_user_func_array( $key, $arguments ); }
[ "public", "static", "function", "call", "(", ")", "{", "$", "arguments", "=", "func_get_args", "(", ")", ";", "// get the key", "$", "key", "=", "array_shift", "(", "$", "arguments", ")", ";", "// container call", "if", "(", "is_string", "(", "$", "key", ")", "&&", "array_key_exists", "(", "$", "key", ",", "static", "::", "$", "_container", ")", "&&", "is_callable", "(", "static", "::", "$", "_container", "[", "$", "key", "]", ")", ")", "{", "return", "call_user_func_array", "(", "static", "::", "$", "_container", "[", "$", "key", "]", ",", "$", "arguments", ")", ";", "}", "if", "(", "!", "is_callable", "(", "$", "key", ")", ")", "{", "throw", "new", "CCException", "(", "\"CCContainer::call - Cannot call '\"", ".", "$", "key", ".", "\"' invalid callback.\"", ")", ";", "}", "// default callback", "return", "call_user_func_array", "(", "$", "key", ",", "$", "arguments", ")", ";", "}" ]
call a container @param string $key @param mixed $callback @return void
[ "call", "a", "container" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCContainer.php#L71-L91
18,109
maniaplanet/matchmaking-lobby
MatchMakingLobby/Lobby/MatchMakers/AbstractDistance.php
AbstractDistance.buildGraph
protected function buildGraph(&$graph, $distanceComputeCallback, array $objects) { $graph = new Helpers\Graph(); while($object = array_shift($objects)) { $graph->addNode( $object, $this->computeDistances($object, $objects, $distanceComputeCallback) ); } }
php
protected function buildGraph(&$graph, $distanceComputeCallback, array $objects) { $graph = new Helpers\Graph(); while($object = array_shift($objects)) { $graph->addNode( $object, $this->computeDistances($object, $objects, $distanceComputeCallback) ); } }
[ "protected", "function", "buildGraph", "(", "&", "$", "graph", ",", "$", "distanceComputeCallback", ",", "array", "$", "objects", ")", "{", "$", "graph", "=", "new", "Helpers", "\\", "Graph", "(", ")", ";", "while", "(", "$", "object", "=", "array_shift", "(", "$", "objects", ")", ")", "{", "$", "graph", "->", "addNode", "(", "$", "object", ",", "$", "this", "->", "computeDistances", "(", "$", "object", ",", "$", "objects", ",", "$", "distanceComputeCallback", ")", ")", ";", "}", "}" ]
Create a graph where each ready player is a node @param DistanciableObject[] $bannedPlayers @return type
[ "Create", "a", "graph", "where", "each", "ready", "player", "is", "a", "node" ]
384f22cdd2cfb0204a071810549eaf1eb01d8b7f
https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Lobby/MatchMakers/AbstractDistance.php#L188-L199
18,110
maniaplanet/matchmaking-lobby
MatchMakingLobby/Lobby/MatchMakers/AbstractDistance.php
AbstractDistance.computeDistances
private function computeDistances($object, $followers, $distanceComputeCallback) { $distances = array(); foreach($followers as $follower) { if($follower == $object) continue; $distances[$follower->id] = call_user_func($distanceComputeCallback, $object->data, $follower->data); } return $distances; }
php
private function computeDistances($object, $followers, $distanceComputeCallback) { $distances = array(); foreach($followers as $follower) { if($follower == $object) continue; $distances[$follower->id] = call_user_func($distanceComputeCallback, $object->data, $follower->data); } return $distances; }
[ "private", "function", "computeDistances", "(", "$", "object", ",", "$", "followers", ",", "$", "distanceComputeCallback", ")", "{", "$", "distances", "=", "array", "(", ")", ";", "foreach", "(", "$", "followers", "as", "$", "follower", ")", "{", "if", "(", "$", "follower", "==", "$", "object", ")", "continue", ";", "$", "distances", "[", "$", "follower", "->", "id", "]", "=", "call_user_func", "(", "$", "distanceComputeCallback", ",", "$", "object", "->", "data", ",", "$", "follower", "->", "data", ")", ";", "}", "return", "$", "distances", ";", "}" ]
Compute distance for a player with all his followers @param string $player @param string[] $followers @return float[string]
[ "Compute", "distance", "for", "a", "player", "with", "all", "his", "followers" ]
384f22cdd2cfb0204a071810549eaf1eb01d8b7f
https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Lobby/MatchMakers/AbstractDistance.php#L207-L217
18,111
ppetermann/king23
src/Http/Middleware/BasePathStripper.php
BasePathStripper.process
public function process(ServerRequestInterface $request, RequestHandlerInterface $next) : ResponseInterface { $path = $request->getUri()->getPath(); if (!empty($this->basePath) && 0 === strpos($path, $this->basePath)) { $cleanPath = substr($path, strlen($this->basePath)); if ($cleanPath === false) { $cleanPath = ''; } $request = $request->withUri($request->getUri()->withPath($cleanPath)); } return $next->handle($request); }
php
public function process(ServerRequestInterface $request, RequestHandlerInterface $next) : ResponseInterface { $path = $request->getUri()->getPath(); if (!empty($this->basePath) && 0 === strpos($path, $this->basePath)) { $cleanPath = substr($path, strlen($this->basePath)); if ($cleanPath === false) { $cleanPath = ''; } $request = $request->withUri($request->getUri()->withPath($cleanPath)); } return $next->handle($request); }
[ "public", "function", "process", "(", "ServerRequestInterface", "$", "request", ",", "RequestHandlerInterface", "$", "next", ")", ":", "ResponseInterface", "{", "$", "path", "=", "$", "request", "->", "getUri", "(", ")", "->", "getPath", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "basePath", ")", "&&", "0", "===", "strpos", "(", "$", "path", ",", "$", "this", "->", "basePath", ")", ")", "{", "$", "cleanPath", "=", "substr", "(", "$", "path", ",", "strlen", "(", "$", "this", "->", "basePath", ")", ")", ";", "if", "(", "$", "cleanPath", "===", "false", ")", "{", "$", "cleanPath", "=", "''", ";", "}", "$", "request", "=", "$", "request", "->", "withUri", "(", "$", "request", "->", "getUri", "(", ")", "->", "withPath", "(", "$", "cleanPath", ")", ")", ";", "}", "return", "$", "next", "->", "handle", "(", "$", "request", ")", ";", "}" ]
strip away the basePath @param ServerRequestInterface $request @param RequestHandlerInterface $next @return ResponseInterface
[ "strip", "away", "the", "basePath" ]
603896083ec89f5ac4d744abd3b1b4db3e914c95
https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Http/Middleware/BasePathStripper.php#L67-L80
18,112
Double-Opt-in/php-client-api
src/Guzzle/Plugin/OAuth2Plugin.php
OAuth2Plugin.setCache
public function setCache($file) { if ( ! empty($file)) { $this->cache = new AccessTokenCache($file); $this->setAccessToken($this->cache->get()); } }
php
public function setCache($file) { if ( ! empty($file)) { $this->cache = new AccessTokenCache($file); $this->setAccessToken($this->cache->get()); } }
[ "public", "function", "setCache", "(", "$", "file", ")", "{", "if", "(", "!", "empty", "(", "$", "file", ")", ")", "{", "$", "this", "->", "cache", "=", "new", "AccessTokenCache", "(", "$", "file", ")", ";", "$", "this", "->", "setAccessToken", "(", "$", "this", "->", "cache", "->", "get", "(", ")", ")", ";", "}", "}" ]
sets the cache file when possible @param string $file
[ "sets", "the", "cache", "file", "when", "possible" ]
2f17da58ec20a408bbd55b2cdd053bc689f995f4
https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Guzzle/Plugin/OAuth2Plugin.php#L24-L31
18,113
gries/rcon
src/Messenger.php
Messenger.send
public function send($messageText, callable $callable = null) { $message = new Message($messageText); $response = $this->connection ->sendMessage($message) ->getBody() ; if ($callable) { $response = call_user_func($callable, $response); } return $response; }
php
public function send($messageText, callable $callable = null) { $message = new Message($messageText); $response = $this->connection ->sendMessage($message) ->getBody() ; if ($callable) { $response = call_user_func($callable, $response); } return $response; }
[ "public", "function", "send", "(", "$", "messageText", ",", "callable", "$", "callable", "=", "null", ")", "{", "$", "message", "=", "new", "Message", "(", "$", "messageText", ")", ";", "$", "response", "=", "$", "this", "->", "connection", "->", "sendMessage", "(", "$", "message", ")", "->", "getBody", "(", ")", ";", "if", "(", "$", "callable", ")", "{", "$", "response", "=", "call_user_func", "(", "$", "callable", ",", "$", "response", ")", ";", "}", "return", "$", "response", ";", "}" ]
Send text to the server. @param $messageText @param callable $callable @return string
[ "Send", "text", "to", "the", "server", "." ]
7fada05b329d89542692af00ab80db02ad59d45d
https://github.com/gries/rcon/blob/7fada05b329d89542692af00ab80db02ad59d45d/src/Messenger.php#L29-L43
18,114
iocaste/microservice-foundation
src/Feature/Client/HttpClient.php
HttpClient.send
public function send(Request $request, $async = false): \Psr\Http\Message\StreamInterface { $this->currentUri = $request->fullUrl(); $options = []; if ($request->method() === 'POST' || $request->method() === 'PUT') { $options['json'] = $request->request->all(); } $client = new Client(); $requestType = $async ? 'requestAsync' : 'request'; $response = $client->{$requestType}($request->method(), $this->currentUri, $options); return $response->getBody(); }
php
public function send(Request $request, $async = false): \Psr\Http\Message\StreamInterface { $this->currentUri = $request->fullUrl(); $options = []; if ($request->method() === 'POST' || $request->method() === 'PUT') { $options['json'] = $request->request->all(); } $client = new Client(); $requestType = $async ? 'requestAsync' : 'request'; $response = $client->{$requestType}($request->method(), $this->currentUri, $options); return $response->getBody(); }
[ "public", "function", "send", "(", "Request", "$", "request", ",", "$", "async", "=", "false", ")", ":", "\\", "Psr", "\\", "Http", "\\", "Message", "\\", "StreamInterface", "{", "$", "this", "->", "currentUri", "=", "$", "request", "->", "fullUrl", "(", ")", ";", "$", "options", "=", "[", "]", ";", "if", "(", "$", "request", "->", "method", "(", ")", "===", "'POST'", "||", "$", "request", "->", "method", "(", ")", "===", "'PUT'", ")", "{", "$", "options", "[", "'json'", "]", "=", "$", "request", "->", "request", "->", "all", "(", ")", ";", "}", "$", "client", "=", "new", "Client", "(", ")", ";", "$", "requestType", "=", "$", "async", "?", "'requestAsync'", ":", "'request'", ";", "$", "response", "=", "$", "client", "->", "{", "$", "requestType", "}", "(", "$", "request", "->", "method", "(", ")", ",", "$", "this", "->", "currentUri", ",", "$", "options", ")", ";", "return", "$", "response", "->", "getBody", "(", ")", ";", "}" ]
Send the given request through the application. This method allows you to fully customize the entire Request object. @param Request $request @param bool $async @return \Psr\Http\Message\StreamInterface
[ "Send", "the", "given", "request", "through", "the", "application", ".", "This", "method", "allows", "you", "to", "fully", "customize", "the", "entire", "Request", "object", "." ]
274a154de4299e8a57314bab972e09f6d8cdae9e
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Feature/Client/HttpClient.php#L177-L192
18,115
adammbalogh/key-value-store-memory
src/Adapter/MemoryAdapter/KeyTrait.php
KeyTrait.delete
public function delete($key) { try { $this->get($key); } catch (KeyNotFoundException $e) { return false; } unset($this->store[$key]); return true; }
php
public function delete($key) { try { $this->get($key); } catch (KeyNotFoundException $e) { return false; } unset($this->store[$key]); return true; }
[ "public", "function", "delete", "(", "$", "key", ")", "{", "try", "{", "$", "this", "->", "get", "(", "$", "key", ")", ";", "}", "catch", "(", "KeyNotFoundException", "$", "e", ")", "{", "return", "false", ";", "}", "unset", "(", "$", "this", "->", "store", "[", "$", "key", "]", ")", ";", "return", "true", ";", "}" ]
Removes a key. @param string $key @return bool True if the deletion was successful, false if the deletion was unsuccessful.
[ "Removes", "a", "key", "." ]
6bafb9037d61911f76343a7aa7270866b1a11995
https://github.com/adammbalogh/key-value-store-memory/blob/6bafb9037d61911f76343a7aa7270866b1a11995/src/Adapter/MemoryAdapter/KeyTrait.php#L18-L29
18,116
Nozemi/SlickBoard-Library
lib/SBLib/Users/User.php
User.setPassword
public function setPassword($p1, $p2 = null, $login = false) { $this->password = $this->integration->setPassword($p1, $p2, $login, $this); return $this; }
php
public function setPassword($p1, $p2 = null, $login = false) { $this->password = $this->integration->setPassword($p1, $p2, $login, $this); return $this; }
[ "public", "function", "setPassword", "(", "$", "p1", ",", "$", "p2", "=", "null", ",", "$", "login", "=", "false", ")", "{", "$", "this", "->", "password", "=", "$", "this", "->", "integration", "->", "setPassword", "(", "$", "p1", ",", "$", "p2", ",", "$", "login", ",", "$", "this", ")", ";", "return", "$", "this", ";", "}" ]
Set the password if the passwords match.
[ "Set", "the", "password", "if", "the", "passwords", "match", "." ]
c9f0a26a30f8127c997f75d7232eac170972418d
https://github.com/Nozemi/SlickBoard-Library/blob/c9f0a26a30f8127c997f75d7232eac170972418d/lib/SBLib/Users/User.php#L110-L113
18,117
comodojo/cookies
src/Comodojo/Cookies/CookieTools.php
CookieTools.checkDomain
public static function checkDomain($domain_name) { if ( $domain_name[0] == '.' ) $domain_name = substr($domain_name, 1); return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain_name) //valid chars check && preg_match("/^.{1,253}$/", $domain_name) //overall length check && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name)); //length of each label }
php
public static function checkDomain($domain_name) { if ( $domain_name[0] == '.' ) $domain_name = substr($domain_name, 1); return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain_name) //valid chars check && preg_match("/^.{1,253}$/", $domain_name) //overall length check && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name)); //length of each label }
[ "public", "static", "function", "checkDomain", "(", "$", "domain_name", ")", "{", "if", "(", "$", "domain_name", "[", "0", "]", "==", "'.'", ")", "$", "domain_name", "=", "substr", "(", "$", "domain_name", ",", "1", ")", ";", "return", "(", "preg_match", "(", "\"/^([a-z\\d](-*[a-z\\d])*)(\\.([a-z\\d](-*[a-z\\d])*))*$/i\"", ",", "$", "domain_name", ")", "//valid chars check\r", "&&", "preg_match", "(", "\"/^.{1,253}$/\"", ",", "$", "domain_name", ")", "//overall length check\r", "&&", "preg_match", "(", "\"/^[^\\.]{1,63}(\\.[^\\.]{1,63})*$/\"", ",", "$", "domain_name", ")", ")", ";", "//length of each label\r", "}" ]
Check if domain is valid Main code from: http://stackoverflow.com/questions/1755144/how-to-validate-domain-name-in-php @param string $domain_name The domain name to check @return bool
[ "Check", "if", "domain", "is", "valid" ]
a81c7dff37d52c1a75462c0ad30db75d0c3b0081
https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieTools.php#L112-L120
18,118
geekwright/Po
src/PoHeader.php
PoHeader.buildStructuredHeaders
protected function buildStructuredHeaders(): void { $this->structuredHeaders = array(); $headers = $this->entry[PoTokens::TRANSLATED]; $headers = ($headers === null) ? array() : $headers; $full = implode('', $headers); $headers = explode("\n", $full); // split on ':' $pattern = '/([a-z0-9\-]+):\s*(.*)/i'; foreach ($headers as $h) { if (preg_match($pattern, trim($h), $matches)) { $this->structuredHeaders[strtolower($matches[1])] = array( 'key' => $matches[1], 'value' => $matches[2], ); } } }
php
protected function buildStructuredHeaders(): void { $this->structuredHeaders = array(); $headers = $this->entry[PoTokens::TRANSLATED]; $headers = ($headers === null) ? array() : $headers; $full = implode('', $headers); $headers = explode("\n", $full); // split on ':' $pattern = '/([a-z0-9\-]+):\s*(.*)/i'; foreach ($headers as $h) { if (preg_match($pattern, trim($h), $matches)) { $this->structuredHeaders[strtolower($matches[1])] = array( 'key' => $matches[1], 'value' => $matches[2], ); } } }
[ "protected", "function", "buildStructuredHeaders", "(", ")", ":", "void", "{", "$", "this", "->", "structuredHeaders", "=", "array", "(", ")", ";", "$", "headers", "=", "$", "this", "->", "entry", "[", "PoTokens", "::", "TRANSLATED", "]", ";", "$", "headers", "=", "(", "$", "headers", "===", "null", ")", "?", "array", "(", ")", ":", "$", "headers", ";", "$", "full", "=", "implode", "(", "''", ",", "$", "headers", ")", ";", "$", "headers", "=", "explode", "(", "\"\\n\"", ",", "$", "full", ")", ";", "// split on ':'", "$", "pattern", "=", "'/([a-z0-9\\-]+):\\s*(.*)/i'", ";", "foreach", "(", "$", "headers", "as", "$", "h", ")", "{", "if", "(", "preg_match", "(", "$", "pattern", ",", "trim", "(", "$", "h", ")", ",", "$", "matches", ")", ")", "{", "$", "this", "->", "structuredHeaders", "[", "strtolower", "(", "$", "matches", "[", "1", "]", ")", "]", "=", "array", "(", "'key'", "=>", "$", "matches", "[", "1", "]", ",", "'value'", "=>", "$", "matches", "[", "2", "]", ",", ")", ";", "}", "}", "}" ]
Populate the internal structuredHeaders property with contents of this entry's "msgstr" value. @return void
[ "Populate", "the", "internal", "structuredHeaders", "property", "with", "contents", "of", "this", "entry", "s", "msgstr", "value", "." ]
9474d059a83b64e6242cc41e5c5b7a08bc57e4e2
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L38-L55
18,119
geekwright/Po
src/PoHeader.php
PoHeader.storeStructuredHeader
protected function storeStructuredHeader(): bool { if (is_null($this->structuredHeaders)) { return false; } $headers = array(""); foreach ($this->structuredHeaders as $h) { $headers[] = $h['key'] . ': ' . $h['value'] . "\n"; } $this->entry[PoTokens::TRANSLATED] = $headers; return true; }
php
protected function storeStructuredHeader(): bool { if (is_null($this->structuredHeaders)) { return false; } $headers = array(""); foreach ($this->structuredHeaders as $h) { $headers[] = $h['key'] . ': ' . $h['value'] . "\n"; } $this->entry[PoTokens::TRANSLATED] = $headers; return true; }
[ "protected", "function", "storeStructuredHeader", "(", ")", ":", "bool", "{", "if", "(", "is_null", "(", "$", "this", "->", "structuredHeaders", ")", ")", "{", "return", "false", ";", "}", "$", "headers", "=", "array", "(", "\"\"", ")", ";", "foreach", "(", "$", "this", "->", "structuredHeaders", "as", "$", "h", ")", "{", "$", "headers", "[", "]", "=", "$", "h", "[", "'key'", "]", ".", "': '", ".", "$", "h", "[", "'value'", "]", ".", "\"\\n\"", ";", "}", "$", "this", "->", "entry", "[", "PoTokens", "::", "TRANSLATED", "]", "=", "$", "headers", ";", "return", "true", ";", "}" ]
Rebuild the this entry's "msgstr" value using contents of the internal structuredHeaders property. @return boolean true if rebuilt, false if not
[ "Rebuild", "the", "this", "entry", "s", "msgstr", "value", "using", "contents", "of", "the", "internal", "structuredHeaders", "property", "." ]
9474d059a83b64e6242cc41e5c5b7a08bc57e4e2
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L63-L75
18,120
geekwright/Po
src/PoHeader.php
PoHeader.getHeader
public function getHeader(string $key): ?string { $this->buildStructuredHeaders(); $lkey = strtolower($key); $header = null; if (isset($this->structuredHeaders[$lkey]['value'])) { $header = $this->structuredHeaders[$lkey]['value']; } return $header; }
php
public function getHeader(string $key): ?string { $this->buildStructuredHeaders(); $lkey = strtolower($key); $header = null; if (isset($this->structuredHeaders[$lkey]['value'])) { $header = $this->structuredHeaders[$lkey]['value']; } return $header; }
[ "public", "function", "getHeader", "(", "string", "$", "key", ")", ":", "?", "string", "{", "$", "this", "->", "buildStructuredHeaders", "(", ")", ";", "$", "lkey", "=", "strtolower", "(", "$", "key", ")", ";", "$", "header", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "structuredHeaders", "[", "$", "lkey", "]", "[", "'value'", "]", ")", ")", "{", "$", "header", "=", "$", "this", "->", "structuredHeaders", "[", "$", "lkey", "]", "[", "'value'", "]", ";", "}", "return", "$", "header", ";", "}" ]
Get a header value string by key @param string $key case insensitive name of header to return @return string|null header string for key or false if not set
[ "Get", "a", "header", "value", "string", "by", "key" ]
9474d059a83b64e6242cc41e5c5b7a08bc57e4e2
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L84-L93
18,121
geekwright/Po
src/PoHeader.php
PoHeader.setHeader
public function setHeader(string $key, string $value): void { $this->buildStructuredHeaders(); $lkey = strtolower($key); if (isset($this->structuredHeaders[$lkey])) { $this->structuredHeaders[$lkey]['value'] = $value; } else { $newHeader = array('key' => $key, 'value' => $value); $this->structuredHeaders[$lkey] = $newHeader; } $this->storeStructuredHeader(); }
php
public function setHeader(string $key, string $value): void { $this->buildStructuredHeaders(); $lkey = strtolower($key); if (isset($this->structuredHeaders[$lkey])) { $this->structuredHeaders[$lkey]['value'] = $value; } else { $newHeader = array('key' => $key, 'value' => $value); $this->structuredHeaders[$lkey] = $newHeader; } $this->storeStructuredHeader(); }
[ "public", "function", "setHeader", "(", "string", "$", "key", ",", "string", "$", "value", ")", ":", "void", "{", "$", "this", "->", "buildStructuredHeaders", "(", ")", ";", "$", "lkey", "=", "strtolower", "(", "$", "key", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "structuredHeaders", "[", "$", "lkey", "]", ")", ")", "{", "$", "this", "->", "structuredHeaders", "[", "$", "lkey", "]", "[", "'value'", "]", "=", "$", "value", ";", "}", "else", "{", "$", "newHeader", "=", "array", "(", "'key'", "=>", "$", "key", ",", "'value'", "=>", "$", "value", ")", ";", "$", "this", "->", "structuredHeaders", "[", "$", "lkey", "]", "=", "$", "newHeader", ";", "}", "$", "this", "->", "storeStructuredHeader", "(", ")", ";", "}" ]
Set the value of a header string for a key. @param string $key name of header to set. If the header exists, the name is case insensitive. If it is new the given case will be used @param string $value value to set @return void
[ "Set", "the", "value", "of", "a", "header", "string", "for", "a", "key", "." ]
9474d059a83b64e6242cc41e5c5b7a08bc57e4e2
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L104-L115
18,122
geekwright/Po
src/PoHeader.php
PoHeader.setCreateDate
public function setCreateDate(?int $time = null): void { $this->setHeader('POT-Creation-Date', $this->formatTimestamp($time)); }
php
public function setCreateDate(?int $time = null): void { $this->setHeader('POT-Creation-Date', $this->formatTimestamp($time)); }
[ "public", "function", "setCreateDate", "(", "?", "int", "$", "time", "=", "null", ")", ":", "void", "{", "$", "this", "->", "setHeader", "(", "'POT-Creation-Date'", ",", "$", "this", "->", "formatTimestamp", "(", "$", "time", ")", ")", ";", "}" ]
Set the POT-Creation-Date header @param integer|null $time unix timestamp, null to use current @return void
[ "Set", "the", "POT", "-", "Creation", "-", "Date", "header" ]
9474d059a83b64e6242cc41e5c5b7a08bc57e4e2
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L124-L127
18,123
geekwright/Po
src/PoHeader.php
PoHeader.setRevisionDate
public function setRevisionDate(?int $time = null): void { $this->setHeader('PO-Revision-Date', $this->formatTimestamp($time)); }
php
public function setRevisionDate(?int $time = null): void { $this->setHeader('PO-Revision-Date', $this->formatTimestamp($time)); }
[ "public", "function", "setRevisionDate", "(", "?", "int", "$", "time", "=", "null", ")", ":", "void", "{", "$", "this", "->", "setHeader", "(", "'PO-Revision-Date'", ",", "$", "this", "->", "formatTimestamp", "(", "$", "time", ")", ")", ";", "}" ]
Set the PO-Revision-Date header @param integer|null $time unix timestamp, null to use current @return void
[ "Set", "the", "PO", "-", "Revision", "-", "Date", "header" ]
9474d059a83b64e6242cc41e5c5b7a08bc57e4e2
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L136-L139
18,124
geekwright/Po
src/PoHeader.php
PoHeader.formatTimestamp
protected function formatTimestamp(?int $time = null): string { if (empty($time)) { $time = time(); } return gmdate('Y-m-d H:iO', $time); }
php
protected function formatTimestamp(?int $time = null): string { if (empty($time)) { $time = time(); } return gmdate('Y-m-d H:iO', $time); }
[ "protected", "function", "formatTimestamp", "(", "?", "int", "$", "time", "=", "null", ")", ":", "string", "{", "if", "(", "empty", "(", "$", "time", ")", ")", "{", "$", "time", "=", "time", "(", ")", ";", "}", "return", "gmdate", "(", "'Y-m-d H:iO'", ",", "$", "time", ")", ";", "}" ]
Format a timestamp following PO file conventions @param integer|null $time unix timestamp, null to use current @return string formatted timestamp
[ "Format", "a", "timestamp", "following", "PO", "file", "conventions" ]
9474d059a83b64e6242cc41e5c5b7a08bc57e4e2
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L148-L154
18,125
geekwright/Po
src/PoHeader.php
PoHeader.buildDefaultHeader
public function buildDefaultHeader(): void { $this->set(PoTokens::MESSAGE, ""); $this->set(PoTokens::TRANSLATOR_COMMENTS, 'SOME DESCRIPTIVE TITLE'); $this->add(PoTokens::TRANSLATOR_COMMENTS, 'Copyright (C) YEAR HOLDER'); $this->add(PoTokens::TRANSLATOR_COMMENTS, 'LICENSE'); $this->add(PoTokens::TRANSLATOR_COMMENTS, 'FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.'); $this->add(PoTokens::TRANSLATOR_COMMENTS, ''); $this->set(PoTokens::FLAG, 'fuzzy'); $this->setHeader('Project-Id-Version', 'PACKAGE VERSION'); $this->setHeader('Report-Msgid-Bugs-To', 'FULL NAME <EMAIL@ADDRESS>'); $this->setCreateDate(); $this->setHeader('PO-Revision-Date', 'YEAR-MO-DA HO:MI+ZONE'); $this->setHeader('Last-Translator', 'FULL NAME <EMAIL@ADDRESS>'); $this->setHeader('Language-Team', 'LANGUAGE <EMAIL@ADDRESS>'); $this->setHeader('MIME-Version', '1.0'); $this->setHeader('Content-Type', 'text/plain; charset=UTF-8'); $this->setHeader('Content-Transfer-Encoding', '8bit'); $this->setHeader('Plural-Forms', 'nplurals=INTEGER; plural=EXPRESSION;'); $this->setHeader('X-Generator', 'geekwright/po'); }
php
public function buildDefaultHeader(): void { $this->set(PoTokens::MESSAGE, ""); $this->set(PoTokens::TRANSLATOR_COMMENTS, 'SOME DESCRIPTIVE TITLE'); $this->add(PoTokens::TRANSLATOR_COMMENTS, 'Copyright (C) YEAR HOLDER'); $this->add(PoTokens::TRANSLATOR_COMMENTS, 'LICENSE'); $this->add(PoTokens::TRANSLATOR_COMMENTS, 'FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.'); $this->add(PoTokens::TRANSLATOR_COMMENTS, ''); $this->set(PoTokens::FLAG, 'fuzzy'); $this->setHeader('Project-Id-Version', 'PACKAGE VERSION'); $this->setHeader('Report-Msgid-Bugs-To', 'FULL NAME <EMAIL@ADDRESS>'); $this->setCreateDate(); $this->setHeader('PO-Revision-Date', 'YEAR-MO-DA HO:MI+ZONE'); $this->setHeader('Last-Translator', 'FULL NAME <EMAIL@ADDRESS>'); $this->setHeader('Language-Team', 'LANGUAGE <EMAIL@ADDRESS>'); $this->setHeader('MIME-Version', '1.0'); $this->setHeader('Content-Type', 'text/plain; charset=UTF-8'); $this->setHeader('Content-Transfer-Encoding', '8bit'); $this->setHeader('Plural-Forms', 'nplurals=INTEGER; plural=EXPRESSION;'); $this->setHeader('X-Generator', 'geekwright/po'); }
[ "public", "function", "buildDefaultHeader", "(", ")", ":", "void", "{", "$", "this", "->", "set", "(", "PoTokens", "::", "MESSAGE", ",", "\"\"", ")", ";", "$", "this", "->", "set", "(", "PoTokens", "::", "TRANSLATOR_COMMENTS", ",", "'SOME DESCRIPTIVE TITLE'", ")", ";", "$", "this", "->", "add", "(", "PoTokens", "::", "TRANSLATOR_COMMENTS", ",", "'Copyright (C) YEAR HOLDER'", ")", ";", "$", "this", "->", "add", "(", "PoTokens", "::", "TRANSLATOR_COMMENTS", ",", "'LICENSE'", ")", ";", "$", "this", "->", "add", "(", "PoTokens", "::", "TRANSLATOR_COMMENTS", ",", "'FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.'", ")", ";", "$", "this", "->", "add", "(", "PoTokens", "::", "TRANSLATOR_COMMENTS", ",", "''", ")", ";", "$", "this", "->", "set", "(", "PoTokens", "::", "FLAG", ",", "'fuzzy'", ")", ";", "$", "this", "->", "setHeader", "(", "'Project-Id-Version'", ",", "'PACKAGE VERSION'", ")", ";", "$", "this", "->", "setHeader", "(", "'Report-Msgid-Bugs-To'", ",", "'FULL NAME <EMAIL@ADDRESS>'", ")", ";", "$", "this", "->", "setCreateDate", "(", ")", ";", "$", "this", "->", "setHeader", "(", "'PO-Revision-Date'", ",", "'YEAR-MO-DA HO:MI+ZONE'", ")", ";", "$", "this", "->", "setHeader", "(", "'Last-Translator'", ",", "'FULL NAME <EMAIL@ADDRESS>'", ")", ";", "$", "this", "->", "setHeader", "(", "'Language-Team'", ",", "'LANGUAGE <EMAIL@ADDRESS>'", ")", ";", "$", "this", "->", "setHeader", "(", "'MIME-Version'", ",", "'1.0'", ")", ";", "$", "this", "->", "setHeader", "(", "'Content-Type'", ",", "'text/plain; charset=UTF-8'", ")", ";", "$", "this", "->", "setHeader", "(", "'Content-Transfer-Encoding'", ",", "'8bit'", ")", ";", "$", "this", "->", "setHeader", "(", "'Plural-Forms'", ",", "'nplurals=INTEGER; plural=EXPRESSION;'", ")", ";", "$", "this", "->", "setHeader", "(", "'X-Generator'", ",", "'geekwright/po'", ")", ";", "}" ]
Create a default header entry @return void
[ "Create", "a", "default", "header", "entry" ]
9474d059a83b64e6242cc41e5c5b7a08bc57e4e2
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L161-L181
18,126
webforge-labs/psc-cms
lib/Psc/Object.php
Object.callObjectMethod
public static function callObjectMethod($object, $name, Array $args = NULL) { $args = (array) $args; /* funky switch da wir performance wollen */ switch (count($args)) { case 0: return $object->$name(); case 1: return $object->$name($args[0]); case 2: return $object->$name($args[0],$args[1]); case 3: return $object->$name($args[0],$args[1],$args[2]); case 4: return $object->$name($args[0],$args[1],$args[2],$args[3]); case 5: return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4]); case 6: return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4],$args[5]); case 7: return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4],$args[5],$args[6]); case 8: return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4],$args[5],$args[6],$args[7]); default: // use call_user_func_array evil return call_user_func_array(array($object,$name),$args); } }
php
public static function callObjectMethod($object, $name, Array $args = NULL) { $args = (array) $args; /* funky switch da wir performance wollen */ switch (count($args)) { case 0: return $object->$name(); case 1: return $object->$name($args[0]); case 2: return $object->$name($args[0],$args[1]); case 3: return $object->$name($args[0],$args[1],$args[2]); case 4: return $object->$name($args[0],$args[1],$args[2],$args[3]); case 5: return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4]); case 6: return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4],$args[5]); case 7: return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4],$args[5],$args[6]); case 8: return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4],$args[5],$args[6],$args[7]); default: // use call_user_func_array evil return call_user_func_array(array($object,$name),$args); } }
[ "public", "static", "function", "callObjectMethod", "(", "$", "object", ",", "$", "name", ",", "Array", "$", "args", "=", "NULL", ")", "{", "$", "args", "=", "(", "array", ")", "$", "args", ";", "/* funky switch da wir performance wollen */", "switch", "(", "count", "(", "$", "args", ")", ")", "{", "case", "0", ":", "return", "$", "object", "->", "$", "name", "(", ")", ";", "case", "1", ":", "return", "$", "object", "->", "$", "name", "(", "$", "args", "[", "0", "]", ")", ";", "case", "2", ":", "return", "$", "object", "->", "$", "name", "(", "$", "args", "[", "0", "]", ",", "$", "args", "[", "1", "]", ")", ";", "case", "3", ":", "return", "$", "object", "->", "$", "name", "(", "$", "args", "[", "0", "]", ",", "$", "args", "[", "1", "]", ",", "$", "args", "[", "2", "]", ")", ";", "case", "4", ":", "return", "$", "object", "->", "$", "name", "(", "$", "args", "[", "0", "]", ",", "$", "args", "[", "1", "]", ",", "$", "args", "[", "2", "]", ",", "$", "args", "[", "3", "]", ")", ";", "case", "5", ":", "return", "$", "object", "->", "$", "name", "(", "$", "args", "[", "0", "]", ",", "$", "args", "[", "1", "]", ",", "$", "args", "[", "2", "]", ",", "$", "args", "[", "3", "]", ",", "$", "args", "[", "4", "]", ")", ";", "case", "6", ":", "return", "$", "object", "->", "$", "name", "(", "$", "args", "[", "0", "]", ",", "$", "args", "[", "1", "]", ",", "$", "args", "[", "2", "]", ",", "$", "args", "[", "3", "]", ",", "$", "args", "[", "4", "]", ",", "$", "args", "[", "5", "]", ")", ";", "case", "7", ":", "return", "$", "object", "->", "$", "name", "(", "$", "args", "[", "0", "]", ",", "$", "args", "[", "1", "]", ",", "$", "args", "[", "2", "]", ",", "$", "args", "[", "3", "]", ",", "$", "args", "[", "4", "]", ",", "$", "args", "[", "5", "]", ",", "$", "args", "[", "6", "]", ")", ";", "case", "8", ":", "return", "$", "object", "->", "$", "name", "(", "$", "args", "[", "0", "]", ",", "$", "args", "[", "1", "]", ",", "$", "args", "[", "2", "]", ",", "$", "args", "[", "3", "]", ",", "$", "args", "[", "4", "]", ",", "$", "args", "[", "5", "]", ",", "$", "args", "[", "6", "]", ",", "$", "args", "[", "7", "]", ")", ";", "default", ":", "// use call_user_func_array evil", "return", "call_user_func_array", "(", "array", "(", "$", "object", ",", "$", "name", ")", ",", "$", "args", ")", ";", "}", "}" ]
Ruft eine Methode auf einem Objekt auf @param object $object @param string $name der Name der Methode die aufgerufen werden soll @param array $arg @return Object
[ "Ruft", "eine", "Methode", "auf", "einem", "Objekt", "auf" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Object.php#L138-L174
18,127
yuncms/framework
src/user/models/LoginForm.php
LoginForm.confirmationValidate
public function confirmationValidate($attribute) { if (!$this->hasErrors()) { if ($this->user !== null) { $confirmationRequired = Yii::$app->settings->get('enableConfirmation', 'user') && !Yii::$app->settings->get('enableUnconfirmedLogin', 'user'); if ($confirmationRequired && !$this->user->isEmailConfirmed) { $this->addError($attribute, Yii::t('yuncms', 'You need to confirm your email address.')); } if ($this->user->isBlocked) { $this->addError($attribute, Yii::t('yuncms', 'Your account has been blocked.')); } } } }
php
public function confirmationValidate($attribute) { if (!$this->hasErrors()) { if ($this->user !== null) { $confirmationRequired = Yii::$app->settings->get('enableConfirmation', 'user') && !Yii::$app->settings->get('enableUnconfirmedLogin', 'user'); if ($confirmationRequired && !$this->user->isEmailConfirmed) { $this->addError($attribute, Yii::t('yuncms', 'You need to confirm your email address.')); } if ($this->user->isBlocked) { $this->addError($attribute, Yii::t('yuncms', 'Your account has been blocked.')); } } } }
[ "public", "function", "confirmationValidate", "(", "$", "attribute", ")", "{", "if", "(", "!", "$", "this", "->", "hasErrors", "(", ")", ")", "{", "if", "(", "$", "this", "->", "user", "!==", "null", ")", "{", "$", "confirmationRequired", "=", "Yii", "::", "$", "app", "->", "settings", "->", "get", "(", "'enableConfirmation'", ",", "'user'", ")", "&&", "!", "Yii", "::", "$", "app", "->", "settings", "->", "get", "(", "'enableUnconfirmedLogin'", ",", "'user'", ")", ";", "if", "(", "$", "confirmationRequired", "&&", "!", "$", "this", "->", "user", "->", "isEmailConfirmed", ")", "{", "$", "this", "->", "addError", "(", "$", "attribute", ",", "Yii", "::", "t", "(", "'yuncms'", ",", "'You need to confirm your email address.'", ")", ")", ";", "}", "if", "(", "$", "this", "->", "user", "->", "isBlocked", ")", "{", "$", "this", "->", "addError", "(", "$", "attribute", ",", "Yii", "::", "t", "(", "'yuncms'", ",", "'Your account has been blocked.'", ")", ")", ";", "}", "}", "}", "}" ]
Validates the confirmation. This method serves as the inline validation for password. @param string $attribute the attribute currently being validated
[ "Validates", "the", "confirmation", ".", "This", "method", "serves", "as", "the", "inline", "validation", "for", "password", "." ]
af42e28ea4ae15ab8eead3f6d119f93863b94154
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/LoginForm.php#L102-L115
18,128
lode/fem
src/exception.php
exception.setUserAction
public function setUserAction($link, $label=null) { if ($label) { $this->userAction = [ 'link' => $link, 'label' => $label, ]; } else { $this->userAction = $link; } }
php
public function setUserAction($link, $label=null) { if ($label) { $this->userAction = [ 'link' => $link, 'label' => $label, ]; } else { $this->userAction = $link; } }
[ "public", "function", "setUserAction", "(", "$", "link", ",", "$", "label", "=", "null", ")", "{", "if", "(", "$", "label", ")", "{", "$", "this", "->", "userAction", "=", "[", "'link'", "=>", "$", "link", ",", "'label'", "=>", "$", "label", ",", "]", ";", "}", "else", "{", "$", "this", "->", "userAction", "=", "$", "link", ";", "}", "}" ]
set a user facing link as continue action @param string $link @param string $label optional
[ "set", "a", "user", "facing", "link", "as", "continue", "action" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/exception.php#L69-L79
18,129
lode/fem
src/exception.php
exception.clean_paths
public static function clean_paths($string) { $string = str_replace(ROOT_DIR, '', $string); $string = str_replace('.php', '', $string); return $string; }
php
public static function clean_paths($string) { $string = str_replace(ROOT_DIR, '', $string); $string = str_replace('.php', '', $string); return $string; }
[ "public", "static", "function", "clean_paths", "(", "$", "string", ")", "{", "$", "string", "=", "str_replace", "(", "ROOT_DIR", ",", "''", ",", "$", "string", ")", ";", "$", "string", "=", "str_replace", "(", "'.php'", ",", "''", ",", "$", "string", ")", ";", "return", "$", "string", ";", "}" ]
cleans file paths from redundant information i.e. ROOT_DIR and '.php' is removed @param string $string @return string
[ "cleans", "file", "paths", "from", "redundant", "information", "i", ".", "e", ".", "ROOT_DIR", "and", ".", "php", "is", "removed" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/exception.php#L101-L106
18,130
simple-php-mvc/simple-php-mvc
src/MVC/Server/Router.php
Router._compile_regex
protected function _compile_regex($route) { $pattern = '`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`'; if ( preg_match_all($pattern, $route, $matches, PREG_SET_ORDER) ) { $match_types = array( 'i' => '[0-9]++', 'a' => '[0-9A-Za-z]++', 'h' => '[0-9A-Fa-f]++', '*' => '.+?', '' => '[^/]++' ); foreach ( $matches as $match ) { list($block, $pre, $type, $param, $optional) = $match; if ( isset($match_types[$type]) ) { $type = $match_types[$type]; } if ( $param ) { $param = "?<{$param}>"; } if ( $optional ) { $optional = '?'; } $replaced = "(?:{$pre}({$param}{$type})){$optional}"; $route = str_replace($block, $replaced, $route); } } if ( substr($route, strlen($route) - 1) != '/' ) { $route .= '/?'; } return "`^{$route}$`"; }
php
protected function _compile_regex($route) { $pattern = '`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`'; if ( preg_match_all($pattern, $route, $matches, PREG_SET_ORDER) ) { $match_types = array( 'i' => '[0-9]++', 'a' => '[0-9A-Za-z]++', 'h' => '[0-9A-Fa-f]++', '*' => '.+?', '' => '[^/]++' ); foreach ( $matches as $match ) { list($block, $pre, $type, $param, $optional) = $match; if ( isset($match_types[$type]) ) { $type = $match_types[$type]; } if ( $param ) { $param = "?<{$param}>"; } if ( $optional ) { $optional = '?'; } $replaced = "(?:{$pre}({$param}{$type})){$optional}"; $route = str_replace($block, $replaced, $route); } } if ( substr($route, strlen($route) - 1) != '/' ) { $route .= '/?'; } return "`^{$route}$`"; }
[ "protected", "function", "_compile_regex", "(", "$", "route", ")", "{", "$", "pattern", "=", "'`(/|\\.|)\\[([^:\\]]*+)(?::([^:\\]]*+))?\\](\\?|)`'", ";", "if", "(", "preg_match_all", "(", "$", "pattern", ",", "$", "route", ",", "$", "matches", ",", "PREG_SET_ORDER", ")", ")", "{", "$", "match_types", "=", "array", "(", "'i'", "=>", "'[0-9]++'", ",", "'a'", "=>", "'[0-9A-Za-z]++'", ",", "'h'", "=>", "'[0-9A-Fa-f]++'", ",", "'*'", "=>", "'.+?'", ",", "''", "=>", "'[^/]++'", ")", ";", "foreach", "(", "$", "matches", "as", "$", "match", ")", "{", "list", "(", "$", "block", ",", "$", "pre", ",", "$", "type", ",", "$", "param", ",", "$", "optional", ")", "=", "$", "match", ";", "if", "(", "isset", "(", "$", "match_types", "[", "$", "type", "]", ")", ")", "{", "$", "type", "=", "$", "match_types", "[", "$", "type", "]", ";", "}", "if", "(", "$", "param", ")", "{", "$", "param", "=", "\"?<{$param}>\"", ";", "}", "if", "(", "$", "optional", ")", "{", "$", "optional", "=", "'?'", ";", "}", "$", "replaced", "=", "\"(?:{$pre}({$param}{$type})){$optional}\"", ";", "$", "route", "=", "str_replace", "(", "$", "block", ",", "$", "replaced", ",", "$", "route", ")", ";", "}", "}", "if", "(", "substr", "(", "$", "route", ",", "strlen", "(", "$", "route", ")", "-", "1", ")", "!=", "'/'", ")", "{", "$", "route", ".=", "'/?'", ";", "}", "return", "\"`^{$route}$`\"", ";", "}" ]
Compiles the regex necessary to capture all match types within a route. @access protected @param string $route The route. @return string
[ "Compiles", "the", "regex", "necessary", "to", "capture", "all", "match", "types", "within", "a", "route", "." ]
e319eb09d29afad6993acb4a7e35f32a87dd0841
https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Server/Router.php#L20-L53
18,131
mongrate/mongrate
src/Mongrate/Model/Name.php
Name.validate
private function validate($name) { if (!is_string($name)) { throw new InvalidNameException('Migration name must be a string, got ' . gettype($name)); } if (strlen($name) === 0) { throw new InvalidNameException('Migration name must not be empty'); } $validCharsRegex = '/^[' . self::NAME_VALID_CHARS_REGEX . ']+$/'; if (preg_match($validCharsRegex, $name) === 0) { $invalidChars = preg_replace('/[' . self::NAME_VALID_CHARS_REGEX . ']/', '', $name); throw new InvalidNameException('Migration name contains invalid characters: ' . $invalidChars); } if (strlen($name) > self::MAX_NAME_LENGTH) { throw new InvalidNameException(sprintf( 'Migration name cannot exceed %d characters, is %d: %s', self::MAX_NAME_LENGTH, strlen($name), $name )); } }
php
private function validate($name) { if (!is_string($name)) { throw new InvalidNameException('Migration name must be a string, got ' . gettype($name)); } if (strlen($name) === 0) { throw new InvalidNameException('Migration name must not be empty'); } $validCharsRegex = '/^[' . self::NAME_VALID_CHARS_REGEX . ']+$/'; if (preg_match($validCharsRegex, $name) === 0) { $invalidChars = preg_replace('/[' . self::NAME_VALID_CHARS_REGEX . ']/', '', $name); throw new InvalidNameException('Migration name contains invalid characters: ' . $invalidChars); } if (strlen($name) > self::MAX_NAME_LENGTH) { throw new InvalidNameException(sprintf( 'Migration name cannot exceed %d characters, is %d: %s', self::MAX_NAME_LENGTH, strlen($name), $name )); } }
[ "private", "function", "validate", "(", "$", "name", ")", "{", "if", "(", "!", "is_string", "(", "$", "name", ")", ")", "{", "throw", "new", "InvalidNameException", "(", "'Migration name must be a string, got '", ".", "gettype", "(", "$", "name", ")", ")", ";", "}", "if", "(", "strlen", "(", "$", "name", ")", "===", "0", ")", "{", "throw", "new", "InvalidNameException", "(", "'Migration name must not be empty'", ")", ";", "}", "$", "validCharsRegex", "=", "'/^['", ".", "self", "::", "NAME_VALID_CHARS_REGEX", ".", "']+$/'", ";", "if", "(", "preg_match", "(", "$", "validCharsRegex", ",", "$", "name", ")", "===", "0", ")", "{", "$", "invalidChars", "=", "preg_replace", "(", "'/['", ".", "self", "::", "NAME_VALID_CHARS_REGEX", ".", "']/'", ",", "''", ",", "$", "name", ")", ";", "throw", "new", "InvalidNameException", "(", "'Migration name contains invalid characters: '", ".", "$", "invalidChars", ")", ";", "}", "if", "(", "strlen", "(", "$", "name", ")", ">", "self", "::", "MAX_NAME_LENGTH", ")", "{", "throw", "new", "InvalidNameException", "(", "sprintf", "(", "'Migration name cannot exceed %d characters, is %d: %s'", ",", "self", "::", "MAX_NAME_LENGTH", ",", "strlen", "(", "$", "name", ")", ",", "$", "name", ")", ")", ";", "}", "}" ]
Ensure the migration name is acceptable. @throws InvalidNameException if the name given is invalid.
[ "Ensure", "the", "migration", "name", "is", "acceptable", "." ]
d76455a58a4ee5e6f8198e033c07bce40e2f7c7b
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Model/Name.php#L47-L71
18,132
fyuze/framework
src/Fyuze/Kernel/Fyuze.php
Fyuze.setupContainer
protected function setupContainer() { $container = Registry::init(); $container->add('app', $this); $container->add('registry', $container); $container->add('config', function () { return new Config($this->getConfigPath(), 'prod'); }); $this->config = $container->make('config'); $container->add('routes', function () { return new Collection(); }); $this->container = $container; }
php
protected function setupContainer() { $container = Registry::init(); $container->add('app', $this); $container->add('registry', $container); $container->add('config', function () { return new Config($this->getConfigPath(), 'prod'); }); $this->config = $container->make('config'); $container->add('routes', function () { return new Collection(); }); $this->container = $container; }
[ "protected", "function", "setupContainer", "(", ")", "{", "$", "container", "=", "Registry", "::", "init", "(", ")", ";", "$", "container", "->", "add", "(", "'app'", ",", "$", "this", ")", ";", "$", "container", "->", "add", "(", "'registry'", ",", "$", "container", ")", ";", "$", "container", "->", "add", "(", "'config'", ",", "function", "(", ")", "{", "return", "new", "Config", "(", "$", "this", "->", "getConfigPath", "(", ")", ",", "'prod'", ")", ";", "}", ")", ";", "$", "this", "->", "config", "=", "$", "container", "->", "make", "(", "'config'", ")", ";", "$", "container", "->", "add", "(", "'routes'", ",", "function", "(", ")", "{", "return", "new", "Collection", "(", ")", ";", "}", ")", ";", "$", "this", "->", "container", "=", "$", "container", ";", "}" ]
Registers container and some classes @return void
[ "Registers", "container", "and", "some", "classes" ]
89b3984f7225e24bfcdafb090ee197275b3222c9
https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Kernel/Fyuze.php#L127-L144
18,133
fyuze/framework
src/Fyuze/Kernel/Fyuze.php
Fyuze.configure
protected function configure() { $config = $this->config->get('app'); $this->charset = $config['charset']; mb_internal_encoding($this->charset); date_default_timezone_set($config['timezone']); }
php
protected function configure() { $config = $this->config->get('app'); $this->charset = $config['charset']; mb_internal_encoding($this->charset); date_default_timezone_set($config['timezone']); }
[ "protected", "function", "configure", "(", ")", "{", "$", "config", "=", "$", "this", "->", "config", "->", "get", "(", "'app'", ")", ";", "$", "this", "->", "charset", "=", "$", "config", "[", "'charset'", "]", ";", "mb_internal_encoding", "(", "$", "this", "->", "charset", ")", ";", "date_default_timezone_set", "(", "$", "config", "[", "'timezone'", "]", ")", ";", "}" ]
Sets up basic application configurations @return void
[ "Sets", "up", "basic", "application", "configurations" ]
89b3984f7225e24bfcdafb090ee197275b3222c9
https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Kernel/Fyuze.php#L151-L159
18,134
fyuze/framework
src/Fyuze/Kernel/Fyuze.php
Fyuze.registerServices
protected function registerServices() { $services = array_filter($this->config->get('app.services'), function ($service) { return class_exists($service); }); foreach ($services as $service) { /** @var \Fyuze\Kernel\Service $obj */ $obj = new $service($this->container); $obj->services(); $this->services[] = $obj; } }
php
protected function registerServices() { $services = array_filter($this->config->get('app.services'), function ($service) { return class_exists($service); }); foreach ($services as $service) { /** @var \Fyuze\Kernel\Service $obj */ $obj = new $service($this->container); $obj->services(); $this->services[] = $obj; } }
[ "protected", "function", "registerServices", "(", ")", "{", "$", "services", "=", "array_filter", "(", "$", "this", "->", "config", "->", "get", "(", "'app.services'", ")", ",", "function", "(", "$", "service", ")", "{", "return", "class_exists", "(", "$", "service", ")", ";", "}", ")", ";", "foreach", "(", "$", "services", "as", "$", "service", ")", "{", "/** @var \\Fyuze\\Kernel\\Service $obj */", "$", "obj", "=", "new", "$", "service", "(", "$", "this", "->", "container", ")", ";", "$", "obj", "->", "services", "(", ")", ";", "$", "this", "->", "services", "[", "]", "=", "$", "obj", ";", "}", "}" ]
Registers all defined services @return void
[ "Registers", "all", "defined", "services" ]
89b3984f7225e24bfcdafb090ee197275b3222c9
https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Kernel/Fyuze.php#L166-L179
18,135
miisieq/InfaktClient
src/Infakt/Repository/AbstractObjectRepository.php
AbstractObjectRepository.get
public function get(int $entityId) { $response = $this->infakt->get($this->getServiceName().'/'.$entityId.'.json'); if (2 != substr((string) $response->getStatusCode(), 0, 1)) { return null; } return $this->getMapper()->map(\GuzzleHttp\json_decode($response->getBody()->getContents(), true)); }
php
public function get(int $entityId) { $response = $this->infakt->get($this->getServiceName().'/'.$entityId.'.json'); if (2 != substr((string) $response->getStatusCode(), 0, 1)) { return null; } return $this->getMapper()->map(\GuzzleHttp\json_decode($response->getBody()->getContents(), true)); }
[ "public", "function", "get", "(", "int", "$", "entityId", ")", "{", "$", "response", "=", "$", "this", "->", "infakt", "->", "get", "(", "$", "this", "->", "getServiceName", "(", ")", ".", "'/'", ".", "$", "entityId", ".", "'.json'", ")", ";", "if", "(", "2", "!=", "substr", "(", "(", "string", ")", "$", "response", "->", "getStatusCode", "(", ")", ",", "0", ",", "1", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "getMapper", "(", ")", "->", "map", "(", "\\", "GuzzleHttp", "\\", "json_decode", "(", "$", "response", "->", "getBody", "(", ")", "->", "getContents", "(", ")", ",", "true", ")", ")", ";", "}" ]
Get entity by ID. @param $entityId @return null|EntityInterface
[ "Get", "entity", "by", "ID", "." ]
5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Repository/AbstractObjectRepository.php#L56-L65
18,136
miisieq/InfaktClient
src/Infakt/Repository/AbstractObjectRepository.php
AbstractObjectRepository.getModelClass
protected function getModelClass(): string { $class = substr(get_class($this), strrpos(get_class($this), '\\') + 1); $class = substr($class, 0, strlen($class) - strlen('Repository')); return 'Infakt\\Model\\'.$class; }
php
protected function getModelClass(): string { $class = substr(get_class($this), strrpos(get_class($this), '\\') + 1); $class = substr($class, 0, strlen($class) - strlen('Repository')); return 'Infakt\\Model\\'.$class; }
[ "protected", "function", "getModelClass", "(", ")", ":", "string", "{", "$", "class", "=", "substr", "(", "get_class", "(", "$", "this", ")", ",", "strrpos", "(", "get_class", "(", "$", "this", ")", ",", "'\\\\'", ")", "+", "1", ")", ";", "$", "class", "=", "substr", "(", "$", "class", ",", "0", ",", "strlen", "(", "$", "class", ")", "-", "strlen", "(", "'Repository'", ")", ")", ";", "return", "'Infakt\\\\Model\\\\'", ".", "$", "class", ";", "}" ]
Get fully-qualified class name of a model. @return string
[ "Get", "fully", "-", "qualified", "class", "name", "of", "a", "model", "." ]
5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Repository/AbstractObjectRepository.php#L207-L213
18,137
miisieq/InfaktClient
src/Infakt/Repository/AbstractObjectRepository.php
AbstractObjectRepository.getMapperClass
protected function getMapperClass(): string { $class = substr(get_class($this), strrpos(get_class($this), '\\') + 1); $class = substr($class, 0, strlen($class) - strlen('Repository')); return 'Infakt\\Mapper\\'.$class.'Mapper'; }
php
protected function getMapperClass(): string { $class = substr(get_class($this), strrpos(get_class($this), '\\') + 1); $class = substr($class, 0, strlen($class) - strlen('Repository')); return 'Infakt\\Mapper\\'.$class.'Mapper'; }
[ "protected", "function", "getMapperClass", "(", ")", ":", "string", "{", "$", "class", "=", "substr", "(", "get_class", "(", "$", "this", ")", ",", "strrpos", "(", "get_class", "(", "$", "this", ")", ",", "'\\\\'", ")", "+", "1", ")", ";", "$", "class", "=", "substr", "(", "$", "class", ",", "0", ",", "strlen", "(", "$", "class", ")", "-", "strlen", "(", "'Repository'", ")", ")", ";", "return", "'Infakt\\\\Mapper\\\\'", ".", "$", "class", ".", "'Mapper'", ";", "}" ]
Get fully-qualified class name of a mapper. @return string
[ "Get", "fully", "-", "qualified", "class", "name", "of", "a", "mapper", "." ]
5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Repository/AbstractObjectRepository.php#L220-L226
18,138
shiftio/safestream-php-sdk
src/Video/Video.php
Video.withExistingProxy
public function withExistingProxy(HlsProxy $hlsProxy) { if(is_null($this->proxies)) { $this->proxies = []; } array_push($this->proxies, $hlsProxy); return $this; }
php
public function withExistingProxy(HlsProxy $hlsProxy) { if(is_null($this->proxies)) { $this->proxies = []; } array_push($this->proxies, $hlsProxy); return $this; }
[ "public", "function", "withExistingProxy", "(", "HlsProxy", "$", "hlsProxy", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "proxies", ")", ")", "{", "$", "this", "->", "proxies", "=", "[", "]", ";", "}", "array_push", "(", "$", "this", "->", "proxies", ",", "$", "hlsProxy", ")", ";", "return", "$", "this", ";", "}" ]
Fluent setter for the property proxies @param HlsProxy $hlsProxy @return $this
[ "Fluent", "setter", "for", "the", "property", "proxies" ]
1957cd5574725b24da1bbff9059aa30a9ca123c2
https://github.com/shiftio/safestream-php-sdk/blob/1957cd5574725b24da1bbff9059aa30a9ca123c2/src/Video/Video.php#L216-L224
18,139
FuriosoJack/LaraException
src/Exceptions/ExceptionProyect.php
ExceptionProyect.toArray
public function toArray() { return [ 'message' => $this->getMessageException(), 'errors' => $this->getErrors(), 'debugCode' => $this->getDebugCode(), 'details' => $this->getDetails(), 'routeBack' => redirect()->back()->getTargetUrl() ]; }
php
public function toArray() { return [ 'message' => $this->getMessageException(), 'errors' => $this->getErrors(), 'debugCode' => $this->getDebugCode(), 'details' => $this->getDetails(), 'routeBack' => redirect()->back()->getTargetUrl() ]; }
[ "public", "function", "toArray", "(", ")", "{", "return", "[", "'message'", "=>", "$", "this", "->", "getMessageException", "(", ")", ",", "'errors'", "=>", "$", "this", "->", "getErrors", "(", ")", ",", "'debugCode'", "=>", "$", "this", "->", "getDebugCode", "(", ")", ",", "'details'", "=>", "$", "this", "->", "getDetails", "(", ")", ",", "'routeBack'", "=>", "redirect", "(", ")", "->", "back", "(", ")", "->", "getTargetUrl", "(", ")", "]", ";", "}" ]
convierte el Objeto en un array @return array
[ "convierte", "el", "Objeto", "en", "un", "array" ]
b30ec2ed3331d99fca4d0ae47c8710a522bd0c19
https://github.com/FuriosoJack/LaraException/blob/b30ec2ed3331d99fca4d0ae47c8710a522bd0c19/src/Exceptions/ExceptionProyect.php#L101-L110
18,140
spiral-modules/auth
source/Auth/TokenManager.php
TokenManager.fetchToken
public function fetchToken(Request $request) { foreach ($this->config->getOperators() as $name) { $operator = $this->getOperator($name); if ($operator->hasToken($request)) { return $operator->fetchToken($request); } } return null; }
php
public function fetchToken(Request $request) { foreach ($this->config->getOperators() as $name) { $operator = $this->getOperator($name); if ($operator->hasToken($request)) { return $operator->fetchToken($request); } } return null; }
[ "public", "function", "fetchToken", "(", "Request", "$", "request", ")", "{", "foreach", "(", "$", "this", "->", "config", "->", "getOperators", "(", ")", "as", "$", "name", ")", "{", "$", "operator", "=", "$", "this", "->", "getOperator", "(", "$", "name", ")", ";", "if", "(", "$", "operator", "->", "hasToken", "(", "$", "request", ")", ")", "{", "return", "$", "operator", "->", "fetchToken", "(", "$", "request", ")", ";", "}", "}", "return", "null", ";", "}" ]
Fetch authorization token from request if any. @param Request $request @return TokenInterface|null
[ "Fetch", "authorization", "token", "from", "request", "if", "any", "." ]
24e2070028f7257e8192914556963a4794428a99
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/TokenManager.php#L65-L76
18,141
mongrate/mongrate
src/Mongrate/Service/MigrationService.php
MigrationService.isMigrationApplied
public function isMigrationApplied(Name $name) { $this->ensureMigrationExists($name); $collection = $this->getAppliedCollection(); $criteria = ['className' => (string) $name]; $record = $collection->find($criteria)->getSingleResult(); if ($record === null) { return false; } else { return (bool) $record['isApplied']; } }
php
public function isMigrationApplied(Name $name) { $this->ensureMigrationExists($name); $collection = $this->getAppliedCollection(); $criteria = ['className' => (string) $name]; $record = $collection->find($criteria)->getSingleResult(); if ($record === null) { return false; } else { return (bool) $record['isApplied']; } }
[ "public", "function", "isMigrationApplied", "(", "Name", "$", "name", ")", "{", "$", "this", "->", "ensureMigrationExists", "(", "$", "name", ")", ";", "$", "collection", "=", "$", "this", "->", "getAppliedCollection", "(", ")", ";", "$", "criteria", "=", "[", "'className'", "=>", "(", "string", ")", "$", "name", "]", ";", "$", "record", "=", "$", "collection", "->", "find", "(", "$", "criteria", ")", "->", "getSingleResult", "(", ")", ";", "if", "(", "$", "record", "===", "null", ")", "{", "return", "false", ";", "}", "else", "{", "return", "(", "bool", ")", "$", "record", "[", "'isApplied'", "]", ";", "}", "}" ]
Check if a migration has been applied. @param Name $name name of the migration. @return bool
[ "Check", "if", "a", "migration", "has", "been", "applied", "." ]
d76455a58a4ee5e6f8198e033c07bce40e2f7c7b
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Service/MigrationService.php#L151-L164
18,142
mongrate/mongrate
src/Mongrate/Service/MigrationService.php
MigrationService.migrate
public function migrate(Name $name, Direction $direction, OutputInterface $output) { $migration = $this->createMigrationInstance($name, $output); $output->writeln('<info>Migrating ' . $direction . '...</info> <comment>' . $name . '</comment>'); if ($direction->isUp()) { $migration->up($this->getDatabase()); $this->setMigrationApplied($name, true); } else { $migration->down($this->getDatabase()); $this->setMigrationApplied($name, false); } $output->writeln('<info>Migrated ' . $direction . '</info>'); }
php
public function migrate(Name $name, Direction $direction, OutputInterface $output) { $migration = $this->createMigrationInstance($name, $output); $output->writeln('<info>Migrating ' . $direction . '...</info> <comment>' . $name . '</comment>'); if ($direction->isUp()) { $migration->up($this->getDatabase()); $this->setMigrationApplied($name, true); } else { $migration->down($this->getDatabase()); $this->setMigrationApplied($name, false); } $output->writeln('<info>Migrated ' . $direction . '</info>'); }
[ "public", "function", "migrate", "(", "Name", "$", "name", ",", "Direction", "$", "direction", ",", "OutputInterface", "$", "output", ")", "{", "$", "migration", "=", "$", "this", "->", "createMigrationInstance", "(", "$", "name", ",", "$", "output", ")", ";", "$", "output", "->", "writeln", "(", "'<info>Migrating '", ".", "$", "direction", ".", "'...</info> <comment>'", ".", "$", "name", ".", "'</comment>'", ")", ";", "if", "(", "$", "direction", "->", "isUp", "(", ")", ")", "{", "$", "migration", "->", "up", "(", "$", "this", "->", "getDatabase", "(", ")", ")", ";", "$", "this", "->", "setMigrationApplied", "(", "$", "name", ",", "true", ")", ";", "}", "else", "{", "$", "migration", "->", "down", "(", "$", "this", "->", "getDatabase", "(", ")", ")", ";", "$", "this", "->", "setMigrationApplied", "(", "$", "name", ",", "false", ")", ";", "}", "$", "output", "->", "writeln", "(", "'<info>Migrated '", ".", "$", "direction", ".", "'</info>'", ")", ";", "}" ]
Migrate up or down. @param Direction $direction
[ "Migrate", "up", "or", "down", "." ]
d76455a58a4ee5e6f8198e033c07bce40e2f7c7b
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Service/MigrationService.php#L186-L201
18,143
mongrate/mongrate
src/Mongrate/Service/MigrationService.php
MigrationService.getAllMigrations
public function getAllMigrations() { $iterator = new \DirectoryIterator($this->configuration->getMigrationsDirectory()); $migrations = []; foreach ($iterator as $file) { $fileName = (string) $file; if ($fileName === '.'|| $fileName === '..') { continue; } if (!is_dir($file->getPathname())) { // Ignore files that might be in the migrations directory, like documentation or // a .gitignore or .gitkeep file. continue; } $name = new Name($fileName); $isApplied = $this->isMigrationApplied($name); $migrations[] = new Migration($name, $isApplied); } usort($migrations, function (Migration $a, Migration $b) { return strcmp($a->getName(), $b->getName()); }); return $migrations; }
php
public function getAllMigrations() { $iterator = new \DirectoryIterator($this->configuration->getMigrationsDirectory()); $migrations = []; foreach ($iterator as $file) { $fileName = (string) $file; if ($fileName === '.'|| $fileName === '..') { continue; } if (!is_dir($file->getPathname())) { // Ignore files that might be in the migrations directory, like documentation or // a .gitignore or .gitkeep file. continue; } $name = new Name($fileName); $isApplied = $this->isMigrationApplied($name); $migrations[] = new Migration($name, $isApplied); } usort($migrations, function (Migration $a, Migration $b) { return strcmp($a->getName(), $b->getName()); }); return $migrations; }
[ "public", "function", "getAllMigrations", "(", ")", "{", "$", "iterator", "=", "new", "\\", "DirectoryIterator", "(", "$", "this", "->", "configuration", "->", "getMigrationsDirectory", "(", ")", ")", ";", "$", "migrations", "=", "[", "]", ";", "foreach", "(", "$", "iterator", "as", "$", "file", ")", "{", "$", "fileName", "=", "(", "string", ")", "$", "file", ";", "if", "(", "$", "fileName", "===", "'.'", "||", "$", "fileName", "===", "'..'", ")", "{", "continue", ";", "}", "if", "(", "!", "is_dir", "(", "$", "file", "->", "getPathname", "(", ")", ")", ")", "{", "// Ignore files that might be in the migrations directory, like documentation or", "// a .gitignore or .gitkeep file.", "continue", ";", "}", "$", "name", "=", "new", "Name", "(", "$", "fileName", ")", ";", "$", "isApplied", "=", "$", "this", "->", "isMigrationApplied", "(", "$", "name", ")", ";", "$", "migrations", "[", "]", "=", "new", "Migration", "(", "$", "name", ",", "$", "isApplied", ")", ";", "}", "usort", "(", "$", "migrations", ",", "function", "(", "Migration", "$", "a", ",", "Migration", "$", "b", ")", "{", "return", "strcmp", "(", "$", "a", "->", "getName", "(", ")", ",", "$", "b", "->", "getName", "(", ")", ")", ";", "}", ")", ";", "return", "$", "migrations", ";", "}" ]
Get a list of all migrations, sorted alphabetically. @return Migration[]
[ "Get", "a", "list", "of", "all", "migrations", "sorted", "alphabetically", "." ]
d76455a58a4ee5e6f8198e033c07bce40e2f7c7b
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Service/MigrationService.php#L208-L237
18,144
mongrate/mongrate
src/Mongrate/Service/MigrationService.php
MigrationService.getMigrationsNotApplied
public function getMigrationsNotApplied() { $migrationsNotApplied = []; $migrations = $this->getAllMigrations(); foreach ($migrations as $migration) { if (!$migration->isApplied()) { $migrationsNotApplied[] = $migration; } } return $migrationsNotApplied; }
php
public function getMigrationsNotApplied() { $migrationsNotApplied = []; $migrations = $this->getAllMigrations(); foreach ($migrations as $migration) { if (!$migration->isApplied()) { $migrationsNotApplied[] = $migration; } } return $migrationsNotApplied; }
[ "public", "function", "getMigrationsNotApplied", "(", ")", "{", "$", "migrationsNotApplied", "=", "[", "]", ";", "$", "migrations", "=", "$", "this", "->", "getAllMigrations", "(", ")", ";", "foreach", "(", "$", "migrations", "as", "$", "migration", ")", "{", "if", "(", "!", "$", "migration", "->", "isApplied", "(", ")", ")", "{", "$", "migrationsNotApplied", "[", "]", "=", "$", "migration", ";", "}", "}", "return", "$", "migrationsNotApplied", ";", "}" ]
Return array with all migrations that were note applied. @return Migration[]
[ "Return", "array", "with", "all", "migrations", "that", "were", "note", "applied", "." ]
d76455a58a4ee5e6f8198e033c07bce40e2f7c7b
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Service/MigrationService.php#L244-L256
18,145
mongrate/mongrate
src/Mongrate/Service/MigrationService.php
MigrationService.setMigrationApplied
private function setMigrationApplied(Name $name, $isApplied) { $collection = $this->getAppliedCollection(); $criteria = ['className' => (string) $name]; $newObj = ['$set' => ['className' => (string) $name, 'isApplied' => $isApplied]]; $collection->upsert($criteria, $newObj); }
php
private function setMigrationApplied(Name $name, $isApplied) { $collection = $this->getAppliedCollection(); $criteria = ['className' => (string) $name]; $newObj = ['$set' => ['className' => (string) $name, 'isApplied' => $isApplied]]; $collection->upsert($criteria, $newObj); }
[ "private", "function", "setMigrationApplied", "(", "Name", "$", "name", ",", "$", "isApplied", ")", "{", "$", "collection", "=", "$", "this", "->", "getAppliedCollection", "(", ")", ";", "$", "criteria", "=", "[", "'className'", "=>", "(", "string", ")", "$", "name", "]", ";", "$", "newObj", "=", "[", "'$set'", "=>", "[", "'className'", "=>", "(", "string", ")", "$", "name", ",", "'isApplied'", "=>", "$", "isApplied", "]", "]", ";", "$", "collection", "->", "upsert", "(", "$", "criteria", ",", "$", "newObj", ")", ";", "}" ]
Update the database to record whether or not the migration has been applied. @param boolean $isApplied
[ "Update", "the", "database", "to", "record", "whether", "or", "not", "the", "migration", "has", "been", "applied", "." ]
d76455a58a4ee5e6f8198e033c07bce40e2f7c7b
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Service/MigrationService.php#L298-L304
18,146
aedart/laravel-helpers
src/Traits/Broadcasting/BroadcastFactoryTrait.php
BroadcastFactoryTrait.getBroadcastFactory
public function getBroadcastFactory(): ?Factory { if (!$this->hasBroadcastFactory()) { $this->setBroadcastFactory($this->getDefaultBroadcastFactory()); } return $this->broadcastFactory; }
php
public function getBroadcastFactory(): ?Factory { if (!$this->hasBroadcastFactory()) { $this->setBroadcastFactory($this->getDefaultBroadcastFactory()); } return $this->broadcastFactory; }
[ "public", "function", "getBroadcastFactory", "(", ")", ":", "?", "Factory", "{", "if", "(", "!", "$", "this", "->", "hasBroadcastFactory", "(", ")", ")", "{", "$", "this", "->", "setBroadcastFactory", "(", "$", "this", "->", "getDefaultBroadcastFactory", "(", ")", ")", ";", "}", "return", "$", "this", "->", "broadcastFactory", ";", "}" ]
Get broadcast factory If no broadcast factory has been set, this method will set and return a default broadcast factory, if any such value is available @see getDefaultBroadcastFactory() @return Factory|null broadcast factory or null if none broadcast factory has been set
[ "Get", "broadcast", "factory" ]
8b81a2d6658f3f8cb62b6be2c34773aaa2df219a
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Broadcasting/BroadcastFactoryTrait.php#L54-L60
18,147
steeffeen/FancyManiaLinks
FML/Script/Features/MenuElement.php
MenuElement.setItem
public function setItem(Control $item) { $item->checkId(); if ($item instanceof Scriptable) { $item->setScriptEvents(true); } $this->item = $item; return $this; }
php
public function setItem(Control $item) { $item->checkId(); if ($item instanceof Scriptable) { $item->setScriptEvents(true); } $this->item = $item; return $this; }
[ "public", "function", "setItem", "(", "Control", "$", "item", ")", "{", "$", "item", "->", "checkId", "(", ")", ";", "if", "(", "$", "item", "instanceof", "Scriptable", ")", "{", "$", "item", "->", "setScriptEvents", "(", "true", ")", ";", "}", "$", "this", "->", "item", "=", "$", "item", ";", "return", "$", "this", ";", "}" ]
Set the Item Control @api @param Control $item Item Control @return static
[ "Set", "the", "Item", "Control" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/MenuElement.php#L63-L71
18,148
dunkelfrosch/phpcoverfish
src/PHPCoverFish/Validator/Base/BaseCoverFishValidator.php
BaseCoverFishValidator.validateMapping
public function validateMapping(CoverFishMapping $coverMapping) { /** @var CoverFishResult $coverFishResult */ $coverFishResult = new CoverFishResult(); // prepare base results, clear all validation errors and warnings $coverFishResult = $this->prepareCoverFishResult($coverFishResult); // E-01: check for classFQN/DefaultCoverClass existence/mapping validation-error $coverFishResult = $this->validateDefaultCoverClassMapping($coverMapping, $coverFishResult); // E-02: check for invalid classFQN validation-error $coverFishResult = $this->validateClassFQNMapping($coverMapping, $coverFishResult); // E-03: check for invalid accessor validation-error $coverFishResult = $this->validateClassAccessorVisibility($coverMapping, $coverFishResult); // E-04: check for invalid method validation-error $coverFishResult = $this->validateClassMethod($coverMapping, $coverFishResult); return $coverFishResult; }
php
public function validateMapping(CoverFishMapping $coverMapping) { /** @var CoverFishResult $coverFishResult */ $coverFishResult = new CoverFishResult(); // prepare base results, clear all validation errors and warnings $coverFishResult = $this->prepareCoverFishResult($coverFishResult); // E-01: check for classFQN/DefaultCoverClass existence/mapping validation-error $coverFishResult = $this->validateDefaultCoverClassMapping($coverMapping, $coverFishResult); // E-02: check for invalid classFQN validation-error $coverFishResult = $this->validateClassFQNMapping($coverMapping, $coverFishResult); // E-03: check for invalid accessor validation-error $coverFishResult = $this->validateClassAccessorVisibility($coverMapping, $coverFishResult); // E-04: check for invalid method validation-error $coverFishResult = $this->validateClassMethod($coverMapping, $coverFishResult); return $coverFishResult; }
[ "public", "function", "validateMapping", "(", "CoverFishMapping", "$", "coverMapping", ")", "{", "/** @var CoverFishResult $coverFishResult */", "$", "coverFishResult", "=", "new", "CoverFishResult", "(", ")", ";", "// prepare base results, clear all validation errors and warnings", "$", "coverFishResult", "=", "$", "this", "->", "prepareCoverFishResult", "(", "$", "coverFishResult", ")", ";", "// E-01: check for classFQN/DefaultCoverClass existence/mapping validation-error", "$", "coverFishResult", "=", "$", "this", "->", "validateDefaultCoverClassMapping", "(", "$", "coverMapping", ",", "$", "coverFishResult", ")", ";", "// E-02: check for invalid classFQN validation-error", "$", "coverFishResult", "=", "$", "this", "->", "validateClassFQNMapping", "(", "$", "coverMapping", ",", "$", "coverFishResult", ")", ";", "// E-03: check for invalid accessor validation-error", "$", "coverFishResult", "=", "$", "this", "->", "validateClassAccessorVisibility", "(", "$", "coverMapping", ",", "$", "coverFishResult", ")", ";", "// E-04: check for invalid method validation-error", "$", "coverFishResult", "=", "$", "this", "->", "validateClassMethod", "(", "$", "coverMapping", ",", "$", "coverFishResult", ")", ";", "return", "$", "coverFishResult", ";", "}" ]
main validator mapping "engine", if any of our cover validator checks will fail, return corresponding result immediately ... @param CoverFishMapping $coverMapping @return CoverFishResult
[ "main", "validator", "mapping", "engine", "if", "any", "of", "our", "cover", "validator", "checks", "will", "fail", "return", "corresponding", "result", "immediately", "..." ]
779bd399ec8f4cadb3b7854200695c5eb3f5a8ad
https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Validator/Base/BaseCoverFishValidator.php#L223-L239
18,149
maniaplanet/matchmaking-lobby
MatchMakingLobby/GUI/AbstractGUI.php
AbstractGUI.createLabel
final function createLabel($message, $login = null, $countdown = null, $isAnimated = false, $hideOnF6 = true, $showBackgroud = false) { $this->removeLabel($login); $ui = Windows\Label::Create($login); $ui->setPosition(0, 40); $ui->setMessage($message, $countdown); $ui->animated = $isAnimated; $ui->hideOnF6 = $hideOnF6; $ui->showBackground = $showBackgroud; $ui->show(); }
php
final function createLabel($message, $login = null, $countdown = null, $isAnimated = false, $hideOnF6 = true, $showBackgroud = false) { $this->removeLabel($login); $ui = Windows\Label::Create($login); $ui->setPosition(0, 40); $ui->setMessage($message, $countdown); $ui->animated = $isAnimated; $ui->hideOnF6 = $hideOnF6; $ui->showBackground = $showBackgroud; $ui->show(); }
[ "final", "function", "createLabel", "(", "$", "message", ",", "$", "login", "=", "null", ",", "$", "countdown", "=", "null", ",", "$", "isAnimated", "=", "false", ",", "$", "hideOnF6", "=", "true", ",", "$", "showBackgroud", "=", "false", ")", "{", "$", "this", "->", "removeLabel", "(", "$", "login", ")", ";", "$", "ui", "=", "Windows", "\\", "Label", "::", "Create", "(", "$", "login", ")", ";", "$", "ui", "->", "setPosition", "(", "0", ",", "40", ")", ";", "$", "ui", "->", "setMessage", "(", "$", "message", ",", "$", "countdown", ")", ";", "$", "ui", "->", "animated", "=", "$", "isAnimated", ";", "$", "ui", "->", "hideOnF6", "=", "$", "hideOnF6", ";", "$", "ui", "->", "showBackground", "=", "$", "showBackgroud", ";", "$", "ui", "->", "show", "(", ")", ";", "}" ]
Display a text message in the center of the player's screen If countdown is set, the message will be refresh every second the end of the countdown @param string $login @param string $message @param int $countdown @param bool $isAnimated If true the text will be animated
[ "Display", "a", "text", "message", "in", "the", "center", "of", "the", "player", "s", "screen", "If", "countdown", "is", "set", "the", "message", "will", "be", "refresh", "every", "second", "the", "end", "of", "the", "countdown" ]
384f22cdd2cfb0204a071810549eaf1eb01d8b7f
https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/GUI/AbstractGUI.php#L190-L200
18,150
maniaplanet/matchmaking-lobby
MatchMakingLobby/GUI/AbstractGUI.php
AbstractGUI.updateLobbyWindow
final function updateLobbyWindow($serverName, $playersCount, $playingPlayersCount, $averageTime) { $lobbyWindow = Windows\LobbyWindow::Create(); Windows\LobbyWindow::setServerName($serverName); Windows\LobbyWindow::setAverageWaitingTime($averageTime == -1 ? -1 : ceil($averageTime/60)); Windows\LobbyWindow::setPlayingPlayerCount($playingPlayersCount); Windows\LobbyWindow::setReadyPlayerCount($playersCount); $lobbyWindow->show(); }
php
final function updateLobbyWindow($serverName, $playersCount, $playingPlayersCount, $averageTime) { $lobbyWindow = Windows\LobbyWindow::Create(); Windows\LobbyWindow::setServerName($serverName); Windows\LobbyWindow::setAverageWaitingTime($averageTime == -1 ? -1 : ceil($averageTime/60)); Windows\LobbyWindow::setPlayingPlayerCount($playingPlayersCount); Windows\LobbyWindow::setReadyPlayerCount($playersCount); $lobbyWindow->show(); }
[ "final", "function", "updateLobbyWindow", "(", "$", "serverName", ",", "$", "playersCount", ",", "$", "playingPlayersCount", ",", "$", "averageTime", ")", "{", "$", "lobbyWindow", "=", "Windows", "\\", "LobbyWindow", "::", "Create", "(", ")", ";", "Windows", "\\", "LobbyWindow", "::", "setServerName", "(", "$", "serverName", ")", ";", "Windows", "\\", "LobbyWindow", "::", "setAverageWaitingTime", "(", "$", "averageTime", "==", "-", "1", "?", "-", "1", ":", "ceil", "(", "$", "averageTime", "/", "60", ")", ")", ";", "Windows", "\\", "LobbyWindow", "::", "setPlayingPlayerCount", "(", "$", "playingPlayersCount", ")", ";", "Windows", "\\", "LobbyWindow", "::", "setReadyPlayerCount", "(", "$", "playersCount", ")", ";", "$", "lobbyWindow", "->", "show", "(", ")", ";", "}" ]
Display the lobby Window on the right of the screen @param string $serverName @param int $playersCount Number of players ready on the lobby @param int $totalPlayerCount Total number of player on the matchmaking system @param int $playingPlayersCount Number of player in match
[ "Display", "the", "lobby", "Window", "on", "the", "right", "of", "the", "screen" ]
384f22cdd2cfb0204a071810549eaf1eb01d8b7f
https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/GUI/AbstractGUI.php#L269-L277
18,151
maniaplanet/matchmaking-lobby
MatchMakingLobby/GUI/AbstractGUI.php
AbstractGUI.removePlayerFromPlayerList
final function removePlayerFromPlayerList($login) { Windows\PlayerList::Erase($login); $playerLists = Windows\PlayerList::GetAll(); foreach($playerLists as $playerList) { $playerList->removePlayer($login); } Windows\PlayerList::RedrawAll(); }
php
final function removePlayerFromPlayerList($login) { Windows\PlayerList::Erase($login); $playerLists = Windows\PlayerList::GetAll(); foreach($playerLists as $playerList) { $playerList->removePlayer($login); } Windows\PlayerList::RedrawAll(); }
[ "final", "function", "removePlayerFromPlayerList", "(", "$", "login", ")", "{", "Windows", "\\", "PlayerList", "::", "Erase", "(", "$", "login", ")", ";", "$", "playerLists", "=", "Windows", "\\", "PlayerList", "::", "GetAll", "(", ")", ";", "foreach", "(", "$", "playerLists", "as", "$", "playerList", ")", "{", "$", "playerList", "->", "removePlayer", "(", "$", "login", ")", ";", "}", "Windows", "\\", "PlayerList", "::", "RedrawAll", "(", ")", ";", "}" ]
Remove a player from the playerlist and destroy his list @param string $login
[ "Remove", "a", "player", "from", "the", "playerlist", "and", "destroy", "his", "list" ]
384f22cdd2cfb0204a071810549eaf1eb01d8b7f
https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/GUI/AbstractGUI.php#L460-L469
18,152
qcubed/orm
src/Database/DatabaseBase.php
DatabaseBase.transactionCommit
public final function transactionCommit() { if (1 == $this->intTransactionDepth) { $this->executeTransactionCommit(); } if ($this->intTransactionDepth <= 0) { throw new Caller("The transaction commit call is called before the transaction begin was called."); } $this->intTransactionDepth--; }
php
public final function transactionCommit() { if (1 == $this->intTransactionDepth) { $this->executeTransactionCommit(); } if ($this->intTransactionDepth <= 0) { throw new Caller("The transaction commit call is called before the transaction begin was called."); } $this->intTransactionDepth--; }
[ "public", "final", "function", "transactionCommit", "(", ")", "{", "if", "(", "1", "==", "$", "this", "->", "intTransactionDepth", ")", "{", "$", "this", "->", "executeTransactionCommit", "(", ")", ";", "}", "if", "(", "$", "this", "->", "intTransactionDepth", "<=", "0", ")", "{", "throw", "new", "Caller", "(", "\"The transaction commit call is called before the transaction begin was called.\"", ")", ";", "}", "$", "this", "->", "intTransactionDepth", "--", ";", "}" ]
This function commits the database transaction. @throws Caller @return void Nothing
[ "This", "function", "commits", "the", "database", "transaction", "." ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/DatabaseBase.php#L217-L226
18,153
qcubed/orm
src/Database/DatabaseBase.php
DatabaseBase.escapeIdentifiers
public function escapeIdentifiers($mixIdentifiers) { if (is_array($mixIdentifiers)) { return array_map(array($this, 'EscapeIdentifier'), $mixIdentifiers); } else { return $this->escapeIdentifier($mixIdentifiers); } }
php
public function escapeIdentifiers($mixIdentifiers) { if (is_array($mixIdentifiers)) { return array_map(array($this, 'EscapeIdentifier'), $mixIdentifiers); } else { return $this->escapeIdentifier($mixIdentifiers); } }
[ "public", "function", "escapeIdentifiers", "(", "$", "mixIdentifiers", ")", "{", "if", "(", "is_array", "(", "$", "mixIdentifiers", ")", ")", "{", "return", "array_map", "(", "array", "(", "$", "this", ",", "'EscapeIdentifier'", ")", ",", "$", "mixIdentifiers", ")", ";", "}", "else", "{", "return", "$", "this", "->", "escapeIdentifier", "(", "$", "mixIdentifiers", ")", ";", "}", "}" ]
Given an array of identifiers, this method returns array of escaped identifiers For corner case handling, if a single identifier is supplied, a single escaped identifier is returned @param array|string $mixIdentifiers Array of escaped identifiers (array) or one unescaped identifier (string) @return array|string Array of escaped identifiers (array) or one escaped identifier (string)
[ "Given", "an", "array", "of", "identifiers", "this", "method", "returns", "array", "of", "escaped", "identifiers", "For", "corner", "case", "handling", "if", "a", "single", "identifier", "is", "supplied", "a", "single", "escaped", "identifier", "is", "returned" ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/DatabaseBase.php#L272-L279
18,154
qcubed/orm
src/Database/DatabaseBase.php
DatabaseBase.escapeIdentifiersAndValues
public function escapeIdentifiersAndValues($mixColumnsAndValuesArray) { $result = array(); foreach ($mixColumnsAndValuesArray as $strColumn => $mixValue) { $result[$this->escapeIdentifier($strColumn)] = $this->sqlVariable($mixValue); } return $result; }
php
public function escapeIdentifiersAndValues($mixColumnsAndValuesArray) { $result = array(); foreach ($mixColumnsAndValuesArray as $strColumn => $mixValue) { $result[$this->escapeIdentifier($strColumn)] = $this->sqlVariable($mixValue); } return $result; }
[ "public", "function", "escapeIdentifiersAndValues", "(", "$", "mixColumnsAndValuesArray", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "mixColumnsAndValuesArray", "as", "$", "strColumn", "=>", "$", "mixValue", ")", "{", "$", "result", "[", "$", "this", "->", "escapeIdentifier", "(", "$", "strColumn", ")", "]", "=", "$", "this", "->", "sqlVariable", "(", "$", "mixValue", ")", ";", "}", "return", "$", "result", ";", "}" ]
Escapes both column and values when supplied as an array @param array $mixColumnsAndValuesArray Array with column=>value format with both (column and value) sides unescaped @return array Array with column=>value format data with both column and value escaped
[ "Escapes", "both", "column", "and", "values", "when", "supplied", "as", "an", "array" ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/DatabaseBase.php#L304-L311
18,155
qcubed/orm
src/Database/DatabaseBase.php
DatabaseBase.insertOrUpdate
public function insertOrUpdate($strTable, $mixColumnsAndValuesArray, $strPKNames = null) { $strEscapedArray = $this->escapeIdentifiersAndValues($mixColumnsAndValuesArray); $strColumns = array_keys($strEscapedArray); $strUpdateStatement = ''; foreach ($strEscapedArray as $strColumn => $strValue) { if ($strUpdateStatement) { $strUpdateStatement .= ', '; } $strUpdateStatement .= $strColumn . ' = ' . $strValue; } if (is_null($strPKNames)) { $strMatchCondition = 'target_.' . $strColumns[0] . ' = source_.' . $strColumns[0]; } else { if (is_array($strPKNames)) { $strMatchCondition = ''; foreach ($strPKNames as $strPKName) { if ($strMatchCondition) { $strMatchCondition .= ' AND '; } $strMatchCondition .= 'target_.' . $this->escapeIdentifier($strPKName) . ' = source_.' . $this->escapeIdentifier($strPKName); } } else { $strMatchCondition = 'target_.' . $this->escapeIdentifier($strPKNames) . ' = source_.' . $this->escapeIdentifier($strPKNames); } } $strTable = $this->EscapeIdentifierBegin . $strTable . $this->EscapeIdentifierEnd; $strSql = sprintf('MERGE INTO %s AS target_ USING %s AS source_ ON %s WHEN MATCHED THEN UPDATE SET %s WHEN NOT MATCHED THEN INSERT (%s) VALUES (%s)', $strTable, $strTable, $strMatchCondition, $strUpdateStatement, implode(', ', $strColumns), implode(', ', array_values($strEscapedArray)) ); $this->executeNonQuery($strSql); }
php
public function insertOrUpdate($strTable, $mixColumnsAndValuesArray, $strPKNames = null) { $strEscapedArray = $this->escapeIdentifiersAndValues($mixColumnsAndValuesArray); $strColumns = array_keys($strEscapedArray); $strUpdateStatement = ''; foreach ($strEscapedArray as $strColumn => $strValue) { if ($strUpdateStatement) { $strUpdateStatement .= ', '; } $strUpdateStatement .= $strColumn . ' = ' . $strValue; } if (is_null($strPKNames)) { $strMatchCondition = 'target_.' . $strColumns[0] . ' = source_.' . $strColumns[0]; } else { if (is_array($strPKNames)) { $strMatchCondition = ''; foreach ($strPKNames as $strPKName) { if ($strMatchCondition) { $strMatchCondition .= ' AND '; } $strMatchCondition .= 'target_.' . $this->escapeIdentifier($strPKName) . ' = source_.' . $this->escapeIdentifier($strPKName); } } else { $strMatchCondition = 'target_.' . $this->escapeIdentifier($strPKNames) . ' = source_.' . $this->escapeIdentifier($strPKNames); } } $strTable = $this->EscapeIdentifierBegin . $strTable . $this->EscapeIdentifierEnd; $strSql = sprintf('MERGE INTO %s AS target_ USING %s AS source_ ON %s WHEN MATCHED THEN UPDATE SET %s WHEN NOT MATCHED THEN INSERT (%s) VALUES (%s)', $strTable, $strTable, $strMatchCondition, $strUpdateStatement, implode(', ', $strColumns), implode(', ', array_values($strEscapedArray)) ); $this->executeNonQuery($strSql); }
[ "public", "function", "insertOrUpdate", "(", "$", "strTable", ",", "$", "mixColumnsAndValuesArray", ",", "$", "strPKNames", "=", "null", ")", "{", "$", "strEscapedArray", "=", "$", "this", "->", "escapeIdentifiersAndValues", "(", "$", "mixColumnsAndValuesArray", ")", ";", "$", "strColumns", "=", "array_keys", "(", "$", "strEscapedArray", ")", ";", "$", "strUpdateStatement", "=", "''", ";", "foreach", "(", "$", "strEscapedArray", "as", "$", "strColumn", "=>", "$", "strValue", ")", "{", "if", "(", "$", "strUpdateStatement", ")", "{", "$", "strUpdateStatement", ".=", "', '", ";", "}", "$", "strUpdateStatement", ".=", "$", "strColumn", ".", "' = '", ".", "$", "strValue", ";", "}", "if", "(", "is_null", "(", "$", "strPKNames", ")", ")", "{", "$", "strMatchCondition", "=", "'target_.'", ".", "$", "strColumns", "[", "0", "]", ".", "' = source_.'", ".", "$", "strColumns", "[", "0", "]", ";", "}", "else", "{", "if", "(", "is_array", "(", "$", "strPKNames", ")", ")", "{", "$", "strMatchCondition", "=", "''", ";", "foreach", "(", "$", "strPKNames", "as", "$", "strPKName", ")", "{", "if", "(", "$", "strMatchCondition", ")", "{", "$", "strMatchCondition", ".=", "' AND '", ";", "}", "$", "strMatchCondition", ".=", "'target_.'", ".", "$", "this", "->", "escapeIdentifier", "(", "$", "strPKName", ")", ".", "' = source_.'", ".", "$", "this", "->", "escapeIdentifier", "(", "$", "strPKName", ")", ";", "}", "}", "else", "{", "$", "strMatchCondition", "=", "'target_.'", ".", "$", "this", "->", "escapeIdentifier", "(", "$", "strPKNames", ")", ".", "' = source_.'", ".", "$", "this", "->", "escapeIdentifier", "(", "$", "strPKNames", ")", ";", "}", "}", "$", "strTable", "=", "$", "this", "->", "EscapeIdentifierBegin", ".", "$", "strTable", ".", "$", "this", "->", "EscapeIdentifierEnd", ";", "$", "strSql", "=", "sprintf", "(", "'MERGE INTO %s AS target_ USING %s AS source_ ON %s WHEN MATCHED THEN UPDATE SET %s WHEN NOT MATCHED THEN INSERT (%s) VALUES (%s)'", ",", "$", "strTable", ",", "$", "strTable", ",", "$", "strMatchCondition", ",", "$", "strUpdateStatement", ",", "implode", "(", "', '", ",", "$", "strColumns", ")", ",", "implode", "(", "', '", ",", "array_values", "(", "$", "strEscapedArray", ")", ")", ")", ";", "$", "this", "->", "executeNonQuery", "(", "$", "strSql", ")", ";", "}" ]
INSERTs or UPDATEs a table @param string $strTable Table name @param array $mixColumnsAndValuesArray column=>value array (they are given to 'EscapeIdentifiersAndValues' method) @param null|string|array $strPKNames Name(s) of primary key column(s) (expressed as string or array)
[ "INSERTs", "or", "UPDATEs", "a", "table" ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/DatabaseBase.php#L321-L355
18,156
qcubed/orm
src/Database/DatabaseBase.php
DatabaseBase.query
public final function query($strQuery) { $timerName = null; if (!$this->blnConnectedFlag) { $this->connect(); } if ($this->blnEnableProfiling) { $timerName = 'queryExec' . mt_rand(); Timer::start($timerName); } $result = $this->executeQuery($strQuery); if ($this->blnEnableProfiling) { $dblQueryTime = Timer::stop($timerName); Timer::reset($timerName); // Log Query (for Profiling, if applicable) $this->logQuery($strQuery, $dblQueryTime); } return $result; }
php
public final function query($strQuery) { $timerName = null; if (!$this->blnConnectedFlag) { $this->connect(); } if ($this->blnEnableProfiling) { $timerName = 'queryExec' . mt_rand(); Timer::start($timerName); } $result = $this->executeQuery($strQuery); if ($this->blnEnableProfiling) { $dblQueryTime = Timer::stop($timerName); Timer::reset($timerName); // Log Query (for Profiling, if applicable) $this->logQuery($strQuery, $dblQueryTime); } return $result; }
[ "public", "final", "function", "query", "(", "$", "strQuery", ")", "{", "$", "timerName", "=", "null", ";", "if", "(", "!", "$", "this", "->", "blnConnectedFlag", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "}", "if", "(", "$", "this", "->", "blnEnableProfiling", ")", "{", "$", "timerName", "=", "'queryExec'", ".", "mt_rand", "(", ")", ";", "Timer", "::", "start", "(", "$", "timerName", ")", ";", "}", "$", "result", "=", "$", "this", "->", "executeQuery", "(", "$", "strQuery", ")", ";", "if", "(", "$", "this", "->", "blnEnableProfiling", ")", "{", "$", "dblQueryTime", "=", "Timer", "::", "stop", "(", "$", "timerName", ")", ";", "Timer", "::", "reset", "(", "$", "timerName", ")", ";", "// Log Query (for Profiling, if applicable)", "$", "this", "->", "logQuery", "(", "$", "strQuery", ",", "$", "dblQueryTime", ")", ";", "}", "return", "$", "result", ";", "}" ]
Sends the 'SELECT' query to the database and returns the result @param string $strQuery query string @return ResultBase
[ "Sends", "the", "SELECT", "query", "to", "the", "database", "and", "returns", "the", "result" ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/DatabaseBase.php#L364-L388
18,157
qcubed/orm
src/Database/DatabaseBase.php
DatabaseBase.logQuery
private function logQuery($strQuery, $dblQueryTime) { if ($this->blnEnableProfiling) { // Dereference-ize Backtrace Information $objDebugBacktrace = debug_backtrace(); // get rid of unnecessary backtrace info in case of: // query if ((count($objDebugBacktrace) > 3) && (array_key_exists('function', $objDebugBacktrace[2])) && (($objDebugBacktrace[2]['function'] == 'QueryArray') || ($objDebugBacktrace[2]['function'] == 'QuerySingle') || ($objDebugBacktrace[2]['function'] == 'QueryCount')) ) { $objBacktrace = $objDebugBacktrace[3]; } else { if (isset($objDebugBacktrace[2])) // non query { $objBacktrace = $objDebugBacktrace[2]; } else // ad hoc query { $objBacktrace = $objDebugBacktrace[1]; } } // get rid of reference to current object in backtrace array if (isset($objBacktrace['object'])) { $objBacktrace['object'] = null; } for ($intIndex = 0, $intMax = count($objBacktrace['args']); $intIndex < $intMax; $intIndex++) { $obj = $objBacktrace['args'][$intIndex]; if (is_null($obj)) { $obj = 'null'; } else { if (gettype($obj) == 'integer') { } else { if (gettype($obj) == 'object') { $obj = 'Object: ' . get_class($obj); if (method_exists($obj, '__toString')) { $obj .= '- ' . $obj; } } else { if (is_array($obj)) { $obj = 'Array'; } else { $obj = sprintf("'%s'", $obj); } } } } $objBacktrace['args'][$intIndex] = $obj; } // Push it onto the profiling information array $arrProfile = array( 'objBacktrace' => $objBacktrace, 'strQuery' => $strQuery, 'dblTimeInfo' => $dblQueryTime ); array_push($this->strProfileArray, $arrProfile); } }
php
private function logQuery($strQuery, $dblQueryTime) { if ($this->blnEnableProfiling) { // Dereference-ize Backtrace Information $objDebugBacktrace = debug_backtrace(); // get rid of unnecessary backtrace info in case of: // query if ((count($objDebugBacktrace) > 3) && (array_key_exists('function', $objDebugBacktrace[2])) && (($objDebugBacktrace[2]['function'] == 'QueryArray') || ($objDebugBacktrace[2]['function'] == 'QuerySingle') || ($objDebugBacktrace[2]['function'] == 'QueryCount')) ) { $objBacktrace = $objDebugBacktrace[3]; } else { if (isset($objDebugBacktrace[2])) // non query { $objBacktrace = $objDebugBacktrace[2]; } else // ad hoc query { $objBacktrace = $objDebugBacktrace[1]; } } // get rid of reference to current object in backtrace array if (isset($objBacktrace['object'])) { $objBacktrace['object'] = null; } for ($intIndex = 0, $intMax = count($objBacktrace['args']); $intIndex < $intMax; $intIndex++) { $obj = $objBacktrace['args'][$intIndex]; if (is_null($obj)) { $obj = 'null'; } else { if (gettype($obj) == 'integer') { } else { if (gettype($obj) == 'object') { $obj = 'Object: ' . get_class($obj); if (method_exists($obj, '__toString')) { $obj .= '- ' . $obj; } } else { if (is_array($obj)) { $obj = 'Array'; } else { $obj = sprintf("'%s'", $obj); } } } } $objBacktrace['args'][$intIndex] = $obj; } // Push it onto the profiling information array $arrProfile = array( 'objBacktrace' => $objBacktrace, 'strQuery' => $strQuery, 'dblTimeInfo' => $dblQueryTime ); array_push($this->strProfileArray, $arrProfile); } }
[ "private", "function", "logQuery", "(", "$", "strQuery", ",", "$", "dblQueryTime", ")", "{", "if", "(", "$", "this", "->", "blnEnableProfiling", ")", "{", "// Dereference-ize Backtrace Information", "$", "objDebugBacktrace", "=", "debug_backtrace", "(", ")", ";", "// get rid of unnecessary backtrace info in case of:", "// query", "if", "(", "(", "count", "(", "$", "objDebugBacktrace", ")", ">", "3", ")", "&&", "(", "array_key_exists", "(", "'function'", ",", "$", "objDebugBacktrace", "[", "2", "]", ")", ")", "&&", "(", "(", "$", "objDebugBacktrace", "[", "2", "]", "[", "'function'", "]", "==", "'QueryArray'", ")", "||", "(", "$", "objDebugBacktrace", "[", "2", "]", "[", "'function'", "]", "==", "'QuerySingle'", ")", "||", "(", "$", "objDebugBacktrace", "[", "2", "]", "[", "'function'", "]", "==", "'QueryCount'", ")", ")", ")", "{", "$", "objBacktrace", "=", "$", "objDebugBacktrace", "[", "3", "]", ";", "}", "else", "{", "if", "(", "isset", "(", "$", "objDebugBacktrace", "[", "2", "]", ")", ")", "// non query", "{", "$", "objBacktrace", "=", "$", "objDebugBacktrace", "[", "2", "]", ";", "}", "else", "// ad hoc query", "{", "$", "objBacktrace", "=", "$", "objDebugBacktrace", "[", "1", "]", ";", "}", "}", "// get rid of reference to current object in backtrace array", "if", "(", "isset", "(", "$", "objBacktrace", "[", "'object'", "]", ")", ")", "{", "$", "objBacktrace", "[", "'object'", "]", "=", "null", ";", "}", "for", "(", "$", "intIndex", "=", "0", ",", "$", "intMax", "=", "count", "(", "$", "objBacktrace", "[", "'args'", "]", ")", ";", "$", "intIndex", "<", "$", "intMax", ";", "$", "intIndex", "++", ")", "{", "$", "obj", "=", "$", "objBacktrace", "[", "'args'", "]", "[", "$", "intIndex", "]", ";", "if", "(", "is_null", "(", "$", "obj", ")", ")", "{", "$", "obj", "=", "'null'", ";", "}", "else", "{", "if", "(", "gettype", "(", "$", "obj", ")", "==", "'integer'", ")", "{", "}", "else", "{", "if", "(", "gettype", "(", "$", "obj", ")", "==", "'object'", ")", "{", "$", "obj", "=", "'Object: '", ".", "get_class", "(", "$", "obj", ")", ";", "if", "(", "method_exists", "(", "$", "obj", ",", "'__toString'", ")", ")", "{", "$", "obj", ".=", "'- '", ".", "$", "obj", ";", "}", "}", "else", "{", "if", "(", "is_array", "(", "$", "obj", ")", ")", "{", "$", "obj", "=", "'Array'", ";", "}", "else", "{", "$", "obj", "=", "sprintf", "(", "\"'%s'\"", ",", "$", "obj", ")", ";", "}", "}", "}", "}", "$", "objBacktrace", "[", "'args'", "]", "[", "$", "intIndex", "]", "=", "$", "obj", ";", "}", "// Push it onto the profiling information array", "$", "arrProfile", "=", "array", "(", "'objBacktrace'", "=>", "$", "objBacktrace", ",", "'strQuery'", "=>", "$", "strQuery", ",", "'dblTimeInfo'", "=>", "$", "dblQueryTime", ")", ";", "array_push", "(", "$", "this", "->", "strProfileArray", ",", "$", "arrProfile", ")", ";", "}", "}" ]
If EnableProfiling is on, then log the query to the profile array @param string $strQuery @param double $dblQueryTime query execution time in milliseconds @return void
[ "If", "EnableProfiling", "is", "on", "then", "log", "the", "query", "to", "the", "profile", "array" ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/DatabaseBase.php#L545-L609
18,158
qcubed/orm
src/Database/DatabaseBase.php
DatabaseBase.outputProfiling
public function outputProfiling($blnPrintOutput = true) { $strPath = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']; $strOut = '<div class="qDbProfile">'; if ($this->blnEnableProfiling) { $strOut .= sprintf('<form method="post" id="frmDbProfile%s" action="%s/profile.php"><div>', $this->intDatabaseIndex, QCUBED_PHP_URL); $strOut .= sprintf('<input type="hidden" name="strProfileData" value="%s" />', base64_encode(serialize($this->strProfileArray))); $strOut .= sprintf('<input type="hidden" name="intDatabaseIndex" value="%s" />', $this->intDatabaseIndex); $strOut .= sprintf('<input type="hidden" name="strReferrer" value="%s" /></div></form>', htmlentities($strPath)); $intCount = round(count($this->strProfileArray)); if ($intCount == 0) { $strQueryString = 'No queries'; } else { if ($intCount == 1) { $strQueryString = '1 query'; } else { $strQueryString = $intCount . ' queries'; } } $strOut .= sprintf('<b>PROFILING INFORMATION FOR DATABASE CONNECTION #%s</b>: %s performed. Please <a href="#" onclick="var frmDbProfile = document.getElementById(\'frmDbProfile%s\'); frmDbProfile.target = \'_blank\'; frmDbProfile.submit(); return false;">click here to view profiling detail</a><br />', $this->intDatabaseIndex, $strQueryString, $this->intDatabaseIndex); } else { $strOut .= '<form></form><b>Profiling was not enabled for this database connection (#' . $this->intDatabaseIndex . ').</b> To enable, ensure that ENABLE_PROFILING is set to TRUE.'; } $strOut .= '</div>'; $strOut .= '<script>$j(function() {$j(".qDbProfile").draggable();});</script>'; // make it draggable so you can move it out of the way if needed. if ($blnPrintOutput) { print ($strOut); return null; } else { return $strOut; } }
php
public function outputProfiling($blnPrintOutput = true) { $strPath = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']; $strOut = '<div class="qDbProfile">'; if ($this->blnEnableProfiling) { $strOut .= sprintf('<form method="post" id="frmDbProfile%s" action="%s/profile.php"><div>', $this->intDatabaseIndex, QCUBED_PHP_URL); $strOut .= sprintf('<input type="hidden" name="strProfileData" value="%s" />', base64_encode(serialize($this->strProfileArray))); $strOut .= sprintf('<input type="hidden" name="intDatabaseIndex" value="%s" />', $this->intDatabaseIndex); $strOut .= sprintf('<input type="hidden" name="strReferrer" value="%s" /></div></form>', htmlentities($strPath)); $intCount = round(count($this->strProfileArray)); if ($intCount == 0) { $strQueryString = 'No queries'; } else { if ($intCount == 1) { $strQueryString = '1 query'; } else { $strQueryString = $intCount . ' queries'; } } $strOut .= sprintf('<b>PROFILING INFORMATION FOR DATABASE CONNECTION #%s</b>: %s performed. Please <a href="#" onclick="var frmDbProfile = document.getElementById(\'frmDbProfile%s\'); frmDbProfile.target = \'_blank\'; frmDbProfile.submit(); return false;">click here to view profiling detail</a><br />', $this->intDatabaseIndex, $strQueryString, $this->intDatabaseIndex); } else { $strOut .= '<form></form><b>Profiling was not enabled for this database connection (#' . $this->intDatabaseIndex . ').</b> To enable, ensure that ENABLE_PROFILING is set to TRUE.'; } $strOut .= '</div>'; $strOut .= '<script>$j(function() {$j(".qDbProfile").draggable();});</script>'; // make it draggable so you can move it out of the way if needed. if ($blnPrintOutput) { print ($strOut); return null; } else { return $strOut; } }
[ "public", "function", "outputProfiling", "(", "$", "blnPrintOutput", "=", "true", ")", "{", "$", "strPath", "=", "isset", "(", "$", "_SERVER", "[", "'REQUEST_URI'", "]", ")", "?", "$", "_SERVER", "[", "'REQUEST_URI'", "]", ":", "$", "_SERVER", "[", "'PHP_SELF'", "]", ";", "$", "strOut", "=", "'<div class=\"qDbProfile\">'", ";", "if", "(", "$", "this", "->", "blnEnableProfiling", ")", "{", "$", "strOut", ".=", "sprintf", "(", "'<form method=\"post\" id=\"frmDbProfile%s\" action=\"%s/profile.php\"><div>'", ",", "$", "this", "->", "intDatabaseIndex", ",", "QCUBED_PHP_URL", ")", ";", "$", "strOut", ".=", "sprintf", "(", "'<input type=\"hidden\" name=\"strProfileData\" value=\"%s\" />'", ",", "base64_encode", "(", "serialize", "(", "$", "this", "->", "strProfileArray", ")", ")", ")", ";", "$", "strOut", ".=", "sprintf", "(", "'<input type=\"hidden\" name=\"intDatabaseIndex\" value=\"%s\" />'", ",", "$", "this", "->", "intDatabaseIndex", ")", ";", "$", "strOut", ".=", "sprintf", "(", "'<input type=\"hidden\" name=\"strReferrer\" value=\"%s\" /></div></form>'", ",", "htmlentities", "(", "$", "strPath", ")", ")", ";", "$", "intCount", "=", "round", "(", "count", "(", "$", "this", "->", "strProfileArray", ")", ")", ";", "if", "(", "$", "intCount", "==", "0", ")", "{", "$", "strQueryString", "=", "'No queries'", ";", "}", "else", "{", "if", "(", "$", "intCount", "==", "1", ")", "{", "$", "strQueryString", "=", "'1 query'", ";", "}", "else", "{", "$", "strQueryString", "=", "$", "intCount", ".", "' queries'", ";", "}", "}", "$", "strOut", ".=", "sprintf", "(", "'<b>PROFILING INFORMATION FOR DATABASE CONNECTION #%s</b>: %s performed. Please <a href=\"#\" onclick=\"var frmDbProfile = document.getElementById(\\'frmDbProfile%s\\'); frmDbProfile.target = \\'_blank\\'; frmDbProfile.submit(); return false;\">click here to view profiling detail</a><br />'", ",", "$", "this", "->", "intDatabaseIndex", ",", "$", "strQueryString", ",", "$", "this", "->", "intDatabaseIndex", ")", ";", "}", "else", "{", "$", "strOut", ".=", "'<form></form><b>Profiling was not enabled for this database connection (#'", ".", "$", "this", "->", "intDatabaseIndex", ".", "').</b> To enable, ensure that ENABLE_PROFILING is set to TRUE.'", ";", "}", "$", "strOut", ".=", "'</div>'", ";", "$", "strOut", ".=", "'<script>$j(function() {$j(\".qDbProfile\").draggable();});</script>'", ";", "// make it draggable so you can move it out of the way if needed.", "if", "(", "$", "blnPrintOutput", ")", "{", "print", "(", "$", "strOut", ")", ";", "return", "null", ";", "}", "else", "{", "return", "$", "strOut", ";", "}", "}" ]
Displays the OutputProfiling results, plus a link which will popup the details of the profiling. @param bool $blnPrintOutput @return null|string
[ "Displays", "the", "OutputProfiling", "results", "plus", "a", "link", "which", "will", "popup", "the", "details", "of", "the", "profiling", "." ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/DatabaseBase.php#L754-L796
18,159
qcubed/orm
src/Database/DatabaseBase.php
DatabaseBase.extractCommentOptions
public static function extractCommentOptions($strComment) { $ret[0] = null; // comment string without options $ret[1] = null; // the options array if (($strComment) && ($pos1 = strpos($strComment, '{')) !== false && ($pos2 = strrpos($strComment, '}', $pos1)) ) { $strJson = substr($strComment, $pos1, $pos2 - $pos1 + 1); $a = json_decode($strJson, true); if ($a) { $ret[0] = substr($strComment, 0, $pos1) . substr($strComment, $pos2 + 1); // return comment without options $ret[1] = $a; } else { $ret[0] = $strComment; } } return $ret; }
php
public static function extractCommentOptions($strComment) { $ret[0] = null; // comment string without options $ret[1] = null; // the options array if (($strComment) && ($pos1 = strpos($strComment, '{')) !== false && ($pos2 = strrpos($strComment, '}', $pos1)) ) { $strJson = substr($strComment, $pos1, $pos2 - $pos1 + 1); $a = json_decode($strJson, true); if ($a) { $ret[0] = substr($strComment, 0, $pos1) . substr($strComment, $pos2 + 1); // return comment without options $ret[1] = $a; } else { $ret[0] = $strComment; } } return $ret; }
[ "public", "static", "function", "extractCommentOptions", "(", "$", "strComment", ")", "{", "$", "ret", "[", "0", "]", "=", "null", ";", "// comment string without options", "$", "ret", "[", "1", "]", "=", "null", ";", "// the options array", "if", "(", "(", "$", "strComment", ")", "&&", "(", "$", "pos1", "=", "strpos", "(", "$", "strComment", ",", "'{'", ")", ")", "!==", "false", "&&", "(", "$", "pos2", "=", "strrpos", "(", "$", "strComment", ",", "'}'", ",", "$", "pos1", ")", ")", ")", "{", "$", "strJson", "=", "substr", "(", "$", "strComment", ",", "$", "pos1", ",", "$", "pos2", "-", "$", "pos1", "+", "1", ")", ";", "$", "a", "=", "json_decode", "(", "$", "strJson", ",", "true", ")", ";", "if", "(", "$", "a", ")", "{", "$", "ret", "[", "0", "]", "=", "substr", "(", "$", "strComment", ",", "0", ",", "$", "pos1", ")", ".", "substr", "(", "$", "strComment", ",", "$", "pos2", "+", "1", ")", ";", "// return comment without options", "$", "ret", "[", "1", "]", "=", "$", "a", ";", "}", "else", "{", "$", "ret", "[", "0", "]", "=", "$", "strComment", ";", "}", "}", "return", "$", "ret", ";", "}" ]
Utility function to extract the json embedded options structure from the comments. Usage: <code> list($strComment, $options) = Base::extractCommentOptions($strComment); </code> @param string $strComment The comment to analyze @return array A two item array, with first item the comment with the options removed, and 2nd item the options array.
[ "Utility", "function", "to", "extract", "the", "json", "embedded", "options", "structure", "from", "the", "comments", "." ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/DatabaseBase.php#L824-L846
18,160
lode/fem
example-project/application/routing.php
routing.get_custom_routes
protected function get_custom_routes() { $routes = []; // map to a file $routes['GET']['foo'] = 'bar'; // map to a method $accept = fem\request::get_primary_accept(); // html, json, etc. $routes['GET']['foo'] = 'bar->'.$accept; $routes['GET']['foo'] = 'bar::'.$accept; // map to an inline function $routes['GET']['foo'] = function($url, $method){}; $routes['GET']['foo'] = function($url, $method, $arguments){ echo 'baz'; }; return $routes; }
php
protected function get_custom_routes() { $routes = []; // map to a file $routes['GET']['foo'] = 'bar'; // map to a method $accept = fem\request::get_primary_accept(); // html, json, etc. $routes['GET']['foo'] = 'bar->'.$accept; $routes['GET']['foo'] = 'bar::'.$accept; // map to an inline function $routes['GET']['foo'] = function($url, $method){}; $routes['GET']['foo'] = function($url, $method, $arguments){ echo 'baz'; }; return $routes; }
[ "protected", "function", "get_custom_routes", "(", ")", "{", "$", "routes", "=", "[", "]", ";", "// map to a file", "$", "routes", "[", "'GET'", "]", "[", "'foo'", "]", "=", "'bar'", ";", "// map to a method", "$", "accept", "=", "fem", "\\", "request", "::", "get_primary_accept", "(", ")", ";", "// html, json, etc.", "$", "routes", "[", "'GET'", "]", "[", "'foo'", "]", "=", "'bar->'", ".", "$", "accept", ";", "$", "routes", "[", "'GET'", "]", "[", "'foo'", "]", "=", "'bar::'", ".", "$", "accept", ";", "// map to an inline function", "$", "routes", "[", "'GET'", "]", "[", "'foo'", "]", "=", "function", "(", "$", "url", ",", "$", "method", ")", "{", "}", ";", "$", "routes", "[", "'GET'", "]", "[", "'foo'", "]", "=", "function", "(", "$", "url", ",", "$", "method", ",", "$", "arguments", ")", "{", "echo", "'baz'", ";", "}", ";", "return", "$", "routes", ";", "}" ]
user defined mapping url to handler @return array with keys for each supported http method .. .. and inside, key-value pairs of url-regex => handler for example `$routes['GET']['foo'] = 'bar';` .. .. maps the GET url 'foo' to the file 'bar' the url-regex doesn't need regex boundaries like '/foo/' @see \alsvanzelf\fem\routing::get_handler_type() for the different ways to define a handler
[ "user", "defined", "mapping", "url", "to", "handler" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/example-project/application/routing.php#L23-L39
18,161
nooku/nooku-installer
src/Nooku/Composer/Installer.php
Installer.getDelegate
public function getDelegate($packageType) { if (!isset($this->_instances[$packageType])) { if (isset($this->_delegates[$packageType])) { $classname = $this->_delegates[$packageType]; $instance = new $classname($this->io, $this->composer, 'nooku-framework'); $this->_instances[$packageType] = $instance; } else throw new \InvalidArgumentException('Unknown package type `'.$packageType.'`.'); } return $this->_instances[$packageType]; }
php
public function getDelegate($packageType) { if (!isset($this->_instances[$packageType])) { if (isset($this->_delegates[$packageType])) { $classname = $this->_delegates[$packageType]; $instance = new $classname($this->io, $this->composer, 'nooku-framework'); $this->_instances[$packageType] = $instance; } else throw new \InvalidArgumentException('Unknown package type `'.$packageType.'`.'); } return $this->_instances[$packageType]; }
[ "public", "function", "getDelegate", "(", "$", "packageType", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_instances", "[", "$", "packageType", "]", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_delegates", "[", "$", "packageType", "]", ")", ")", "{", "$", "classname", "=", "$", "this", "->", "_delegates", "[", "$", "packageType", "]", ";", "$", "instance", "=", "new", "$", "classname", "(", "$", "this", "->", "io", ",", "$", "this", "->", "composer", ",", "'nooku-framework'", ")", ";", "$", "this", "->", "_instances", "[", "$", "packageType", "]", "=", "$", "instance", ";", "}", "else", "throw", "new", "\\", "InvalidArgumentException", "(", "'Unknown package type `'", ".", "$", "packageType", ".", "'`.'", ")", ";", "}", "return", "$", "this", "->", "_instances", "[", "$", "packageType", "]", ";", "}" ]
Returns a specialized LibraryInstaller subclass to deal with the given package type. @return Composer\Installer\LibraryInstaller @throws \InvalidArgumentException
[ "Returns", "a", "specialized", "LibraryInstaller", "subclass", "to", "deal", "with", "the", "given", "package", "type", "." ]
2aa82ed08983bccd51905426cfff4980ba960d89
https://github.com/nooku/nooku-installer/blob/2aa82ed08983bccd51905426cfff4980ba960d89/src/Nooku/Composer/Installer.php#L50-L65
18,162
gajus/brick
src/System.php
System.setDirectory
public function setDirectory ($directory) { if (strpos($directory, '/') !== 0) { throw new Exception\InvalidArgumentException('Directory name must be an absolute path.'); } if (!is_dir($directory)) { throw new Exception\LogicException('Template directory does not exist.'); } $this->directory = realpath($directory); }
php
public function setDirectory ($directory) { if (strpos($directory, '/') !== 0) { throw new Exception\InvalidArgumentException('Directory name must be an absolute path.'); } if (!is_dir($directory)) { throw new Exception\LogicException('Template directory does not exist.'); } $this->directory = realpath($directory); }
[ "public", "function", "setDirectory", "(", "$", "directory", ")", "{", "if", "(", "strpos", "(", "$", "directory", ",", "'/'", ")", "!==", "0", ")", "{", "throw", "new", "Exception", "\\", "InvalidArgumentException", "(", "'Directory name must be an absolute path.'", ")", ";", "}", "if", "(", "!", "is_dir", "(", "$", "directory", ")", ")", "{", "throw", "new", "Exception", "\\", "LogicException", "(", "'Template directory does not exist.'", ")", ";", "}", "$", "this", "->", "directory", "=", "realpath", "(", "$", "directory", ")", ";", "}" ]
Template resolution is restricted to the paths under the template directory. @param string $directory Absolute path to the template directory.
[ "Template", "resolution", "is", "restricted", "to", "the", "paths", "under", "the", "template", "directory", "." ]
8e1890b2993fb1e2049a3fd73ec048c95fb0a7df
https://github.com/gajus/brick/blob/8e1890b2993fb1e2049a3fd73ec048c95fb0a7df/src/System.php#L39-L49
18,163
yuncms/framework
src/helpers/RBACHelper.php
RBACHelper.getDefaultRoutes
protected static function getDefaultRoutes() { if (self::$_defaultRoutes === null) { $manager = self::getAuthManager(); $roles = $manager->defaultRoles; if ($manager->cache && ($routes = $manager->cache->get($roles)) !== false) { self::$_defaultRoutes = $routes; } else { $permissions = self::$_defaultRoutes = []; foreach ($roles as $role) { $permissions = array_merge($permissions, $manager->getPermissionsByRole($role)); } foreach ($permissions as $item) { if ($item->name[0] === '/') { self::$_defaultRoutes[$item->name] = true; } } if ($manager->cache) { $manager->cache->set($roles, self::$_defaultRoutes, $manager->cacheDuration, new TagDependency([ 'tags' => $manager->cacheTag ])); } } } return self::$_defaultRoutes; }
php
protected static function getDefaultRoutes() { if (self::$_defaultRoutes === null) { $manager = self::getAuthManager(); $roles = $manager->defaultRoles; if ($manager->cache && ($routes = $manager->cache->get($roles)) !== false) { self::$_defaultRoutes = $routes; } else { $permissions = self::$_defaultRoutes = []; foreach ($roles as $role) { $permissions = array_merge($permissions, $manager->getPermissionsByRole($role)); } foreach ($permissions as $item) { if ($item->name[0] === '/') { self::$_defaultRoutes[$item->name] = true; } } if ($manager->cache) { $manager->cache->set($roles, self::$_defaultRoutes, $manager->cacheDuration, new TagDependency([ 'tags' => $manager->cacheTag ])); } } } return self::$_defaultRoutes; }
[ "protected", "static", "function", "getDefaultRoutes", "(", ")", "{", "if", "(", "self", "::", "$", "_defaultRoutes", "===", "null", ")", "{", "$", "manager", "=", "self", "::", "getAuthManager", "(", ")", ";", "$", "roles", "=", "$", "manager", "->", "defaultRoles", ";", "if", "(", "$", "manager", "->", "cache", "&&", "(", "$", "routes", "=", "$", "manager", "->", "cache", "->", "get", "(", "$", "roles", ")", ")", "!==", "false", ")", "{", "self", "::", "$", "_defaultRoutes", "=", "$", "routes", ";", "}", "else", "{", "$", "permissions", "=", "self", "::", "$", "_defaultRoutes", "=", "[", "]", ";", "foreach", "(", "$", "roles", "as", "$", "role", ")", "{", "$", "permissions", "=", "array_merge", "(", "$", "permissions", ",", "$", "manager", "->", "getPermissionsByRole", "(", "$", "role", ")", ")", ";", "}", "foreach", "(", "$", "permissions", "as", "$", "item", ")", "{", "if", "(", "$", "item", "->", "name", "[", "0", "]", "===", "'/'", ")", "{", "self", "::", "$", "_defaultRoutes", "[", "$", "item", "->", "name", "]", "=", "true", ";", "}", "}", "if", "(", "$", "manager", "->", "cache", ")", "{", "$", "manager", "->", "cache", "->", "set", "(", "$", "roles", ",", "self", "::", "$", "_defaultRoutes", ",", "$", "manager", "->", "cacheDuration", ",", "new", "TagDependency", "(", "[", "'tags'", "=>", "$", "manager", "->", "cacheTag", "]", ")", ")", ";", "}", "}", "}", "return", "self", "::", "$", "_defaultRoutes", ";", "}" ]
Get assigned routes by default roles @return array
[ "Get", "assigned", "routes", "by", "default", "roles" ]
af42e28ea4ae15ab8eead3f6d119f93863b94154
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/RBACHelper.php#L51-L76
18,164
yuncms/framework
src/helpers/RBACHelper.php
RBACHelper.getRoutesByUser
public static function getRoutesByUser($userId) { if (!isset(self::$_userRoutes[$userId])) { $manager = self::getAuthManager(); if ($manager->cache && ($routes = $manager->cache->get([__METHOD__, $userId])) !== false) { self::$_userRoutes[$userId] = $routes; } else { $routes = static::getDefaultRoutes(); foreach ($manager->getPermissionsByUser($userId) as $item) { if ($item->name[0] === '/') { $routes[$item->name] = true; } } self::$_userRoutes[$userId] = $routes; if ($manager->cache) { $manager->cache->set([__METHOD__, $userId], $routes, $manager->cacheDuration, new TagDependency([ 'tags' => $manager->cacheTag ])); } } } return self::$_userRoutes[$userId]; }
php
public static function getRoutesByUser($userId) { if (!isset(self::$_userRoutes[$userId])) { $manager = self::getAuthManager(); if ($manager->cache && ($routes = $manager->cache->get([__METHOD__, $userId])) !== false) { self::$_userRoutes[$userId] = $routes; } else { $routes = static::getDefaultRoutes(); foreach ($manager->getPermissionsByUser($userId) as $item) { if ($item->name[0] === '/') { $routes[$item->name] = true; } } self::$_userRoutes[$userId] = $routes; if ($manager->cache) { $manager->cache->set([__METHOD__, $userId], $routes, $manager->cacheDuration, new TagDependency([ 'tags' => $manager->cacheTag ])); } } } return self::$_userRoutes[$userId]; }
[ "public", "static", "function", "getRoutesByUser", "(", "$", "userId", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "_userRoutes", "[", "$", "userId", "]", ")", ")", "{", "$", "manager", "=", "self", "::", "getAuthManager", "(", ")", ";", "if", "(", "$", "manager", "->", "cache", "&&", "(", "$", "routes", "=", "$", "manager", "->", "cache", "->", "get", "(", "[", "__METHOD__", ",", "$", "userId", "]", ")", ")", "!==", "false", ")", "{", "self", "::", "$", "_userRoutes", "[", "$", "userId", "]", "=", "$", "routes", ";", "}", "else", "{", "$", "routes", "=", "static", "::", "getDefaultRoutes", "(", ")", ";", "foreach", "(", "$", "manager", "->", "getPermissionsByUser", "(", "$", "userId", ")", "as", "$", "item", ")", "{", "if", "(", "$", "item", "->", "name", "[", "0", "]", "===", "'/'", ")", "{", "$", "routes", "[", "$", "item", "->", "name", "]", "=", "true", ";", "}", "}", "self", "::", "$", "_userRoutes", "[", "$", "userId", "]", "=", "$", "routes", ";", "if", "(", "$", "manager", "->", "cache", ")", "{", "$", "manager", "->", "cache", "->", "set", "(", "[", "__METHOD__", ",", "$", "userId", "]", ",", "$", "routes", ",", "$", "manager", "->", "cacheDuration", ",", "new", "TagDependency", "(", "[", "'tags'", "=>", "$", "manager", "->", "cacheTag", "]", ")", ")", ";", "}", "}", "}", "return", "self", "::", "$", "_userRoutes", "[", "$", "userId", "]", ";", "}" ]
Get assigned routes of user. @param integer $userId @return array
[ "Get", "assigned", "routes", "of", "user", "." ]
af42e28ea4ae15ab8eead3f6d119f93863b94154
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/RBACHelper.php#L83-L105
18,165
parsnick/steak
src/Console/Command.php
Command.setIo
protected function setIo(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = $output; return $this; }
php
protected function setIo(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = $output; return $this; }
[ "protected", "function", "setIo", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "input", "=", "$", "input", ";", "$", "this", "->", "output", "=", "$", "output", ";", "return", "$", "this", ";", "}" ]
Attach IO to command for easier access between methods. @param InputInterface $input @param OutputInterface $output @return $this
[ "Attach", "IO", "to", "command", "for", "easier", "access", "between", "methods", "." ]
461869189a640938438187330f6c50aca97c5ccc
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Console/Command.php#L55-L61
18,166
parsnick/steak
src/Console/Command.php
Command.createGulpProcess
protected function createGulpProcess($task, array $options = []) { $config = $this->container['config']; return ProcessBuilder::create(array_flatten([ $config['gulp.bin'], $task, $options, '--source', $config['source.directory'], '--dest', $config['build.directory'], '--gulpfile', $config['source.directory'] . DIRECTORY_SEPARATOR . $config['gulp.file'], '--phpwd', getcwd(), '--color', ])) ->getProcess(); }
php
protected function createGulpProcess($task, array $options = []) { $config = $this->container['config']; return ProcessBuilder::create(array_flatten([ $config['gulp.bin'], $task, $options, '--source', $config['source.directory'], '--dest', $config['build.directory'], '--gulpfile', $config['source.directory'] . DIRECTORY_SEPARATOR . $config['gulp.file'], '--phpwd', getcwd(), '--color', ])) ->getProcess(); }
[ "protected", "function", "createGulpProcess", "(", "$", "task", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "config", "=", "$", "this", "->", "container", "[", "'config'", "]", ";", "return", "ProcessBuilder", "::", "create", "(", "array_flatten", "(", "[", "$", "config", "[", "'gulp.bin'", "]", ",", "$", "task", ",", "$", "options", ",", "'--source'", ",", "$", "config", "[", "'source.directory'", "]", ",", "'--dest'", ",", "$", "config", "[", "'build.directory'", "]", ",", "'--gulpfile'", ",", "$", "config", "[", "'source.directory'", "]", ".", "DIRECTORY_SEPARATOR", ".", "$", "config", "[", "'gulp.file'", "]", ",", "'--phpwd'", ",", "getcwd", "(", ")", ",", "'--color'", ",", "]", ")", ")", "->", "getProcess", "(", ")", ";", "}" ]
Create a process builder for the given gulp task. @param string $task @param array $options @return Process
[ "Create", "a", "process", "builder", "for", "the", "given", "gulp", "task", "." ]
461869189a640938438187330f6c50aca97c5ccc
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Console/Command.php#L70-L85
18,167
steeffeen/FancyManiaLinks
FML/Script/Features/ScriptFeature.php
ScriptFeature.collect
public static function collect() { $params = func_get_args(); $scriptFeatures = array(); foreach ($params as $object) { if ($object instanceof ScriptFeature) { $scriptFeatures = static::addScriptFeature($scriptFeatures, $object); } else if ($object instanceof ScriptFeatureable) { $scriptFeatures = static::addScriptFeature($scriptFeatures, $object->getScriptFeatures()); } else if (is_array($object)) { foreach ($object as $subObject) { $scriptFeatures = static::addScriptFeature($scriptFeatures, static::collect($subObject)); } } } return $scriptFeatures; }
php
public static function collect() { $params = func_get_args(); $scriptFeatures = array(); foreach ($params as $object) { if ($object instanceof ScriptFeature) { $scriptFeatures = static::addScriptFeature($scriptFeatures, $object); } else if ($object instanceof ScriptFeatureable) { $scriptFeatures = static::addScriptFeature($scriptFeatures, $object->getScriptFeatures()); } else if (is_array($object)) { foreach ($object as $subObject) { $scriptFeatures = static::addScriptFeature($scriptFeatures, static::collect($subObject)); } } } return $scriptFeatures; }
[ "public", "static", "function", "collect", "(", ")", "{", "$", "params", "=", "func_get_args", "(", ")", ";", "$", "scriptFeatures", "=", "array", "(", ")", ";", "foreach", "(", "$", "params", "as", "$", "object", ")", "{", "if", "(", "$", "object", "instanceof", "ScriptFeature", ")", "{", "$", "scriptFeatures", "=", "static", "::", "addScriptFeature", "(", "$", "scriptFeatures", ",", "$", "object", ")", ";", "}", "else", "if", "(", "$", "object", "instanceof", "ScriptFeatureable", ")", "{", "$", "scriptFeatures", "=", "static", "::", "addScriptFeature", "(", "$", "scriptFeatures", ",", "$", "object", "->", "getScriptFeatures", "(", ")", ")", ";", "}", "else", "if", "(", "is_array", "(", "$", "object", ")", ")", "{", "foreach", "(", "$", "object", "as", "$", "subObject", ")", "{", "$", "scriptFeatures", "=", "static", "::", "addScriptFeature", "(", "$", "scriptFeatures", ",", "static", "::", "collect", "(", "$", "subObject", ")", ")", ";", "}", "}", "}", "return", "$", "scriptFeatures", ";", "}" ]
Collect the Script Features of the given objects @return ScriptFeature[]
[ "Collect", "the", "Script", "Features", "of", "the", "given", "objects" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/ScriptFeature.php#L23-L39
18,168
steeffeen/FancyManiaLinks
FML/Script/Features/ScriptFeature.php
ScriptFeature.addScriptFeature
public static function addScriptFeature(array $scriptFeatures, $newScriptFeatures) { if (!$newScriptFeatures) { return $scriptFeatures; } if ($newScriptFeatures instanceof ScriptFeature) { if (!in_array($newScriptFeatures, $scriptFeatures, true)) { array_push($scriptFeatures, $newScriptFeatures); } } else if (is_array($newScriptFeatures)) { foreach ($newScriptFeatures as $newScriptFeature) { $scriptFeatures = static::addScriptFeature($scriptFeatures, $newScriptFeature); } } return $scriptFeatures; }
php
public static function addScriptFeature(array $scriptFeatures, $newScriptFeatures) { if (!$newScriptFeatures) { return $scriptFeatures; } if ($newScriptFeatures instanceof ScriptFeature) { if (!in_array($newScriptFeatures, $scriptFeatures, true)) { array_push($scriptFeatures, $newScriptFeatures); } } else if (is_array($newScriptFeatures)) { foreach ($newScriptFeatures as $newScriptFeature) { $scriptFeatures = static::addScriptFeature($scriptFeatures, $newScriptFeature); } } return $scriptFeatures; }
[ "public", "static", "function", "addScriptFeature", "(", "array", "$", "scriptFeatures", ",", "$", "newScriptFeatures", ")", "{", "if", "(", "!", "$", "newScriptFeatures", ")", "{", "return", "$", "scriptFeatures", ";", "}", "if", "(", "$", "newScriptFeatures", "instanceof", "ScriptFeature", ")", "{", "if", "(", "!", "in_array", "(", "$", "newScriptFeatures", ",", "$", "scriptFeatures", ",", "true", ")", ")", "{", "array_push", "(", "$", "scriptFeatures", ",", "$", "newScriptFeatures", ")", ";", "}", "}", "else", "if", "(", "is_array", "(", "$", "newScriptFeatures", ")", ")", "{", "foreach", "(", "$", "newScriptFeatures", "as", "$", "newScriptFeature", ")", "{", "$", "scriptFeatures", "=", "static", "::", "addScriptFeature", "(", "$", "scriptFeatures", ",", "$", "newScriptFeature", ")", ";", "}", "}", "return", "$", "scriptFeatures", ";", "}" ]
Add one or more Script Features to an Array of Features if they are not already contained @param array $scriptFeatures @param ScriptFeature||ScriptFeature[] $newScriptFeatures @return array
[ "Add", "one", "or", "more", "Script", "Features", "to", "an", "Array", "of", "Features", "if", "they", "are", "not", "already", "contained" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/ScriptFeature.php#L48-L63
18,169
phossa2/config
src/Config/Config.php
Config.loadGlobal
protected function loadGlobal(/*# string */ $group) { if (!isset($GLOBALS[$group])) { $this->throwError( Message::get(Message::CONFIG_GLOBAL_UNKNOWN, $group), Message::CONFIG_GLOBAL_UNKNOWN ); } // load super global $this->config->addNode($group, $GLOBALS[$group]); return $this; }
php
protected function loadGlobal(/*# string */ $group) { if (!isset($GLOBALS[$group])) { $this->throwError( Message::get(Message::CONFIG_GLOBAL_UNKNOWN, $group), Message::CONFIG_GLOBAL_UNKNOWN ); } // load super global $this->config->addNode($group, $GLOBALS[$group]); return $this; }
[ "protected", "function", "loadGlobal", "(", "/*# string */", "$", "group", ")", "{", "if", "(", "!", "isset", "(", "$", "GLOBALS", "[", "$", "group", "]", ")", ")", "{", "$", "this", "->", "throwError", "(", "Message", "::", "get", "(", "Message", "::", "CONFIG_GLOBAL_UNKNOWN", ",", "$", "group", ")", ",", "Message", "::", "CONFIG_GLOBAL_UNKNOWN", ")", ";", "}", "// load super global", "$", "this", "->", "config", "->", "addNode", "(", "$", "group", ",", "$", "GLOBALS", "[", "$", "group", "]", ")", ";", "return", "$", "this", ";", "}" ]
Load super globals @param string $group @return $this @throws LogicException if super global unknown @access protected
[ "Load", "super", "globals" ]
7c046fd2c97633b69545b4745d8bffe28e19b1df
https://github.com/phossa2/config/blob/7c046fd2c97633b69545b4745d8bffe28e19b1df/src/Config/Config.php#L261-L274
18,170
phossa2/config
src/Config/Config.php
Config.getGroupName
protected function getGroupName(/*# string */ $id)/*# : string */ { return explode( $this->config->getDelimiter(), ltrim($id, $this->config->getDelimiter()) )[0]; }
php
protected function getGroupName(/*# string */ $id)/*# : string */ { return explode( $this->config->getDelimiter(), ltrim($id, $this->config->getDelimiter()) )[0]; }
[ "protected", "function", "getGroupName", "(", "/*# string */", "$", "id", ")", "/*# : string */", "{", "return", "explode", "(", "$", "this", "->", "config", "->", "getDelimiter", "(", ")", ",", "ltrim", "(", "$", "id", ",", "$", "this", "->", "config", "->", "getDelimiter", "(", ")", ")", ")", "[", "0", "]", ";", "}" ]
Get group name - returns 'system' from $id 'system.dir.tmp' - '.system.tmpdir' is invalid @param string $id @return string @access protected
[ "Get", "group", "name" ]
7c046fd2c97633b69545b4745d8bffe28e19b1df
https://github.com/phossa2/config/blob/7c046fd2c97633b69545b4745d8bffe28e19b1df/src/Config/Config.php#L286-L292
18,171
ARCANEDEV/Sanitizer
src/Factory.php
Factory.isFilterable
private function isFilterable($filter) { if (is_string($filter) && ! class_exists($filter)) { throw new Exceptions\InvalidFilterException( "The [$filter] class does not exits." ); } if ( ! in_array(Filterable::class, class_implements($filter))) { throw new Exceptions\InvalidFilterException( 'The filter must be a Closure or a class implementing the Filterable interface.' ); } }
php
private function isFilterable($filter) { if (is_string($filter) && ! class_exists($filter)) { throw new Exceptions\InvalidFilterException( "The [$filter] class does not exits." ); } if ( ! in_array(Filterable::class, class_implements($filter))) { throw new Exceptions\InvalidFilterException( 'The filter must be a Closure or a class implementing the Filterable interface.' ); } }
[ "private", "function", "isFilterable", "(", "$", "filter", ")", "{", "if", "(", "is_string", "(", "$", "filter", ")", "&&", "!", "class_exists", "(", "$", "filter", ")", ")", "{", "throw", "new", "Exceptions", "\\", "InvalidFilterException", "(", "\"The [$filter] class does not exits.\"", ")", ";", "}", "if", "(", "!", "in_array", "(", "Filterable", "::", "class", ",", "class_implements", "(", "$", "filter", ")", ")", ")", "{", "throw", "new", "Exceptions", "\\", "InvalidFilterException", "(", "'The filter must be a Closure or a class implementing the Filterable interface.'", ")", ";", "}", "}" ]
Check if filter is filterable. @param mixed $filter @throws \Arcanedev\Sanitizer\Exceptions\InvalidFilterException
[ "Check", "if", "filter", "is", "filterable", "." ]
e21990ce6d881366d52a7f4e5040b07cc3ecca96
https://github.com/ARCANEDEV/Sanitizer/blob/e21990ce6d881366d52a7f4e5040b07cc3ecca96/src/Factory.php#L102-L115
18,172
fubhy/graphql-php
src/Language/Parser.php
Parser.advance
protected function advance() { $this->cursor = $this->token->getEnd(); return $this->token = $this->lexer->readToken($this->cursor); }
php
protected function advance() { $this->cursor = $this->token->getEnd(); return $this->token = $this->lexer->readToken($this->cursor); }
[ "protected", "function", "advance", "(", ")", "{", "$", "this", "->", "cursor", "=", "$", "this", "->", "token", "->", "getEnd", "(", ")", ";", "return", "$", "this", "->", "token", "=", "$", "this", "->", "lexer", "->", "readToken", "(", "$", "this", "->", "cursor", ")", ";", "}" ]
Moves the internal parser object to the next lexed token.
[ "Moves", "the", "internal", "parser", "object", "to", "the", "next", "lexed", "token", "." ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Parser.php#L109-L113
18,173
fubhy/graphql-php
src/Language/Parser.php
Parser.skip
protected function skip($type) { if ($match = ($this->token->getType() === $type)) { $this->advance(); } return $match; }
php
protected function skip($type) { if ($match = ($this->token->getType() === $type)) { $this->advance(); } return $match; }
[ "protected", "function", "skip", "(", "$", "type", ")", "{", "if", "(", "$", "match", "=", "(", "$", "this", "->", "token", "->", "getType", "(", ")", "===", "$", "type", ")", ")", "{", "$", "this", "->", "advance", "(", ")", ";", "}", "return", "$", "match", ";", "}" ]
If the next token is of the given kind, return true after advancing the parser. Otherwise, do not change the parser state and return false. @param int $type @return bool
[ "If", "the", "next", "token", "is", "of", "the", "given", "kind", "return", "true", "after", "advancing", "the", "parser", ".", "Otherwise", "do", "not", "change", "the", "parser", "state", "and", "return", "false", "." ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Parser.php#L135-L142
18,174
fubhy/graphql-php
src/Language/Parser.php
Parser.expect
protected function expect($type) { if ($this->token->getType() !== $type) { throw new \Exception(sprintf('Expected %s, found %s', Token::typeToString($type), (string) $this->token)); } $token = $this->token; $this->advance(); return $token; }
php
protected function expect($type) { if ($this->token->getType() !== $type) { throw new \Exception(sprintf('Expected %s, found %s', Token::typeToString($type), (string) $this->token)); } $token = $this->token; $this->advance(); return $token; }
[ "protected", "function", "expect", "(", "$", "type", ")", "{", "if", "(", "$", "this", "->", "token", "->", "getType", "(", ")", "!==", "$", "type", ")", "{", "throw", "new", "\\", "Exception", "(", "sprintf", "(", "'Expected %s, found %s'", ",", "Token", "::", "typeToString", "(", "$", "type", ")", ",", "(", "string", ")", "$", "this", "->", "token", ")", ")", ";", "}", "$", "token", "=", "$", "this", "->", "token", ";", "$", "this", "->", "advance", "(", ")", ";", "return", "$", "token", ";", "}" ]
If the next token is of the given kind, return that token after advancing the parser. Otherwise, do not change the parser state and return false. @param int $type @return \Fubhy\GraphQL\Language\Token @throws \Exception
[ "If", "the", "next", "token", "is", "of", "the", "given", "kind", "return", "that", "token", "after", "advancing", "the", "parser", ".", "Otherwise", "do", "not", "change", "the", "parser", "state", "and", "return", "false", "." ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Parser.php#L154-L163
18,175
fubhy/graphql-php
src/Language/Parser.php
Parser.expectKeyword
protected function expectKeyword($value) { if ($this->token->getType() !== Token::NAME_TYPE || $this->token->getValue() !== $value) { throw new \Exception(sprintf('Expected %s, found %s', $value, $this->token->getDescription())); } return $this->advance(); }
php
protected function expectKeyword($value) { if ($this->token->getType() !== Token::NAME_TYPE || $this->token->getValue() !== $value) { throw new \Exception(sprintf('Expected %s, found %s', $value, $this->token->getDescription())); } return $this->advance(); }
[ "protected", "function", "expectKeyword", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "token", "->", "getType", "(", ")", "!==", "Token", "::", "NAME_TYPE", "||", "$", "this", "->", "token", "->", "getValue", "(", ")", "!==", "$", "value", ")", "{", "throw", "new", "\\", "Exception", "(", "sprintf", "(", "'Expected %s, found %s'", ",", "$", "value", ",", "$", "this", "->", "token", "->", "getDescription", "(", ")", ")", ")", ";", "}", "return", "$", "this", "->", "advance", "(", ")", ";", "}" ]
If the next token is a keyword with the given value, return that token after advancing the parser. Otherwise, do not change the parser state and return false. @param string $value @return \Fubhy\GraphQL\Language\Token @throws \Exception
[ "If", "the", "next", "token", "is", "a", "keyword", "with", "the", "given", "value", "return", "that", "token", "after", "advancing", "the", "parser", ".", "Otherwise", "do", "not", "change", "the", "parser", "state", "and", "return", "false", "." ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Parser.php#L176-L183
18,176
fubhy/graphql-php
src/Language/Parser.php
Parser.unexpected
protected function unexpected(Token $atToken = NULL) { $token = $atToken ?: $this->token; return new \Exception(sprintf('Unexpected %s', $token->getDescription())); }
php
protected function unexpected(Token $atToken = NULL) { $token = $atToken ?: $this->token; return new \Exception(sprintf('Unexpected %s', $token->getDescription())); }
[ "protected", "function", "unexpected", "(", "Token", "$", "atToken", "=", "NULL", ")", "{", "$", "token", "=", "$", "atToken", "?", ":", "$", "this", "->", "token", ";", "return", "new", "\\", "Exception", "(", "sprintf", "(", "'Unexpected %s'", ",", "$", "token", "->", "getDescription", "(", ")", ")", ")", ";", "}" ]
Helper protected function for creating an error when an unexpected lexed token is encountered. @param \Fubhy\GraphQL\Language\Token|null $atToken @return \Exception
[ "Helper", "protected", "function", "for", "creating", "an", "error", "when", "an", "unexpected", "lexed", "token", "is", "encountered", "." ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Parser.php#L193-L198
18,177
fubhy/graphql-php
src/Language/Parser.php
Parser.many
protected function many($openKind, $parseFn, $closeKind) { $this->expect($openKind); $nodes = [$parseFn($this)]; while (!$this->skip($closeKind)) { array_push($nodes, $parseFn($this)); } return $nodes; }
php
protected function many($openKind, $parseFn, $closeKind) { $this->expect($openKind); $nodes = [$parseFn($this)]; while (!$this->skip($closeKind)) { array_push($nodes, $parseFn($this)); } return $nodes; }
[ "protected", "function", "many", "(", "$", "openKind", ",", "$", "parseFn", ",", "$", "closeKind", ")", "{", "$", "this", "->", "expect", "(", "$", "openKind", ")", ";", "$", "nodes", "=", "[", "$", "parseFn", "(", "$", "this", ")", "]", ";", "while", "(", "!", "$", "this", "->", "skip", "(", "$", "closeKind", ")", ")", "{", "array_push", "(", "$", "nodes", ",", "$", "parseFn", "(", "$", "this", ")", ")", ";", "}", "return", "$", "nodes", ";", "}" ]
Returns a non-empty list of parse nodes, determined by the parseFn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token. @param int $openKind @param callable $parseFn @param int $closeKind @return array
[ "Returns", "a", "non", "-", "empty", "list", "of", "parse", "nodes", "determined", "by", "the", "parseFn", "." ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Parser.php#L238-L248
18,178
ARCANEDEV/Sanitizer
src/Sanitizer.php
Sanitizer.setFilters
public function setFilters(array $filters) { if (empty($this->filters)) { $this->filters = $this->getDefaultFilters(); } $this->filters = array_merge( $this->filters, $filters ); return $this; }
php
public function setFilters(array $filters) { if (empty($this->filters)) { $this->filters = $this->getDefaultFilters(); } $this->filters = array_merge( $this->filters, $filters ); return $this; }
[ "public", "function", "setFilters", "(", "array", "$", "filters", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "filters", ")", ")", "{", "$", "this", "->", "filters", "=", "$", "this", "->", "getDefaultFilters", "(", ")", ";", "}", "$", "this", "->", "filters", "=", "array_merge", "(", "$", "this", "->", "filters", ",", "$", "filters", ")", ";", "return", "$", "this", ";", "}" ]
Set filters. @param array $filters @return self
[ "Set", "filters", "." ]
e21990ce6d881366d52a7f4e5040b07cc3ecca96
https://github.com/ARCANEDEV/Sanitizer/blob/e21990ce6d881366d52a7f4e5040b07cc3ecca96/src/Sanitizer.php#L59-L70
18,179
ARCANEDEV/Sanitizer
src/Sanitizer.php
Sanitizer.sanitize
public function sanitize(array $data, array $rules = [], array $filters = []) { $this->setRules($rules); $this->setFilters($filters); foreach ($data as $name => $value) { $data[$name] = $this->sanitizeAttribute($name, $value); } return $data; }
php
public function sanitize(array $data, array $rules = [], array $filters = []) { $this->setRules($rules); $this->setFilters($filters); foreach ($data as $name => $value) { $data[$name] = $this->sanitizeAttribute($name, $value); } return $data; }
[ "public", "function", "sanitize", "(", "array", "$", "data", ",", "array", "$", "rules", "=", "[", "]", ",", "array", "$", "filters", "=", "[", "]", ")", "{", "$", "this", "->", "setRules", "(", "$", "rules", ")", ";", "$", "this", "->", "setFilters", "(", "$", "filters", ")", ";", "foreach", "(", "$", "data", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "data", "[", "$", "name", "]", "=", "$", "this", "->", "sanitizeAttribute", "(", "$", "name", ",", "$", "value", ")", ";", "}", "return", "$", "data", ";", "}" ]
Sanitize the given data. @param array $data @param array $rules @param array $filters @return array
[ "Sanitize", "the", "given", "data", "." ]
e21990ce6d881366d52a7f4e5040b07cc3ecca96
https://github.com/ARCANEDEV/Sanitizer/blob/e21990ce6d881366d52a7f4e5040b07cc3ecca96/src/Sanitizer.php#L99-L109
18,180
ARCANEDEV/Sanitizer
src/Sanitizer.php
Sanitizer.sanitizeAttribute
protected function sanitizeAttribute($attribute, $value) { foreach ($this->rules->get($attribute) as $rule) { $value = $this->applyFilter($rule['name'], $value, $rule['options']); } return $value; }
php
protected function sanitizeAttribute($attribute, $value) { foreach ($this->rules->get($attribute) as $rule) { $value = $this->applyFilter($rule['name'], $value, $rule['options']); } return $value; }
[ "protected", "function", "sanitizeAttribute", "(", "$", "attribute", ",", "$", "value", ")", "{", "foreach", "(", "$", "this", "->", "rules", "->", "get", "(", "$", "attribute", ")", "as", "$", "rule", ")", "{", "$", "value", "=", "$", "this", "->", "applyFilter", "(", "$", "rule", "[", "'name'", "]", ",", "$", "value", ",", "$", "rule", "[", "'options'", "]", ")", ";", "}", "return", "$", "value", ";", "}" ]
Sanitize the given attribute @param string $attribute @param mixed $value @return mixed
[ "Sanitize", "the", "given", "attribute" ]
e21990ce6d881366d52a7f4e5040b07cc3ecca96
https://github.com/ARCANEDEV/Sanitizer/blob/e21990ce6d881366d52a7f4e5040b07cc3ecca96/src/Sanitizer.php#L119-L126
18,181
ARCANEDEV/Sanitizer
src/Sanitizer.php
Sanitizer.applyFilter
protected function applyFilter($name, $value, $options = []) { $this->hasFilter($name); if (empty($value)) return $value; $filter = $this->filters[$name]; if ($filter instanceof Closure) { return call_user_func_array($filter, compact('value', 'options')); } /** @var Filterable $filterable */ $filterable = new $filter; return $filterable->filter($value, $options); }
php
protected function applyFilter($name, $value, $options = []) { $this->hasFilter($name); if (empty($value)) return $value; $filter = $this->filters[$name]; if ($filter instanceof Closure) { return call_user_func_array($filter, compact('value', 'options')); } /** @var Filterable $filterable */ $filterable = new $filter; return $filterable->filter($value, $options); }
[ "protected", "function", "applyFilter", "(", "$", "name", ",", "$", "value", ",", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "hasFilter", "(", "$", "name", ")", ";", "if", "(", "empty", "(", "$", "value", ")", ")", "return", "$", "value", ";", "$", "filter", "=", "$", "this", "->", "filters", "[", "$", "name", "]", ";", "if", "(", "$", "filter", "instanceof", "Closure", ")", "{", "return", "call_user_func_array", "(", "$", "filter", ",", "compact", "(", "'value'", ",", "'options'", ")", ")", ";", "}", "/** @var Filterable $filterable */", "$", "filterable", "=", "new", "$", "filter", ";", "return", "$", "filterable", "->", "filter", "(", "$", "value", ",", "$", "options", ")", ";", "}" ]
Apply the given filter by its name. @param string $name @param mixed $value @param array $options @return mixed
[ "Apply", "the", "given", "filter", "by", "its", "name", "." ]
e21990ce6d881366d52a7f4e5040b07cc3ecca96
https://github.com/ARCANEDEV/Sanitizer/blob/e21990ce6d881366d52a7f4e5040b07cc3ecca96/src/Sanitizer.php#L137-L153
18,182
ARCANEDEV/Sanitizer
src/Sanitizer.php
Sanitizer.getDefaultFilters
private function getDefaultFilters() { return [ 'capitalize' => Filters\CapitalizeFilter::class, 'email' => Filters\EmailFilter::class, 'escape' => Filters\EscapeFilter::class, 'format_date' => Filters\FormatDateFilter::class, 'lowercase' => Filters\LowercaseFilter::class, 'slug' => Filters\SlugFilter::class, 'trim' => Filters\TrimFilter::class, 'uppercase' => Filters\UppercaseFilter::class, 'url' => Filters\UrlFilter::class, ]; }
php
private function getDefaultFilters() { return [ 'capitalize' => Filters\CapitalizeFilter::class, 'email' => Filters\EmailFilter::class, 'escape' => Filters\EscapeFilter::class, 'format_date' => Filters\FormatDateFilter::class, 'lowercase' => Filters\LowercaseFilter::class, 'slug' => Filters\SlugFilter::class, 'trim' => Filters\TrimFilter::class, 'uppercase' => Filters\UppercaseFilter::class, 'url' => Filters\UrlFilter::class, ]; }
[ "private", "function", "getDefaultFilters", "(", ")", "{", "return", "[", "'capitalize'", "=>", "Filters", "\\", "CapitalizeFilter", "::", "class", ",", "'email'", "=>", "Filters", "\\", "EmailFilter", "::", "class", ",", "'escape'", "=>", "Filters", "\\", "EscapeFilter", "::", "class", ",", "'format_date'", "=>", "Filters", "\\", "FormatDateFilter", "::", "class", ",", "'lowercase'", "=>", "Filters", "\\", "LowercaseFilter", "::", "class", ",", "'slug'", "=>", "Filters", "\\", "SlugFilter", "::", "class", ",", "'trim'", "=>", "Filters", "\\", "TrimFilter", "::", "class", ",", "'uppercase'", "=>", "Filters", "\\", "UppercaseFilter", "::", "class", ",", "'url'", "=>", "Filters", "\\", "UrlFilter", "::", "class", ",", "]", ";", "}" ]
Get default filters. @return array
[ "Get", "default", "filters", "." ]
e21990ce6d881366d52a7f4e5040b07cc3ecca96
https://github.com/ARCANEDEV/Sanitizer/blob/e21990ce6d881366d52a7f4e5040b07cc3ecca96/src/Sanitizer.php#L184-L197
18,183
webforge-labs/psc-cms
lib/Psc/URL/Helper.php
Helper.getURL
public static function getURL($section, $flags = 0x000000, Array $queryVars = array()) { /* Query Vars Handling */ if ($section === NULL) { $url = $_SERVER['PHP_SELF']; // da bin ich mir hier noch nicht ganz sicher if (!isset($_SERVER['PHP_SELF'])) { throw new \Psc\Exception('SERVER[PHP_SELF] not set!'); } } elseif ($section instanceof Routable) { /* Achtung hier return */ return $section->getRoutingURL(); } else { $url = $section; } if ($flags & self::ENV_QUERY_VARS) { $queryVars = (array) $_GET; } elseif($flags & self::MERGE_QUERY_VARS) { $queryVars = array_merge((array) $_GET, $queryVars); } elseif($flags & self::MY_QUERY_VARS) { $queryVars = (array) $queryVars; } $queryVars = array_filter($queryVars,create_function('$a', 'return $a != ""; ')); if (count($queryVars) > 0) { if (mb_substr($url,-1) != '/' && mb_substr($url,-5) != '.html' && mb_substr($url,-4) != '.php') $url .= '/'; $url .= '?'; $url .= http_build_query($queryVars); } if ($flags & self::ABSOLUTE) $url = self::absolute($url); return $url; }
php
public static function getURL($section, $flags = 0x000000, Array $queryVars = array()) { /* Query Vars Handling */ if ($section === NULL) { $url = $_SERVER['PHP_SELF']; // da bin ich mir hier noch nicht ganz sicher if (!isset($_SERVER['PHP_SELF'])) { throw new \Psc\Exception('SERVER[PHP_SELF] not set!'); } } elseif ($section instanceof Routable) { /* Achtung hier return */ return $section->getRoutingURL(); } else { $url = $section; } if ($flags & self::ENV_QUERY_VARS) { $queryVars = (array) $_GET; } elseif($flags & self::MERGE_QUERY_VARS) { $queryVars = array_merge((array) $_GET, $queryVars); } elseif($flags & self::MY_QUERY_VARS) { $queryVars = (array) $queryVars; } $queryVars = array_filter($queryVars,create_function('$a', 'return $a != ""; ')); if (count($queryVars) > 0) { if (mb_substr($url,-1) != '/' && mb_substr($url,-5) != '.html' && mb_substr($url,-4) != '.php') $url .= '/'; $url .= '?'; $url .= http_build_query($queryVars); } if ($flags & self::ABSOLUTE) $url = self::absolute($url); return $url; }
[ "public", "static", "function", "getURL", "(", "$", "section", ",", "$", "flags", "=", "0x000000", ",", "Array", "$", "queryVars", "=", "array", "(", ")", ")", "{", "/*\n Query Vars Handling\n */", "if", "(", "$", "section", "===", "NULL", ")", "{", "$", "url", "=", "$", "_SERVER", "[", "'PHP_SELF'", "]", ";", "// da bin ich mir hier noch nicht ganz sicher", "if", "(", "!", "isset", "(", "$", "_SERVER", "[", "'PHP_SELF'", "]", ")", ")", "{", "throw", "new", "\\", "Psc", "\\", "Exception", "(", "'SERVER[PHP_SELF] not set!'", ")", ";", "}", "}", "elseif", "(", "$", "section", "instanceof", "Routable", ")", "{", "/* Achtung hier return */", "return", "$", "section", "->", "getRoutingURL", "(", ")", ";", "}", "else", "{", "$", "url", "=", "$", "section", ";", "}", "if", "(", "$", "flags", "&", "self", "::", "ENV_QUERY_VARS", ")", "{", "$", "queryVars", "=", "(", "array", ")", "$", "_GET", ";", "}", "elseif", "(", "$", "flags", "&", "self", "::", "MERGE_QUERY_VARS", ")", "{", "$", "queryVars", "=", "array_merge", "(", "(", "array", ")", "$", "_GET", ",", "$", "queryVars", ")", ";", "}", "elseif", "(", "$", "flags", "&", "self", "::", "MY_QUERY_VARS", ")", "{", "$", "queryVars", "=", "(", "array", ")", "$", "queryVars", ";", "}", "$", "queryVars", "=", "array_filter", "(", "$", "queryVars", ",", "create_function", "(", "'$a'", ",", "'return $a != \"\"; '", ")", ")", ";", "if", "(", "count", "(", "$", "queryVars", ")", ">", "0", ")", "{", "if", "(", "mb_substr", "(", "$", "url", ",", "-", "1", ")", "!=", "'/'", "&&", "mb_substr", "(", "$", "url", ",", "-", "5", ")", "!=", "'.html'", "&&", "mb_substr", "(", "$", "url", ",", "-", "4", ")", "!=", "'.php'", ")", "$", "url", ".=", "'/'", ";", "$", "url", ".=", "'?'", ";", "$", "url", ".=", "http_build_query", "(", "$", "queryVars", ")", ";", "}", "if", "(", "$", "flags", "&", "self", "::", "ABSOLUTE", ")", "$", "url", "=", "self", "::", "absolute", "(", "$", "url", ")", ";", "return", "$", "url", ";", "}" ]
Konstruiert eine URL @param string|NULL|\Psc\URL\Routable $section wenn $section NULL ist, wird der Teil dynamisch bestimmt (aktuelle Seite)
[ "Konstruiert", "eine", "URL" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/URL/Helper.php#L54-L91
18,184
infinity-next/braintree
src/BraintreeGateway.php
BraintreeGateway.create
public function create($token, array $properties = array(), $customer = null) { $parameters = array_merge([ 'paymentMethodNonce' => $token, ], $properties); $response = BraintreeCustomer::create($parameters); return $response; }
php
public function create($token, array $properties = array(), $customer = null) { $parameters = array_merge([ 'paymentMethodNonce' => $token, ], $properties); $response = BraintreeCustomer::create($parameters); return $response; }
[ "public", "function", "create", "(", "$", "token", ",", "array", "$", "properties", "=", "array", "(", ")", ",", "$", "customer", "=", "null", ")", "{", "$", "parameters", "=", "array_merge", "(", "[", "'paymentMethodNonce'", "=>", "$", "token", ",", "]", ",", "$", "properties", ")", ";", "$", "response", "=", "BraintreeCustomer", "::", "create", "(", "$", "parameters", ")", ";", "return", "$", "response", ";", "}" ]
Subscribe to the plan for the first time. @param string $token @param array $properties @param object|null $customer @return void
[ "Subscribe", "to", "the", "plan", "for", "the", "first", "time", "." ]
4bf6f49d4d8a05734a295003137f360e331cc10f
https://github.com/infinity-next/braintree/blob/4bf6f49d4d8a05734a295003137f360e331cc10f/src/BraintreeGateway.php#L124-L134
18,185
steeffeen/FancyManiaLinks
FML/Script/Features/RadioButtonGroupFeature.php
RadioButtonGroupFeature.addRadioButton
public function addRadioButton(CheckBox $radioButton) { if (!in_array($radioButton, $this->radioButtons, true)) { array_push($this->radioButtons, $radioButton); } return $this; }
php
public function addRadioButton(CheckBox $radioButton) { if (!in_array($radioButton, $this->radioButtons, true)) { array_push($this->radioButtons, $radioButton); } return $this; }
[ "public", "function", "addRadioButton", "(", "CheckBox", "$", "radioButton", ")", "{", "if", "(", "!", "in_array", "(", "$", "radioButton", ",", "$", "this", "->", "radioButtons", ",", "true", ")", ")", "{", "array_push", "(", "$", "this", "->", "radioButtons", ",", "$", "radioButton", ")", ";", "}", "return", "$", "this", ";", "}" ]
Add a new RadioButton @api @param CheckBox $radioButton RadioButton @return static
[ "Add", "a", "new", "RadioButton" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/RadioButtonGroupFeature.php#L106-L112
18,186
steeffeen/FancyManiaLinks
FML/Script/Features/RadioButtonGroupFeature.php
RadioButtonGroupFeature.prepareRadioButtonIdsConstant
protected function prepareRadioButtonIdsConstant(Script $script) { $radioButtonIds = array(); foreach ($this->radioButtons as $radioButton) { $radioButtonIds[$radioButton->getName()] = Builder::getId($radioButton->getQuad()); } $script->addScriptConstant($this->getRadioButtonIdsConstantName(), $radioButtonIds); return $this; }
php
protected function prepareRadioButtonIdsConstant(Script $script) { $radioButtonIds = array(); foreach ($this->radioButtons as $radioButton) { $radioButtonIds[$radioButton->getName()] = Builder::getId($radioButton->getQuad()); } $script->addScriptConstant($this->getRadioButtonIdsConstantName(), $radioButtonIds); return $this; }
[ "protected", "function", "prepareRadioButtonIdsConstant", "(", "Script", "$", "script", ")", "{", "$", "radioButtonIds", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "radioButtons", "as", "$", "radioButton", ")", "{", "$", "radioButtonIds", "[", "$", "radioButton", "->", "getName", "(", ")", "]", "=", "Builder", "::", "getId", "(", "$", "radioButton", "->", "getQuad", "(", ")", ")", ";", "}", "$", "script", "->", "addScriptConstant", "(", "$", "this", "->", "getRadioButtonIdsConstantName", "(", ")", ",", "$", "radioButtonIds", ")", ";", "return", "$", "this", ";", "}" ]
Prepare the Constant containing the RadioButton Ids @param Script $script Script @return static
[ "Prepare", "the", "Constant", "containing", "the", "RadioButton", "Ids" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/RadioButtonGroupFeature.php#L171-L179
18,187
steeffeen/FancyManiaLinks
FML/Script/Features/RadioButtonGroupFeature.php
RadioButtonGroupFeature.prepareOnRadioButtonClickFunction
protected function prepareOnRadioButtonClickFunction(Script $script) { $script->addScriptFunction(self::FUNCTION_ON_RADIO_BUTTON_CLICK, " Void " . self::FUNCTION_ON_RADIO_BUTTON_CLICK . "(CMlQuad _RadioButtonQuad, CMlEntry _RadioButtonGroupEntry, Text[Text] _RadioButtonIds) { // update group entry with name of selected radio button declare " . CheckBoxFeature::VAR_CHECKBOX_ENABLED . " as RadioButtonEnabled for _RadioButtonQuad = False; if (_RadioButtonGroupEntry != Null) { declare RadioButtonGroupValue = \"\"; if (RadioButtonEnabled && _RadioButtonIds.exists(_RadioButtonQuad.ControlId)) { RadioButtonGroupValue = _RadioButtonIds.keyof(_RadioButtonQuad.ControlId); } _RadioButtonGroupEntry.Value = RadioButtonGroupValue; } // disable other radio buttons if (RadioButtonEnabled) { foreach (OtherRadioButtonId in _RadioButtonIds) { declare OtherRadioButtonQuad <=> (Page.GetFirstChild(OtherRadioButtonId) as CMlQuad); if (OtherRadioButtonQuad != Null && OtherRadioButtonQuad != _RadioButtonQuad) { declare " . CheckBoxFeature::VAR_CHECKBOX_ENABLED . " as OtherRadioButtonEnabled for OtherRadioButtonQuad = False; if (OtherRadioButtonEnabled) { " . CheckBoxFeature::FUNCTION_UPDATE_QUAD_DESIGN . "(OtherRadioButtonQuad); } } } } }"); return $this; }
php
protected function prepareOnRadioButtonClickFunction(Script $script) { $script->addScriptFunction(self::FUNCTION_ON_RADIO_BUTTON_CLICK, " Void " . self::FUNCTION_ON_RADIO_BUTTON_CLICK . "(CMlQuad _RadioButtonQuad, CMlEntry _RadioButtonGroupEntry, Text[Text] _RadioButtonIds) { // update group entry with name of selected radio button declare " . CheckBoxFeature::VAR_CHECKBOX_ENABLED . " as RadioButtonEnabled for _RadioButtonQuad = False; if (_RadioButtonGroupEntry != Null) { declare RadioButtonGroupValue = \"\"; if (RadioButtonEnabled && _RadioButtonIds.exists(_RadioButtonQuad.ControlId)) { RadioButtonGroupValue = _RadioButtonIds.keyof(_RadioButtonQuad.ControlId); } _RadioButtonGroupEntry.Value = RadioButtonGroupValue; } // disable other radio buttons if (RadioButtonEnabled) { foreach (OtherRadioButtonId in _RadioButtonIds) { declare OtherRadioButtonQuad <=> (Page.GetFirstChild(OtherRadioButtonId) as CMlQuad); if (OtherRadioButtonQuad != Null && OtherRadioButtonQuad != _RadioButtonQuad) { declare " . CheckBoxFeature::VAR_CHECKBOX_ENABLED . " as OtherRadioButtonEnabled for OtherRadioButtonQuad = False; if (OtherRadioButtonEnabled) { " . CheckBoxFeature::FUNCTION_UPDATE_QUAD_DESIGN . "(OtherRadioButtonQuad); } } } } }"); return $this; }
[ "protected", "function", "prepareOnRadioButtonClickFunction", "(", "Script", "$", "script", ")", "{", "$", "script", "->", "addScriptFunction", "(", "self", "::", "FUNCTION_ON_RADIO_BUTTON_CLICK", ",", "\"\nVoid \"", ".", "self", "::", "FUNCTION_ON_RADIO_BUTTON_CLICK", ".", "\"(CMlQuad _RadioButtonQuad, CMlEntry _RadioButtonGroupEntry, Text[Text] _RadioButtonIds) {\n // update group entry with name of selected radio button\n\tdeclare \"", ".", "CheckBoxFeature", "::", "VAR_CHECKBOX_ENABLED", ".", "\" as RadioButtonEnabled for _RadioButtonQuad = False;\n\tif (_RadioButtonGroupEntry != Null) {\n\t declare RadioButtonGroupValue = \\\"\\\";\n\t if (RadioButtonEnabled && _RadioButtonIds.exists(_RadioButtonQuad.ControlId)) {\n\t RadioButtonGroupValue = _RadioButtonIds.keyof(_RadioButtonQuad.ControlId);\n\t }\n _RadioButtonGroupEntry.Value = RadioButtonGroupValue;\n\t}\n\t// disable other radio buttons\n\tif (RadioButtonEnabled) {\n foreach (OtherRadioButtonId in _RadioButtonIds) {\n declare OtherRadioButtonQuad <=> (Page.GetFirstChild(OtherRadioButtonId) as CMlQuad);\n if (OtherRadioButtonQuad != Null && OtherRadioButtonQuad != _RadioButtonQuad) {\n declare \"", ".", "CheckBoxFeature", "::", "VAR_CHECKBOX_ENABLED", ".", "\" as OtherRadioButtonEnabled for OtherRadioButtonQuad = False;\n if (OtherRadioButtonEnabled) {\n \"", ".", "CheckBoxFeature", "::", "FUNCTION_UPDATE_QUAD_DESIGN", ".", "\"(OtherRadioButtonQuad);\n }\n }\n }\n\t}\n}\"", ")", ";", "return", "$", "this", ";", "}" ]
Build the RadioButton click handler function @param Script $script Script @return static
[ "Build", "the", "RadioButton", "click", "handler", "function" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/RadioButtonGroupFeature.php#L187-L214
18,188
steeffeen/FancyManiaLinks
FML/Script/Features/RadioButtonGroupFeature.php
RadioButtonGroupFeature.prepareRadioButtonClickScript
protected function prepareRadioButtonClickScript(Script $script) { $script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK2, " if (" . $this->getRadioButtonIdsConstantName() . ".exists(Event.ControlId)) { declare RadioButtonQuad <=> (Event.Control as CMlQuad); declare RadioButtonGroupEntry <=> (Page.GetFirstChild(\"" . Builder::getId($this->entry) . "\") as CMlEntry); " . self::FUNCTION_ON_RADIO_BUTTON_CLICK . "(RadioButtonQuad, RadioButtonGroupEntry, " . $this->getRadioButtonIdsConstantName() . "); }"); return $this; }
php
protected function prepareRadioButtonClickScript(Script $script) { $script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK2, " if (" . $this->getRadioButtonIdsConstantName() . ".exists(Event.ControlId)) { declare RadioButtonQuad <=> (Event.Control as CMlQuad); declare RadioButtonGroupEntry <=> (Page.GetFirstChild(\"" . Builder::getId($this->entry) . "\") as CMlEntry); " . self::FUNCTION_ON_RADIO_BUTTON_CLICK . "(RadioButtonQuad, RadioButtonGroupEntry, " . $this->getRadioButtonIdsConstantName() . "); }"); return $this; }
[ "protected", "function", "prepareRadioButtonClickScript", "(", "Script", "$", "script", ")", "{", "$", "script", "->", "appendGenericScriptLabel", "(", "ScriptLabel", "::", "MOUSECLICK2", ",", "\"\nif (\"", ".", "$", "this", "->", "getRadioButtonIdsConstantName", "(", ")", ".", "\".exists(Event.ControlId)) {\n\tdeclare RadioButtonQuad <=> (Event.Control as CMlQuad);\n\tdeclare RadioButtonGroupEntry <=> (Page.GetFirstChild(\\\"\"", ".", "Builder", "::", "getId", "(", "$", "this", "->", "entry", ")", ".", "\"\\\") as CMlEntry);\n\t\"", ".", "self", "::", "FUNCTION_ON_RADIO_BUTTON_CLICK", ".", "\"(RadioButtonQuad, RadioButtonGroupEntry, \"", ".", "$", "this", "->", "getRadioButtonIdsConstantName", "(", ")", ".", "\");\n}\"", ")", ";", "return", "$", "this", ";", "}" ]
Prepare the script for RadioButton clicks @param Script $script Script @return static
[ "Prepare", "the", "script", "for", "RadioButton", "clicks" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/RadioButtonGroupFeature.php#L222-L231
18,189
parsnick/steak
src/Application.php
Application.configureOutput
protected function configureOutput() { $this->output = new ConsoleOutput(); $this->output->getFormatter()->setStyle('path', new OutputFormatterStyle('green', null, ['bold'])); $this->output->getFormatter()->setStyle('time', new OutputFormatterStyle('cyan', null, ['bold'])); $this->output->getFormatter()->setStyle('b', new OutputFormatterStyle(null, null, ['bold'])); }
php
protected function configureOutput() { $this->output = new ConsoleOutput(); $this->output->getFormatter()->setStyle('path', new OutputFormatterStyle('green', null, ['bold'])); $this->output->getFormatter()->setStyle('time', new OutputFormatterStyle('cyan', null, ['bold'])); $this->output->getFormatter()->setStyle('b', new OutputFormatterStyle(null, null, ['bold'])); }
[ "protected", "function", "configureOutput", "(", ")", "{", "$", "this", "->", "output", "=", "new", "ConsoleOutput", "(", ")", ";", "$", "this", "->", "output", "->", "getFormatter", "(", ")", "->", "setStyle", "(", "'path'", ",", "new", "OutputFormatterStyle", "(", "'green'", ",", "null", ",", "[", "'bold'", "]", ")", ")", ";", "$", "this", "->", "output", "->", "getFormatter", "(", ")", "->", "setStyle", "(", "'time'", ",", "new", "OutputFormatterStyle", "(", "'cyan'", ",", "null", ",", "[", "'bold'", "]", ")", ")", ";", "$", "this", "->", "output", "->", "getFormatter", "(", ")", "->", "setStyle", "(", "'b'", ",", "new", "OutputFormatterStyle", "(", "null", ",", "null", ",", "[", "'bold'", "]", ")", ")", ";", "}" ]
Configure the console output with custom styles.
[ "Configure", "the", "console", "output", "with", "custom", "styles", "." ]
461869189a640938438187330f6c50aca97c5ccc
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Application.php#L67-L74
18,190
parsnick/steak
src/Application.php
Application.loadExternalConfig
protected function loadExternalConfig() { $config = new Repository(static::getDefaultConfig()); $filesystem = new Filesystem(); foreach ($this->getConfigFiles($filesystem) as $filename) { $this->output->writeln("<info>Reading config from <path>{$filename}</path></info>"); if ($filesystem->extension($filename) == 'php') { $configValues = $filesystem->getRequire($filename); } else { $configValues = Yaml::parse($filesystem->get($filename)); } $config->set(array_dot($configValues)); } $this->container->instance('config', $config); }
php
protected function loadExternalConfig() { $config = new Repository(static::getDefaultConfig()); $filesystem = new Filesystem(); foreach ($this->getConfigFiles($filesystem) as $filename) { $this->output->writeln("<info>Reading config from <path>{$filename}</path></info>"); if ($filesystem->extension($filename) == 'php') { $configValues = $filesystem->getRequire($filename); } else { $configValues = Yaml::parse($filesystem->get($filename)); } $config->set(array_dot($configValues)); } $this->container->instance('config', $config); }
[ "protected", "function", "loadExternalConfig", "(", ")", "{", "$", "config", "=", "new", "Repository", "(", "static", "::", "getDefaultConfig", "(", ")", ")", ";", "$", "filesystem", "=", "new", "Filesystem", "(", ")", ";", "foreach", "(", "$", "this", "->", "getConfigFiles", "(", "$", "filesystem", ")", "as", "$", "filename", ")", "{", "$", "this", "->", "output", "->", "writeln", "(", "\"<info>Reading config from <path>{$filename}</path></info>\"", ")", ";", "if", "(", "$", "filesystem", "->", "extension", "(", "$", "filename", ")", "==", "'php'", ")", "{", "$", "configValues", "=", "$", "filesystem", "->", "getRequire", "(", "$", "filename", ")", ";", "}", "else", "{", "$", "configValues", "=", "Yaml", "::", "parse", "(", "$", "filesystem", "->", "get", "(", "$", "filename", ")", ")", ";", "}", "$", "config", "->", "set", "(", "array_dot", "(", "$", "configValues", ")", ")", ";", "}", "$", "this", "->", "container", "->", "instance", "(", "'config'", ",", "$", "config", ")", ";", "}" ]
Load the external config files specified by the command line option.
[ "Load", "the", "external", "config", "files", "specified", "by", "the", "command", "line", "option", "." ]
461869189a640938438187330f6c50aca97c5ccc
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Application.php#L80-L99
18,191
parsnick/steak
src/Application.php
Application.getConfigFiles
protected function getConfigFiles($files, array $defaults = ['steak.yml', 'steak.php']) { $option = (new ArgvInput())->getParameterOption(['--config', '-c']); if ( ! $option) { foreach ($defaults as $default) { if ($files->exists($default)) { $option = ($option ? ',' : '') . $default; } } } return $option ? explode(',', $option) : []; }
php
protected function getConfigFiles($files, array $defaults = ['steak.yml', 'steak.php']) { $option = (new ArgvInput())->getParameterOption(['--config', '-c']); if ( ! $option) { foreach ($defaults as $default) { if ($files->exists($default)) { $option = ($option ? ',' : '') . $default; } } } return $option ? explode(',', $option) : []; }
[ "protected", "function", "getConfigFiles", "(", "$", "files", ",", "array", "$", "defaults", "=", "[", "'steak.yml'", ",", "'steak.php'", "]", ")", "{", "$", "option", "=", "(", "new", "ArgvInput", "(", ")", ")", "->", "getParameterOption", "(", "[", "'--config'", ",", "'-c'", "]", ")", ";", "if", "(", "!", "$", "option", ")", "{", "foreach", "(", "$", "defaults", "as", "$", "default", ")", "{", "if", "(", "$", "files", "->", "exists", "(", "$", "default", ")", ")", "{", "$", "option", "=", "(", "$", "option", "?", "','", ":", "''", ")", ".", "$", "default", ";", "}", "}", "}", "return", "$", "option", "?", "explode", "(", "','", ",", "$", "option", ")", ":", "[", "]", ";", "}" ]
Parse the command line option for config file to use. Multiple files can be given as a comma-separated list. If no option is given, defaults as used. @param Filesystem $files @param array $defaults @return array
[ "Parse", "the", "command", "line", "option", "for", "config", "file", "to", "use", "." ]
461869189a640938438187330f6c50aca97c5ccc
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Application.php#L111-L124
18,192
parsnick/steak
src/Application.php
Application.registerCommand
public function registerCommand($commandClass) { $command = $this->container->make($commandClass); $command->setContainer($this->container); return $this->symfony->add($command); }
php
public function registerCommand($commandClass) { $command = $this->container->make($commandClass); $command->setContainer($this->container); return $this->symfony->add($command); }
[ "public", "function", "registerCommand", "(", "$", "commandClass", ")", "{", "$", "command", "=", "$", "this", "->", "container", "->", "make", "(", "$", "commandClass", ")", ";", "$", "command", "->", "setContainer", "(", "$", "this", "->", "container", ")", ";", "return", "$", "this", "->", "symfony", "->", "add", "(", "$", "command", ")", ";", "}" ]
Register a single command. @param string $commandClass @return \Symfony\Component\Console\Command\Command
[ "Register", "a", "single", "command", "." ]
461869189a640938438187330f6c50aca97c5ccc
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Application.php#L159-L166
18,193
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.setScriptInclude
public function setScriptInclude($file, $namespace = null) { if ($file instanceof ScriptInclude) { $scriptInclude = $file; } else { $scriptInclude = new ScriptInclude($file, $namespace); } $this->includes[$scriptInclude->getNamespace()] = $scriptInclude; return $this; }
php
public function setScriptInclude($file, $namespace = null) { if ($file instanceof ScriptInclude) { $scriptInclude = $file; } else { $scriptInclude = new ScriptInclude($file, $namespace); } $this->includes[$scriptInclude->getNamespace()] = $scriptInclude; return $this; }
[ "public", "function", "setScriptInclude", "(", "$", "file", ",", "$", "namespace", "=", "null", ")", "{", "if", "(", "$", "file", "instanceof", "ScriptInclude", ")", "{", "$", "scriptInclude", "=", "$", "file", ";", "}", "else", "{", "$", "scriptInclude", "=", "new", "ScriptInclude", "(", "$", "file", ",", "$", "namespace", ")", ";", "}", "$", "this", "->", "includes", "[", "$", "scriptInclude", "->", "getNamespace", "(", ")", "]", "=", "$", "scriptInclude", ";", "return", "$", "this", ";", "}" ]
Set a Script Include @api @param string|ScriptInclude $file Include file or ScriptInclude @param string $namespace Include namespace @return static
[ "Set", "a", "Script", "Include" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L75-L84
18,194
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.addScriptConstant
public function addScriptConstant($name, $value = null) { if ($name instanceof ScriptConstant) { $scriptConstant = $name; } else { $scriptConstant = new ScriptConstant($name, $value); } if (!in_array($scriptConstant, $this->constants)) { array_push($this->constants, $scriptConstant); } return $this; }
php
public function addScriptConstant($name, $value = null) { if ($name instanceof ScriptConstant) { $scriptConstant = $name; } else { $scriptConstant = new ScriptConstant($name, $value); } if (!in_array($scriptConstant, $this->constants)) { array_push($this->constants, $scriptConstant); } return $this; }
[ "public", "function", "addScriptConstant", "(", "$", "name", ",", "$", "value", "=", "null", ")", "{", "if", "(", "$", "name", "instanceof", "ScriptConstant", ")", "{", "$", "scriptConstant", "=", "$", "name", ";", "}", "else", "{", "$", "scriptConstant", "=", "new", "ScriptConstant", "(", "$", "name", ",", "$", "value", ")", ";", "}", "if", "(", "!", "in_array", "(", "$", "scriptConstant", ",", "$", "this", "->", "constants", ")", ")", "{", "array_push", "(", "$", "this", "->", "constants", ",", "$", "scriptConstant", ")", ";", "}", "return", "$", "this", ";", "}" ]
Add a Script Constant @api @param string|ScriptConstant $name Constant name or ScriptConstant @param string $value Constant value @return static
[ "Add", "a", "Script", "Constant" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L104-L115
18,195
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.addScriptFunction
public function addScriptFunction($name, $text = null) { if ($name instanceof ScriptFunction) { $scriptFunction = $name; } else { $scriptFunction = new ScriptFunction($name, $text); } if (!in_array($scriptFunction, $this->functions)) { array_push($this->functions, $scriptFunction); } return $this; }
php
public function addScriptFunction($name, $text = null) { if ($name instanceof ScriptFunction) { $scriptFunction = $name; } else { $scriptFunction = new ScriptFunction($name, $text); } if (!in_array($scriptFunction, $this->functions)) { array_push($this->functions, $scriptFunction); } return $this; }
[ "public", "function", "addScriptFunction", "(", "$", "name", ",", "$", "text", "=", "null", ")", "{", "if", "(", "$", "name", "instanceof", "ScriptFunction", ")", "{", "$", "scriptFunction", "=", "$", "name", ";", "}", "else", "{", "$", "scriptFunction", "=", "new", "ScriptFunction", "(", "$", "name", ",", "$", "text", ")", ";", "}", "if", "(", "!", "in_array", "(", "$", "scriptFunction", ",", "$", "this", "->", "functions", ")", ")", "{", "array_push", "(", "$", "this", "->", "functions", ",", "$", "scriptFunction", ")", ";", "}", "return", "$", "this", ";", "}" ]
Add a Script Function @api @param string|ScriptFunction $name Function name or ScriptFunction @param string $text Function text @return static
[ "Add", "a", "Script", "Function" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L135-L146
18,196
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.addCustomScriptLabel
public function addCustomScriptLabel($name, $text = null) { if ($name instanceof ScriptLabel) { $scriptLabel = $name; } else { $scriptLabel = new ScriptLabel($name, $text); } if (!in_array($scriptLabel, $this->customLabels)) { array_push($this->customLabels, $scriptLabel); } return $this; }
php
public function addCustomScriptLabel($name, $text = null) { if ($name instanceof ScriptLabel) { $scriptLabel = $name; } else { $scriptLabel = new ScriptLabel($name, $text); } if (!in_array($scriptLabel, $this->customLabels)) { array_push($this->customLabels, $scriptLabel); } return $this; }
[ "public", "function", "addCustomScriptLabel", "(", "$", "name", ",", "$", "text", "=", "null", ")", "{", "if", "(", "$", "name", "instanceof", "ScriptLabel", ")", "{", "$", "scriptLabel", "=", "$", "name", ";", "}", "else", "{", "$", "scriptLabel", "=", "new", "ScriptLabel", "(", "$", "name", ",", "$", "text", ")", ";", "}", "if", "(", "!", "in_array", "(", "$", "scriptLabel", ",", "$", "this", "->", "customLabels", ")", ")", "{", "array_push", "(", "$", "this", "->", "customLabels", ",", "$", "scriptLabel", ")", ";", "}", "return", "$", "this", ";", "}" ]
Add a custom Script text @api @param string|ScriptLabel $name Label name or ScriptLabel @param string $text Script text @return static
[ "Add", "a", "custom", "Script", "text" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L156-L167
18,197
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.appendGenericScriptLabel
public function appendGenericScriptLabel($name, $text = null, $isolated = false) { if ($name instanceof ScriptLabel) { $scriptLabel = $name; } else { $scriptLabel = new ScriptLabel($name, $text, $isolated); } if (!in_array($scriptLabel, $this->genericLabels)) { array_push($this->genericLabels, $scriptLabel); } return $this; }
php
public function appendGenericScriptLabel($name, $text = null, $isolated = false) { if ($name instanceof ScriptLabel) { $scriptLabel = $name; } else { $scriptLabel = new ScriptLabel($name, $text, $isolated); } if (!in_array($scriptLabel, $this->genericLabels)) { array_push($this->genericLabels, $scriptLabel); } return $this; }
[ "public", "function", "appendGenericScriptLabel", "(", "$", "name", ",", "$", "text", "=", "null", ",", "$", "isolated", "=", "false", ")", "{", "if", "(", "$", "name", "instanceof", "ScriptLabel", ")", "{", "$", "scriptLabel", "=", "$", "name", ";", "}", "else", "{", "$", "scriptLabel", "=", "new", "ScriptLabel", "(", "$", "name", ",", "$", "text", ",", "$", "isolated", ")", ";", "}", "if", "(", "!", "in_array", "(", "$", "scriptLabel", ",", "$", "this", "->", "genericLabels", ")", ")", "{", "array_push", "(", "$", "this", "->", "genericLabels", ",", "$", "scriptLabel", ")", ";", "}", "return", "$", "this", ";", "}" ]
Append a generic Script text for the next rendering @TODO: get rid of generic script labels approach @param string|ScriptLabel $name Label name or ScriptLabel @param string $text Script text @param bool $isolated (optional) Whether to isolate the Label Script @return static
[ "Append", "a", "generic", "Script", "text", "for", "the", "next", "rendering" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L188-L199
18,198
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.addFeature
public function addFeature(ScriptFeature $feature) { if (!in_array($feature, $this->features, true)) { array_push($this->features, $feature); } return $this; }
php
public function addFeature(ScriptFeature $feature) { if (!in_array($feature, $this->features, true)) { array_push($this->features, $feature); } return $this; }
[ "public", "function", "addFeature", "(", "ScriptFeature", "$", "feature", ")", "{", "if", "(", "!", "in_array", "(", "$", "feature", ",", "$", "this", "->", "features", ",", "true", ")", ")", "{", "array_push", "(", "$", "this", "->", "features", ",", "$", "feature", ")", ";", "}", "return", "$", "this", ";", "}" ]
Add a Script Feature @api @param ScriptFeature $feature Script Feature @return static
[ "Add", "a", "Script", "Feature" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L220-L226
18,199
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.buildScriptText
public function buildScriptText() { $scriptText = PHP_EOL; $scriptText .= $this->getHeaderComment(); $scriptText .= $this->getIncludes(); $scriptText .= $this->getConstants(); $scriptText .= $this->getFunctions(); $scriptText .= $this->getLabels(); $scriptText .= $this->getMainFunction(); return $scriptText; }
php
public function buildScriptText() { $scriptText = PHP_EOL; $scriptText .= $this->getHeaderComment(); $scriptText .= $this->getIncludes(); $scriptText .= $this->getConstants(); $scriptText .= $this->getFunctions(); $scriptText .= $this->getLabels(); $scriptText .= $this->getMainFunction(); return $scriptText; }
[ "public", "function", "buildScriptText", "(", ")", "{", "$", "scriptText", "=", "PHP_EOL", ";", "$", "scriptText", ".=", "$", "this", "->", "getHeaderComment", "(", ")", ";", "$", "scriptText", ".=", "$", "this", "->", "getIncludes", "(", ")", ";", "$", "scriptText", ".=", "$", "this", "->", "getConstants", "(", ")", ";", "$", "scriptText", ".=", "$", "this", "->", "getFunctions", "(", ")", ";", "$", "scriptText", ".=", "$", "this", "->", "getLabels", "(", ")", ";", "$", "scriptText", ".=", "$", "this", "->", "getMainFunction", "(", ")", ";", "return", "$", "scriptText", ";", "}" ]
Build the complete Script text @return string
[ "Build", "the", "complete", "Script", "text" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L272-L282