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
27,400
melisplatform/melis-core
src/Controller/MelisAuthController.php
MelisAuthController.getProfilePictureAction
public function getProfilePictureAction() { $melisCoreAuth = $this->serviceLocator->get('MelisCoreAuth'); $moduleSvc = $this->getServiceLocator()->get('ModulesService'); $user = $melisCoreAuth->getIdentity(); $imageDefault = $moduleSvc->getModulePath('MelisCore') . '/public/images/pr...
php
public function getProfilePictureAction() { $melisCoreAuth = $this->serviceLocator->get('MelisCoreAuth'); $moduleSvc = $this->getServiceLocator()->get('ModulesService'); $user = $melisCoreAuth->getIdentity(); $imageDefault = $moduleSvc->getModulePath('MelisCore') . '/public/images/pr...
[ "public", "function", "getProfilePictureAction", "(", ")", "{", "$", "melisCoreAuth", "=", "$", "this", "->", "serviceLocator", "->", "get", "(", "'MelisCoreAuth'", ")", ";", "$", "moduleSvc", "=", "$", "this", "->", "getServiceLocator", "(", ")", "->", "get...
Get the profile picture @return \Zend\Stdlib\ResponseInterface
[ "Get", "the", "profile", "picture" ]
f8b0648930e21d1f2b2e5b9300781c335bd34ea4
https://github.com/melisplatform/melis-core/blob/f8b0648930e21d1f2b2e5b9300781c335bd34ea4/src/Controller/MelisAuthController.php#L488-L509
27,401
locomotivemtl/charcoal-app
src/Charcoal/App/Middleware/IpMiddleware.php
IpMiddleware.isIpBlacklisted
private function isIpBlacklisted($ip) { if (empty($this->blacklist)) { return false; } return $this->isIpInRange($ip, $this->blacklist); }
php
private function isIpBlacklisted($ip) { if (empty($this->blacklist)) { return false; } return $this->isIpInRange($ip, $this->blacklist); }
[ "private", "function", "isIpBlacklisted", "(", "$", "ip", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "blacklist", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "isIpInRange", "(", "$", "ip", ",", "$", "this", "...
Check wether a certain IP is explicitely blacklisted. If the blacklist is null or empty, then nothing is ever blacklisted (return false). Note: this method only performs an exact string match on IP address, no IP masking / range features. @param string $ip The IP address to check against the blacklist. @return boole...
[ "Check", "wether", "a", "certain", "IP", "is", "explicitely", "blacklisted", "." ]
d25bdab08d40dda83c71b770c59e3b469e0ebfbc
https://github.com/locomotivemtl/charcoal-app/blob/d25bdab08d40dda83c71b770c59e3b469e0ebfbc/src/Charcoal/App/Middleware/IpMiddleware.php#L137-L143
27,402
locomotivemtl/charcoal-app
src/Charcoal/App/Middleware/IpMiddleware.php
IpMiddleware.isIpWhitelisted
private function isIpWhitelisted($ip) { if (empty($this->whitelist)) { return true; } return $this->isIpInRange($ip, $this->whitelist); }
php
private function isIpWhitelisted($ip) { if (empty($this->whitelist)) { return true; } return $this->isIpInRange($ip, $this->whitelist); }
[ "private", "function", "isIpWhitelisted", "(", "$", "ip", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "whitelist", ")", ")", "{", "return", "true", ";", "}", "return", "$", "this", "->", "isIpInRange", "(", "$", "ip", ",", "$", "this", "-...
Check wether a certain IP is explicitely whitelisted. If the whitelist is null or empty, then all IPs are whitelisted (return true). Note; This method only performs an exact string match on IP address, no IP masking / range features. @param string $ip The IP address to check against the whitelist. @return boolean
[ "Check", "wether", "a", "certain", "IP", "is", "explicitely", "whitelisted", "." ]
d25bdab08d40dda83c71b770c59e3b469e0ebfbc
https://github.com/locomotivemtl/charcoal-app/blob/d25bdab08d40dda83c71b770c59e3b469e0ebfbc/src/Charcoal/App/Middleware/IpMiddleware.php#L155-L161
27,403
locomotivemtl/charcoal-app
src/Charcoal/App/Module/AbstractModule.php
AbstractModule.config
public function config($key = null) { if ($this->config === null) { throw new InvalidArgumentException( 'Configuration not set.' ); } if ($key !== null) { return $this->config->get($key); } else { return $this->config; ...
php
public function config($key = null) { if ($this->config === null) { throw new InvalidArgumentException( 'Configuration not set.' ); } if ($key !== null) { return $this->config->get($key); } else { return $this->config; ...
[ "public", "function", "config", "(", "$", "key", "=", "null", ")", "{", "if", "(", "$", "this", "->", "config", "===", "null", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Configuration not set.'", ")", ";", "}", "if", "(", "$", "key", ...
Retrieve the module's configuration container, or one of its entry. If a key is provided, return the configuration key value instead of the full object. @param string $key Optional. If provided, the config key value will be returned, instead of the full object. @throws InvalidArgumentException If a config has not be...
[ "Retrieve", "the", "module", "s", "configuration", "container", "or", "one", "of", "its", "entry", "." ]
d25bdab08d40dda83c71b770c59e3b469e0ebfbc
https://github.com/locomotivemtl/charcoal-app/blob/d25bdab08d40dda83c71b770c59e3b469e0ebfbc/src/Charcoal/App/Module/AbstractModule.php#L77-L90
27,404
locomotivemtl/charcoal-app
src/Charcoal/App/Module/AbstractModule.php
AbstractModule.setupRoutes
public function setupRoutes() { if (!isset($this->routeManager)) { $config = $this->config(); $routes = (isset($config['routes']) ? $config['routes'] : [] ); $this->routeManager = new RouteManager([ 'config' => $routes, 'app' => $this->...
php
public function setupRoutes() { if (!isset($this->routeManager)) { $config = $this->config(); $routes = (isset($config['routes']) ? $config['routes'] : [] ); $this->routeManager = new RouteManager([ 'config' => $routes, 'app' => $this->...
[ "public", "function", "setupRoutes", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "routeManager", ")", ")", "{", "$", "config", "=", "$", "this", "->", "config", "(", ")", ";", "$", "routes", "=", "(", "isset", "(", "$", "confi...
Set up the module's routes, via a RouteManager @return self
[ "Set", "up", "the", "module", "s", "routes", "via", "a", "RouteManager" ]
d25bdab08d40dda83c71b770c59e3b469e0ebfbc
https://github.com/locomotivemtl/charcoal-app/blob/d25bdab08d40dda83c71b770c59e3b469e0ebfbc/src/Charcoal/App/Module/AbstractModule.php#L109-L125
27,405
locomotivemtl/charcoal-app
src/Charcoal/App/Route/TemplateRouteConfig.php
TemplateRouteConfig.setTemplateData
public function setTemplateData(array $templateData) { if (!isset($this->templateData)) { $this->templateData = []; } $this->templateData = array_merge($this->templateData, $templateData); return $this; }
php
public function setTemplateData(array $templateData) { if (!isset($this->templateData)) { $this->templateData = []; } $this->templateData = array_merge($this->templateData, $templateData); return $this; }
[ "public", "function", "setTemplateData", "(", "array", "$", "templateData", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "templateData", ")", ")", "{", "$", "this", "->", "templateData", "=", "[", "]", ";", "}", "$", "this", "->", "temp...
Set the template data for the view. @param array $templateData The route template data. @return TemplateRouteConfig Chainable
[ "Set", "the", "template", "data", "for", "the", "view", "." ]
d25bdab08d40dda83c71b770c59e3b469e0ebfbc
https://github.com/locomotivemtl/charcoal-app/blob/d25bdab08d40dda83c71b770c59e3b469e0ebfbc/src/Charcoal/App/Route/TemplateRouteConfig.php#L161-L170
27,406
Magicalex/WriteiniFile
src/WriteiniFile.php
WriteiniFile.rm
public function rm(array $rm_value) { $this->data_ini_file = self::arrayDiffRecursive($this->data_ini_file, $rm_value); return $this; }
php
public function rm(array $rm_value) { $this->data_ini_file = self::arrayDiffRecursive($this->data_ini_file, $rm_value); return $this; }
[ "public", "function", "rm", "(", "array", "$", "rm_value", ")", "{", "$", "this", "->", "data_ini_file", "=", "self", "::", "arrayDiffRecursive", "(", "$", "this", "->", "data_ini_file", ",", "$", "rm_value", ")", ";", "return", "$", "this", ";", "}" ]
method for remove some values in the ini file. @param array $rm_value @return $this
[ "method", "for", "remove", "some", "values", "in", "the", "ini", "file", "." ]
19fe9bd3041219fecdd63e1f0ae14f86cb6800cb
https://github.com/Magicalex/WriteiniFile/blob/19fe9bd3041219fecdd63e1f0ae14f86cb6800cb/src/WriteiniFile.php#L102-L107
27,407
Magicalex/WriteiniFile
src/WriteiniFile.php
WriteiniFile.write
public function write() { $file_content = null; foreach ($this->data_ini_file as $key_1 => $groupe) { $file_content .= PHP_EOL.'['.$key_1.']'.PHP_EOL; foreach ($groupe as $key_2 => $value_2) { if (is_array($value_2)) { foreach ($value_2 as...
php
public function write() { $file_content = null; foreach ($this->data_ini_file as $key_1 => $groupe) { $file_content .= PHP_EOL.'['.$key_1.']'.PHP_EOL; foreach ($groupe as $key_2 => $value_2) { if (is_array($value_2)) { foreach ($value_2 as...
[ "public", "function", "write", "(", ")", "{", "$", "file_content", "=", "null", ";", "foreach", "(", "$", "this", "->", "data_ini_file", "as", "$", "key_1", "=>", "$", "groupe", ")", "{", "$", "file_content", ".=", "PHP_EOL", ".", "'['", ".", "$", "k...
method for write data in the ini file. @return bool
[ "method", "for", "write", "data", "in", "the", "ini", "file", "." ]
19fe9bd3041219fecdd63e1f0ae14f86cb6800cb
https://github.com/Magicalex/WriteiniFile/blob/19fe9bd3041219fecdd63e1f0ae14f86cb6800cb/src/WriteiniFile.php#L114-L138
27,408
UseMuffin/Tokenize
src/Model/Entity/Token.php
Token.random
public static function random($length = null) { if ($length === null) { $length = Configure::read('Muffin/Tokenize.length', self::DEFAULT_LENGTH); } return bin2hex(Security::randomBytes($length / 2)); }
php
public static function random($length = null) { if ($length === null) { $length = Configure::read('Muffin/Tokenize.length', self::DEFAULT_LENGTH); } return bin2hex(Security::randomBytes($length / 2)); }
[ "public", "static", "function", "random", "(", "$", "length", "=", "null", ")", "{", "if", "(", "$", "length", "===", "null", ")", "{", "$", "length", "=", "Configure", "::", "read", "(", "'Muffin/Tokenize.length'", ",", "self", "::", "DEFAULT_LENGTH", "...
Creates a secure random token. @param int|null $length Token length @return string @see http://stackoverflow.com/a/29137661/2020428
[ "Creates", "a", "secure", "random", "token", "." ]
a7ecf4114782abe12b0ab36e8a32504428fe91ec
https://github.com/UseMuffin/Tokenize/blob/a7ecf4114782abe12b0ab36e8a32504428fe91ec/src/Model/Entity/Token.php#L49-L56
27,409
flash-global/api-client
src/AbstractApiClient.php
AbstractApiClient.getAppropriateTransport
protected function getAppropriateTransport($flags) { if ($flags & ApiRequestOption::NO_RESPONSE) { $transport = $this->getAsyncTransport(); if (is_null($transport)) { $transport = $this->getTransport(); } else { $fallback = $this->getTransp...
php
protected function getAppropriateTransport($flags) { if ($flags & ApiRequestOption::NO_RESPONSE) { $transport = $this->getAsyncTransport(); if (is_null($transport)) { $transport = $this->getTransport(); } else { $fallback = $this->getTransp...
[ "protected", "function", "getAppropriateTransport", "(", "$", "flags", ")", "{", "if", "(", "$", "flags", "&", "ApiRequestOption", "::", "NO_RESPONSE", ")", "{", "$", "transport", "=", "$", "this", "->", "getAsyncTransport", "(", ")", ";", "if", "(", "is_n...
Returns the most appropriate transport according to request flags @param $flags @return AsyncTransportInterface|TransportInterface
[ "Returns", "the", "most", "appropriate", "transport", "according", "to", "request", "flags" ]
5e54dea5c37ef7b5736d46f9997ea6c245c4949f
https://github.com/flash-global/api-client/blob/5e54dea5c37ef7b5736d46f9997ea6c245c4949f/src/AbstractApiClient.php#L380-L397
27,410
flash-global/api-client
src/ApiClientException.php
ApiClientException.getRequestException
public function getRequestException() { if (!is_null($this->requestException)) { return $this->requestException; } $search = function (\Exception $exception = null) use (&$search) { $previous = $exception->getPrevious(); if (is_null($previous)) { ...
php
public function getRequestException() { if (!is_null($this->requestException)) { return $this->requestException; } $search = function (\Exception $exception = null) use (&$search) { $previous = $exception->getPrevious(); if (is_null($previous)) { ...
[ "public", "function", "getRequestException", "(", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "requestException", ")", ")", "{", "return", "$", "this", "->", "requestException", ";", "}", "$", "search", "=", "function", "(", "\\", "Excep...
Return the response body of the exception @return null|RequestException
[ "Return", "the", "response", "body", "of", "the", "exception" ]
5e54dea5c37ef7b5736d46f9997ea6c245c4949f
https://github.com/flash-global/api-client/blob/5e54dea5c37ef7b5736d46f9997ea6c245c4949f/src/ApiClientException.php#L23-L44
27,411
n2n/n2n
src/app/n2n/core/err/ThrowableInfoFactory.php
ThrowableInfoFactory.findCallPos
public static function findCallPos(\Throwable $t, string &$filePath = null, int &$lineNo = null) { if (!($t instanceof \TypeError || $t instanceof WarningError || $t instanceof RecoverableError)) { return; } $message = $t->getMessage(); if (false !== strpos($message, '{closure}')) { return; }...
php
public static function findCallPos(\Throwable $t, string &$filePath = null, int &$lineNo = null) { if (!($t instanceof \TypeError || $t instanceof WarningError || $t instanceof RecoverableError)) { return; } $message = $t->getMessage(); if (false !== strpos($message, '{closure}')) { return; }...
[ "public", "static", "function", "findCallPos", "(", "\\", "Throwable", "$", "t", ",", "string", "&", "$", "filePath", "=", "null", ",", "int", "&", "$", "lineNo", "=", "null", ")", "{", "if", "(", "!", "(", "$", "t", "instanceof", "\\", "TypeError", ...
Makes error infos more user friendly @param string $errmsg; @param string $filePath @param string $lineNo
[ "Makes", "error", "infos", "more", "user", "friendly" ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ThrowableInfoFactory.php#L73-L98
27,412
thebuggenie/b2db
src/Core.php
Core.initialize
public static function initialize($configuration = array(), $cache_object = null) { try { if (array_key_exists('dsn', $configuration) && $configuration['dsn']) self::setDSN($configuration['dsn']); if (array_key_exists('driver', $configuration) && $...
php
public static function initialize($configuration = array(), $cache_object = null) { try { if (array_key_exists('dsn', $configuration) && $configuration['dsn']) self::setDSN($configuration['dsn']); if (array_key_exists('driver', $configuration) && $...
[ "public", "static", "function", "initialize", "(", "$", "configuration", "=", "array", "(", ")", ",", "$", "cache_object", "=", "null", ")", "{", "try", "{", "if", "(", "array_key_exists", "(", "'dsn'", ",", "$", "configuration", ")", "&&", "$", "configu...
Initialize B2DB and load related B2DB classes @param array $configuration [optional] Configuration to load @param \b2db\interfaces\Cache $cache_object
[ "Initialize", "B2DB", "and", "load", "related", "B2DB", "classes" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Core.php#L147-L186
27,413
thebuggenie/b2db
src/Core.php
Core.saveConnectionParameters
public static function saveConnectionParameters($bootstrap_location) { $string = "b2db:\n"; $string .= " driver: " . self::getDriver() . "\n"; $string .= " username: " . self::getUsername() . "\n"; $string .= " password: \"" . self::getPassword() . "\"\n"...
php
public static function saveConnectionParameters($bootstrap_location) { $string = "b2db:\n"; $string .= " driver: " . self::getDriver() . "\n"; $string .= " username: " . self::getUsername() . "\n"; $string .= " password: \"" . self::getPassword() . "\"\n"...
[ "public", "static", "function", "saveConnectionParameters", "(", "$", "bootstrap_location", ")", "{", "$", "string", "=", "\"b2db:\\n\"", ";", "$", "string", ".=", "\" driver: \"", ".", "self", "::", "getDriver", "(", ")", ".", "\"\\n\"", ";", "$", "string"...
Store connection parameters @param string $bootstrap_location Where to save the connection parameters
[ "Store", "connection", "parameters" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Core.php#L203-L219
27,414
thebuggenie/b2db
src/Core.php
Core.getTable
public static function getTable($table_name) { if (!isset(self::$tables[$table_name])) { self::loadNewTable(new $table_name()); } if (!isset(self::$tables[$table_name])) { throw new Exception('Table ' . $table_name . ' is not loaded'); ...
php
public static function getTable($table_name) { if (!isset(self::$tables[$table_name])) { self::loadNewTable(new $table_name()); } if (!isset(self::$tables[$table_name])) { throw new Exception('Table ' . $table_name . ' is not loaded'); ...
[ "public", "static", "function", "getTable", "(", "$", "table_name", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "tables", "[", "$", "table_name", "]", ")", ")", "{", "self", "::", "loadNewTable", "(", "new", "$", "table_name", "(", ")"...
Returns the Table object @param string $table_name The table class name to load @return Table
[ "Returns", "the", "Table", "object" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Core.php#L228-L237
27,415
thebuggenie/b2db
src/Core.php
Core.simpleQuery
public static function simpleQuery($sql) { self::$sql_hits++; try { $res = self::getDBLink()->query($sql); } catch (PDOException $e) { throw new Exception($e->getMessage()); } return $res; }
php
public static function simpleQuery($sql) { self::$sql_hits++; try { $res = self::getDBLink()->query($sql); } catch (PDOException $e) { throw new Exception($e->getMessage()); } return $res; }
[ "public", "static", "function", "simpleQuery", "(", "$", "sql", ")", "{", "self", "::", "$", "sql_hits", "++", ";", "try", "{", "$", "res", "=", "self", "::", "getDBLink", "(", ")", "->", "query", "(", "$", "sql", ")", ";", "}", "catch", "(", "PD...
returns a PDO resultset @param string $sql @return \PDOStatement
[ "returns", "a", "PDO", "resultset" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Core.php#L373-L382
27,416
thebuggenie/b2db
src/Core.php
Core.setDSN
public static function setDSN($dsn) { $dsn_details = parse_url($dsn); if (!is_array($dsn_details) || !array_key_exists('scheme', $dsn_details)) { throw new Exception('This does not look like a valid DSN - cannot read the database type'); } try { ...
php
public static function setDSN($dsn) { $dsn_details = parse_url($dsn); if (!is_array($dsn_details) || !array_key_exists('scheme', $dsn_details)) { throw new Exception('This does not look like a valid DSN - cannot read the database type'); } try { ...
[ "public", "static", "function", "setDSN", "(", "$", "dsn", ")", "{", "$", "dsn_details", "=", "parse_url", "(", "$", "dsn", ")", ";", "if", "(", "!", "is_array", "(", "$", "dsn_details", ")", "||", "!", "array_key_exists", "(", "'scheme'", ",", "$", ...
Set the DSN @param string $dsn
[ "Set", "the", "DSN" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Core.php#L389-L419
27,417
thebuggenie/b2db
src/Core.php
Core.generateDSN
protected static function generateDSN() { $dsn = self::getDriver() . ":host=" . self::getHostname(); if (self::getPort()) { $dsn .= ';port=' . self::getPort(); } $dsn .= ';dbname=' . self::getDatabaseName(); self::$dsn = $dsn; }
php
protected static function generateDSN() { $dsn = self::getDriver() . ":host=" . self::getHostname(); if (self::getPort()) { $dsn .= ';port=' . self::getPort(); } $dsn .= ';dbname=' . self::getDatabaseName(); self::$dsn = $dsn; }
[ "protected", "static", "function", "generateDSN", "(", ")", "{", "$", "dsn", "=", "self", "::", "getDriver", "(", ")", ".", "\":host=\"", ".", "self", "::", "getHostname", "(", ")", ";", "if", "(", "self", "::", "getPort", "(", ")", ")", "{", "$", ...
Generate the DSN when needed
[ "Generate", "the", "DSN", "when", "needed" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Core.php#L424-L432
27,418
thebuggenie/b2db
src/Core.php
Core.setDriver
public static function setDriver($driver) { if (self::isDriverSupported($driver) == false) { throw new Exception('The selected database is not supported: "' . $driver . '".'); } self::$driver = $driver; }
php
public static function setDriver($driver) { if (self::isDriverSupported($driver) == false) { throw new Exception('The selected database is not supported: "' . $driver . '".'); } self::$driver = $driver; }
[ "public", "static", "function", "setDriver", "(", "$", "driver", ")", "{", "if", "(", "self", "::", "isDriverSupported", "(", "$", "driver", ")", "==", "false", ")", "{", "throw", "new", "Exception", "(", "'The selected database is not supported: \"'", ".", "$...
Set the database type @param string $driver
[ "Set", "the", "database", "type" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Core.php#L573-L579
27,419
thebuggenie/b2db
src/Core.php
Core.doConnect
public static function doConnect() { if (!\class_exists('\\PDO')) { throw new Exception('B2DB needs the PDO PHP libraries installed. See http://php.net/PDO for more information.'); } try { $uname = self::getUsername(); $pwd = se...
php
public static function doConnect() { if (!\class_exists('\\PDO')) { throw new Exception('B2DB needs the PDO PHP libraries installed. See http://php.net/PDO for more information.'); } try { $uname = self::getUsername(); $pwd = se...
[ "public", "static", "function", "doConnect", "(", ")", "{", "if", "(", "!", "\\", "class_exists", "(", "'\\\\PDO'", ")", ")", "{", "throw", "new", "Exception", "(", "'B2DB needs the PDO PHP libraries installed. See http://php.net/PDO for more information.'", ")", ";", ...
Try connecting to the database
[ "Try", "connecting", "to", "the", "database" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Core.php#L599-L629
27,420
thebuggenie/b2db
src/Core.php
Core.getDrivers
public static function getDrivers() { $types = array(); if (class_exists('\PDO')) { $types[self::DRIVER_MYSQL] = 'MySQL / MariaDB'; $types[self::DRIVER_POSTGRES] = 'PostgreSQL'; $types[self::DRIVER_MS_SQL_SERVER] = 'Microsoft SQL Server'; ...
php
public static function getDrivers() { $types = array(); if (class_exists('\PDO')) { $types[self::DRIVER_MYSQL] = 'MySQL / MariaDB'; $types[self::DRIVER_POSTGRES] = 'PostgreSQL'; $types[self::DRIVER_MS_SQL_SERVER] = 'Microsoft SQL Server'; ...
[ "public", "static", "function", "getDrivers", "(", ")", "{", "$", "types", "=", "array", "(", ")", ";", "if", "(", "class_exists", "(", "'\\PDO'", ")", ")", "{", "$", "types", "[", "self", "::", "DRIVER_MYSQL", "]", "=", "'MySQL / MariaDB'", ";", "$", ...
Get available DB drivers @return array
[ "Get", "available", "DB", "drivers" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Core.php#L746-L759
27,421
thebuggenie/b2db
src/Statement.php
Statement.execute
public function execute() { $values = ($this->getQuery() instanceof QueryInterface) ? $this->getQuery()->getValues() : array(); if (Core::isDebugMode()) { if (Core::isDebugLoggingEnabled() && class_exists('\\caspar\\core\\Logging')) { \caspar\core\Logg...
php
public function execute() { $values = ($this->getQuery() instanceof QueryInterface) ? $this->getQuery()->getValues() : array(); if (Core::isDebugMode()) { if (Core::isDebugLoggingEnabled() && class_exists('\\caspar\\core\\Logging')) { \caspar\core\Logg...
[ "public", "function", "execute", "(", ")", "{", "$", "values", "=", "(", "$", "this", "->", "getQuery", "(", ")", "instanceof", "QueryInterface", ")", "?", "$", "this", "->", "getQuery", "(", ")", "->", "getValues", "(", ")", ":", "array", "(", ")", ...
Performs a query, then returns a resultset @return Resultset
[ "Performs", "a", "query", "then", "returns", "a", "resultset" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Statement.php#L79-L126
27,422
thebuggenie/b2db
src/Statement.php
Statement.fetch
public function fetch() { try { if ($this->values = $this->statement->fetch(\PDO::FETCH_ASSOC)) { return $this->values; } else { return false; } } catch (\PDOException $e) { throw new ...
php
public function fetch() { try { if ($this->values = $this->statement->fetch(\PDO::FETCH_ASSOC)) { return $this->values; } else { return false; } } catch (\PDOException $e) { throw new ...
[ "public", "function", "fetch", "(", ")", "{", "try", "{", "if", "(", "$", "this", "->", "values", "=", "$", "this", "->", "statement", "->", "fetch", "(", "\\", "PDO", "::", "FETCH_ASSOC", ")", ")", "{", "return", "$", "this", "->", "values", ";", ...
Fetch the resultset
[ "Fetch", "the", "resultset" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Statement.php#L162-L173
27,423
thebuggenie/b2db
src/Statement.php
Statement.prepare
protected function prepare() { if (!Core::getDBlink() instanceof \PDO) { throw new Exception('Connection not up, can\'t prepare the statement'); } $this->statement = Core::getDBlink()->prepare($this->query->getSql()); }
php
protected function prepare() { if (!Core::getDBlink() instanceof \PDO) { throw new Exception('Connection not up, can\'t prepare the statement'); } $this->statement = Core::getDBlink()->prepare($this->query->getSql()); }
[ "protected", "function", "prepare", "(", ")", "{", "if", "(", "!", "Core", "::", "getDBlink", "(", ")", "instanceof", "\\", "PDO", ")", "{", "throw", "new", "Exception", "(", "'Connection not up, can\\'t prepare the statement'", ")", ";", "}", "$", "this", "...
Prepare the statement
[ "Prepare", "the", "statement" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Statement.php#L178-L185
27,424
n2n/n2n
src/app/n2n/core/module/ModuleManager.php
ModuleManager.getModuleOfTypeName
public function getModuleOfTypeName(string $typeName, bool $required = true) { $typeName = trim($typeName, '\\'); $module = null; $nsLength = 0; foreach ($this->modules as $curNamespace => $curModule) { if (!StringUtils::startsWith($curNamespace . '\\', $typeName)) continue; $curNsLength = ...
php
public function getModuleOfTypeName(string $typeName, bool $required = true) { $typeName = trim($typeName, '\\'); $module = null; $nsLength = 0; foreach ($this->modules as $curNamespace => $curModule) { if (!StringUtils::startsWith($curNamespace . '\\', $typeName)) continue; $curNsLength = ...
[ "public", "function", "getModuleOfTypeName", "(", "string", "$", "typeName", ",", "bool", "$", "required", "=", "true", ")", "{", "$", "typeName", "=", "trim", "(", "$", "typeName", ",", "'\\\\'", ")", ";", "$", "module", "=", "null", ";", "$", "nsLeng...
Returns the module which the passed type is part of. @param string $typeName @param bool $required @throws UnknownModuleException if $required is true and type is not part of any module. @return Module or null if $required is false and type is not part of any module.
[ "Returns", "the", "module", "which", "the", "passed", "type", "is", "part", "of", "." ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/module/ModuleManager.php#L64-L82
27,425
n2n/n2n
src/app/n2n/core/err/ExceptionHandler.php
ExceptionHandler.setLogMailRecipient
public function setLogMailRecipient(string $mailRecipient, string $mailAddresser) { $this->logMailRecipient = $mailRecipient; $this->logMailAddresser = $mailAddresser; }
php
public function setLogMailRecipient(string $mailRecipient, string $mailAddresser) { $this->logMailRecipient = $mailRecipient; $this->logMailAddresser = $mailAddresser; }
[ "public", "function", "setLogMailRecipient", "(", "string", "$", "mailRecipient", ",", "string", "$", "mailAddresser", ")", "{", "$", "this", "->", "logMailRecipient", "=", "$", "mailRecipient", ";", "$", "this", "->", "logMailAddresser", "=", "$", "mailAddresse...
If mailRecipient and mailAddresser are set, the exception handler sends an mail when an exception was handled by this exception handler. @param string $mailRecipient @param string $mailAddresser
[ "If", "mailRecipient", "and", "mailAddresser", "are", "set", "the", "exception", "handler", "sends", "an", "mail", "when", "an", "exception", "was", "handled", "by", "this", "exception", "handler", "." ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ExceptionHandler.php#L146-L149
27,426
n2n/n2n
src/app/n2n/core/err/ExceptionHandler.php
ExceptionHandler.checkForFatalErrors
public function checkForFatalErrors() { // in case of memory size exhausted error gc_collect_cycles(); // $this->checkForPendingLogExceptions(); $error = error_get_last(); if (!isset($error) || $this->checkForError($error['type'], $error['file'], $error['line'], $error['message'])) { return; ...
php
public function checkForFatalErrors() { // in case of memory size exhausted error gc_collect_cycles(); // $this->checkForPendingLogExceptions(); $error = error_get_last(); if (!isset($error) || $this->checkForError($error['type'], $error['file'], $error['line'], $error['message'])) { return; ...
[ "public", "function", "checkForFatalErrors", "(", ")", "{", "// in case of memory size exhausted error\r", "gc_collect_cycles", "(", ")", ";", "// \t\t$this->checkForPendingLogExceptions();\r", "$", "error", "=", "error_get_last", "(", ")", ";", "if", "(", "!", "isset", ...
Is called from N2N after shutdown was performed to detect and handle fatal errors which weren't handled yet.
[ "Is", "called", "from", "N2N", "after", "shutdown", "was", "performed", "to", "detect", "and", "handle", "fatal", "errors", "which", "weren", "t", "handled", "yet", "." ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ExceptionHandler.php#L302-L328
27,427
n2n/n2n
src/app/n2n/core/err/ExceptionHandler.php
ExceptionHandler.checkForPendingLogExceptions
private function checkForPendingLogExceptions() { foreach ($this->pendingLogException as $logException) { $this->log($logException); $this->dispatchException($logException); } $this->pendingLogException = array(); }
php
private function checkForPendingLogExceptions() { foreach ($this->pendingLogException as $logException) { $this->log($logException); $this->dispatchException($logException); } $this->pendingLogException = array(); }
[ "private", "function", "checkForPendingLogExceptions", "(", ")", "{", "foreach", "(", "$", "this", "->", "pendingLogException", "as", "$", "logException", ")", "{", "$", "this", "->", "log", "(", "$", "logException", ")", ";", "$", "this", "->", "dispatchExc...
Possible exceptions which were thrown while logging will be handled.
[ "Possible", "exceptions", "which", "were", "thrown", "while", "logging", "will", "be", "handled", "." ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ExceptionHandler.php#L332-L338
27,428
n2n/n2n
src/app/n2n/core/err/ExceptionHandler.php
ExceptionHandler.createPhpError
private function createPhpError($errno, $errstr, $errfile, $errline) { switch($errno) { case E_ERROR: // if (!is_null($exception = $this->checkForTypeLoaderException($errno, $errstr, $errfile, $errline))) { // return $exception; // } case E_USER_ERROR: case E_COMPILE_ERROR: case E_COR...
php
private function createPhpError($errno, $errstr, $errfile, $errline) { switch($errno) { case E_ERROR: // if (!is_null($exception = $this->checkForTypeLoaderException($errno, $errstr, $errfile, $errline))) { // return $exception; // } case E_USER_ERROR: case E_COMPILE_ERROR: case E_COR...
[ "private", "function", "createPhpError", "(", "$", "errno", ",", "$", "errstr", ",", "$", "errfile", ",", "$", "errline", ")", "{", "switch", "(", "$", "errno", ")", "{", "case", "E_ERROR", ":", "// \t\t\t\tif (!is_null($exception = $this->checkForTypeLoaderExcept...
Creates an exception based on a triggered error @param string $errno @param string $errstr @param string $errfile @param string $errline @return \Error created exception
[ "Creates", "an", "exception", "based", "on", "a", "triggered", "error" ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ExceptionHandler.php#L349-L379
27,429
n2n/n2n
src/app/n2n/core/err/ExceptionHandler.php
ExceptionHandler.buildErrorHash
private function buildErrorHash($errno, $errfile, $errline, $errstr) { return sha1($errno . '-' . $errfile . '-' . $errline . '-' . $errstr); }
php
private function buildErrorHash($errno, $errfile, $errline, $errstr) { return sha1($errno . '-' . $errfile . '-' . $errline . '-' . $errstr); }
[ "private", "function", "buildErrorHash", "(", "$", "errno", ",", "$", "errfile", ",", "$", "errline", ",", "$", "errstr", ")", "{", "return", "sha1", "(", "$", "errno", ".", "'-'", ".", "$", "errfile", ".", "'-'", ".", "$", "errline", ".", "'-'", "...
An Error Hash is a unique hash of an triggered error. @param int $errno @param string $errfile @param int $errline @param string $errstr @return string
[ "An", "Error", "Hash", "is", "a", "unique", "hash", "of", "an", "triggered", "error", "." ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ExceptionHandler.php#L467-L469
27,430
n2n/n2n
src/app/n2n/core/err/ExceptionHandler.php
ExceptionHandler.createSimpleLogMessage
private function createSimpleLogMessage(\Throwable $e) { $message = get_class($e) . ': ' . $e->getMessage(); if ($e instanceof \ErrorException || $e instanceof \Error) { $message .= ' in ' . $e->getFile() . ' on line ' . $e->getLine(); } return $message; }
php
private function createSimpleLogMessage(\Throwable $e) { $message = get_class($e) . ': ' . $e->getMessage(); if ($e instanceof \ErrorException || $e instanceof \Error) { $message .= ' in ' . $e->getFile() . ' on line ' . $e->getLine(); } return $message; }
[ "private", "function", "createSimpleLogMessage", "(", "\\", "Throwable", "$", "e", ")", "{", "$", "message", "=", "get_class", "(", "$", "e", ")", ".", "': '", ".", "$", "e", "->", "getMessage", "(", ")", ";", "if", "(", "$", "e", "instanceof", "\\",...
Creates short description of an exception used for logging @param \Exception $e @return string short description
[ "Creates", "short", "description", "of", "an", "exception", "used", "for", "logging" ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ExceptionHandler.php#L563-L569
27,431
n2n/n2n
src/app/n2n/core/err/ExceptionHandler.php
ExceptionHandler.dispatchException
private function dispatchException(\Throwable $t) { array_unshift($this->dispatchingThrowables, $t); $numDispatchingThrowables = sizeof($this->dispatchingThrowables); if (!N2N::isInitialized() || 2 < $numDispatchingThrowables || (2 == $numDispatchingThrowables && !($this->dispatchingThrowables[1] ins...
php
private function dispatchException(\Throwable $t) { array_unshift($this->dispatchingThrowables, $t); $numDispatchingThrowables = sizeof($this->dispatchingThrowables); if (!N2N::isInitialized() || 2 < $numDispatchingThrowables || (2 == $numDispatchingThrowables && !($this->dispatchingThrowables[1] ins...
[ "private", "function", "dispatchException", "(", "\\", "Throwable", "$", "t", ")", "{", "array_unshift", "(", "$", "this", "->", "dispatchingThrowables", ",", "$", "t", ")", ";", "$", "numDispatchingThrowables", "=", "sizeof", "(", "$", "this", "->", "dispat...
Decides what exception infos should be rendered. @param \Throwable $t
[ "Decides", "what", "exception", "infos", "should", "be", "rendered", "." ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ExceptionHandler.php#L665-L690
27,432
n2n/n2n
src/app/n2n/core/err/ExceptionHandler.php
ExceptionHandler.renderFatalExceptionsHtmlInfo
private function renderFatalExceptionsHtmlInfo(array $exceptions) { if ($this->httpFatalExceptionSent) return; if (!$this->isObActive()) { $this->httpFatalExceptionSent = true; } $output = $this->fetchObDirty(); if (!headers_sent()) { header('Content-Type: text/html; charset=utf-8'); header...
php
private function renderFatalExceptionsHtmlInfo(array $exceptions) { if ($this->httpFatalExceptionSent) return; if (!$this->isObActive()) { $this->httpFatalExceptionSent = true; } $output = $this->fetchObDirty(); if (!headers_sent()) { header('Content-Type: text/html; charset=utf-8'); header...
[ "private", "function", "renderFatalExceptionsHtmlInfo", "(", "array", "$", "exceptions", ")", "{", "if", "(", "$", "this", "->", "httpFatalExceptionSent", ")", "return", ";", "if", "(", "!", "$", "this", "->", "isObActive", "(", ")", ")", "{", "$", "this",...
prints fatal exception infos in html @param array $exceptions
[ "prints", "fatal", "exception", "infos", "in", "html" ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ExceptionHandler.php#L696-L738
27,433
n2n/n2n
src/app/n2n/core/err/ExceptionHandler.php
ExceptionHandler.renderBeautifulExceptionView
private function renderBeautifulExceptionView(\Throwable $e) { $request = N2N::getCurrentRequest(); $response = N2N::getCurrentResponse(); $status = null; $viewName = null; if ($e instanceof StatusException) { $status = $e->getStatus(); } else { $status = Response::STATUS_500_INTERNAL_SERVER_E...
php
private function renderBeautifulExceptionView(\Throwable $e) { $request = N2N::getCurrentRequest(); $response = N2N::getCurrentResponse(); $status = null; $viewName = null; if ($e instanceof StatusException) { $status = $e->getStatus(); } else { $status = Response::STATUS_500_INTERNAL_SERVER_E...
[ "private", "function", "renderBeautifulExceptionView", "(", "\\", "Throwable", "$", "e", ")", "{", "$", "request", "=", "N2N", "::", "getCurrentRequest", "(", ")", ";", "$", "response", "=", "N2N", "::", "getCurrentResponse", "(", ")", ";", "$", "status", ...
Sends a nice detailed view to the Response @param \Exception $e
[ "Sends", "a", "nice", "detailed", "view", "to", "the", "Response" ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ExceptionHandler.php#L756-L804
27,434
n2n/n2n
src/app/n2n/core/err/ExceptionHandler.php
ExceptionHandler.buildDevelopmentExceptionHtmlContent
private function buildDevelopmentExceptionHtmlContent(\Throwable $e) { $html = ''; $first = true; do { if ($first) $first = false; else { $html .= '<h3>caused by: ' . htmlspecialchars(get_class($e), ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE) . '</h3>' . "\r\n"; } $html .= '<p>' . htmlsp...
php
private function buildDevelopmentExceptionHtmlContent(\Throwable $e) { $html = ''; $first = true; do { if ($first) $first = false; else { $html .= '<h3>caused by: ' . htmlspecialchars(get_class($e), ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE) . '</h3>' . "\r\n"; } $html .= '<p>' . htmlsp...
[ "private", "function", "buildDevelopmentExceptionHtmlContent", "(", "\\", "Throwable", "$", "e", ")", "{", "$", "html", "=", "''", ";", "$", "first", "=", "true", ";", "do", "{", "if", "(", "$", "first", ")", "$", "first", "=", "false", ";", "else", ...
Create html description of an exception for fatal error view if development is enabled. @param \Exception $e @return string html description
[ "Create", "html", "description", "of", "an", "exception", "for", "fatal", "error", "view", "if", "development", "is", "enabled", "." ]
b3d45f9cccea5ee59592420dc2cacefd0d1c83ae
https://github.com/n2n/n2n/blob/b3d45f9cccea5ee59592420dc2cacefd0d1c83ae/src/app/n2n/core/err/ExceptionHandler.php#L812-L841
27,435
thebuggenie/b2db
src/Table.php
Table.addForeignKeyColumn
protected function addForeignKeyColumn($column, Table $table, $key = null) { $add_table = clone $table; $key = ($key !== null) ? $key : $add_table->getIdColumn(); $foreign_column = $add_table->getColumn($key); switch ($foreign_column['type']) { cas...
php
protected function addForeignKeyColumn($column, Table $table, $key = null) { $add_table = clone $table; $key = ($key !== null) ? $key : $add_table->getIdColumn(); $foreign_column = $add_table->getColumn($key); switch ($foreign_column['type']) { cas...
[ "protected", "function", "addForeignKeyColumn", "(", "$", "column", ",", "Table", "$", "table", ",", "$", "key", "=", "null", ")", "{", "$", "add_table", "=", "clone", "$", "table", ";", "$", "key", "=", "(", "$", "key", "!==", "null", ")", "?", "$...
Adds a foreign table @param string $column @param Table $table @param string $key
[ "Adds", "a", "foreign", "table" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L164-L185
27,436
thebuggenie/b2db
src/Table.php
Table.rawSelectAll
public function rawSelectAll() { $query = new Query($this); $query->generateSelectSQL(true); return Statement::getPreparedStatement($query)->execute(); }
php
public function rawSelectAll() { $query = new Query($this); $query->generateSelectSQL(true); return Statement::getPreparedStatement($query)->execute(); }
[ "public", "function", "rawSelectAll", "(", ")", "{", "$", "query", "=", "new", "Query", "(", "$", "this", ")", ";", "$", "query", "->", "generateSelectSQL", "(", "true", ")", ";", "return", "Statement", "::", "getPreparedStatement", "(", "$", "query", ")...
Selects all records in this table @return Resultset
[ "Selects", "all", "records", "in", "this", "table" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L337-L343
27,437
thebuggenie/b2db
src/Table.php
Table.rawSelectById
public function rawSelectById($id, Query $query = null, $join = 'all') { if (!$id) { return null; } if (!$query instanceof Query) { $query = new Query($this); } $query->where($this->id_column, $id); $query->...
php
public function rawSelectById($id, Query $query = null, $join = 'all') { if (!$id) { return null; } if (!$query instanceof Query) { $query = new Query($this); } $query->where($this->id_column, $id); $query->...
[ "public", "function", "rawSelectById", "(", "$", "id", ",", "Query", "$", "query", "=", "null", ",", "$", "join", "=", "'all'", ")", "{", "if", "(", "!", "$", "id", ")", "{", "return", "null", ";", "}", "if", "(", "!", "$", "query", "instanceof",...
Returns one row from the current table based on a given id @param integer $id @param Query|null $query @param mixed $join @return \b2db\Row|null
[ "Returns", "one", "row", "from", "the", "current", "table", "based", "on", "a", "given", "id" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L360-L372
27,438
thebuggenie/b2db
src/Table.php
Table.selectById
public function selectById($id, Query $query = null, $join = 'all') { if (!$this->hasCachedB2DBObject($id)) { $row = $this->rawSelectById($id, $query, $join); $object = $this->populateFromRow($row); } else { $object = $this->getB2DBCachedOb...
php
public function selectById($id, Query $query = null, $join = 'all') { if (!$this->hasCachedB2DBObject($id)) { $row = $this->rawSelectById($id, $query, $join); $object = $this->populateFromRow($row); } else { $object = $this->getB2DBCachedOb...
[ "public", "function", "selectById", "(", "$", "id", ",", "Query", "$", "query", "=", "null", ",", "$", "join", "=", "'all'", ")", "{", "if", "(", "!", "$", "this", "->", "hasCachedB2DBObject", "(", "$", "id", ")", ")", "{", "$", "row", "=", "$", ...
Select an object by its unique id @param integer $id @param Query $query (optional) Criteria with filters @param mixed $join @return Saveable @throws Exception
[ "Select", "an", "object", "by", "its", "unique", "id" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L384-L393
27,439
thebuggenie/b2db
src/Table.php
Table.rawSelect
public function rawSelect(Query $query, $join = 'all') { if (!$query instanceof Query) { $query = new Query($this); } $query->setupJoinTables($join); $query->generateSelectSQL(); $resultset = Statement::getPreparedStatement($query)->e...
php
public function rawSelect(Query $query, $join = 'all') { if (!$query instanceof Query) { $query = new Query($this); } $query->setupJoinTables($join); $query->generateSelectSQL(); $resultset = Statement::getPreparedStatement($query)->e...
[ "public", "function", "rawSelect", "(", "Query", "$", "query", ",", "$", "join", "=", "'all'", ")", "{", "if", "(", "!", "$", "query", "instanceof", "Query", ")", "{", "$", "query", "=", "new", "Query", "(", "$", "this", ")", ";", "}", "$", "quer...
Selects rows based on given criteria @param Query $query @param string $join @return Resultset
[ "Selects", "rows", "based", "on", "given", "criteria" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L419-L430
27,440
thebuggenie/b2db
src/Table.php
Table.rawSelectOne
public function rawSelectOne(Query $query, $join = 'all') { $query->setTable($this); $query->setupJoinTables($join); $query->setLimit(1); $query->generateSelectSQL(); $resultset = Statement::getPreparedStatement($query)->execute(); $result...
php
public function rawSelectOne(Query $query, $join = 'all') { $query->setTable($this); $query->setupJoinTables($join); $query->setLimit(1); $query->generateSelectSQL(); $resultset = Statement::getPreparedStatement($query)->execute(); $result...
[ "public", "function", "rawSelectOne", "(", "Query", "$", "query", ",", "$", "join", "=", "'all'", ")", "{", "$", "query", "->", "setTable", "(", "$", "this", ")", ";", "$", "query", "->", "setupJoinTables", "(", "$", "join", ")", ";", "$", "query", ...
Selects one row from the table based on the given criteria @param Query $query @param mixed $join @return Row @throws Exception
[ "Selects", "one", "row", "from", "the", "table", "based", "on", "the", "given", "criteria" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L447-L458
27,441
thebuggenie/b2db
src/Table.php
Table.selectOne
public function selectOne(Query $query, $join = 'all') { $row = $this->rawSelectOne($query, $join); return $this->populateFromRow($row); }
php
public function selectOne(Query $query, $join = 'all') { $row = $this->rawSelectOne($query, $join); return $this->populateFromRow($row); }
[ "public", "function", "selectOne", "(", "Query", "$", "query", ",", "$", "join", "=", "'all'", ")", "{", "$", "row", "=", "$", "this", "->", "rawSelectOne", "(", "$", "query", ",", "$", "join", ")", ";", "return", "$", "this", "->", "populateFromRow"...
Selects one object based on the given criteria @param Query $query @param mixed $join @return Saveable
[ "Selects", "one", "object", "based", "on", "the", "given", "criteria" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L468-L472
27,442
thebuggenie/b2db
src/Table.php
Table.rawDelete
public function rawDelete(Query $query) { $query->setTable($this); $query->generateDeleteSQL(); $value = Statement::getPreparedStatement($query)->execute(); $this->clearB2DBCachedObjects(); return $value; }
php
public function rawDelete(Query $query) { $query->setTable($this); $query->generateDeleteSQL(); $value = Statement::getPreparedStatement($query)->execute(); $this->clearB2DBCachedObjects(); return $value; }
[ "public", "function", "rawDelete", "(", "Query", "$", "query", ")", "{", "$", "query", "->", "setTable", "(", "$", "this", ")", ";", "$", "query", "->", "generateDeleteSQL", "(", ")", ";", "$", "value", "=", "Statement", "::", "getPreparedStatement", "("...
Perform an SQL delete @param Query $query @return Resultset
[ "Perform", "an", "SQL", "delete" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L543-L552
27,443
thebuggenie/b2db
src/Table.php
Table.rawDeleteById
public function rawDeleteById($id) { if (!$id) { return null; } $query = new Query($this); $query->where($this->id_column, $id); $query->generateDeleteSQL(); $this->deleteB2DBObjectFromCache($id); return State...
php
public function rawDeleteById($id) { if (!$id) { return null; } $query = new Query($this); $query->where($this->id_column, $id); $query->generateDeleteSQL(); $this->deleteB2DBObjectFromCache($id); return State...
[ "public", "function", "rawDeleteById", "(", "$", "id", ")", "{", "if", "(", "!", "$", "id", ")", "{", "return", "null", ";", "}", "$", "query", "=", "new", "Query", "(", "$", "this", ")", ";", "$", "query", "->", "where", "(", "$", "this", "->"...
Perform an SQL delete by an id @param integer $id @return Resultset|null
[ "Perform", "an", "SQL", "delete", "by", "an", "id" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L561-L574
27,444
thebuggenie/b2db
src/Table.php
Table.create
public function create() { $sql = $this->generateCreateSql(); $query = new RawQuery($sql); try { $this->drop(); return Statement::getPreparedStatement($query)->execute(); } catch (\Exception $e) { throw new Exception...
php
public function create() { $sql = $this->generateCreateSql(); $query = new RawQuery($sql); try { $this->drop(); return Statement::getPreparedStatement($query)->execute(); } catch (\Exception $e) { throw new Exception...
[ "public", "function", "create", "(", ")", "{", "$", "sql", "=", "$", "this", "->", "generateCreateSql", "(", ")", ";", "$", "query", "=", "new", "RawQuery", "(", "$", "sql", ")", ";", "try", "{", "$", "this", "->", "drop", "(", ")", ";", "return"...
creates the table by executing the sql create statement @return Resultset
[ "creates", "the", "table", "by", "executing", "the", "sql", "create", "statement" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L581-L591
27,445
thebuggenie/b2db
src/Table.php
Table.upgrade
public function upgrade(Table $old_table) { $old_columns = $old_table->getColumns(); $new_columns = $this->getColumns(); $added_columns = \array_diff_key($new_columns, $old_columns); $altered_columns = Tools::array_diff_recursive($old_columns, $new_columns); ...
php
public function upgrade(Table $old_table) { $old_columns = $old_table->getColumns(); $new_columns = $this->getColumns(); $added_columns = \array_diff_key($new_columns, $old_columns); $altered_columns = Tools::array_diff_recursive($old_columns, $new_columns); ...
[ "public", "function", "upgrade", "(", "Table", "$", "old_table", ")", "{", "$", "old_columns", "=", "$", "old_table", "->", "getColumns", "(", ")", ";", "$", "new_columns", "=", "$", "this", "->", "getColumns", "(", ")", ";", "$", "added_columns", "=", ...
Perform upgrade for a table, by comparing one table to an old version of the same table @param Table $old_table
[ "Perform", "upgrade", "for", "a", "table", "by", "comparing", "one", "table", "to", "an", "old", "version", "of", "the", "same", "table" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Table.php#L912-L950
27,446
thebuggenie/b2db
src/Cache.php
Cache.set
public function set($key, $value) { if (!$this->enabled) { return false; } switch ($this->type) { case self::TYPE_APC: apc_store($key, $value); break; case self::TYPE_FILE: ...
php
public function set($key, $value) { if (!$this->enabled) { return false; } switch ($this->type) { case self::TYPE_APC: apc_store($key, $value); break; case self::TYPE_FILE: ...
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "!", "$", "this", "->", "enabled", ")", "{", "return", "false", ";", "}", "switch", "(", "$", "this", "->", "type", ")", "{", "case", "self", "::", "TYPE_APC", ...
Store an item in the cache @param string $key The cache key to store the item under @param mixed $value The value to store @return bool
[ "Store", "an", "item", "in", "the", "cache" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Cache.php#L131-L149
27,447
thebuggenie/b2db
src/Cache.php
Cache.delete
public function delete($key) { if (!$this->enabled) return; switch ($this->type) { case self::TYPE_APC: apc_delete($key); break; case self::TYPE_FILE: $filename = $this->path . $key . '.cache'; ...
php
public function delete($key) { if (!$this->enabled) return; switch ($this->type) { case self::TYPE_APC: apc_delete($key); break; case self::TYPE_FILE: $filename = $this->path . $key . '.cache'; ...
[ "public", "function", "delete", "(", "$", "key", ")", "{", "if", "(", "!", "$", "this", "->", "enabled", ")", "return", ";", "switch", "(", "$", "this", "->", "type", ")", "{", "case", "self", "::", "TYPE_APC", ":", "apc_delete", "(", "$", "key", ...
Delete an entry from the cache @param string $key The cache key to delete
[ "Delete", "an", "entry", "from", "the", "cache" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Cache.php#L156-L168
27,448
thebuggenie/b2db
src/Cache.php
Cache.flush
public function flush() { if (!$this->enabled) return; switch ($this->type) { case self::TYPE_FILE: $iterator = new \DirectoryIterator($this->path); foreach ($iterator as $file_info) { if...
php
public function flush() { if (!$this->enabled) return; switch ($this->type) { case self::TYPE_FILE: $iterator = new \DirectoryIterator($this->path); foreach ($iterator as $file_info) { if...
[ "public", "function", "flush", "(", ")", "{", "if", "(", "!", "$", "this", "->", "enabled", ")", "return", ";", "switch", "(", "$", "this", "->", "type", ")", "{", "case", "self", "::", "TYPE_FILE", ":", "$", "iterator", "=", "new", "\\", "Director...
Flush all entries in the cache
[ "Flush", "all", "entries", "in", "the", "cache" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Cache.php#L199-L214
27,449
thebuggenie/b2db
src/Resultset.php
Resultset.getCurrentRow
public function getCurrentRow() { if (isset($this->rows[($this->int_ptr - 1)])) { return $this->rows[($this->int_ptr - 1)]; } return null; }
php
public function getCurrentRow() { if (isset($this->rows[($this->int_ptr - 1)])) { return $this->rows[($this->int_ptr - 1)]; } return null; }
[ "public", "function", "getCurrentRow", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "rows", "[", "(", "$", "this", "->", "int_ptr", "-", "1", ")", "]", ")", ")", "{", "return", "$", "this", "->", "rows", "[", "(", "$", "this", "->...
Returns the current row @return Row
[ "Returns", "the", "current", "row" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Resultset.php#L94-L100
27,450
thebuggenie/b2db
src/Resultset.php
Resultset.getNextRow
public function getNextRow() { if ($this->_next()) { $row = $this->getCurrentRow(); if ($row instanceof Row) { return $row; } throw new \Exception('This should never happen. Please file a bug report'); } ...
php
public function getNextRow() { if ($this->_next()) { $row = $this->getCurrentRow(); if ($row instanceof Row) { return $row; } throw new \Exception('This should never happen. Please file a bug report'); } ...
[ "public", "function", "getNextRow", "(", ")", "{", "if", "(", "$", "this", "->", "_next", "(", ")", ")", "{", "$", "row", "=", "$", "this", "->", "getCurrentRow", "(", ")", ";", "if", "(", "$", "row", "instanceof", "Row", ")", "{", "return", "$",...
Advances through the resultset and returns the current row Returns false when there are no more rows @return Row|false
[ "Advances", "through", "the", "resultset", "and", "returns", "the", "current", "row", "Returns", "false", "when", "there", "are", "no", "more", "rows" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Resultset.php#L108-L119
27,451
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.addValue
protected function addValue($value, $force_null = false) { if (is_array($value)) { foreach ($value as $single_value) { $this->addValue($single_value); } } else { if ($value !== null || $force_null) { ...
php
protected function addValue($value, $force_null = false) { if (is_array($value)) { foreach ($value as $single_value) { $this->addValue($single_value); } } else { if ($value !== null || $force_null) { ...
[ "protected", "function", "addValue", "(", "$", "value", ",", "$", "force_null", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "foreach", "(", "$", "value", "as", "$", "single_value", ")", "{", "$", "this", "->", "...
Add a specified value @param mixed $value @param bool $force_null
[ "Add", "a", "specified", "value" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L48-L59
27,452
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.generateWhereSQL
protected function generateWhereSQL($strip = false) { $sql = $this->generateWherePartSql($strip); $sql .= $this->generateGroupPartSql(); $sql .= $this->generateOrderByPartSql(); if ($this->query->isSelect()) { if ($this->query->hasLimit()) { ...
php
protected function generateWhereSQL($strip = false) { $sql = $this->generateWherePartSql($strip); $sql .= $this->generateGroupPartSql(); $sql .= $this->generateOrderByPartSql(); if ($this->query->isSelect()) { if ($this->query->hasLimit()) { ...
[ "protected", "function", "generateWhereSQL", "(", "$", "strip", "=", "false", ")", "{", "$", "sql", "=", "$", "this", "->", "generateWherePartSql", "(", "$", "strip", ")", ";", "$", "sql", ".=", "$", "this", "->", "generateGroupPartSql", "(", ")", ";", ...
Generate the "where" part of the query @param bool $strip @return string
[ "Generate", "the", "where", "part", "of", "the", "query" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L159-L174
27,453
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.generateJoinSQL
protected function generateJoinSQL() { $sql = ' FROM ' . $this->getTable()->getSelectFromSql(); foreach ($this->query->getJoins() as $join) { $sql .= ' ' . $join->getJoinType() . ' ' . $join->getTable()->getSelectFromSql(); $sql .= ' ON (' . Query::quoteId...
php
protected function generateJoinSQL() { $sql = ' FROM ' . $this->getTable()->getSelectFromSql(); foreach ($this->query->getJoins() as $join) { $sql .= ' ' . $join->getJoinType() . ' ' . $join->getTable()->getSelectFromSql(); $sql .= ' ON (' . Query::quoteId...
[ "protected", "function", "generateJoinSQL", "(", ")", "{", "$", "sql", "=", "' FROM '", ".", "$", "this", "->", "getTable", "(", ")", "->", "getSelectFromSql", "(", ")", ";", "foreach", "(", "$", "this", "->", "query", "->", "getJoins", "(", ")", "as",...
Generate the "join" part of the sql @return string
[ "Generate", "the", "join", "part", "of", "the", "sql" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L181-L206
27,454
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.addAllSelectColumns
protected function addAllSelectColumns() { foreach ($this->getTable()->getAliasColumns() as $column) { $this->query->addSelectionColumnRaw($column); } foreach ($this->query->getJoins() as $join) { foreach ($join->getTable()->getAliasColumns() ...
php
protected function addAllSelectColumns() { foreach ($this->getTable()->getAliasColumns() as $column) { $this->query->addSelectionColumnRaw($column); } foreach ($this->query->getJoins() as $join) { foreach ($join->getTable()->getAliasColumns() ...
[ "protected", "function", "addAllSelectColumns", "(", ")", "{", "foreach", "(", "$", "this", "->", "getTable", "(", ")", "->", "getAliasColumns", "(", ")", "as", "$", "column", ")", "{", "$", "this", "->", "query", "->", "addSelectionColumnRaw", "(", "$", ...
Adds all select columns from all available tables in the query
[ "Adds", "all", "select", "columns", "from", "all", "available", "tables", "in", "the", "query" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L211-L222
27,455
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.generateSelectAllSQL
protected function generateSelectAllSQL() { $sql_parts = []; foreach ($this->query->getSelectionColumns() as $selection) { $sql_parts[] = $selection->getSql(); } return implode(', ', $sql_parts); }
php
protected function generateSelectAllSQL() { $sql_parts = []; foreach ($this->query->getSelectionColumns() as $selection) { $sql_parts[] = $selection->getSql(); } return implode(', ', $sql_parts); }
[ "protected", "function", "generateSelectAllSQL", "(", ")", "{", "$", "sql_parts", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "query", "->", "getSelectionColumns", "(", ")", "as", "$", "selection", ")", "{", "$", "sql_parts", "[", "]", "=", ...
Generates "select all" SQL @return string
[ "Generates", "select", "all", "SQL" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L229-L236
27,456
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.generateSelectSQL
protected function generateSelectSQL() { $sql = ($this->query->isDistinct()) ? 'SELECT DISTINCT ' : 'SELECT '; if ($this->query->isCustomSelection()) { if ($this->query->isDistinct() && Core::getDriver() == Core::DRIVER_POSTGRES) { foreach ($this->que...
php
protected function generateSelectSQL() { $sql = ($this->query->isDistinct()) ? 'SELECT DISTINCT ' : 'SELECT '; if ($this->query->isCustomSelection()) { if ($this->query->isDistinct() && Core::getDriver() == Core::DRIVER_POSTGRES) { foreach ($this->que...
[ "protected", "function", "generateSelectSQL", "(", ")", "{", "$", "sql", "=", "(", "$", "this", "->", "query", "->", "isDistinct", "(", ")", ")", "?", "'SELECT DISTINCT '", ":", "'SELECT '", ";", "if", "(", "$", "this", "->", "query", "->", "isCustomSele...
Generate the "select" part of the query @return string
[ "Generate", "the", "select", "part", "of", "the", "query" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L243-L277
27,457
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.getSelectSQL
public function getSelectSQL($all = false) { if (!$this->query->getTable() instanceof Table) { throw new Exception('Trying to generate sql when no table is being used.'); } $sql = $this->generateSelectSQL(); $sql .= $this->generateJoinSQL(); ...
php
public function getSelectSQL($all = false) { if (!$this->query->getTable() instanceof Table) { throw new Exception('Trying to generate sql when no table is being used.'); } $sql = $this->generateSelectSQL(); $sql .= $this->generateJoinSQL(); ...
[ "public", "function", "getSelectSQL", "(", "$", "all", "=", "false", ")", "{", "if", "(", "!", "$", "this", "->", "query", "->", "getTable", "(", ")", "instanceof", "Table", ")", "{", "throw", "new", "Exception", "(", "'Trying to generate sql when no table i...
Generate a "select" query @param boolean $all [optional] @return string
[ "Generate", "a", "select", "query" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L285-L297
27,458
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.generateCountSQL
protected function generateCountSQL() { $sql = ($this->query->isDistinct()) ? 'SELECT COUNT(DISTINCT ' : 'SELECT COUNT('; $sql .= Query::quoteIdentifier($this->query->getSelectionColumn($this->getTable()->getIdColumn())); $sql .= ') as num_col'; return $sql; ...
php
protected function generateCountSQL() { $sql = ($this->query->isDistinct()) ? 'SELECT COUNT(DISTINCT ' : 'SELECT COUNT('; $sql .= Query::quoteIdentifier($this->query->getSelectionColumn($this->getTable()->getIdColumn())); $sql .= ') as num_col'; return $sql; ...
[ "protected", "function", "generateCountSQL", "(", ")", "{", "$", "sql", "=", "(", "$", "this", "->", "query", "->", "isDistinct", "(", ")", ")", "?", "'SELECT COUNT(DISTINCT '", ":", "'SELECT COUNT('", ";", "$", "sql", ".=", "Query", "::", "quoteIdentifier",...
Generate the "count" part of the query @return string
[ "Generate", "the", "count", "part", "of", "the", "query" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L304-L311
27,459
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.getCountSQL
public function getCountSQL() { if (!$this->query->getTable() instanceof Table) { throw new Exception('Trying to generate sql when no table is being used.'); } $sql = $this->generateCountSQL(); $sql .= $this->generateJoinSQL(); $sql .= ...
php
public function getCountSQL() { if (!$this->query->getTable() instanceof Table) { throw new Exception('Trying to generate sql when no table is being used.'); } $sql = $this->generateCountSQL(); $sql .= $this->generateJoinSQL(); $sql .= ...
[ "public", "function", "getCountSQL", "(", ")", "{", "if", "(", "!", "$", "this", "->", "query", "->", "getTable", "(", ")", "instanceof", "Table", ")", "{", "throw", "new", "Exception", "(", "'Trying to generate sql when no table is being used.'", ")", ";", "}...
Generate a "count" query @return string
[ "Generate", "a", "count", "query" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L318-L328
27,460
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.generateUpdateSQL
protected function generateUpdateSQL(Update $update) { $updates = []; foreach ($update->getValues() as $column => $value) { $column = mb_substr($column, mb_strpos($column, '.') + 1); $prefix = Query::quoteIdentifier($column); $updates[] = $...
php
protected function generateUpdateSQL(Update $update) { $updates = []; foreach ($update->getValues() as $column => $value) { $column = mb_substr($column, mb_strpos($column, '.') + 1); $prefix = Query::quoteIdentifier($column); $updates[] = $...
[ "protected", "function", "generateUpdateSQL", "(", "Update", "$", "update", ")", "{", "$", "updates", "=", "[", "]", ";", "foreach", "(", "$", "update", "->", "getValues", "(", ")", "as", "$", "column", "=>", "$", "value", ")", "{", "$", "column", "=...
Generate the "update" part of the query @param Update $update @return string
[ "Generate", "the", "update", "part", "of", "the", "query" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L336-L348
27,461
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.getUpdateSQL
public function getUpdateSQL(Update $update) { if (!$this->query->getTable() instanceof Table) { throw new Exception('Trying to generate sql when no table is being used.'); } $sql = $this->generateUpdateSQL($update); $sql .= $this->generateWhereSQL...
php
public function getUpdateSQL(Update $update) { if (!$this->query->getTable() instanceof Table) { throw new Exception('Trying to generate sql when no table is being used.'); } $sql = $this->generateUpdateSQL($update); $sql .= $this->generateWhereSQL...
[ "public", "function", "getUpdateSQL", "(", "Update", "$", "update", ")", "{", "if", "(", "!", "$", "this", "->", "query", "->", "getTable", "(", ")", "instanceof", "Table", ")", "{", "throw", "new", "Exception", "(", "'Trying to generate sql when no table is b...
Generate an "update" query @param Update $update @return string @throws Exception
[ "Generate", "an", "update", "query" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L357-L366
27,462
thebuggenie/b2db
src/SqlGenerator.php
SqlGenerator.getDeleteSQL
public function getDeleteSQL() { if (!$this->query->getTable() instanceof Table) { throw new Exception('Trying to generate sql when no table is being used.'); } $sql = 'DELETE FROM ' . $this->getTable()->getSqlTableName(); $sql .= $this->generateWh...
php
public function getDeleteSQL() { if (!$this->query->getTable() instanceof Table) { throw new Exception('Trying to generate sql when no table is being used.'); } $sql = 'DELETE FROM ' . $this->getTable()->getSqlTableName(); $sql .= $this->generateWh...
[ "public", "function", "getDeleteSQL", "(", ")", "{", "if", "(", "!", "$", "this", "->", "query", "->", "getTable", "(", ")", "instanceof", "Table", ")", "{", "throw", "new", "Exception", "(", "'Trying to generate sql when no table is being used.'", ")", ";", "...
Generate a "delete" query @return string
[ "Generate", "a", "delete", "query" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/SqlGenerator.php#L410-L419
27,463
thebuggenie/b2db
src/Query.php
Query.setTable
public function setTable(Table $table, $setup_join_tables = false): self { $this->table = $table; if ($setup_join_tables) { $this->setupJoinTables(); } return $this; }
php
public function setTable(Table $table, $setup_join_tables = false): self { $this->table = $table; if ($setup_join_tables) { $this->setupJoinTables(); } return $this; }
[ "public", "function", "setTable", "(", "Table", "$", "table", ",", "$", "setup_join_tables", "=", "false", ")", ":", "self", "{", "$", "this", "->", "table", "=", "$", "table", ";", "if", "(", "$", "setup_join_tables", ")", "{", "$", "this", "->", "s...
Set the "from" table @param Table $table The table @param bool $setup_join_tables [optional] Whether to automatically join other tables @return Query
[ "Set", "the", "from", "table" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Query.php#L116-L125
27,464
thebuggenie/b2db
src/Query.php
Query.addValue
public function addValue($value) { if (is_array($value)) { foreach ($value as $single_value) { $this->addValue($single_value); } } else { if ($value !== null) { $this->values[] = $this->getDatabaseVal...
php
public function addValue($value) { if (is_array($value)) { foreach ($value as $single_value) { $this->addValue($single_value); } } else { if ($value !== null) { $this->values[] = $this->getDatabaseVal...
[ "public", "function", "addValue", "(", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "foreach", "(", "$", "value", "as", "$", "single_value", ")", "{", "$", "this", "->", "addValue", "(", "$", "single_value", ")", ...
Add a value to the value container @param mixed $value
[ "Add", "a", "value", "to", "the", "value", "container" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Query.php#L204-L215
27,465
thebuggenie/b2db
src/Query.php
Query.addSelectionColumn
public function addSelectionColumn($column, $alias = '', $special = '', $variable = '', $additional = ''): self { if (!$this->table instanceof Table) { throw new \Exception('You must set the from-table before adding selection columns'); } $column = $this->get...
php
public function addSelectionColumn($column, $alias = '', $special = '', $variable = '', $additional = ''): self { if (!$this->table instanceof Table) { throw new \Exception('You must set the from-table before adding selection columns'); } $column = $this->get...
[ "public", "function", "addSelectionColumn", "(", "$", "column", ",", "$", "alias", "=", "''", ",", "$", "special", "=", "''", ",", "$", "variable", "=", "''", ",", "$", "additional", "=", "''", ")", ":", "self", "{", "if", "(", "!", "$", "this", ...
Add a column to select @param string $column The column @param string $alias [optional] An alias for the column @param string $special [optional] Whether to use a special method on the column @param string $variable [optional] An optional variable to assign it to @param string $additional [optional] Additional paramet...
[ "Add", "a", "column", "to", "select" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Query.php#L228-L241
27,466
thebuggenie/b2db
src/Query.php
Query.update
public function update($column, $value): self { if (is_object($value)) { throw new Exception("Invalid value, can't be an object."); } $this->updates[] = compact('column', 'value'); return $this; }
php
public function update($column, $value): self { if (is_object($value)) { throw new Exception("Invalid value, can't be an object."); } $this->updates[] = compact('column', 'value'); return $this; }
[ "public", "function", "update", "(", "$", "column", ",", "$", "value", ")", ":", "self", "{", "if", "(", "is_object", "(", "$", "value", ")", ")", "{", "throw", "new", "Exception", "(", "\"Invalid value, can't be an object.\"", ")", ";", "}", "$", "this"...
Add a field to update @param string $column The column name @param mixed $value The value to update @return Query
[ "Add", "a", "field", "to", "update" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Query.php#L261-L269
27,467
thebuggenie/b2db
src/Query.php
Query.join
public function join(Table $table, $joined_table_column, $column, $criteria = [], $join_type = Join::LEFT, $on_table = null) { if (!$this->table instanceof Table) { throw new Exception('Cannot use ' . $this->table . ' as a table. You need to call setTable() before trying to join a ne...
php
public function join(Table $table, $joined_table_column, $column, $criteria = [], $join_type = Join::LEFT, $on_table = null) { if (!$this->table instanceof Table) { throw new Exception('Cannot use ' . $this->table . ' as a table. You need to call setTable() before trying to join a ne...
[ "public", "function", "join", "(", "Table", "$", "table", ",", "$", "joined_table_column", ",", "$", "column", ",", "$", "criteria", "=", "[", "]", ",", "$", "join_type", "=", "Join", "::", "LEFT", ",", "$", "on_table", "=", "null", ")", "{", "if", ...
Join one table on another @param Table $table The table to join @param string $joined_table_column The left matching column @param string $column The right matching column @param Criteria[] $criteria An array of criteria (ex: array(array(DB_FLD_ISSUE_ID, 1), array(DB_FLD_ISSUE_STATE, 1)); @param string $join_type Type...
[ "Join", "one", "table", "on", "another" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Query.php#L359-L383
27,468
thebuggenie/b2db
src/Query.php
Query.getSelectionColumn
public function getSelectionColumn($column) { if (isset($this->selections[$column])) { return $this->selections[$column]->getColumn(); } foreach ($this->selections as $selection) { if ($selection->getAlias() == $column) { r...
php
public function getSelectionColumn($column) { if (isset($this->selections[$column])) { return $this->selections[$column]->getColumn(); } foreach ($this->selections as $selection) { if ($selection->getAlias() == $column) { r...
[ "public", "function", "getSelectionColumn", "(", "$", "column", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "selections", "[", "$", "column", "]", ")", ")", "{", "return", "$", "this", "->", "selections", "[", "$", "column", "]", "->", "get...
Return a select column @param string $column @return string
[ "Return", "a", "select", "column" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Query.php#L470-L497
27,469
thebuggenie/b2db
src/Query.php
Query.getSelectionAlias
public function getSelectionAlias($column) { if (!is_numeric($column) && !is_string($column)) { if (is_array($column) && array_key_exists('column', $column)) { $column = $column['column']; } else { throw new Exception('Invalid c...
php
public function getSelectionAlias($column) { if (!is_numeric($column) && !is_string($column)) { if (is_array($column) && array_key_exists('column', $column)) { $column = $column['column']; } else { throw new Exception('Invalid c...
[ "public", "function", "getSelectionAlias", "(", "$", "column", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "column", ")", "&&", "!", "is_string", "(", "$", "column", ")", ")", "{", "if", "(", "is_array", "(", "$", "column", ")", "&&", "array_ke...
Get the selection alias for a specified column @param string $column @return string
[ "Get", "the", "selection", "alias", "for", "a", "specified", "column" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Query.php#L506-L520
27,470
thebuggenie/b2db
src/Query.php
Query.addOrderBy
public function addOrderBy($column, $sort = null) { if (is_array($column)) { foreach ($column as $single_column) { $this->addOrderBy($single_column[0], $single_column[1]); } } else { $this->sort_orders[] = new QueryColum...
php
public function addOrderBy($column, $sort = null) { if (is_array($column)) { foreach ($column as $single_column) { $this->addOrderBy($single_column[0], $single_column[1]); } } else { $this->sort_orders[] = new QueryColum...
[ "public", "function", "addOrderBy", "(", "$", "column", ",", "$", "sort", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "column", ")", ")", "{", "foreach", "(", "$", "column", "as", "$", "single_column", ")", "{", "$", "this", "->", "addO...
Add an order by clause @param string|array $column The column to order by @param string $sort [optional] The sort order @return Query
[ "Add", "an", "order", "by", "clause" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Query.php#L530-L541
27,471
thebuggenie/b2db
src/Query.php
Query.addGroupBy
public function addGroupBy($column, $sort = null) { if (is_array($column)) { foreach ($column as $single_column) { $this->addGroupBy($single_column[0], $single_column[1]); } } else { $this->sort_groups[] = new QueryColum...
php
public function addGroupBy($column, $sort = null) { if (is_array($column)) { foreach ($column as $single_column) { $this->addGroupBy($single_column[0], $single_column[1]); } } else { $this->sort_groups[] = new QueryColum...
[ "public", "function", "addGroupBy", "(", "$", "column", ",", "$", "sort", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "column", ")", ")", "{", "foreach", "(", "$", "column", "as", "$", "single_column", ")", "{", "$", "this", "->", "addG...
Add a group by clause @param string|array $column The column to group by @param string $sort [optional] The sort order @return Query
[ "Add", "a", "group", "by", "clause" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Query.php#L588-L599
27,472
thebuggenie/b2db
src/Query.php
Query.setupJoinTables
public function setupJoinTables($join = 'all') { if (is_array($join)) { foreach ($join as $join_column) { $foreign_table = $this->table->getForeignTableByLocalColumn($join_column); $this->join($foreign_table->getTable(), $foreign_table->getKeyC...
php
public function setupJoinTables($join = 'all') { if (is_array($join)) { foreach ($join as $join_column) { $foreign_table = $this->table->getForeignTableByLocalColumn($join_column); $this->join($foreign_table->getTable(), $foreign_table->getKeyC...
[ "public", "function", "setupJoinTables", "(", "$", "join", "=", "'all'", ")", "{", "if", "(", "is_array", "(", "$", "join", ")", ")", "{", "foreach", "(", "$", "join", "as", "$", "join_column", ")", "{", "$", "foreign_table", "=", "$", "this", "->", ...
Add all available foreign tables @param array|string|bool $join [optional]
[ "Add", "all", "available", "foreign", "tables" ]
8501d737cd824ff961659e059cd920dc0ebd17cf
https://github.com/thebuggenie/b2db/blob/8501d737cd824ff961659e059cd920dc0ebd17cf/src/Query.php#L742-L754
27,473
contributte/utils
src/FileSystem.php
FileSystem.copy
public static function copy(string $source, string $dest, bool $overwrite = true): void { NetteFileSystem::copy($source, $dest, $overwrite); }
php
public static function copy(string $source, string $dest, bool $overwrite = true): void { NetteFileSystem::copy($source, $dest, $overwrite); }
[ "public", "static", "function", "copy", "(", "string", "$", "source", ",", "string", "$", "dest", ",", "bool", "$", "overwrite", "=", "true", ")", ":", "void", "{", "NetteFileSystem", "::", "copy", "(", "$", "source", ",", "$", "dest", ",", "$", "ove...
Copies a file or directory. @throws IOException
[ "Copies", "a", "file", "or", "directory", "." ]
3afb4010ee60fd01307850c13000b1918dc90859
https://github.com/contributte/utils/blob/3afb4010ee60fd01307850c13000b1918dc90859/src/FileSystem.php#L74-L77
27,474
contributte/utils
src/Http.php
Http.metadata
public static function metadata(string $content): array { if (preg_match_all(self::$metadataPattern, $content, $matches) !== false) { $combine = array_combine($matches[1], $matches[2]); if ($combine === false) { throw new LogicException('Matches count is not equal.'); } return $combine; } retu...
php
public static function metadata(string $content): array { if (preg_match_all(self::$metadataPattern, $content, $matches) !== false) { $combine = array_combine($matches[1], $matches[2]); if ($combine === false) { throw new LogicException('Matches count is not equal.'); } return $combine; } retu...
[ "public", "static", "function", "metadata", "(", "string", "$", "content", ")", ":", "array", "{", "if", "(", "preg_match_all", "(", "self", "::", "$", "metadataPattern", ",", "$", "content", ",", "$", "matches", ")", "!==", "false", ")", "{", "$", "co...
Gets http metadata from string @return string[] [name => content]
[ "Gets", "http", "metadata", "from", "string" ]
3afb4010ee60fd01307850c13000b1918dc90859
https://github.com/contributte/utils/blob/3afb4010ee60fd01307850c13000b1918dc90859/src/Http.php#L37-L50
27,475
GiacoCorsiglia/php-stubs-generator
src/NodeVisitor.php
NodeVisitor.getStubStmts
public function getStubStmts(): array { foreach ($this->classLikes as $classLike) { $this->resolveClassLike($classLike); } if ($this->allAreGlobal($this->namespaces) && $this->allAreGlobal($this->classLikeNamespaces)) { return array_merge( $this->redu...
php
public function getStubStmts(): array { foreach ($this->classLikes as $classLike) { $this->resolveClassLike($classLike); } if ($this->allAreGlobal($this->namespaces) && $this->allAreGlobal($this->classLikeNamespaces)) { return array_merge( $this->redu...
[ "public", "function", "getStubStmts", "(", ")", ":", "array", "{", "foreach", "(", "$", "this", "->", "classLikes", "as", "$", "classLike", ")", "{", "$", "this", "->", "resolveClassLike", "(", "$", "classLike", ")", ";", "}", "if", "(", "$", "this", ...
Returns the stored set of stub nodes which are built up during traversal. @return Node[]
[ "Returns", "the", "stored", "set", "of", "stub", "nodes", "which", "are", "built", "up", "during", "traversal", "." ]
c5796427ebc8052c6c662e5101e8250ed5f295fe
https://github.com/GiacoCorsiglia/php-stubs-generator/blob/c5796427ebc8052c6c662e5101e8250ed5f295fe/src/NodeVisitor.php#L263-L284
27,476
GiacoCorsiglia/php-stubs-generator
src/NodeVisitor.php
NodeVisitor.count
private function count(string $type, string $name = null): bool { assert(isset($this->counts[$type]), 'Expected valid `$type`'); if (!$name) { return false; } return ($this->counts[$type][$name] = ($this->counts[$type][$name] ?? 0) + 1) === 1; }
php
private function count(string $type, string $name = null): bool { assert(isset($this->counts[$type]), 'Expected valid `$type`'); if (!$name) { return false; } return ($this->counts[$type][$name] = ($this->counts[$type][$name] ?? 0) + 1) === 1; }
[ "private", "function", "count", "(", "string", "$", "type", ",", "string", "$", "name", "=", "null", ")", ":", "bool", "{", "assert", "(", "isset", "(", "$", "this", "->", "counts", "[", "$", "type", "]", ")", ",", "'Expected valid `$type`'", ")", ";...
Keeps a count of declarations by type and name of node. @param string $type One of `array_keys($this->counts)`. @param string|null $name Name of the node. Theoretically could be null. @return bool If true, this is the first declaration of this type with this name, so it can be safely included.
[ "Keeps", "a", "count", "of", "declarations", "by", "type", "and", "name", "of", "node", "." ]
c5796427ebc8052c6c662e5101e8250ed5f295fe
https://github.com/GiacoCorsiglia/php-stubs-generator/blob/c5796427ebc8052c6c662e5101e8250ed5f295fe/src/NodeVisitor.php#L364-L373
27,477
GiacoCorsiglia/php-stubs-generator
src/NodeVisitor.php
NodeVisitor.resolveClassLike
private function resolveClassLike(ClassLikeWithDependencies $clwd): void { if (isset($this->resolvedClassLikes[$clwd->fullyQualifiedName])) { // Already resolved. return; } $this->resolvedClassLikes[$clwd->fullyQualifiedName] = true; foreach ($clwd->dependenc...
php
private function resolveClassLike(ClassLikeWithDependencies $clwd): void { if (isset($this->resolvedClassLikes[$clwd->fullyQualifiedName])) { // Already resolved. return; } $this->resolvedClassLikes[$clwd->fullyQualifiedName] = true; foreach ($clwd->dependenc...
[ "private", "function", "resolveClassLike", "(", "ClassLikeWithDependencies", "$", "clwd", ")", ":", "void", "{", "if", "(", "isset", "(", "$", "this", "->", "resolvedClassLikes", "[", "$", "clwd", "->", "fullyQualifiedName", "]", ")", ")", "{", "// Already res...
Populates the `classLikeNamespaces` property with namespaces with classes declared in a valid order. @param ClassLikeWithDependencies $clwd @return void
[ "Populates", "the", "classLikeNamespaces", "property", "with", "namespaces", "with", "classes", "declared", "in", "a", "valid", "order", "." ]
c5796427ebc8052c6c662e5101e8250ed5f295fe
https://github.com/GiacoCorsiglia/php-stubs-generator/blob/c5796427ebc8052c6c662e5101e8250ed5f295fe/src/NodeVisitor.php#L382-L412
27,478
GiacoCorsiglia/php-stubs-generator
src/NodeVisitor.php
NodeVisitor.allAreGlobal
private function allAreGlobal(array $namespaces): bool { foreach ($namespaces as $namespace) { if ($namespace->name && $namespace->name->toString() !== '') { return false; } } return true; }
php
private function allAreGlobal(array $namespaces): bool { foreach ($namespaces as $namespace) { if ($namespace->name && $namespace->name->toString() !== '') { return false; } } return true; }
[ "private", "function", "allAreGlobal", "(", "array", "$", "namespaces", ")", ":", "bool", "{", "foreach", "(", "$", "namespaces", "as", "$", "namespace", ")", "{", "if", "(", "$", "namespace", "->", "name", "&&", "$", "namespace", "->", "name", "->", "...
Determines if each namespace in the list is a global namespace. @param Namespace_[] $namespaces @return bool
[ "Determines", "if", "each", "namespace", "in", "the", "list", "is", "a", "global", "namespace", "." ]
c5796427ebc8052c6c662e5101e8250ed5f295fe
https://github.com/GiacoCorsiglia/php-stubs-generator/blob/c5796427ebc8052c6c662e5101e8250ed5f295fe/src/NodeVisitor.php#L420-L428
27,479
GiacoCorsiglia/php-stubs-generator
src/NodeVisitor.php
NodeVisitor.reduceStmts
private function reduceStmts(array $namespaces): array { $stmts = []; foreach ($namespaces as $namespace) { foreach ($namespace->stmts as $stmt) { $stmts[] = $stmt; } } return $stmts; }
php
private function reduceStmts(array $namespaces): array { $stmts = []; foreach ($namespaces as $namespace) { foreach ($namespace->stmts as $stmt) { $stmts[] = $stmt; } } return $stmts; }
[ "private", "function", "reduceStmts", "(", "array", "$", "namespaces", ")", ":", "array", "{", "$", "stmts", "=", "[", "]", ";", "foreach", "(", "$", "namespaces", "as", "$", "namespace", ")", "{", "foreach", "(", "$", "namespace", "->", "stmts", "as",...
Merges the statements of each namespace into one array. @param Namespace_[] $namespaces @return Stmt[]
[ "Merges", "the", "statements", "of", "each", "namespace", "into", "one", "array", "." ]
c5796427ebc8052c6c662e5101e8250ed5f295fe
https://github.com/GiacoCorsiglia/php-stubs-generator/blob/c5796427ebc8052c6c662e5101e8250ed5f295fe/src/NodeVisitor.php#L436-L445
27,480
hiqdev/yii2-data-mapper
src/components/EntityManager.php
EntityManager.getRepository
public function getRepository($entityClass) { if (is_object($entityClass)) { $entityClass = get_class($entityClass); } if (!isset($this->repositories[$entityClass])) { throw new \Exception("no repository defined for: $entityClass"); } if (!is_object(...
php
public function getRepository($entityClass) { if (is_object($entityClass)) { $entityClass = get_class($entityClass); } if (!isset($this->repositories[$entityClass])) { throw new \Exception("no repository defined for: $entityClass"); } if (!is_object(...
[ "public", "function", "getRepository", "(", "$", "entityClass", ")", "{", "if", "(", "is_object", "(", "$", "entityClass", ")", ")", "{", "$", "entityClass", "=", "get_class", "(", "$", "entityClass", ")", ";", "}", "if", "(", "!", "isset", "(", "$", ...
Get entity repository by entity or class. @param object|string $entityClass entity or class @return BaseRepository
[ "Get", "entity", "repository", "by", "entity", "or", "class", "." ]
2e39de404b010b2beb527b913ddf3149422ed738
https://github.com/hiqdev/yii2-data-mapper/blob/2e39de404b010b2beb527b913ddf3149422ed738/src/components/EntityManager.php#L75-L90
27,481
contributte/utils
src/DateTime.php
DateTime.setCurrentTime
public function setCurrentTime(): self { return $this->modifyClone()->setTime((int) date('H'), (int) date('i'), (int) date('s')); }
php
public function setCurrentTime(): self { return $this->modifyClone()->setTime((int) date('H'), (int) date('i'), (int) date('s')); }
[ "public", "function", "setCurrentTime", "(", ")", ":", "self", "{", "return", "$", "this", "->", "modifyClone", "(", ")", "->", "setTime", "(", "(", "int", ")", "date", "(", "'H'", ")", ",", "(", "int", ")", "date", "(", "'i'", ")", ",", "(", "in...
Set time to current time
[ "Set", "time", "to", "current", "time" ]
3afb4010ee60fd01307850c13000b1918dc90859
https://github.com/contributte/utils/blob/3afb4010ee60fd01307850c13000b1918dc90859/src/DateTime.php#L37-L40
27,482
contributte/utils
src/DateTime.php
DateTime.setToday
public function setToday(): self { return $this->modifyClone()->setDate((int) date('Y'), (int) date('m'), (int) date('d')); }
php
public function setToday(): self { return $this->modifyClone()->setDate((int) date('Y'), (int) date('m'), (int) date('d')); }
[ "public", "function", "setToday", "(", ")", ":", "self", "{", "return", "$", "this", "->", "modifyClone", "(", ")", "->", "setDate", "(", "(", "int", ")", "date", "(", "'Y'", ")", ",", "(", "int", ")", "date", "(", "'m'", ")", ",", "(", "int", ...
Set date to today
[ "Set", "date", "to", "today" ]
3afb4010ee60fd01307850c13000b1918dc90859
https://github.com/contributte/utils/blob/3afb4010ee60fd01307850c13000b1918dc90859/src/DateTime.php#L69-L72
27,483
TargetLiu/PHPRedis
src/Database.php
Database.createClient
protected function createClient(array $servers) { $clients = []; foreach ($servers as $key => $server) { $clients[$key] = new \Redis(); $clients[$key]->pconnect($server['host'], $server['port'], 0, $key . $server['database']); if (!empty($server['password'])) { ...
php
protected function createClient(array $servers) { $clients = []; foreach ($servers as $key => $server) { $clients[$key] = new \Redis(); $clients[$key]->pconnect($server['host'], $server['port'], 0, $key . $server['database']); if (!empty($server['password'])) { ...
[ "protected", "function", "createClient", "(", "array", "$", "servers", ")", "{", "$", "clients", "=", "[", "]", ";", "foreach", "(", "$", "servers", "as", "$", "key", "=>", "$", "server", ")", "{", "$", "clients", "[", "$", "key", "]", "=", "new", ...
Create an array of connection clients. @param array $servers @param array $options @return array
[ "Create", "an", "array", "of", "connection", "clients", "." ]
5930a9233e603754ff284c35a96575ed1e384af1
https://github.com/TargetLiu/PHPRedis/blob/5930a9233e603754ff284c35a96575ed1e384af1/src/Database.php#L62-L79
27,484
hiqdev/yii2-data-mapper
src/repositories/BaseRepository.php
BaseRepository.findByIds
public function findByIds(array $ids): array { $spec = $this->createSpecification()->where(['id' => $ids]); return $this->findAll($spec); }
php
public function findByIds(array $ids): array { $spec = $this->createSpecification()->where(['id' => $ids]); return $this->findAll($spec); }
[ "public", "function", "findByIds", "(", "array", "$", "ids", ")", ":", "array", "{", "$", "spec", "=", "$", "this", "->", "createSpecification", "(", ")", "->", "where", "(", "[", "'id'", "=>", "$", "ids", "]", ")", ";", "return", "$", "this", "->"...
Selects entities from DB by given IDs. @param string[] $ids @return array
[ "Selects", "entities", "from", "DB", "by", "given", "IDs", "." ]
2e39de404b010b2beb527b913ddf3149422ed738
https://github.com/hiqdev/yii2-data-mapper/blob/2e39de404b010b2beb527b913ddf3149422ed738/src/repositories/BaseRepository.php#L68-L73
27,485
TargetLiu/PHPRedis
src/Queue/PHPRedisQueue.php
PHPRedisQueue.migrateAllExpiredJobs
protected function migrateAllExpiredJobs($queue) { $this->migrateExpiredJobs($queue . ':delayed', $queue); $this->migrateExpiredJobs($queue . ':reserved', $queue); }
php
protected function migrateAllExpiredJobs($queue) { $this->migrateExpiredJobs($queue . ':delayed', $queue); $this->migrateExpiredJobs($queue . ':reserved', $queue); }
[ "protected", "function", "migrateAllExpiredJobs", "(", "$", "queue", ")", "{", "$", "this", "->", "migrateExpiredJobs", "(", "$", "queue", ".", "':delayed'", ",", "$", "queue", ")", ";", "$", "this", "->", "migrateExpiredJobs", "(", "$", "queue", ".", "':r...
Migrate all of the waiting jobs in the queue. @param string $queue @return void
[ "Migrate", "all", "of", "the", "waiting", "jobs", "in", "the", "queue", "." ]
5930a9233e603754ff284c35a96575ed1e384af1
https://github.com/TargetLiu/PHPRedis/blob/5930a9233e603754ff284c35a96575ed1e384af1/src/Queue/PHPRedisQueue.php#L161-L166
27,486
contributte/utils
src/Strings.php
Strings.spaceless
public static function spaceless(string $s) { $s = trim($s); $s = self::replace($s, '#\s#', ''); return $s; }
php
public static function spaceless(string $s) { $s = trim($s); $s = self::replace($s, '#\s#', ''); return $s; }
[ "public", "static", "function", "spaceless", "(", "string", "$", "s", ")", "{", "$", "s", "=", "trim", "(", "$", "s", ")", ";", "$", "s", "=", "self", "::", "replace", "(", "$", "s", ",", "'#\\s#'", ",", "''", ")", ";", "return", "$", "s", ";...
Remove spaces from the beginning and end of a string and between chars @return mixed
[ "Remove", "spaces", "from", "the", "beginning", "and", "end", "of", "a", "string", "and", "between", "chars" ]
3afb4010ee60fd01307850c13000b1918dc90859
https://github.com/contributte/utils/blob/3afb4010ee60fd01307850c13000b1918dc90859/src/Strings.php#L40-L46
27,487
contributte/utils
src/Strings.php
Strings.doublespaceless
public static function doublespaceless(string $s) { $s = trim($s); $s = self::replace($s, '#\s{2,}#', ' '); return $s; }
php
public static function doublespaceless(string $s) { $s = trim($s); $s = self::replace($s, '#\s{2,}#', ' '); return $s; }
[ "public", "static", "function", "doublespaceless", "(", "string", "$", "s", ")", "{", "$", "s", "=", "trim", "(", "$", "s", ")", ";", "$", "s", "=", "self", "::", "replace", "(", "$", "s", ",", "'#\\s{2,}#'", ",", "' '", ")", ";", "return", "$", ...
Remove spaces from the beginning and end of a string and convert double and more spaces between chars to one space @return mixed
[ "Remove", "spaces", "from", "the", "beginning", "and", "end", "of", "a", "string", "and", "convert", "double", "and", "more", "spaces", "between", "chars", "to", "one", "space" ]
3afb4010ee60fd01307850c13000b1918dc90859
https://github.com/contributte/utils/blob/3afb4010ee60fd01307850c13000b1918dc90859/src/Strings.php#L54-L60
27,488
contributte/utils
src/Strings.php
Strings.dashless
public static function dashless(string $s) { $s = trim($s); $s = self::replace($s, '#\-#', ''); return $s; }
php
public static function dashless(string $s) { $s = trim($s); $s = self::replace($s, '#\-#', ''); return $s; }
[ "public", "static", "function", "dashless", "(", "string", "$", "s", ")", "{", "$", "s", "=", "trim", "(", "$", "s", ")", ";", "$", "s", "=", "self", "::", "replace", "(", "$", "s", ",", "'#\\-#'", ",", "''", ")", ";", "return", "$", "s", ";"...
Remove spaces from the beginning and end of a string and remove dashes @return mixed
[ "Remove", "spaces", "from", "the", "beginning", "and", "end", "of", "a", "string", "and", "remove", "dashes" ]
3afb4010ee60fd01307850c13000b1918dc90859
https://github.com/contributte/utils/blob/3afb4010ee60fd01307850c13000b1918dc90859/src/Strings.php#L67-L73
27,489
contributte/utils
src/Strings.php
Strings.slashless
public static function slashless(string $s): string { $s = trim($s); $s = self::replace($s, '#\/{2,}#', '/'); return $s; }
php
public static function slashless(string $s): string { $s = trim($s); $s = self::replace($s, '#\/{2,}#', '/'); return $s; }
[ "public", "static", "function", "slashless", "(", "string", "$", "s", ")", ":", "string", "{", "$", "s", "=", "trim", "(", "$", "s", ")", ";", "$", "s", "=", "self", "::", "replace", "(", "$", "s", ",", "'#\\/{2,}#'", ",", "'/'", ")", ";", "ret...
Remove spaces from the beginning and end of a string and convert double and more slashes between chars to one slash
[ "Remove", "spaces", "from", "the", "beginning", "and", "end", "of", "a", "string", "and", "convert", "double", "and", "more", "slashes", "between", "chars", "to", "one", "slash" ]
3afb4010ee60fd01307850c13000b1918dc90859
https://github.com/contributte/utils/blob/3afb4010ee60fd01307850c13000b1918dc90859/src/Strings.php#L79-L85
27,490
hiqdev/yii2-data-mapper
src/hydrator/ConfigurableAggregateHydrator.php
ConfigurableAggregateHydrator.extractAll
public function extractAll(array $array, int $depth = 1) { $depth--; $res = []; foreach ($array as $key => $object) { $res[$key] = $depth>0 ? $this->extractAll($object, $depth) : $this->extract($object); } return $res; }
php
public function extractAll(array $array, int $depth = 1) { $depth--; $res = []; foreach ($array as $key => $object) { $res[$key] = $depth>0 ? $this->extractAll($object, $depth) : $this->extract($object); } return $res; }
[ "public", "function", "extractAll", "(", "array", "$", "array", ",", "int", "$", "depth", "=", "1", ")", "{", "$", "depth", "--", ";", "$", "res", "=", "[", "]", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "object", ")", "{"...
Extract multiple objects. @param array $array @return array
[ "Extract", "multiple", "objects", "." ]
2e39de404b010b2beb527b913ddf3149422ed738
https://github.com/hiqdev/yii2-data-mapper/blob/2e39de404b010b2beb527b913ddf3149422ed738/src/hydrator/ConfigurableAggregateHydrator.php#L105-L114
27,491
GiacoCorsiglia/php-stubs-generator
src/Result.php
Result.getDuplicates
public function getDuplicates(): array { $dupes = []; foreach ($this->visitor->getCounts() as $type => $names) { foreach ($names as $name => $count) { if ($count > 1) { $dupes[] = [ 'type' => $type, 'name...
php
public function getDuplicates(): array { $dupes = []; foreach ($this->visitor->getCounts() as $type => $names) { foreach ($names as $name => $count) { if ($count > 1) { $dupes[] = [ 'type' => $type, 'name...
[ "public", "function", "getDuplicates", "(", ")", ":", "array", "{", "$", "dupes", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "visitor", "->", "getCounts", "(", ")", "as", "$", "type", "=>", "$", "names", ")", "{", "foreach", "(", "$", ...
Returns a list which includes any symbols for which more than one declaration was found during stub generation. @return (string|int)[][] @psalm-return array<array{ type: string, name: string, count: int }>
[ "Returns", "a", "list", "which", "includes", "any", "symbols", "for", "which", "more", "than", "one", "declaration", "was", "found", "during", "stub", "generation", "." ]
c5796427ebc8052c6c662e5101e8250ed5f295fe
https://github.com/GiacoCorsiglia/php-stubs-generator/blob/c5796427ebc8052c6c662e5101e8250ed5f295fe/src/Result.php#L75-L95
27,492
GiacoCorsiglia/php-stubs-generator
src/Result.php
Result.prettyPrint
public function prettyPrint(PrettyPrinterAbstract $printer = null): string { if (!$printer) { $printer = new Standard(); } return $printer->prettyPrintFile($this->getStubStmts()); }
php
public function prettyPrint(PrettyPrinterAbstract $printer = null): string { if (!$printer) { $printer = new Standard(); } return $printer->prettyPrintFile($this->getStubStmts()); }
[ "public", "function", "prettyPrint", "(", "PrettyPrinterAbstract", "$", "printer", "=", "null", ")", ":", "string", "{", "if", "(", "!", "$", "printer", ")", "{", "$", "printer", "=", "new", "Standard", "(", ")", ";", "}", "return", "$", "printer", "->...
Shortcut to pretty print all the stubs as one file. If no `$printer` is provided, a `\PhpParser\PrettyPrinter\Standard` will be used. @param PrettyPrinterAbstract|null $printer Pretty printer instance. @return string The pretty printed version.
[ "Shortcut", "to", "pretty", "print", "all", "the", "stubs", "as", "one", "file", "." ]
c5796427ebc8052c6c662e5101e8250ed5f295fe
https://github.com/GiacoCorsiglia/php-stubs-generator/blob/c5796427ebc8052c6c662e5101e8250ed5f295fe/src/Result.php#L107-L113
27,493
vanry/laravel-scout-tntsearch
src/TokenizerManager.php
TokenizerManager.createAnalysisDriver
public function createAnalysisDriver() { $analysis = new Phpanalysis; foreach ($this->getConfig('analysis') as $key => $value) { $key = camel_case($key); if (property_exists($analysis, $key)) { $analysis->$key = $value; } } retur...
php
public function createAnalysisDriver() { $analysis = new Phpanalysis; foreach ($this->getConfig('analysis') as $key => $value) { $key = camel_case($key); if (property_exists($analysis, $key)) { $analysis->$key = $value; } } retur...
[ "public", "function", "createAnalysisDriver", "(", ")", "{", "$", "analysis", "=", "new", "Phpanalysis", ";", "foreach", "(", "$", "this", "->", "getConfig", "(", "'analysis'", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "key", "=", "came...
Create a PhpAnalysis tokenizer instance. @return \Vanry\Scout\Tokenizers\PhpAnalysisTokenizer
[ "Create", "a", "PhpAnalysis", "tokenizer", "instance", "." ]
ece71f76030f2c055214ec496a21e123388fa63f
https://github.com/vanry/laravel-scout-tntsearch/blob/ece71f76030f2c055214ec496a21e123388fa63f/src/TokenizerManager.php#L30-L43
27,494
Litepie/Message
src/Message.php
Message.count
public function count($folder, $label = null, $read = 1) { return $this->repository ->pushCriteria(new MessageResourceCriteria($folder, $label, $read)) ->mailCount(); }
php
public function count($folder, $label = null, $read = 1) { return $this->repository ->pushCriteria(new MessageResourceCriteria($folder, $label, $read)) ->mailCount(); }
[ "public", "function", "count", "(", "$", "folder", ",", "$", "label", "=", "null", ",", "$", "read", "=", "1", ")", "{", "return", "$", "this", "->", "repository", "->", "pushCriteria", "(", "new", "MessageResourceCriteria", "(", "$", "folder", ",", "$...
Returns count of message. @param array $filter @return int
[ "Returns", "count", "of", "message", "." ]
6c123f0feea627d572141fd71935250f3ba3cad0
https://github.com/Litepie/Message/blob/6c123f0feea627d572141fd71935250f3ba3cad0/src/Message.php#L31-L36
27,495
Litepie/Message
src/Message.php
Message.list
public function list($folder, $label = null, $read = 1) { return $this->repository ->pushCriteria(new MessageResourceCriteria($folder, $label, $read)) ->mailList(); }
php
public function list($folder, $label = null, $read = 1) { return $this->repository ->pushCriteria(new MessageResourceCriteria($folder, $label, $read)) ->mailList(); }
[ "public", "function", "list", "(", "$", "folder", ",", "$", "label", "=", "null", ",", "$", "read", "=", "1", ")", "{", "return", "$", "this", "->", "repository", "->", "pushCriteria", "(", "new", "MessageResourceCriteria", "(", "$", "folder", ",", "$"...
Returns count of message with given label. @param array $filter @return int
[ "Returns", "count", "of", "message", "with", "given", "label", "." ]
6c123f0feea627d572141fd71935250f3ba3cad0
https://github.com/Litepie/Message/blob/6c123f0feea627d572141fd71935250f3ba3cad0/src/Message.php#L45-L50
27,496
Litepie/Message
src/Http/Requests/MessageRequest.php
MessageRequest.canAccess
protected function canAccess() { if ($this->formRequest->user()->isAdmin() || $this->formRequest->user()->isUser()) { return true; } return $this->formRequest->user()->canDo('message.message.view'); }
php
protected function canAccess() { if ($this->formRequest->user()->isAdmin() || $this->formRequest->user()->isUser()) { return true; } return $this->formRequest->user()->canDo('message.message.view'); }
[ "protected", "function", "canAccess", "(", ")", "{", "if", "(", "$", "this", "->", "formRequest", "->", "user", "(", ")", "->", "isAdmin", "(", ")", "||", "$", "this", "->", "formRequest", "->", "user", "(", ")", "->", "isUser", "(", ")", ")", "{",...
Check whether the user can access the module. @return bool
[ "Check", "whether", "the", "user", "can", "access", "the", "module", "." ]
6c123f0feea627d572141fd71935250f3ba3cad0
https://github.com/Litepie/Message/blob/6c123f0feea627d572141fd71935250f3ba3cad0/src/Http/Requests/MessageRequest.php#L78-L85
27,497
Litepie/Message
src/Policies/MessagePolicy.php
MessagePolicy.view
public function view(UserPolicy $user, Message $message) { if ($user->canDo('message.message.view') && $user->hasRole('admin')) { return true; } return $user->id == $message->user_id && get_class($user) == $message->user_type; }
php
public function view(UserPolicy $user, Message $message) { if ($user->canDo('message.message.view') && $user->hasRole('admin')) { return true; } return $user->id == $message->user_id && get_class($user) == $message->user_type; }
[ "public", "function", "view", "(", "UserPolicy", "$", "user", ",", "Message", "$", "message", ")", "{", "if", "(", "$", "user", "->", "canDo", "(", "'message.message.view'", ")", "&&", "$", "user", "->", "hasRole", "(", "'admin'", ")", ")", "{", "retur...
Determine if the given user can view the message. @param User $user @param Message $message @return bool
[ "Determine", "if", "the", "given", "user", "can", "view", "the", "message", "." ]
6c123f0feea627d572141fd71935250f3ba3cad0
https://github.com/Litepie/Message/blob/6c123f0feea627d572141fd71935250f3ba3cad0/src/Policies/MessagePolicy.php#L18-L25
27,498
Litepie/Message
src/Policies/MessagePolicy.php
MessagePolicy.update
public function update(UserPolicy $user, Message $message) { return $user->id == $message->user_id && get_class($user) == $message->user_type; }
php
public function update(UserPolicy $user, Message $message) { return $user->id == $message->user_id && get_class($user) == $message->user_type; }
[ "public", "function", "update", "(", "UserPolicy", "$", "user", ",", "Message", "$", "message", ")", "{", "return", "$", "user", "->", "id", "==", "$", "message", "->", "user_id", "&&", "get_class", "(", "$", "user", ")", "==", "$", "message", "->", ...
Determine if the given user can update the given message. @param User $user @param Message $message @return bool
[ "Determine", "if", "the", "given", "user", "can", "update", "the", "given", "message", "." ]
6c123f0feea627d572141fd71935250f3ba3cad0
https://github.com/Litepie/Message/blob/6c123f0feea627d572141fd71935250f3ba3cad0/src/Policies/MessagePolicy.php#L48-L51
27,499
Litepie/Message
src/Http/Controllers/MessageResourceController.php
MessageResourceController.index
public function index(MessageRequest $request) { if ($this->response->typeIs('json')) { $pageLimit = $request->input('pageLimit'); $data = $this->repository ->setPresenter(\Litepie\Message\Repositories\Presenter\MessageListPresenter::class) ->get...
php
public function index(MessageRequest $request) { if ($this->response->typeIs('json')) { $pageLimit = $request->input('pageLimit'); $data = $this->repository ->setPresenter(\Litepie\Message\Repositories\Presenter\MessageListPresenter::class) ->get...
[ "public", "function", "index", "(", "MessageRequest", "$", "request", ")", "{", "if", "(", "$", "this", "->", "response", "->", "typeIs", "(", "'json'", ")", ")", "{", "$", "pageLimit", "=", "$", "request", "->", "input", "(", "'pageLimit'", ")", ";", ...
Display a list of message. @return Response
[ "Display", "a", "list", "of", "message", "." ]
6c123f0feea627d572141fd71935250f3ba3cad0
https://github.com/Litepie/Message/blob/6c123f0feea627d572141fd71935250f3ba3cad0/src/Http/Controllers/MessageResourceController.php#L36-L56