repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php
UserRoleQuery.filterByUser
public function filterByUser($user, $comparison = null) { if ($user instanceof \Alchemy\Component\Cerberus\Model\User) { return $this ->addUsingAlias(UserRoleTableMap::COL_USER_ID, $user->getId(), $comparison); } elseif ($user instanceof ObjectCollection) { if...
php
public function filterByUser($user, $comparison = null) { if ($user instanceof \Alchemy\Component\Cerberus\Model\User) { return $this ->addUsingAlias(UserRoleTableMap::COL_USER_ID, $user->getId(), $comparison); } elseif ($user instanceof ObjectCollection) { if...
[ "public", "function", "filterByUser", "(", "$", "user", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "$", "user", "instanceof", "\\", "Alchemy", "\\", "Component", "\\", "Cerberus", "\\", "Model", "\\", "User", ")", "{", "return", "$", "th...
Filter the query by a related \Alchemy\Component\Cerberus\Model\User object @param \Alchemy\Component\Cerberus\Model\User|ObjectCollection $user The related object(s) to use as filter @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return ChildUserRoleQuery The curren...
[ "Filter", "the", "query", "by", "a", "related", "\\", "Alchemy", "\\", "Component", "\\", "Cerberus", "\\", "Model", "\\", "User", "object" ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php#L337-L352
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php
UserRoleQuery.useUserQuery
public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinUser($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'User', '\Alchemy\Component\Cerberus\Model\UserQuery'); }
php
public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinUser($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'User', '\Alchemy\Component\Cerberus\Model\UserQuery'); }
[ "public", "function", "useUserQuery", "(", "$", "relationAlias", "=", "null", ",", "$", "joinType", "=", "Criteria", "::", "INNER_JOIN", ")", "{", "return", "$", "this", "->", "joinUser", "(", "$", "relationAlias", ",", "$", "joinType", ")", "->", "useQuer...
Use the User relation User object @see useQuery() @param string $relationAlias optional alias for the relation, to be used as main alias in the secondary query @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' @return \Alchemy\Component\Cerberus\Model\UserQuery A secon...
[ "Use", "the", "User", "relation", "User", "object" ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php#L397-L402
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php
UserRoleQuery.prune
public function prune($userRole = null) { if ($userRole) { $this->addCond('pruneCond0', $this->getAliasedColName(UserRoleTableMap::COL_USER_ID), $userRole->getUserId(), Criteria::NOT_EQUAL); $this->addCond('pruneCond1', $this->getAliasedColName(UserRoleTableMap::COL_ROLE_ID), $userRo...
php
public function prune($userRole = null) { if ($userRole) { $this->addCond('pruneCond0', $this->getAliasedColName(UserRoleTableMap::COL_USER_ID), $userRole->getUserId(), Criteria::NOT_EQUAL); $this->addCond('pruneCond1', $this->getAliasedColName(UserRoleTableMap::COL_ROLE_ID), $userRo...
[ "public", "function", "prune", "(", "$", "userRole", "=", "null", ")", "{", "if", "(", "$", "userRole", ")", "{", "$", "this", "->", "addCond", "(", "'pruneCond0'", ",", "$", "this", "->", "getAliasedColName", "(", "UserRoleTableMap", "::", "COL_USER_ID", ...
Exclude object from result @param ChildUserRole $userRole Object to remove from the list of results @return $this|ChildUserRoleQuery The current query, for fluid interface
[ "Exclude", "object", "from", "result" ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php#L486-L495
pickles2/px2-sitemapexcel
php/helper/PHPExcelHelper.php
pxplugin_sitemapExcel_helper_PHPExcelHelper.load
public function load( $path ){ if(!strlen($path)){ return false; } if(!is_file($path)){ return false; } if(!is_readable($path)){ return false; } $objPHPExcel = \PHPExcel_IOFactory::load($path); return $objPHPExcel; }
php
public function load( $path ){ if(!strlen($path)){ return false; } if(!is_file($path)){ return false; } if(!is_readable($path)){ return false; } $objPHPExcel = \PHPExcel_IOFactory::load($path); return $objPHPExcel; }
[ "public", "function", "load", "(", "$", "path", ")", "{", "if", "(", "!", "strlen", "(", "$", "path", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "is_file", "(", "$", "path", ")", ")", "{", "return", "false", ";", "}", "if", "...
既存のファイルを開く
[ "既存のファイルを開く" ]
train
https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/helper/PHPExcelHelper.php#L26-L33
pickles2/px2-sitemapexcel
php/helper/PHPExcelHelper.php
pxplugin_sitemapExcel_helper_PHPExcelHelper.save
public function save( $objPHPExcel, $path, $type = 'Excel2007' ){ $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, $type); return $objWriter->save($path); }
php
public function save( $objPHPExcel, $path, $type = 'Excel2007' ){ $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, $type); return $objWriter->save($path); }
[ "public", "function", "save", "(", "$", "objPHPExcel", ",", "$", "path", ",", "$", "type", "=", "'Excel2007'", ")", "{", "$", "objWriter", "=", "\\", "PHPExcel_IOFactory", "::", "createWriter", "(", "$", "objPHPExcel", ",", "$", "type", ")", ";", "return...
保存する
[ "保存する" ]
train
https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/helper/PHPExcelHelper.php#L38-L41
Atlantic18/CoralCoreBundle
Service/Connector.php
Connector.to
public function to($connector) { if(!array_key_exists($connector, $this->connectors)) { throw new ConnectorException( "Connector [$connector] not found. Available connectors: " . implode(', ', array_keys($this->connectors)) . '.' ); } ...
php
public function to($connector) { if(!array_key_exists($connector, $this->connectors)) { throw new ConnectorException( "Connector [$connector] not found. Available connectors: " . implode(', ', array_keys($this->connectors)) . '.' ); } ...
[ "public", "function", "to", "(", "$", "connector", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "connector", ",", "$", "this", "->", "connectors", ")", ")", "{", "throw", "new", "ConnectorException", "(", "\"Connector [$connector] not found. Available...
Get connector instance @param string $connector Connector name @return ConnectorInterface
[ "Get", "connector", "instance" ]
train
https://github.com/Atlantic18/CoralCoreBundle/blob/7d74ffaf51046ad13cbfc2b0b69d656a499f38ab/Service/Connector.php#L50-L61
withfatpanda/illuminate-wordpress
src/WordPress/Models/User.php
User.current
static function current() { $current = false; if (is_user_logged_in()) { $current = new static(); $user = wp_get_current_user(); // $current->wp_user = $user; foreach($user->data as $name => $value) { $current->$name = $v...
php
static function current() { $current = false; if (is_user_logged_in()) { $current = new static(); $user = wp_get_current_user(); // $current->wp_user = $user; foreach($user->data as $name => $value) { $current->$name = $v...
[ "static", "function", "current", "(", ")", "{", "$", "current", "=", "false", ";", "if", "(", "is_user_logged_in", "(", ")", ")", "{", "$", "current", "=", "new", "static", "(", ")", ";", "$", "user", "=", "wp_get_current_user", "(", ")", ";", "// $c...
Get the current user. @return User instance mapped to current WP_User; otherwise returns false.
[ "Get", "the", "current", "user", "." ]
train
https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Models/User.php#L306-L322
kderyabin/logger
src/LoggerFactory.php
LoggerFactory.getMessage
public static function getMessage(array $config = []): Message { $message = Message::class; $msgConf = $config['message'] ?? []; if (!empty($config['message']['instance'])) { $message = $config['message']['instance']; unset($config['message']['instance']); } ...
php
public static function getMessage(array $config = []): Message { $message = Message::class; $msgConf = $config['message'] ?? []; if (!empty($config['message']['instance'])) { $message = $config['message']['instance']; unset($config['message']['instance']); } ...
[ "public", "static", "function", "getMessage", "(", "array", "$", "config", "=", "[", "]", ")", ":", "Message", "{", "$", "message", "=", "Message", "::", "class", ";", "$", "msgConf", "=", "$", "config", "[", "'message'", "]", "??", "[", "]", ";", ...
Initializes a Message instance from the logger configuration. Message configuration must be set in an array with the key "message". @param array $config Logger configuration @return Message
[ "Initializes", "a", "Message", "instance", "from", "the", "logger", "configuration", ".", "Message", "configuration", "must", "be", "set", "in", "an", "array", "with", "the", "key", "message", "." ]
train
https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/LoggerFactory.php#L30-L41
kderyabin/logger
src/LoggerFactory.php
LoggerFactory.getChannels
public static function getChannels($config = []): array { $channels = []; if (empty($config['channels'])) { $channels[] = static::getChannel(); return $channels; } foreach ($config['channels'] as $channel) { $channels[] = ($channel instanceof Chan...
php
public static function getChannels($config = []): array { $channels = []; if (empty($config['channels'])) { $channels[] = static::getChannel(); return $channels; } foreach ($config['channels'] as $channel) { $channels[] = ($channel instanceof Chan...
[ "public", "static", "function", "getChannels", "(", "$", "config", "=", "[", "]", ")", ":", "array", "{", "$", "channels", "=", "[", "]", ";", "if", "(", "empty", "(", "$", "config", "[", "'channels'", "]", ")", ")", "{", "$", "channels", "[", "]...
Initializes an array of Channel's instances from the logger configuration. Channels settings are declared with the key "chanells". @see static::getChannel for Channel settings. @param array|\ArrayAccess $config Logger configuration @return Channel[] @throws \InvalidArgumentException
[ "Initializes", "an", "array", "of", "Channel", "s", "instances", "from", "the", "logger", "configuration", ".", "Channels", "settings", "are", "declared", "with", "the", "key", "chanells", ".", "@see", "static", "::", "getChannel", "for", "Channel", "settings", ...
train
https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/LoggerFactory.php#L52-L65
kderyabin/logger
src/LoggerFactory.php
LoggerFactory.getChannel
public static function getChannel(array $config = []): Channel { $channel = new Channel(); $channel->setHandler(static::getHandler($config['handler'] ?? [])); $channel->setFormatter(static::getFormatter($config['formatter'] ?? [])); return $channel; }
php
public static function getChannel(array $config = []): Channel { $channel = new Channel(); $channel->setHandler(static::getHandler($config['handler'] ?? [])); $channel->setFormatter(static::getFormatter($config['formatter'] ?? [])); return $channel; }
[ "public", "static", "function", "getChannel", "(", "array", "$", "config", "=", "[", "]", ")", ":", "Channel", "{", "$", "channel", "=", "new", "Channel", "(", ")", ";", "$", "channel", "->", "setHandler", "(", "static", "::", "getHandler", "(", "$", ...
Initializes a Channel instance. @param array $config Channel settings @return Channel @throws \InvalidArgumentException
[ "Initializes", "a", "Channel", "instance", "." ]
train
https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/LoggerFactory.php#L74-L81
kderyabin/logger
src/LoggerFactory.php
LoggerFactory.getHandler
public static function getHandler(array $config = []): AbstractHandler { if (!empty($config['instance'])) { $handler = $config['instance']; unset($config['instance']); } else { $handler = StreamHandler::class; } return new $handler($config); }
php
public static function getHandler(array $config = []): AbstractHandler { if (!empty($config['instance'])) { $handler = $config['instance']; unset($config['instance']); } else { $handler = StreamHandler::class; } return new $handler($config); }
[ "public", "static", "function", "getHandler", "(", "array", "$", "config", "=", "[", "]", ")", ":", "AbstractHandler", "{", "if", "(", "!", "empty", "(", "$", "config", "[", "'instance'", "]", ")", ")", "{", "$", "handler", "=", "$", "config", "[", ...
Initializes a handler instance. If the configuration is empty a default handler is returned. All settings except 'instance' are passed to the handler constructor. If declared, an 'instance' value must be a fully qualified class name. @param array $config Handler settings @return AbstractHandler
[ "Initializes", "a", "handler", "instance", ".", "If", "the", "configuration", "is", "empty", "a", "default", "handler", "is", "returned", ".", "All", "settings", "except", "instance", "are", "passed", "to", "the", "handler", "constructor", ".", "If", "declared...
train
https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/LoggerFactory.php#L92-L101
kderyabin/logger
src/LoggerFactory.php
LoggerFactory.getFormatter
public static function getFormatter(array $config = []): AbstractFormatter { if (!empty($config['instance'])) { $formatter = $config['instance']; unset($config['instance']); } else { $formatter = JsonFormatter::class; } return new $formatter($conf...
php
public static function getFormatter(array $config = []): AbstractFormatter { if (!empty($config['instance'])) { $formatter = $config['instance']; unset($config['instance']); } else { $formatter = JsonFormatter::class; } return new $formatter($conf...
[ "public", "static", "function", "getFormatter", "(", "array", "$", "config", "=", "[", "]", ")", ":", "AbstractFormatter", "{", "if", "(", "!", "empty", "(", "$", "config", "[", "'instance'", "]", ")", ")", "{", "$", "formatter", "=", "$", "config", ...
Initializes a formatter instance. If the configuration is empty a default formatter is returned. All settings except 'instance' are passed to the formatter constructor. If declared, an 'instance' value must be a fully qualified class name. @param array $config Formatter settings @return AbstractFormatter
[ "Initializes", "a", "formatter", "instance", ".", "If", "the", "configuration", "is", "empty", "a", "default", "formatter", "is", "returned", ".", "All", "settings", "except", "instance", "are", "passed", "to", "the", "formatter", "constructor", ".", "If", "de...
train
https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/LoggerFactory.php#L112-L122
kderyabin/logger
src/LoggerFactory.php
LoggerFactory.getMaxPriority
public static function getMaxPriority($config = []) { if (!empty($config['levelPriorityMax'])) { if (!LogLevelPriority::isDefined($config['levelPriorityMax'])) { throw new \InvalidArgumentException( sprintf('levelPriorityMax "%s" is not declared in level prior...
php
public static function getMaxPriority($config = []) { if (!empty($config['levelPriorityMax'])) { if (!LogLevelPriority::isDefined($config['levelPriorityMax'])) { throw new \InvalidArgumentException( sprintf('levelPriorityMax "%s" is not declared in level prior...
[ "public", "static", "function", "getMaxPriority", "(", "$", "config", "=", "[", "]", ")", "{", "if", "(", "!", "empty", "(", "$", "config", "[", "'levelPriorityMax'", "]", ")", ")", "{", "if", "(", "!", "LogLevelPriority", "::", "isDefined", "(", "$", ...
Initializes a maximum log level priority. Converts a named level to integer value. This value must be declared with the key 'levelPriorityMax' and must be one of LogLevel constants. @see LogLevel @example 'levelPriorityMax' => 'notice' @param array|\ArrayAccess $config Logger configuration @return int|null
[ "Initializes", "a", "maximum", "log", "level", "priority", ".", "Converts", "a", "named", "level", "to", "integer", "value", ".", "This", "value", "must", "be", "declared", "with", "the", "key", "levelPriorityMax", "and", "must", "be", "one", "of", "LogLevel...
train
https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/LoggerFactory.php#L170-L181
dreamcommerce/common-bundle
src/DreamCommerce/Component/Common/Doctrine/DBAL/Types/MapEnumType.php
MapEnumType.getSQLDeclaration
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) { $definition = null; $platformName = $platform->getName(); switch ($this->enumType) { case static::TYPE_UINT8: Assert::oneOf($platformName, array('mysql')); $d...
php
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) { $definition = null; $platformName = $platform->getName(); switch ($this->enumType) { case static::TYPE_UINT8: Assert::oneOf($platformName, array('mysql')); $d...
[ "public", "function", "getSQLDeclaration", "(", "array", "$", "fieldDeclaration", ",", "AbstractPlatform", "$", "platform", ")", "{", "$", "definition", "=", "null", ";", "$", "platformName", "=", "$", "platform", "->", "getName", "(", ")", ";", "switch", "(...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamcommerce/common-bundle/blob/adb0850e90e63c3997f10d1ce110bf13a84b63ab/src/DreamCommerce/Component/Common/Doctrine/DBAL/Types/MapEnumType.php#L30-L67
dreamcommerce/common-bundle
src/DreamCommerce/Component/Common/Doctrine/DBAL/Types/MapEnumType.php
MapEnumType.convertToPHPValue
public function convertToPHPValue($value, AbstractPlatform $platform) { $value = (string) $value; if (strlen($value) === 0) { return null; } if ($this->flipValues == null) { $this->flipValues = array_flip($this->values); } Assert::keyExists($...
php
public function convertToPHPValue($value, AbstractPlatform $platform) { $value = (string) $value; if (strlen($value) === 0) { return null; } if ($this->flipValues == null) { $this->flipValues = array_flip($this->values); } Assert::keyExists($...
[ "public", "function", "convertToPHPValue", "(", "$", "value", ",", "AbstractPlatform", "$", "platform", ")", "{", "$", "value", "=", "(", "string", ")", "$", "value", ";", "if", "(", "strlen", "(", "$", "value", ")", "===", "0", ")", "{", "return", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamcommerce/common-bundle/blob/adb0850e90e63c3997f10d1ce110bf13a84b63ab/src/DreamCommerce/Component/Common/Doctrine/DBAL/Types/MapEnumType.php#L72-L86
dreamcommerce/common-bundle
src/DreamCommerce/Component/Common/Doctrine/DBAL/Types/MapEnumType.php
MapEnumType.convertToDatabaseValue
public function convertToDatabaseValue($value, AbstractPlatform $platform) { $value = (string) $value; if (strlen($value) === 0) { return null; } Assert::keyExists($this->values, $value); return $this->values[$value]; }
php
public function convertToDatabaseValue($value, AbstractPlatform $platform) { $value = (string) $value; if (strlen($value) === 0) { return null; } Assert::keyExists($this->values, $value); return $this->values[$value]; }
[ "public", "function", "convertToDatabaseValue", "(", "$", "value", ",", "AbstractPlatform", "$", "platform", ")", "{", "$", "value", "=", "(", "string", ")", "$", "value", ";", "if", "(", "strlen", "(", "$", "value", ")", "===", "0", ")", "{", "return"...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamcommerce/common-bundle/blob/adb0850e90e63c3997f10d1ce110bf13a84b63ab/src/DreamCommerce/Component/Common/Doctrine/DBAL/Types/MapEnumType.php#L91-L101
dreamcommerce/common-bundle
src/DreamCommerce/Component/Common/Doctrine/DBAL/Types/MapEnumType.php
MapEnumType.getBindingType
public function getBindingType() { switch ($this->enumType) { case static::TYPE_UINT8: case static::TYPE_UINT16: case static::TYPE_UINT32: return \PDO::PARAM_INT; } return \PDO::PARAM_STR; }
php
public function getBindingType() { switch ($this->enumType) { case static::TYPE_UINT8: case static::TYPE_UINT16: case static::TYPE_UINT32: return \PDO::PARAM_INT; } return \PDO::PARAM_STR; }
[ "public", "function", "getBindingType", "(", ")", "{", "switch", "(", "$", "this", "->", "enumType", ")", "{", "case", "static", "::", "TYPE_UINT8", ":", "case", "static", "::", "TYPE_UINT16", ":", "case", "static", "::", "TYPE_UINT32", ":", "return", "\\"...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamcommerce/common-bundle/blob/adb0850e90e63c3997f10d1ce110bf13a84b63ab/src/DreamCommerce/Component/Common/Doctrine/DBAL/Types/MapEnumType.php#L106-L116
movoin/one-swoole
src/Protocol/Responders/Handlers/XmlHandler.php
XmlHandler.getXML
protected function getXML(array $body): string { $this->xmlWriter = new XMLWriter; $this->xmlWriter->openMemory(); $this->xmlWriter->setIndent(true); $this->xmlWriter->setIndentString(''); $this->xmlWriter->startDocument('1.0', 'UTF-8'); $this->xmlWriter->startElemen...
php
protected function getXML(array $body): string { $this->xmlWriter = new XMLWriter; $this->xmlWriter->openMemory(); $this->xmlWriter->setIndent(true); $this->xmlWriter->setIndentString(''); $this->xmlWriter->startDocument('1.0', 'UTF-8'); $this->xmlWriter->startElemen...
[ "protected", "function", "getXML", "(", "array", "$", "body", ")", ":", "string", "{", "$", "this", "->", "xmlWriter", "=", "new", "XMLWriter", ";", "$", "this", "->", "xmlWriter", "->", "openMemory", "(", ")", ";", "$", "this", "->", "xmlWriter", "->"...
获得 XML @param array $body @return string
[ "获得", "XML" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Responders/Handlers/XmlHandler.php#L62-L78
movoin/one-swoole
src/Protocol/Responders/Handlers/XmlHandler.php
XmlHandler.fromArray
protected function fromArray(array $array) { if (is_array($array)) { foreach ($array as $index => $element) { if (is_array($element)) { $this->xmlWriter->startElement($index); $this->fromArray($element); $this->xmlWriter...
php
protected function fromArray(array $array) { if (is_array($array)) { foreach ($array as $index => $element) { if (is_array($element)) { $this->xmlWriter->startElement($index); $this->fromArray($element); $this->xmlWriter...
[ "protected", "function", "fromArray", "(", "array", "$", "array", ")", "{", "if", "(", "is_array", "(", "$", "array", ")", ")", "{", "foreach", "(", "$", "array", "as", "$", "index", "=>", "$", "element", ")", "{", "if", "(", "is_array", "(", "$", ...
处理嵌套数据 @param array $array
[ "处理嵌套数据" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Responders/Handlers/XmlHandler.php#L85-L100
acasademont/wurfl
WURFL/Handlers/UcwebU3Handler.php
WURFL_Handlers_UcwebU3Handler.getUcAndroidModel
public static function getUcAndroidModel($ua, $use_default=true) { // Locales are optional for matching model name since UAs like Chrome Mobile do not contain them if (!preg_match('#Adr [\d\.]+; [a-zA-Z]+-[a-zA-Z]+; (.*)\) U2#', $ua, $matches)) { return null; } $mode...
php
public static function getUcAndroidModel($ua, $use_default=true) { // Locales are optional for matching model name since UAs like Chrome Mobile do not contain them if (!preg_match('#Adr [\d\.]+; [a-zA-Z]+-[a-zA-Z]+; (.*)\) U2#', $ua, $matches)) { return null; } $mode...
[ "public", "static", "function", "getUcAndroidModel", "(", "$", "ua", ",", "$", "use_default", "=", "true", ")", "{", "// Locales are optional for matching model name since UAs like Chrome Mobile do not contain them", "if", "(", "!", "preg_match", "(", "'#Adr [\\d\\.]+; [a-zA-...
Slightly modified from Android's get model function
[ "Slightly", "modified", "from", "Android", "s", "get", "model", "function" ]
train
https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/UcwebU3Handler.php#L168-L196
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtMedia/MediaRule.php
MediaRule.setQueries
public function setQueries($queries) { $this->queries = []; if (!is_array($queries)) { $queries = [$queries]; } foreach ($queries as $query) { $this->addQuery($query); } return $this; }
php
public function setQueries($queries) { $this->queries = []; if (!is_array($queries)) { $queries = [$queries]; } foreach ($queries as $query) { $this->addQuery($query); } return $this; }
[ "public", "function", "setQueries", "(", "$", "queries", ")", "{", "$", "this", "->", "queries", "=", "[", "]", ";", "if", "(", "!", "is_array", "(", "$", "queries", ")", ")", "{", "$", "queries", "=", "[", "$", "queries", "]", ";", "}", "foreach...
Sets the media queries for the rule. @param MediaQuery[]|MediaQuery $queries @return $this
[ "Sets", "the", "media", "queries", "for", "the", "rule", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtMedia/MediaRule.php#L39-L50
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtMedia/MediaRule.php
MediaRule.parseRuleString
protected function parseRuleString($ruleString) { if (is_string($ruleString)) { $charset = $this->getCharset(); // Remove at-rule and unnecessary white-spaces $ruleString = preg_replace('/^[ \r\n\t\f]*@media[ \r\n\t\f]*/i', '', $ruleString); $ruleString = tri...
php
protected function parseRuleString($ruleString) { if (is_string($ruleString)) { $charset = $this->getCharset(); // Remove at-rule and unnecessary white-spaces $ruleString = preg_replace('/^[ \r\n\t\f]*@media[ \r\n\t\f]*/i', '', $ruleString); $ruleString = tri...
[ "protected", "function", "parseRuleString", "(", "$", "ruleString", ")", "{", "if", "(", "is_string", "(", "$", "ruleString", ")", ")", "{", "$", "charset", "=", "$", "this", "->", "getCharset", "(", ")", ";", "// Remove at-rule and unnecessary white-spaces", ...
Parses the media rule. @param string $ruleString
[ "Parses", "the", "media", "rule", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtMedia/MediaRule.php#L80-L202
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtMedia/MediaRule.php
MediaRule.getQueryInstanceFromQueryString
protected function getQueryInstanceFromQueryString($queryString) { if (preg_match('/^[ \r\n\t\f]*(?:(only[ \r\n\t\f]+)|(not[ \r\n\t\f]+))?([^ \r\n\t\f]*)[ \r\n\t\f]*(?:(?:and)?[ \r\n\t\f]*)*$/iD', $queryString, $matches)) { $type = $matches[3] === "" ? MediaQuery::TYPE_ALL : $matches[3]; ...
php
protected function getQueryInstanceFromQueryString($queryString) { if (preg_match('/^[ \r\n\t\f]*(?:(only[ \r\n\t\f]+)|(not[ \r\n\t\f]+))?([^ \r\n\t\f]*)[ \r\n\t\f]*(?:(?:and)?[ \r\n\t\f]*)*$/iD', $queryString, $matches)) { $type = $matches[3] === "" ? MediaQuery::TYPE_ALL : $matches[3]; ...
[ "protected", "function", "getQueryInstanceFromQueryString", "(", "$", "queryString", ")", "{", "if", "(", "preg_match", "(", "'/^[ \\r\\n\\t\\f]*(?:(only[ \\r\\n\\t\\f]+)|(not[ \\r\\n\\t\\f]+))?([^ \\r\\n\\t\\f]*)[ \\r\\n\\t\\f]*(?:(?:and)?[ \\r\\n\\t\\f]*)*$/iD'", ",", "$", "queryStri...
Extracts the type from the query part of the media rule and returns a MediaQuery instance for it. @param $queryString @return MediaQuery|null
[ "Extracts", "the", "type", "from", "the", "query", "part", "of", "the", "media", "rule", "and", "returns", "a", "MediaQuery", "instance", "for", "it", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtMedia/MediaRule.php#L210-L224
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtMedia/MediaRule.php
MediaRule.parseConditionList
protected function parseConditionList($conditionList) { $charset = $this->getCharset(); $conditions = []; foreach (Condition::splitNestedConditions($conditionList) as $normalizedConditionList) { $normalizedConditions = []; $currentCondition = ""; if (pre...
php
protected function parseConditionList($conditionList) { $charset = $this->getCharset(); $conditions = []; foreach (Condition::splitNestedConditions($conditionList) as $normalizedConditionList) { $normalizedConditions = []; $currentCondition = ""; if (pre...
[ "protected", "function", "parseConditionList", "(", "$", "conditionList", ")", "{", "$", "charset", "=", "$", "this", "->", "getCharset", "(", ")", ";", "$", "conditions", "=", "[", "]", ";", "foreach", "(", "Condition", "::", "splitNestedConditions", "(", ...
Parses the condition part of the media rule. @param string $conditionList @return MediaCondition[]
[ "Parses", "the", "condition", "part", "of", "the", "media", "rule", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtMedia/MediaRule.php#L232-L278
yosmanyga/resource
src/Yosmanyga/Resource/Transformer/DelegatorTransformer.php
DelegatorTransformer.supports
public function supports(Resource $resource, Resource $parentResource) { try { if ($this->pickTransformer($resource, $parentResource)) { return true; } } catch (\RuntimeException $e) { } return false; }
php
public function supports(Resource $resource, Resource $parentResource) { try { if ($this->pickTransformer($resource, $parentResource)) { return true; } } catch (\RuntimeException $e) { } return false; }
[ "public", "function", "supports", "(", "Resource", "$", "resource", ",", "Resource", "$", "parentResource", ")", "{", "try", "{", "if", "(", "$", "this", "->", "pickTransformer", "(", "$", "resource", ",", "$", "parentResource", ")", ")", "{", "return", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Transformer/DelegatorTransformer.php#L31-L41
yosmanyga/resource
src/Yosmanyga/Resource/Transformer/DelegatorTransformer.php
DelegatorTransformer.transform
public function transform(Resource $resource, Resource $parentResource) { return $this->pickTransformer($resource, $parentResource)->transform($resource, $parentResource); }
php
public function transform(Resource $resource, Resource $parentResource) { return $this->pickTransformer($resource, $parentResource)->transform($resource, $parentResource); }
[ "public", "function", "transform", "(", "Resource", "$", "resource", ",", "Resource", "$", "parentResource", ")", "{", "return", "$", "this", "->", "pickTransformer", "(", "$", "resource", ",", "$", "parentResource", ")", "->", "transform", "(", "$", "resour...
{@inheritdoc}
[ "{" ]
train
https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Transformer/DelegatorTransformer.php#L46-L49
yosmanyga/resource
src/Yosmanyga/Resource/Transformer/DelegatorTransformer.php
DelegatorTransformer.pickTransformer
protected function pickTransformer(Resource $resource, Resource $parentResource) { foreach ($this->transformers as $i => $transformer) { if ($transformer->supports($resource, $parentResource)) { if (0 != $i) { // Move transformer to top to improve next pick ...
php
protected function pickTransformer(Resource $resource, Resource $parentResource) { foreach ($this->transformers as $i => $transformer) { if ($transformer->supports($resource, $parentResource)) { if (0 != $i) { // Move transformer to top to improve next pick ...
[ "protected", "function", "pickTransformer", "(", "Resource", "$", "resource", ",", "Resource", "$", "parentResource", ")", "{", "foreach", "(", "$", "this", "->", "transformers", "as", "$", "i", "=>", "$", "transformer", ")", "{", "if", "(", "$", "transfor...
@param \Yosmanyga\Resource\Resource $resource @param \Yosmanyga\Resource\Resource $parentResource @throws \RuntimeException If no transformer is able to support the resource @return \Yosmanyga\Resource\Transformer\TransformerInterface
[ "@param", "\\", "Yosmanyga", "\\", "Resource", "\\", "Resource", "$resource", "@param", "\\", "Yosmanyga", "\\", "Resource", "\\", "Resource", "$parentResource" ]
train
https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Transformer/DelegatorTransformer.php#L60-L75
repli2dev/nette-mailpanel
src/MailPanel.php
MailPanel.getPanel
public function getPanel() { $template = new FileTemplate(); $template->registerFilter(new Engine); $template->registerHelperLoader('Nette\\Templating\\Helpers::loader'); $template->setFile(__DIR__ . '/MailPanel.latte'); $template->baseUrl = $this->request->getUrl()->getBaseUrl(); $template->messages = $thi...
php
public function getPanel() { $template = new FileTemplate(); $template->registerFilter(new Engine); $template->registerHelperLoader('Nette\\Templating\\Helpers::loader'); $template->setFile(__DIR__ . '/MailPanel.latte'); $template->baseUrl = $this->request->getUrl()->getBaseUrl(); $template->messages = $thi...
[ "public", "function", "getPanel", "(", ")", "{", "$", "template", "=", "new", "FileTemplate", "(", ")", ";", "$", "template", "->", "registerFilter", "(", "new", "Engine", ")", ";", "$", "template", "->", "registerHelperLoader", "(", "'Nette\\\\Templating\\\\H...
Show content of panel @return string
[ "Show", "content", "of", "panel" ]
train
https://github.com/repli2dev/nette-mailpanel/blob/608e6967098b6a27aae2fbc5637b00f3723cbbff/src/MailPanel.php#L70-L79
activecollab/databasestructure
src/Field/Composite/EmailField.php
EmailField.getValidatorLines
public function getValidatorLines($indent, array &$result) { $result[] = $indent . '$validator->email(' . var_export($this->getName(), true) . ', ' . ($this->getDefaultValue() === null ? 'true' : 'false') . ');'; }
php
public function getValidatorLines($indent, array &$result) { $result[] = $indent . '$validator->email(' . var_export($this->getName(), true) . ', ' . ($this->getDefaultValue() === null ? 'true' : 'false') . ');'; }
[ "public", "function", "getValidatorLines", "(", "$", "indent", ",", "array", "&", "$", "result", ")", "{", "$", "result", "[", "]", "=", "$", "indent", ".", "'$validator->email('", ".", "var_export", "(", "$", "this", "->", "getName", "(", ")", ",", "t...
{@inheritdoc}
[ "{" ]
train
https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Composite/EmailField.php#L31-L34
stubbles/stubbles-webapp-core
src/main/php/response/Status.php
Status.setCode
public function setCode(int $code, string $reasonPhrase = null): self { $this->code = $code; $this->reasonPhrase = null === $reasonPhrase ? Http::reasonPhraseFor($code) : $reasonPhrase; return $this; }
php
public function setCode(int $code, string $reasonPhrase = null): self { $this->code = $code; $this->reasonPhrase = null === $reasonPhrase ? Http::reasonPhraseFor($code) : $reasonPhrase; return $this; }
[ "public", "function", "setCode", "(", "int", "$", "code", ",", "string", "$", "reasonPhrase", "=", "null", ")", ":", "self", "{", "$", "this", "->", "code", "=", "$", "code", ";", "$", "this", "->", "reasonPhrase", "=", "null", "===", "$", "reasonPhr...
sets the status code If reason phrase is null it will use the default reason phrase for given status code. @param int $code @param string $reasonPhrase optional @return \stubbles\webapp\response\Status
[ "sets", "the", "status", "code" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Status.php#L72-L77
stubbles/stubbles-webapp-core
src/main/php/response/Status.php
Status.fixateCode
private function fixateCode(int $code): self { $this->setCode($code); $this->fixed = true; return $this; }
php
private function fixateCode(int $code): self { $this->setCode($code); $this->fixed = true; return $this; }
[ "private", "function", "fixateCode", "(", "int", "$", "code", ")", ":", "self", "{", "$", "this", "->", "setCode", "(", "$", "code", ")", ";", "$", "this", "->", "fixed", "=", "true", ";", "return", "$", "this", ";", "}" ]
sets status code and sets status to fixed @param int $code @return \stubbles\webapp\response\Status
[ "sets", "status", "code", "and", "sets", "status", "to", "fixed" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Status.php#L85-L90
stubbles/stubbles-webapp-core
src/main/php/response/Status.php
Status.created
public function created($uri, string $etag = null): self { $this->headers->location($uri); if (null !== $etag) { $this->headers->add('ETag', $etag); } return $this->fixateCode(201); }
php
public function created($uri, string $etag = null): self { $this->headers->location($uri); if (null !== $etag) { $this->headers->add('ETag', $etag); } return $this->fixateCode(201); }
[ "public", "function", "created", "(", "$", "uri", ",", "string", "$", "etag", "=", "null", ")", ":", "self", "{", "$", "this", "->", "headers", "->", "location", "(", "$", "uri", ")", ";", "if", "(", "null", "!==", "$", "etag", ")", "{", "$", "...
sets status to 201 Created @param string|\stubbles\peer\http\HttpUri $uri uri under which created resource can be found @param string $etag optional entity-tag of the newly created resource's representation @return \stubbles\webapp\response\Status
[ "sets", "status", "to", "201", "Created" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Status.php#L99-L107
stubbles/stubbles-webapp-core
src/main/php/response/Status.php
Status.noContent
public function noContent(): self { $this->allowsPayload = false; $this->headers->add('Content-Length', 0); return $this->fixateCode(204); }
php
public function noContent(): self { $this->allowsPayload = false; $this->headers->add('Content-Length', 0); return $this->fixateCode(204); }
[ "public", "function", "noContent", "(", ")", ":", "self", "{", "$", "this", "->", "allowsPayload", "=", "false", ";", "$", "this", "->", "headers", "->", "add", "(", "'Content-Length'", ",", "0", ")", ";", "return", "$", "this", "->", "fixateCode", "("...
sets status code to 204 No Content @return \stubbles\webapp\response\Status
[ "sets", "status", "code", "to", "204", "No", "Content" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Status.php#L124-L129
stubbles/stubbles-webapp-core
src/main/php/response/Status.php
Status.resetContent
public function resetContent(): self { $this->allowsPayload = false; $this->headers->add('Content-Length', 0); return $this->fixateCode(205); }
php
public function resetContent(): self { $this->allowsPayload = false; $this->headers->add('Content-Length', 0); return $this->fixateCode(205); }
[ "public", "function", "resetContent", "(", ")", ":", "self", "{", "$", "this", "->", "allowsPayload", "=", "false", ";", "$", "this", "->", "headers", "->", "add", "(", "'Content-Length'", ",", "0", ")", ";", "return", "$", "this", "->", "fixateCode", ...
sets status code to 205 Reset Content @return \stubbles\webapp\response\Status
[ "sets", "status", "code", "to", "205", "Reset", "Content" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Status.php#L136-L141
stubbles/stubbles-webapp-core
src/main/php/response/Status.php
Status.partialContent
public function partialContent($lower, $upper, $total = '*', string $rangeUnit = 'bytes'): self { $this->headers->add( 'Content-Range', $rangeUnit . ' ' . $lower . '-' . $upper . '/' . $total ); return $this->fixateCode(206); }
php
public function partialContent($lower, $upper, $total = '*', string $rangeUnit = 'bytes'): self { $this->headers->add( 'Content-Range', $rangeUnit . ' ' . $lower . '-' . $upper . '/' . $total ); return $this->fixateCode(206); }
[ "public", "function", "partialContent", "(", "$", "lower", ",", "$", "upper", ",", "$", "total", "=", "'*'", ",", "string", "$", "rangeUnit", "=", "'bytes'", ")", ":", "self", "{", "$", "this", "->", "headers", "->", "add", "(", "'Content-Range'", ",",...
sets status code to 206 Partial Content @param int|string $lower lower border of range @param int|string $upper upper border of range @param int|string $total optional total length of content, defaults to * for "unknown" @param string $rangeUnit optional range unit, defaults to "b...
[ "sets", "status", "code", "to", "206", "Partial", "Content" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Status.php#L152-L159
stubbles/stubbles-webapp-core
src/main/php/response/Status.php
Status.redirect
public function redirect($uri, int $statusCode = 302): self { $this->headers->location($uri); return $this->fixateCode($statusCode); }
php
public function redirect($uri, int $statusCode = 302): self { $this->headers->location($uri); return $this->fixateCode($statusCode); }
[ "public", "function", "redirect", "(", "$", "uri", ",", "int", "$", "statusCode", "=", "302", ")", ":", "self", "{", "$", "this", "->", "headers", "->", "location", "(", "$", "uri", ")", ";", "return", "$", "this", "->", "fixateCode", "(", "$", "st...
sets status to 30x @param string|\stubbles\peer\http\HttpUri $uri http uri to redirect to @param int $statusCode HTTP status code to redirect with (301, 302, ...) @return \stubbles\webapp\response\Status
[ "sets", "status", "to", "30x" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Status.php#L168-L172
stubbles/stubbles-webapp-core
src/main/php/response/Status.php
Status.unauthorized
public function unauthorized(array $challenges): self { if (count($challenges) === 0) { throw new \InvalidArgumentException('Challenges must contain at least one entry'); } $this->headers->add('WWW-Authenticate', join(', ', $challenges)); return $this->fixateCode(401); ...
php
public function unauthorized(array $challenges): self { if (count($challenges) === 0) { throw new \InvalidArgumentException('Challenges must contain at least one entry'); } $this->headers->add('WWW-Authenticate', join(', ', $challenges)); return $this->fixateCode(401); ...
[ "public", "function", "unauthorized", "(", "array", "$", "challenges", ")", ":", "self", "{", "if", "(", "count", "(", "$", "challenges", ")", "===", "0", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Challenges must contain at least one ent...
sets status to 401 Unauthorized @param string[] $challenges list of challenges @return \stubbles\webapp\response\Status @throws \InvalidArgumentException in case $challenges is empty
[ "sets", "status", "to", "401", "Unauthorized" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Status.php#L202-L210
stubbles/stubbles-webapp-core
src/main/php/response/Status.php
Status.rangeNotSatisfiable
public function rangeNotSatisfiable($total, string $rangeUnit = 'bytes'): self { $this->headers->add('Content-Range', $rangeUnit . ' */' . $total); return $this->fixateCode(416); }
php
public function rangeNotSatisfiable($total, string $rangeUnit = 'bytes'): self { $this->headers->add('Content-Range', $rangeUnit . ' */' . $total); return $this->fixateCode(416); }
[ "public", "function", "rangeNotSatisfiable", "(", "$", "total", ",", "string", "$", "rangeUnit", "=", "'bytes'", ")", ":", "self", "{", "$", "this", "->", "headers", "->", "add", "(", "'Content-Range'", ",", "$", "rangeUnit", ".", "' */'", ".", "$", "tot...
sets status to 416 Range Not Satisfiable @param int|string $total total length of content @param string $rangeUnit optional range unit, defaults to "bytes" @return \stubbles\webapp\response\Status
[ "sets", "status", "to", "416", "Range", "Not", "Satisfiable" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Status.php#L313-L317
stubbles/stubbles-webapp-core
src/main/php/response/Status.php
Status.line
public function line($httpVersion, string $sapi = PHP_SAPI): string { if ('cgi' === $sapi) { return 'Status: ' . $this->code . ' ' . $this->reasonPhrase; } return $httpVersion . ' ' . $this->code . ' ' . $this->reasonPhrase; }
php
public function line($httpVersion, string $sapi = PHP_SAPI): string { if ('cgi' === $sapi) { return 'Status: ' . $this->code . ' ' . $this->reasonPhrase; } return $httpVersion . ' ' . $this->code . ' ' . $this->reasonPhrase; }
[ "public", "function", "line", "(", "$", "httpVersion", ",", "string", "$", "sapi", "=", "PHP_SAPI", ")", ":", "string", "{", "if", "(", "'cgi'", "===", "$", "sapi", ")", "{", "return", "'Status: '", ".", "$", "this", "->", "code", ".", "' '", ".", ...
returns status line @param string $httpVersion @param string $sapi optional @return string
[ "returns", "status", "line" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Status.php#L386-L393
larakit/lk-staticfiles
src/StaticFiles/LarakitServiceProvider.php
LarakitServiceProvider.register
public function register() { $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'larakit.lk-staticfiles'); $this->mergeConfigFrom(__DIR__ . '/../config/js.php', 'larakit.lk-staticfiles.js'); $this->mergeConfigFrom(__DIR__ . '/../config/css.php', 'larakit.lk-staticfiles.css'); ...
php
public function register() { $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'larakit.lk-staticfiles'); $this->mergeConfigFrom(__DIR__ . '/../config/js.php', 'larakit.lk-staticfiles.js'); $this->mergeConfigFrom(__DIR__ . '/../config/css.php', 'larakit.lk-staticfiles.css'); ...
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "mergeConfigFrom", "(", "__DIR__", ".", "'/../config/config.php'", ",", "'larakit.lk-staticfiles'", ")", ";", "$", "this", "->", "mergeConfigFrom", "(", "__DIR__", ".", "'/../config/js.php'", ",",...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/larakit/lk-staticfiles/blob/1ee718b1f3a00c29c46b06c2f501413599b0335a/src/StaticFiles/LarakitServiceProvider.php#L22-L30
puli/twig-extension
src/PuliTemplateLoader.php
PuliTemplateLoader.getSource
public function getSource($path) { try { // The "loaded_by_puli" tag makes it possible to recognize node // trees of templates loaded through this loader. In this way, we // can turn relative Puli paths into absolute ones in those // templates. The "loaded_by_...
php
public function getSource($path) { try { // The "loaded_by_puli" tag makes it possible to recognize node // trees of templates loaded through this loader. In this way, we // can turn relative Puli paths into absolute ones in those // templates. The "loaded_by_...
[ "public", "function", "getSource", "(", "$", "path", ")", "{", "try", "{", "// The \"loaded_by_puli\" tag makes it possible to recognize node", "// trees of templates loaded through this loader. In this way, we", "// can turn relative Puli paths into absolute ones in those", "// templates....
Gets the source code of a template, given its name. @param string $path The name of the template to load @return string The template source code @throws Twig_Error_Loader When $path is not found
[ "Gets", "the", "source", "code", "of", "a", "template", "given", "its", "name", "." ]
train
https://github.com/puli/twig-extension/blob/b19fce610aa9fda5d86c73045ed5b9d378c47b93/src/PuliTemplateLoader.php#L46-L61
puli/twig-extension
src/PuliTemplateLoader.php
PuliTemplateLoader.getCacheKey
public function getCacheKey($path) { try { // Even though the path and $path are the same, call the locator to // make sure that the path actually exists // The result of this method MUST NOT be the real path (without // prefix), because then the generated fil...
php
public function getCacheKey($path) { try { // Even though the path and $path are the same, call the locator to // make sure that the path actually exists // The result of this method MUST NOT be the real path (without // prefix), because then the generated fil...
[ "public", "function", "getCacheKey", "(", "$", "path", ")", "{", "try", "{", "// Even though the path and $path are the same, call the locator to", "// make sure that the path actually exists", "// The result of this method MUST NOT be the real path (without", "// prefix), because then the...
Gets the cache key to use for the cache for a given template name. @param string $path The name of the template to load @return string The cache key @throws Twig_Error_Loader When $path is not found
[ "Gets", "the", "cache", "key", "to", "use", "for", "the", "cache", "for", "a", "given", "template", "name", "." ]
train
https://github.com/puli/twig-extension/blob/b19fce610aa9fda5d86c73045ed5b9d378c47b93/src/PuliTemplateLoader.php#L72-L89
puli/twig-extension
src/PuliTemplateLoader.php
PuliTemplateLoader.isFresh
public function isFresh($path, $time) { try { return $this->getResource($path)->getMetadata()->getModificationTime() <= $time; } catch (ResourceNotFoundException $e) { throw new Twig_Error_Loader($e->getMessage(), -1, null, $e); } catch (InvalidArgumentException $e) {...
php
public function isFresh($path, $time) { try { return $this->getResource($path)->getMetadata()->getModificationTime() <= $time; } catch (ResourceNotFoundException $e) { throw new Twig_Error_Loader($e->getMessage(), -1, null, $e); } catch (InvalidArgumentException $e) {...
[ "public", "function", "isFresh", "(", "$", "path", ",", "$", "time", ")", "{", "try", "{", "return", "$", "this", "->", "getResource", "(", "$", "path", ")", "->", "getMetadata", "(", ")", "->", "getModificationTime", "(", ")", "<=", "$", "time", ";"...
Returns true if the template is still fresh. @param string $path The template name @param int $time The last modification time of the cached template @return bool true if the template is fresh, false otherwise @throws Twig_Error_Loader When $path is not found
[ "Returns", "true", "if", "the", "template", "is", "still", "fresh", "." ]
train
https://github.com/puli/twig-extension/blob/b19fce610aa9fda5d86c73045ed5b9d378c47b93/src/PuliTemplateLoader.php#L101-L110
vespolina/VespolinaCommerceBundle
DependencyInjection/Configuration.php
Configuration.getConfigTreeBuilder
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('vespolina_commerce'); $rootNode ->children() ->scalarNode('db_driver')->cannotBeOverwritten()->isRequired()->cannotBeEmpty()->end() ->end() ...
php
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('vespolina_commerce'); $rootNode ->children() ->scalarNode('db_driver')->cannotBeOverwritten()->isRequired()->cannotBeEmpty()->end() ->end() ...
[ "public", "function", "getConfigTreeBuilder", "(", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", ")", ";", "$", "rootNode", "=", "$", "treeBuilder", "->", "root", "(", "'vespolina_commerce'", ")", ";", "$", "rootNode", "->", "children", "(", ...
Generates the configuration tree. @return TreeBuilder
[ "Generates", "the", "configuration", "tree", "." ]
train
https://github.com/vespolina/VespolinaCommerceBundle/blob/0644dd2c0fb39637a0a6c2838b02e17bc480bdbc/DependencyInjection/Configuration.php#L26-L51
Wonail/wocenter
helpers/UrlHelper.php
UrlHelper.convertUrlQuery
public static function convertUrlQuery($query) { if (empty($query)) { return []; } $queryParts = explode('&', $query); $params = []; foreach ($queryParts as $param) { $item = explode('=', $param); // FIXED:2016-07-13 解析数组型参数 $po...
php
public static function convertUrlQuery($query) { if (empty($query)) { return []; } $queryParts = explode('&', $query); $params = []; foreach ($queryParts as $param) { $item = explode('=', $param); // FIXED:2016-07-13 解析数组型参数 $po...
[ "public", "static", "function", "convertUrlQuery", "(", "$", "query", ")", "{", "if", "(", "empty", "(", "$", "query", ")", ")", "{", "return", "[", "]", ";", "}", "$", "queryParts", "=", "explode", "(", "'&'", ",", "$", "query", ")", ";", "$", "...
将URL中的参数取出来放到数组里 @param string $query @return array $params
[ "将URL中的参数取出来放到数组里" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/UrlHelper.php#L20-L39
Wonail/wocenter
helpers/UrlHelper.php
UrlHelper.getUrlQuery
public static function getUrlQuery(array $array_query) { $tmp = []; foreach ($array_query as $name => $value) { if (is_array($value)) { foreach ($value as $k => $v) { $tmp[] = "{$name}[{$k}]={$v}"; } } else { ...
php
public static function getUrlQuery(array $array_query) { $tmp = []; foreach ($array_query as $name => $value) { if (is_array($value)) { foreach ($value as $k => $v) { $tmp[] = "{$name}[{$k}]={$v}"; } } else { ...
[ "public", "static", "function", "getUrlQuery", "(", "array", "$", "array_query", ")", "{", "$", "tmp", "=", "[", "]", ";", "foreach", "(", "$", "array_query", "as", "$", "name", "=>", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ...
将 参数数组 变回 字符串形式的参数格式 @param array $array_query @return string
[ "将", "参数数组", "变回", "字符串形式的参数格式" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/UrlHelper.php#L48-L62
Wonail/wocenter
helpers/UrlHelper.php
UrlHelper.unsetParams
public static function unsetParams($url = '', $params = '', $format = true) { if (strpos($url, '?') === false) { return $url; } $parseUrl = static::parseUrl($url); if (isset($parseUrl['query'])) { foreach (explode(',', $params) as $param) { if ...
php
public static function unsetParams($url = '', $params = '', $format = true) { if (strpos($url, '?') === false) { return $url; } $parseUrl = static::parseUrl($url); if (isset($parseUrl['query'])) { foreach (explode(',', $params) as $param) { if ...
[ "public", "static", "function", "unsetParams", "(", "$", "url", "=", "''", ",", "$", "params", "=", "''", ",", "$", "format", "=", "true", ")", "{", "if", "(", "strpos", "(", "$", "url", ",", "'?'", ")", "===", "false", ")", "{", "return", "$", ...
删除url地址里指定的参数 @param string $url @param string $params 待删除参数名,不支持删除数组参数 @param boolean $format 是否返回格式化后干净的url地址,默认格式化 @return string|array 干净的url或包含path、query等信息的数组
[ "删除url地址里指定的参数" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/UrlHelper.php#L73-L94
Wonail/wocenter
helpers/UrlHelper.php
UrlHelper.parseUrl
public static function parseUrl($url) { $parseUrl = parse_url($url); if (isset($parseUrl['query'])) { // 修复Pjax参数。该参数带#符号,导致该参数后的其他参数被标识为fragment if (strpos($parseUrl['query'], '_pjax') !== false && isset($parseUrl['fragment'])) { $parseUrl['query'] .= $parseU...
php
public static function parseUrl($url) { $parseUrl = parse_url($url); if (isset($parseUrl['query'])) { // 修复Pjax参数。该参数带#符号,导致该参数后的其他参数被标识为fragment if (strpos($parseUrl['query'], '_pjax') !== false && isset($parseUrl['fragment'])) { $parseUrl['query'] .= $parseU...
[ "public", "static", "function", "parseUrl", "(", "$", "url", ")", "{", "$", "parseUrl", "=", "parse_url", "(", "$", "url", ")", ";", "if", "(", "isset", "(", "$", "parseUrl", "[", "'query'", "]", ")", ")", "{", "// 修复Pjax参数。该参数带#符号,导致该参数后的其他参数被标识为fragment"...
解析url地址,返回的query请求参数为数组格式 @param string $url @return array ['path', 'query']
[ "解析url地址,返回的query请求参数为数组格式" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/UrlHelper.php#L103-L116
drunomics/service-utils
src/Core/Entity/EntityRepositoryTrait.php
EntityRepositoryTrait.getEntityRepository
public function getEntityRepository() { if (empty($this->entityRepository)) { $this->entityRepository = \Drupal::service('entity.repository'); } return $this->entityRepository; }
php
public function getEntityRepository() { if (empty($this->entityRepository)) { $this->entityRepository = \Drupal::service('entity.repository'); } return $this->entityRepository; }
[ "public", "function", "getEntityRepository", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "entityRepository", ")", ")", "{", "$", "this", "->", "entityRepository", "=", "\\", "Drupal", "::", "service", "(", "'entity.repository'", ")", ";", "}...
Gets the entity repository. @return \Drupal\Core\Entity\EntityRepositoryInterface The entity repository.
[ "Gets", "the", "entity", "repository", "." ]
train
https://github.com/drunomics/service-utils/blob/56761750043132365ef4ae5d9e0cf4263459328f/src/Core/Entity/EntityRepositoryTrait.php#L38-L43
adminarchitect/contacts
src/Terranet/Contacts/Contacts.php
Contacts.department
public function department($name, Closure $callback) { $department = $this->createDepartment($name); call_user_func($callback, $department); if (is_null(static::$departments)) { static::$departments = Collection::make([]); } static::$departments->push($departme...
php
public function department($name, Closure $callback) { $department = $this->createDepartment($name); call_user_func($callback, $department); if (is_null(static::$departments)) { static::$departments = Collection::make([]); } static::$departments->push($departme...
[ "public", "function", "department", "(", "$", "name", ",", "Closure", "$", "callback", ")", "{", "$", "department", "=", "$", "this", "->", "createDepartment", "(", "$", "name", ")", ";", "call_user_func", "(", "$", "callback", ",", "$", "department", ")...
Register new department @param $name @param Closure $callback @return $this
[ "Register", "new", "department" ]
train
https://github.com/adminarchitect/contacts/blob/f46e6a13a2d5802ad32c446d5a7e0fbc878a4b5e/src/Terranet/Contacts/Contacts.php#L60-L73
crossjoin/Css
src/Crossjoin/Css/Format/StyleSheet/StyleSheet.php
StyleSheet.setCharset
public function setCharset($charset) { if (is_string($charset)) { if (in_array($charset, mb_list_encodings())) { $this->charset = $charset; } else { throw new \InvalidArgumentException( "Invalid value '" . $charset . "' for argument...
php
public function setCharset($charset) { if (is_string($charset)) { if (in_array($charset, mb_list_encodings())) { $this->charset = $charset; } else { throw new \InvalidArgumentException( "Invalid value '" . $charset . "' for argument...
[ "public", "function", "setCharset", "(", "$", "charset", ")", "{", "if", "(", "is_string", "(", "$", "charset", ")", ")", "{", "if", "(", "in_array", "(", "$", "charset", ",", "mb_list_encodings", "(", ")", ")", ")", "{", "$", "this", "->", "charset"...
Sets the charset for the style sheet. @param string $charset @return $this
[ "Sets", "the", "charset", "for", "the", "style", "sheet", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/StyleSheet/StyleSheet.php#L23-L40
harp-orm/query
src/Compiler/Set.php
Set.renderValue
public static function renderValue(SQL\Set $item) { $value = $item->getValue(); $content = $item->getContent(); if ($value instanceof SQL\SQL) { return $value->getContent(); } elseif ($value instanceof Query\Select) { return Compiler::braced(Select::render($v...
php
public static function renderValue(SQL\Set $item) { $value = $item->getValue(); $content = $item->getContent(); if ($value instanceof SQL\SQL) { return $value->getContent(); } elseif ($value instanceof Query\Select) { return Compiler::braced(Select::render($v...
[ "public", "static", "function", "renderValue", "(", "SQL", "\\", "Set", "$", "item", ")", "{", "$", "value", "=", "$", "item", "->", "getValue", "(", ")", ";", "$", "content", "=", "$", "item", "->", "getContent", "(", ")", ";", "if", "(", "$", "...
Render the value of Set object @param SQL\Set $item @return string
[ "Render", "the", "value", "of", "Set", "object" ]
train
https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Compiler/Set.php#L31-L45
harp-orm/query
src/Compiler/Set.php
Set.render
public static function render(SQL\Set $item) { return Compiler::expression(array( Compiler::name($item->getContent()), '=', self::renderValue($item) )); }
php
public static function render(SQL\Set $item) { return Compiler::expression(array( Compiler::name($item->getContent()), '=', self::renderValue($item) )); }
[ "public", "static", "function", "render", "(", "SQL", "\\", "Set", "$", "item", ")", "{", "return", "Compiler", "::", "expression", "(", "array", "(", "Compiler", "::", "name", "(", "$", "item", "->", "getContent", "(", ")", ")", ",", "'='", ",", "se...
Render a Set object @param SQL\Set $item @return string
[ "Render", "a", "Set", "object" ]
train
https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Compiler/Set.php#L72-L79
jasny/router
src/Router/Runner/Controller.php
Controller.withFactory
public function withFactory($factory) { if (!is_callable($factory)) { throw new \InvalidArgumentException("Factory isn't callable"); } $runner = clone $this; $runner->factory = $factory; return $runner; }
php
public function withFactory($factory) { if (!is_callable($factory)) { throw new \InvalidArgumentException("Factory isn't callable"); } $runner = clone $this; $runner->factory = $factory; return $runner; }
[ "public", "function", "withFactory", "(", "$", "factory", ")", "{", "if", "(", "!", "is_callable", "(", "$", "factory", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Factory isn't callable\"", ")", ";", "}", "$", "runner", "=", "...
Create a clone that uses the provided factory @param callable $factory
[ "Create", "a", "clone", "that", "uses", "the", "provided", "factory" ]
train
https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Runner/Controller.php#L30-L40
jasny/router
src/Router/Runner/Controller.php
Controller.run
public function run(ServerRequestInterface $request, ResponseInterface $response) { $route = $request->getAttribute('route'); $name = !empty($route->controller) ? $route->controller : 'default'; try { $controller = call_user_func($this->getFactory(), $name); ...
php
public function run(ServerRequestInterface $request, ResponseInterface $response) { $route = $request->getAttribute('route'); $name = !empty($route->controller) ? $route->controller : 'default'; try { $controller = call_user_func($this->getFactory(), $name); ...
[ "public", "function", "run", "(", "ServerRequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "$", "route", "=", "$", "request", "->", "getAttribute", "(", "'route'", ")", ";", "$", "name", "=", "!", "empty", "(", "$", ...
Route to a controller @param ServerRequestInterface $request @param ResponseInterface $response @return ResponseInterface|mixed
[ "Route", "to", "a", "controller" ]
train
https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Runner/Controller.php#L64-L83
tequila/mongodb-php-lib
src/Client.php
Client.dropDatabase
public function dropDatabase($databaseName, array $options = []) { $cursor = $this ->getCommandExecutor() ->executeCommand( $this->manager, $databaseName, ['dropDatabase' => 1], $options ); return $c...
php
public function dropDatabase($databaseName, array $options = []) { $cursor = $this ->getCommandExecutor() ->executeCommand( $this->manager, $databaseName, ['dropDatabase' => 1], $options ); return $c...
[ "public", "function", "dropDatabase", "(", "$", "databaseName", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "cursor", "=", "$", "this", "->", "getCommandExecutor", "(", ")", "->", "executeCommand", "(", "$", "this", "->", "manager", ",", ...
@param string $databaseName @param array $options @return array
[ "@param", "string", "$databaseName", "@param", "array", "$options" ]
train
https://github.com/tequila/mongodb-php-lib/blob/49a25f45268df358f5ceb40a655d9a7ddc6db4f7/src/Client.php#L62-L74
jan-dolata/crude-crud
src/Engine/CrudeSetupTrait/ExtraColumn.php
ExtraColumn.setExtraColumn
public function setExtraColumn($name, $visible = false, $description = '') { $extraColumns = is_array($name) ? $name : [[$name, $visible, $description]]; foreach ($extraColumns as $column) { if (! is_array($column)) $column = [$column]; ...
php
public function setExtraColumn($name, $visible = false, $description = '') { $extraColumns = is_array($name) ? $name : [[$name, $visible, $description]]; foreach ($extraColumns as $column) { if (! is_array($column)) $column = [$column]; ...
[ "public", "function", "setExtraColumn", "(", "$", "name", ",", "$", "visible", "=", "false", ",", "$", "description", "=", "''", ")", "{", "$", "extraColumns", "=", "is_array", "(", "$", "name", ")", "?", "$", "name", ":", "[", "[", "$", "name", ",...
Sets the Extra column. @param array|sting $name @param sting $description = true @param boolean $visible = false @return self
[ "Sets", "the", "Extra", "column", "." ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/ExtraColumn.php#L33-L51
JoffreyPoreeCoding/MongoDB-ODM
src/GridFS/Hydrator.php
Hydrator.hydrate
public function hydrate(&$object, $datas, $soft = false, $maxReferenceDepth = 10) { $stream = $object->getStream(); if (isset($datas['stream'])) { $stream = $datas['stream']; unset($datas['stream']); } if (isset($datas["metadata"])) { $metadata = ...
php
public function hydrate(&$object, $datas, $soft = false, $maxReferenceDepth = 10) { $stream = $object->getStream(); if (isset($datas['stream'])) { $stream = $datas['stream']; unset($datas['stream']); } if (isset($datas["metadata"])) { $metadata = ...
[ "public", "function", "hydrate", "(", "&", "$", "object", ",", "$", "datas", ",", "$", "soft", "=", "false", ",", "$", "maxReferenceDepth", "=", "10", ")", "{", "$", "stream", "=", "$", "object", "->", "getStream", "(", ")", ";", "if", "(", "isset"...
Hydrate an object from data @param mixed $object Object to hydrate @param mixed $datas Data to hydrate object @param integer $maxReference Depth Maximum reference depth @return void
[ "Hydrate", "an", "object", "from", "data" ]
train
https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/GridFS/Hydrator.php#L21-L39
JoffreyPoreeCoding/MongoDB-ODM
src/GridFS/Hydrator.php
Hydrator.unhydrate
public function unhydrate($object) { $datas = parent::unhydrate($object); $properties = $this->classMetadata->getPropertiesInfos(); foreach ($properties as $name => $infos) { if ($infos->getMetadata()) { if (isset($datas[$infos->getField()])) { ...
php
public function unhydrate($object) { $datas = parent::unhydrate($object); $properties = $this->classMetadata->getPropertiesInfos(); foreach ($properties as $name => $infos) { if ($infos->getMetadata()) { if (isset($datas[$infos->getField()])) { ...
[ "public", "function", "unhydrate", "(", "$", "object", ")", "{", "$", "datas", "=", "parent", "::", "unhydrate", "(", "$", "object", ")", ";", "$", "properties", "=", "$", "this", "->", "classMetadata", "->", "getPropertiesInfos", "(", ")", ";", "foreach...
Unhydrate object to array @param mixed $object Object to unhydrate @return array
[ "Unhydrate", "object", "to", "array" ]
train
https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/GridFS/Hydrator.php#L46-L59
gregorybesson/PlaygroundCore
src/Mapper/Cronjob.php
Cronjob.getPending
public function getPending() { $dqb = $this->_em->createQueryBuilder(); $dqb->select(array('j')) ->from('PlaygroundCore\Entity\Cronjob', 'j') ->where($dqb->expr()->in('j.status', array(self::STATUS_PENDING))) ->orderBy('j.scheduleTime', 'ASC'); return $dq...
php
public function getPending() { $dqb = $this->_em->createQueryBuilder(); $dqb->select(array('j')) ->from('PlaygroundCore\Entity\Cronjob', 'j') ->where($dqb->expr()->in('j.status', array(self::STATUS_PENDING))) ->orderBy('j.scheduleTime', 'ASC'); return $dq...
[ "public", "function", "getPending", "(", ")", "{", "$", "dqb", "=", "$", "this", "->", "_em", "->", "createQueryBuilder", "(", ")", ";", "$", "dqb", "->", "select", "(", "array", "(", "'j'", ")", ")", "->", "from", "(", "'PlaygroundCore\\Entity\\Cronjob'...
get pending cron jobs @return array of \Heartsentwined\Cron\Entity\Job
[ "get", "pending", "cron", "jobs" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Mapper/Cronjob.php#L20-L29
gregorybesson/PlaygroundCore
src/Mapper/Cronjob.php
Cronjob.getRunning
public function getRunning() { $dqb = $this->_em->createQueryBuilder(); $dqb->select(array('j')) ->from('PlaygroundCore\Entity\Cronjob', 'j') ->where($dqb->expr()->in('j.status', array(self::STATUS_RUNNING))) ->orderBy('j.scheduleTime', 'ASC'); return $dq...
php
public function getRunning() { $dqb = $this->_em->createQueryBuilder(); $dqb->select(array('j')) ->from('PlaygroundCore\Entity\Cronjob', 'j') ->where($dqb->expr()->in('j.status', array(self::STATUS_RUNNING))) ->orderBy('j.scheduleTime', 'ASC'); return $dq...
[ "public", "function", "getRunning", "(", ")", "{", "$", "dqb", "=", "$", "this", "->", "_em", "->", "createQueryBuilder", "(", ")", ";", "$", "dqb", "->", "select", "(", "array", "(", "'j'", ")", ")", "->", "from", "(", "'PlaygroundCore\\Entity\\Cronjob'...
get running cron jobs @return array of \PlaygroundCore\Entity\Job
[ "get", "running", "cron", "jobs" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Mapper/Cronjob.php#L36-L45
gregorybesson/PlaygroundCore
src/Mapper/Cronjob.php
Cronjob.getHistory
public function getHistory() { $dqb = $this->_em->createQueryBuilder(); $dqb->select(array('j')) ->from('PlaygroundCore\Entity\Cronjob', 'j') ->where($dqb->expr()->in('j.status', array( self::STATUS_SUCCESS, self::STATUS_MISSED, self::STATUS_ERROR, ...
php
public function getHistory() { $dqb = $this->_em->createQueryBuilder(); $dqb->select(array('j')) ->from('PlaygroundCore\Entity\Cronjob', 'j') ->where($dqb->expr()->in('j.status', array( self::STATUS_SUCCESS, self::STATUS_MISSED, self::STATUS_ERROR, ...
[ "public", "function", "getHistory", "(", ")", "{", "$", "dqb", "=", "$", "this", "->", "_em", "->", "createQueryBuilder", "(", ")", ";", "$", "dqb", "->", "select", "(", "array", "(", "'j'", ")", ")", "->", "from", "(", "'PlaygroundCore\\Entity\\Cronjob'...
get completed cron jobs @return array of \PlaygroundCore\Entity\Job
[ "get", "completed", "cron", "jobs" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Mapper/Cronjob.php#L52-L63
phossa2/middleware
src/Middleware/Middleware/WhoopsMiddleware.php
WhoopsMiddleware.process
public function process( RequestInterface $request, ResponseInterface $response, DelegateInterface $next = null ) { try { if ($next) { return $next->next($request, $response); } return $response; } catch (\Exception $e) { ...
php
public function process( RequestInterface $request, ResponseInterface $response, DelegateInterface $next = null ) { try { if ($next) { return $next->next($request, $response); } return $response; } catch (\Exception $e) { ...
[ "public", "function", "process", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ",", "DelegateInterface", "$", "next", "=", "null", ")", "{", "try", "{", "if", "(", "$", "next", ")", "{", "return", "$", "next", "->", ...
Should be the very first middleware in the queue {@inheritDoc}
[ "Should", "be", "the", "very", "first", "middleware", "in", "the", "queue" ]
train
https://github.com/phossa2/middleware/blob/518e97ae48077f2c11adcd3c2393830ed7ab7ce7/src/Middleware/Middleware/WhoopsMiddleware.php#L41-L54
discophp/framework
core/classes/FileHelper.class.php
FileHelper.iniHumanFriendlySize
public function iniHumanFriendlySize($size){ switch( substr($size,-1) ) { case 'G': $size = $size * 1024; case 'M': $size = $size * 1024; case 'K': $size = $size * 1024; }//switch return $this->humanFileSize($s...
php
public function iniHumanFriendlySize($size){ switch( substr($size,-1) ) { case 'G': $size = $size * 1024; case 'M': $size = $size * 1024; case 'K': $size = $size * 1024; }//switch return $this->humanFileSize($s...
[ "public", "function", "iniHumanFriendlySize", "(", "$", "size", ")", "{", "switch", "(", "substr", "(", "$", "size", ",", "-", "1", ")", ")", "{", "case", "'G'", ":", "$", "size", "=", "$", "size", "*", "1024", ";", "case", "'M'", ":", "$", "size...
Human friendly file size of a value using a convention supported in php ini values. @param string $size The ini size. @return string
[ "Human", "friendly", "file", "size", "of", "a", "value", "using", "a", "convention", "supported", "in", "php", "ini", "values", "." ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/FileHelper.class.php#L46-L59
discophp/framework
core/classes/FileHelper.class.php
FileHelper.getMimeType
public function getMimeType($file){ if(function_exists('finfo_open')) { $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME; $info = finfo_open($const); if($info && ($result = finfo_file($info,$file,$const)) !== false){ finfo_close($in...
php
public function getMimeType($file){ if(function_exists('finfo_open')) { $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME; $info = finfo_open($const); if($info && ($result = finfo_file($info,$file,$const)) !== false){ finfo_close($in...
[ "public", "function", "getMimeType", "(", "$", "file", ")", "{", "if", "(", "function_exists", "(", "'finfo_open'", ")", ")", "{", "$", "const", "=", "defined", "(", "'FILEINFO_MIME_TYPE'", ")", "?", "FILEINFO_MIME_TYPE", ":", "FILEINFO_MIME", ";", "$", "inf...
Get a file type based on the file MIME info. @param string $file The file. @return string The type.
[ "Get", "a", "file", "type", "based", "on", "the", "file", "MIME", "info", "." ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/FileHelper.class.php#L85-L100
discophp/framework
core/classes/FileHelper.class.php
FileHelper.getMimeTypeByExtension
public function getMimeTypeByExtension($path){ if(!$this->mimeCache){ $this->mimeCache = require \App::getAlias('disco.mime'); }//if if(isset($this->mimeCache[$this->getExtension($path)])){ return $this->mimeCache[$this->getExtension($path)]; }//if retu...
php
public function getMimeTypeByExtension($path){ if(!$this->mimeCache){ $this->mimeCache = require \App::getAlias('disco.mime'); }//if if(isset($this->mimeCache[$this->getExtension($path)])){ return $this->mimeCache[$this->getExtension($path)]; }//if retu...
[ "public", "function", "getMimeTypeByExtension", "(", "$", "path", ")", "{", "if", "(", "!", "$", "this", "->", "mimeCache", ")", "{", "$", "this", "->", "mimeCache", "=", "require", "\\", "App", "::", "getAlias", "(", "'disco.mime'", ")", ";", "}", "//...
Get a file extension type based on the file MIME info. @param string $path The file. @return null|string The extension.
[ "Get", "a", "file", "extension", "type", "based", "on", "the", "file", "MIME", "info", "." ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/FileHelper.class.php#L112-L124
discophp/framework
core/classes/FileHelper.class.php
FileHelper.emptyDir
public function emptyDir($path,$except = Array()){ try { $iterator = new \DirectoryIterator($path); foreach ($iterator as $file){ if($file->isDot() || in_array($file->getPathname(),$except)){ continue; }//if if($fil...
php
public function emptyDir($path,$except = Array()){ try { $iterator = new \DirectoryIterator($path); foreach ($iterator as $file){ if($file->isDot() || in_array($file->getPathname(),$except)){ continue; }//if if($fil...
[ "public", "function", "emptyDir", "(", "$", "path", ",", "$", "except", "=", "Array", "(", ")", ")", "{", "try", "{", "$", "iterator", "=", "new", "\\", "DirectoryIterator", "(", "$", "path", ")", ";", "foreach", "(", "$", "iterator", "as", "$", "f...
Empty a directory. @param string $path The directory to empty. @param array $except Don't remove paths included in this array. @return boolean
[ "Empty", "a", "directory", "." ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/FileHelper.class.php#L151-L180
discophp/framework
core/classes/FileHelper.class.php
FileHelper.copyDir
public function copyDir($path, $toPath, $nested = false){ $path = rtrim($path,'/') . '/'; $toPath = rtrim($toPath,'/') . '/'; if(!$nested){ if(!is_dir($toPath) && !mkdir($toPath)){ return false; }//if $this->copyDirBasePathLen = strlen($path)...
php
public function copyDir($path, $toPath, $nested = false){ $path = rtrim($path,'/') . '/'; $toPath = rtrim($toPath,'/') . '/'; if(!$nested){ if(!is_dir($toPath) && !mkdir($toPath)){ return false; }//if $this->copyDirBasePathLen = strlen($path)...
[ "public", "function", "copyDir", "(", "$", "path", ",", "$", "toPath", ",", "$", "nested", "=", "false", ")", "{", "$", "path", "=", "rtrim", "(", "$", "path", ",", "'/'", ")", ".", "'/'", ";", "$", "toPath", "=", "rtrim", "(", "$", "toPath", "...
Copy a directory. @param string $path The directory to copy. @param string $toPath The directory to copy to. @param boolean $nested Whether to create the $path directory in $toPath or not. @return boolean
[ "Copy", "a", "directory", "." ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/FileHelper.class.php#L213-L254
discophp/framework
core/classes/FileHelper.class.php
FileHelper.chmodRecursive
public function chmodRecursive($path, $mode){ $items = $this->recursiveIterate($path); foreach($items as $item){ chmod($item,$mode); }//foreach }
php
public function chmodRecursive($path, $mode){ $items = $this->recursiveIterate($path); foreach($items as $item){ chmod($item,$mode); }//foreach }
[ "public", "function", "chmodRecursive", "(", "$", "path", ",", "$", "mode", ")", "{", "$", "items", "=", "$", "this", "->", "recursiveIterate", "(", "$", "path", ")", ";", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "chmod", "(", "$"...
Change file mode for directory and all contents. @param string $path The directory to chmod recursivly. @param int $mode The file mode to apply.
[ "Change", "file", "mode", "for", "directory", "and", "all", "contents", "." ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/FileHelper.class.php#L265-L273
discophp/framework
core/classes/FileHelper.class.php
FileHelper.serveFile
public function serveFile($path){ $this->isFileOrDie($path); header('Content-type: ' . $this->getMimeTypeByExtension($path)); $this->serve($path); }
php
public function serveFile($path){ $this->isFileOrDie($path); header('Content-type: ' . $this->getMimeTypeByExtension($path)); $this->serve($path); }
[ "public", "function", "serveFile", "(", "$", "path", ")", "{", "$", "this", "->", "isFileOrDie", "(", "$", "path", ")", ";", "header", "(", "'Content-type: '", ".", "$", "this", "->", "getMimeTypeByExtension", "(", "$", "path", ")", ")", ";", "$", "thi...
Serve a file with the proper `Content-type` header value set for use in a browser context. The content type is determined by calling `$this->getMimeTypeByExtension($path)`. If the file doesn't exist then it will serve a 404. @param string $path The file to serve. @return void
[ "Serve", "a", "file", "with", "the", "proper", "Content", "-", "type", "header", "value", "set", "for", "use", "in", "a", "browser", "context", ".", "The", "content", "type", "is", "determined", "by", "calling", "$this", "-", ">", "getMimeTypeByExtension", ...
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/FileHelper.class.php#L287-L294
discophp/framework
core/classes/FileHelper.class.php
FileHelper.XServeFile
public function XServeFile($path){ $this->isFileOrDie($path); header('Content-type: ' . $this->getMimeTypeByExtension($path)); $this->Xserve($path); }
php
public function XServeFile($path){ $this->isFileOrDie($path); header('Content-type: ' . $this->getMimeTypeByExtension($path)); $this->Xserve($path); }
[ "public", "function", "XServeFile", "(", "$", "path", ")", "{", "$", "this", "->", "isFileOrDie", "(", "$", "path", ")", ";", "header", "(", "'Content-type: '", ".", "$", "this", "->", "getMimeTypeByExtension", "(", "$", "path", ")", ")", ";", "$", "th...
Serve a file using the Apache module XSendFile `https://tn123.org/mod_xsendfile/` with the proper `Content-type` header value set for use in a browser context. The content type is determined by calling `$this->getMimeTypeByExtension($path)`. If the file doesn't exist then it will serve a 404. @param string $path The ...
[ "Serve", "a", "file", "using", "the", "Apache", "module", "XSendFile", "https", ":", "//", "tn123", ".", "org", "/", "mod_xsendfile", "/", "with", "the", "proper", "Content", "-", "type", "header", "value", "set", "for", "use", "in", "a", "browser", "con...
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/FileHelper.class.php#L308-L315
discophp/framework
core/classes/FileHelper.class.php
FileHelper.serveAsDownload
public function serveAsDownload($path){ $this->isFileOrDie($path); $this->downloadHeaders($path); $this->serve($path); }
php
public function serveAsDownload($path){ $this->isFileOrDie($path); $this->downloadHeaders($path); $this->serve($path); }
[ "public", "function", "serveAsDownload", "(", "$", "path", ")", "{", "$", "this", "->", "isFileOrDie", "(", "$", "path", ")", ";", "$", "this", "->", "downloadHeaders", "(", "$", "path", ")", ";", "$", "this", "->", "serve", "(", "$", "path", ")", ...
Serve a file as a download. @param string $path The file to be downloaded. @return void
[ "Serve", "a", "file", "as", "a", "download", "." ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/FileHelper.class.php#L327-L334
discophp/framework
core/classes/FileHelper.class.php
FileHelper.XServeAsDownload
public function XServeAsDownload($path){ $this->isFileOrDie($path); $this->downloadHeaders($path); $this->XServe($path); }
php
public function XServeAsDownload($path){ $this->isFileOrDie($path); $this->downloadHeaders($path); $this->XServe($path); }
[ "public", "function", "XServeAsDownload", "(", "$", "path", ")", "{", "$", "this", "->", "isFileOrDie", "(", "$", "path", ")", ";", "$", "this", "->", "downloadHeaders", "(", "$", "path", ")", ";", "$", "this", "->", "XServe", "(", "$", "path", ")", ...
Serve a file as a download using the Apache module XSendFile. @param string $path The file to be downloaded. @return void
[ "Serve", "a", "file", "as", "a", "download", "using", "the", "Apache", "module", "XSendFile", "." ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/FileHelper.class.php#L346-L353
huasituo/hstcms
src/Console/Commands/HookManageCommand.php
HookManageCommand.handle
public function handle() { $slug = $this->argument('slug'); $value = $this->argument('value'); if($slug && $value) { if($slug == 'module') { HookModel::del('', $value); } else { HookModel::del($value); } $this->c...
php
public function handle() { $slug = $this->argument('slug'); $value = $this->argument('value'); if($slug && $value) { if($slug == 'module') { HookModel::del('', $value); } else { HookModel::del($value); } $this->c...
[ "public", "function", "handle", "(", ")", "{", "$", "slug", "=", "$", "this", "->", "argument", "(", "'slug'", ")", ";", "$", "value", "=", "$", "this", "->", "argument", "(", "'value'", ")", ";", "if", "(", "$", "slug", "&&", "$", "value", ")", ...
Execute the console command. @return mixed
[ "Execute", "the", "console", "command", "." ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Console/Commands/HookManageCommand.php#L35-L48
bfitech/zapcore
src/Router.php
Router.config_home
private function config_home($home) { if (!is_string($home) || !$home || $home[0] != '/') return; $home = rtrim($home, '/') . '/'; $this->home = $home; }
php
private function config_home($home) { if (!is_string($home) || !$home || $home[0] != '/') return; $home = rtrim($home, '/') . '/'; $this->home = $home; }
[ "private", "function", "config_home", "(", "$", "home", ")", "{", "if", "(", "!", "is_string", "(", "$", "home", ")", "||", "!", "$", "home", "||", "$", "home", "[", "0", "]", "!=", "'/'", ")", "return", ";", "$", "home", "=", "rtrim", "(", "$"...
Home configuration validation.
[ "Home", "configuration", "validation", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L52-L57
bfitech/zapcore
src/Router.php
Router.config_host
private function config_host(string $host=null) { if (filter_var($host, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED) === false) return; $host = rtrim($host, '/') . '/'; $home = $this->home; if ($home == '/') { $this->host = $host; return; } # home must be at the end of host if (substr($hos...
php
private function config_host(string $host=null) { if (filter_var($host, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED) === false) return; $host = rtrim($host, '/') . '/'; $home = $this->home; if ($home == '/') { $this->host = $host; return; } # home must be at the end of host if (substr($hos...
[ "private", "function", "config_host", "(", "string", "$", "host", "=", "null", ")", "{", "if", "(", "filter_var", "(", "$", "host", ",", "FILTER_VALIDATE_URL", ",", "FILTER_FLAG_PATH_REQUIRED", ")", "===", "false", ")", "return", ";", "$", "host", "=", "rt...
Host configuration validation.
[ "Host", "configuration", "validation", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L62-L76
bfitech/zapcore
src/Router.php
Router.config
final public function config(string $key, $val) { if ($this->request_initted) return $this; switch ($key) { case 'home': $this->config_home($val); return $this; case 'host': $this->config_host($val); return $this; case 'shutdown': $this->auto_shutdown = (bool)$val; return $this; ...
php
final public function config(string $key, $val) { if ($this->request_initted) return $this; switch ($key) { case 'home': $this->config_home($val); return $this; case 'host': $this->config_host($val); return $this; case 'shutdown': $this->auto_shutdown = (bool)$val; return $this; ...
[ "final", "public", "function", "config", "(", "string", "$", "key", ",", "$", "val", ")", "{", "if", "(", "$", "this", "->", "request_initted", ")", "return", "$", "this", ";", "switch", "(", "$", "key", ")", "{", "case", "'home'", ":", "$", "this"...
Configure. If using constructor is too verbose or cumbersome, use this to finetune properties. @param string $key Configuration key. @param mixed $val Configuration value.
[ "Configure", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L87-L110
bfitech/zapcore
src/Router.php
Router.init
final public function init() { if ($this->request_initted) return; $this->init_request(); if ($this->auto_shutdown) register_shutdown_function([$this, 'shutdown']); $this->request_initted = true; return $this; }
php
final public function init() { if ($this->request_initted) return; $this->init_request(); if ($this->auto_shutdown) register_shutdown_function([$this, 'shutdown']); $this->request_initted = true; return $this; }
[ "final", "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "request_initted", ")", "return", ";", "$", "this", "->", "init_request", "(", ")", ";", "if", "(", "$", "this", "->", "auto_shutdown", ")", "register_shutdown_function", ...
Initialize parser and shutdown handler. Only manually call this in case you need to do something prior to calling $this->route() as that method will internally call this.
[ "Initialize", "parser", "and", "shutdown", "handler", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L119-L127
bfitech/zapcore
src/Router.php
Router.deinit
final public function deinit() { $this->request_path = null; $this->request_comp = []; $this->home = null; $this->host = null; $this->auto_shutdown = true; $this->request_initted = false; $this->request_handled = false; $this->request_method = null; $this->method_collection = []; return $this; ...
php
final public function deinit() { $this->request_path = null; $this->request_comp = []; $this->home = null; $this->host = null; $this->auto_shutdown = true; $this->request_initted = false; $this->request_handled = false; $this->request_method = null; $this->method_collection = []; return $this; ...
[ "final", "public", "function", "deinit", "(", ")", "{", "$", "this", "->", "request_path", "=", "null", ";", "$", "this", "->", "request_comp", "=", "[", "]", ";", "$", "this", "->", "home", "=", "null", ";", "$", "this", "->", "host", "=", "null",...
Reset properties to default values. Mostly useful for testing, so that you don't have to repeatedly instantiate the object.
[ "Reset", "properties", "to", "default", "values", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L135-L150
bfitech/zapcore
src/Router.php
Router.autodetect_home
private function autodetect_home() { if ($this->home !== null) return; if (php_sapi_name() == 'cli') return $this->home = '/'; $home = dirname($_SERVER['SCRIPT_NAME']); $home = !$home || $home[0] != '/' ? '/' : rtrim($home, '/') . '/'; $this->home = $home; }
php
private function autodetect_home() { if ($this->home !== null) return; if (php_sapi_name() == 'cli') return $this->home = '/'; $home = dirname($_SERVER['SCRIPT_NAME']); $home = !$home || $home[0] != '/' ? '/' : rtrim($home, '/') . '/'; $this->home = $home; }
[ "private", "function", "autodetect_home", "(", ")", "{", "if", "(", "$", "this", "->", "home", "!==", "null", ")", "return", ";", "if", "(", "php_sapi_name", "(", ")", "==", "'cli'", ")", "return", "$", "this", "->", "home", "=", "'/'", ";", "$", "...
Autodetect home. Naive home detection. Works on standard mod_php, mod_fcgid, or Nginx PHP-FPM. Fails miserably when Alias directive or mod_proxy is involved, in which case, manual config should be used. Untested on lighty and other servers. @fixme This becomes untestable after SAPI detection, since all tests run from...
[ "Autodetect", "home", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L164-L173
bfitech/zapcore
src/Router.php
Router.autodetect_host
private function autodetect_host() { if ($this->host !== null) return; $proto = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ? 'https://' : 'http://'; $host = isset($_SERVER['SERVER_NAME']) ? $_SERVER['HTTP_HOST'] : 'localhost'; $port = isset($_SERVER['SERVER_PORT']) ? (int)$_SERVER['SERVER...
php
private function autodetect_host() { if ($this->host !== null) return; $proto = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ? 'https://' : 'http://'; $host = isset($_SERVER['SERVER_NAME']) ? $_SERVER['HTTP_HOST'] : 'localhost'; $port = isset($_SERVER['SERVER_PORT']) ? (int)$_SERVER['SERVER...
[ "private", "function", "autodetect_host", "(", ")", "{", "if", "(", "$", "this", "->", "host", "!==", "null", ")", "return", ";", "$", "proto", "=", "isset", "(", "$", "_SERVER", "[", "'HTTPS'", "]", ")", "&&", "!", "empty", "(", "$", "_SERVER", "[...
Autodetect host. Naive host detection. This relies on super-global $_SERVER variable which varies from one web server to another, and especially inaccurate when aliasing or reverse-proxying is involved, in which case, manual config should be used.
[ "Autodetect", "host", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L183-L199
bfitech/zapcore
src/Router.php
Router.verify_port
private function verify_port(int $port=null, string $proto) { if (!$port) return $port; if ($port < 0 || $port > pow(2, 16)) return null; if ($port == 80 && $proto == 'http') return null; if ($port == 443 && $proto == 'https') return null; return $port; }
php
private function verify_port(int $port=null, string $proto) { if (!$port) return $port; if ($port < 0 || $port > pow(2, 16)) return null; if ($port == 80 && $proto == 'http') return null; if ($port == 443 && $proto == 'https') return null; return $port; }
[ "private", "function", "verify_port", "(", "int", "$", "port", "=", "null", ",", "string", "$", "proto", ")", "{", "if", "(", "!", "$", "port", ")", "return", "$", "port", ";", "if", "(", "$", "port", "<", "0", "||", "$", "port", ">", "pow", "(...
Verify if port number is valid and not redundant with protocol. @codeCoverageIgnore
[ "Verify", "if", "port", "number", "is", "valid", "and", "not", "redundant", "with", "protocol", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L206-L216
bfitech/zapcore
src/Router.php
Router.init_request
private function init_request() { $this->autodetect_home(); $this->autodetect_host(); # initialize from request uri $url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; # remove query string $rpath = parse_url($url)['path']; # remove home if ($rpath != '/') $rpath = substr($r...
php
private function init_request() { $this->autodetect_home(); $this->autodetect_host(); # initialize from request uri $url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; # remove query string $rpath = parse_url($url)['path']; # remove home if ($rpath != '/') $rpath = substr($r...
[ "private", "function", "init_request", "(", ")", "{", "$", "this", "->", "autodetect_home", "(", ")", ";", "$", "this", "->", "autodetect_host", "(", ")", ";", "# initialize from request uri", "$", "url", "=", "isset", "(", "$", "_SERVER", "[", "'REQUEST_URI...
Initialize request processing. This sets home, host, and other request-related properties based on current request URI.
[ "Initialize", "request", "processing", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L224-L250
bfitech/zapcore
src/Router.php
Router.verify_route_method
private function verify_route_method($path_method) { $this->request_method = ( isset($_SERVER['REQUEST_METHOD']) && !empty($_SERVER['REQUEST_METHOD']) ) ? strtoupper($_SERVER['REQUEST_METHOD']) : 'GET'; # always allow HEAD $methods = is_array($path_method) ? $methods = array_merge($path_method, ['HEAD...
php
private function verify_route_method($path_method) { $this->request_method = ( isset($_SERVER['REQUEST_METHOD']) && !empty($_SERVER['REQUEST_METHOD']) ) ? strtoupper($_SERVER['REQUEST_METHOD']) : 'GET'; # always allow HEAD $methods = is_array($path_method) ? $methods = array_merge($path_method, ['HEAD...
[ "private", "function", "verify_route_method", "(", "$", "path_method", ")", "{", "$", "this", "->", "request_method", "=", "(", "isset", "(", "$", "_SERVER", "[", "'REQUEST_METHOD'", "]", ")", "&&", "!", "empty", "(", "$", "_SERVER", "[", "'REQUEST_METHOD'",...
Verify route method. This validates route method, i.e. method parameter of Router::route, collects it into method collection for accurate abort code on shutdown, and finally matches it against current request method.
[ "Verify", "route", "method", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L260-L278
bfitech/zapcore
src/Router.php
Router.parse_request_path
private function parse_request_path(string $path) { # route path and request path is the same if ($path == $this->request_path) return []; # generate parser $parser = $this->path_parser($path); if (!$parser[1]) return false; # parse request $pattern = '!^' . $parser[0] . '$!'; $matched = preg_m...
php
private function parse_request_path(string $path) { # route path and request path is the same if ($path == $this->request_path) return []; # generate parser $parser = $this->path_parser($path); if (!$parser[1]) return false; # parse request $pattern = '!^' . $parser[0] . '$!'; $matched = preg_m...
[ "private", "function", "parse_request_path", "(", "string", "$", "path", ")", "{", "# route path and request path is the same", "if", "(", "$", "path", "==", "$", "this", "->", "request_path", ")", "return", "[", "]", ";", "# generate parser", "$", "parser", "="...
Parse request path. This generates path parser from route path to use against request path. @param string $path Route path. @return array|bool False if current request URI doesn't match, a dict otherwise. The dict will be assigned to $args['params'] of router callback, which is empty in case of non-compound route pat...
[ "Parse", "request", "path", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L292-L313
bfitech/zapcore
src/Router.php
Router.execute_callback
private function execute_callback( callable $callback, array $args, bool $is_raw=null ) { $method = strtolower($this->request_method); if (in_array($method, ['head', 'get', 'options'])) return $this->finish_callback($callback, $args); if ($method == 'post') { $args['post'] = $is_raw ? file_get_cont...
php
private function execute_callback( callable $callback, array $args, bool $is_raw=null ) { $method = strtolower($this->request_method); if (in_array($method, ['head', 'get', 'options'])) return $this->finish_callback($callback, $args); if ($method == 'post') { $args['post'] = $is_raw ? file_get_cont...
[ "private", "function", "execute_callback", "(", "callable", "$", "callback", ",", "array", "$", "args", ",", "bool", "$", "is_raw", "=", "null", ")", "{", "$", "method", "=", "strtolower", "(", "$", "this", "->", "request_method", ")", ";", "if", "(", ...
Execute callback of a matched route. @param callable $callback Route callback. @param array $args Route callback parameter. @param bool $is_raw If true, request body is not treated as HTTP query. Applicable for POST only.
[ "Execute", "callback", "of", "a", "matched", "route", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L323-L353
bfitech/zapcore
src/Router.php
Router.finish_callback
private function finish_callback( callable $callback, array $args ) { $this->request_handled = true; $this->wrap_callback($callback, $args); return $this; }
php
private function finish_callback( callable $callback, array $args ) { $this->request_handled = true; $this->wrap_callback($callback, $args); return $this; }
[ "private", "function", "finish_callback", "(", "callable", "$", "callback", ",", "array", "$", "args", ")", "{", "$", "this", "->", "request_handled", "=", "true", ";", "$", "this", "->", "wrap_callback", "(", "$", "callback", ",", "$", "args", ")", ";",...
Finish callback.
[ "Finish", "callback", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L358-L364
bfitech/zapcore
src/Router.php
Router.path_parser
final public static function path_parser(string $path) { # path must start with slash if ($path[0] != '/') { self::throw_error( "Router: path invalid in '$path'."); } # ignore trailing slash if ($path != '/') $path = rtrim($path, '/'); # allowed characters in path $valid_chars = 'a-zA-Z0-9\_\.\...
php
final public static function path_parser(string $path) { # path must start with slash if ($path[0] != '/') { self::throw_error( "Router: path invalid in '$path'."); } # ignore trailing slash if ($path != '/') $path = rtrim($path, '/'); # allowed characters in path $valid_chars = 'a-zA-Z0-9\_\.\...
[ "final", "public", "static", "function", "path_parser", "(", "string", "$", "path", ")", "{", "# path must start with slash", "if", "(", "$", "path", "[", "0", "]", "!=", "'/'", ")", "{", "self", "::", "throw_error", "(", "\"Router: path invalid in '$path'.\"", ...
Path parser. This parses route path and returns arrays that will parse request path. @param string $path Route path with special enclosing characters: - `< >` for dynamic URL parameter without `/` - `{ }` for dynamic URL parameter with `/` @return array A duple with values: - a regular expression to match against req...
[ "Path", "parser", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L397-L483
bfitech/zapcore
src/Router.php
Router.wrap_callback
public function wrap_callback(callable $callback, array $args=[]) { self::$logger->debug(sprintf("Router: %s '%s'.", $this->request_method, $this->request_path)); $callback($args); static::halt(); }
php
public function wrap_callback(callable $callback, array $args=[]) { self::$logger->debug(sprintf("Router: %s '%s'.", $this->request_method, $this->request_path)); $callback($args); static::halt(); }
[ "public", "function", "wrap_callback", "(", "callable", "$", "callback", ",", "array", "$", "args", "=", "[", "]", ")", "{", "self", "::", "$", "logger", "->", "debug", "(", "sprintf", "(", "\"Router: %s '%s'.\"", ",", "$", "this", "->", "request_method", ...
Callback wrapper. Override this for more decorator-like processing. Make sure the override always ends with halt(). @param callable $callback Callback method. @param array $args HTTP variables collected by router.
[ "Callback", "wrapper", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L494-L499
bfitech/zapcore
src/Router.php
Router.route
final public function route( string $path, callable $callback, $method='GET', bool $is_raw=null ) { # route always initializes $this->init(); # check if request has been handled if ($this->request_handled) return $this; # verify route method if (!$this->verify_route_method($method)) return $th...
php
final public function route( string $path, callable $callback, $method='GET', bool $is_raw=null ) { # route always initializes $this->init(); # check if request has been handled if ($this->request_handled) return $this; # verify route method if (!$this->verify_route_method($method)) return $th...
[ "final", "public", "function", "route", "(", "string", "$", "path", ",", "callable", "$", "callback", ",", "$", "method", "=", "'GET'", ",", "bool", "$", "is_raw", "=", "null", ")", "{", "# route always initializes", "$", "this", "->", "init", "(", ")", ...
Route. @param string $path The path, not including the leading path provided by e.g. script name. @param callable $callback Callback function for the path. Callback takes one argument containing HTTP variables collected by route processor. @param string $method HTTP request method. @param bool $is_raw If true, accept ...
[ "Route", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L515-L559
bfitech/zapcore
src/Router.php
Router.abort_default
private function abort_default($code) { extract(self::get_header_string($code)); static::start_header($code); $uri = htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES); echo "<!doctype html> <html> <head> <meta charset=utf-8> <meta name=viewport content='width=device-width, initial-scale=1.0, use...
php
private function abort_default($code) { extract(self::get_header_string($code)); static::start_header($code); $uri = htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES); echo "<!doctype html> <html> <head> <meta charset=utf-8> <meta name=viewport content='width=device-width, initial-scale=1.0, use...
[ "private", "function", "abort_default", "(", "$", "code", ")", "{", "extract", "(", "self", "::", "get_header_string", "(", "$", "code", ")", ")", ";", "static", "::", "start_header", "(", "$", "code", ")", ";", "$", "uri", "=", "htmlspecialchars", "(", ...
Default abort method.
[ "Default", "abort", "method", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L564-L592
bfitech/zapcore
src/Router.php
Router.abort
final public function abort(int $code) { $this->request_handled = true; self::$logger->info(sprintf( "Router: abort %s: '%s'.", $code, $this->request_path)); if (!method_exists($this, 'abort_custom')) $this->abort_default($code); else $this->abort_custom($code); static::halt(); }
php
final public function abort(int $code) { $this->request_handled = true; self::$logger->info(sprintf( "Router: abort %s: '%s'.", $code, $this->request_path)); if (!method_exists($this, 'abort_custom')) $this->abort_default($code); else $this->abort_custom($code); static::halt(); }
[ "final", "public", "function", "abort", "(", "int", "$", "code", ")", "{", "$", "this", "->", "request_handled", "=", "true", ";", "self", "::", "$", "logger", "->", "info", "(", "sprintf", "(", "\"Router: abort %s: '%s'.\"", ",", "$", "code", ",", "$", ...
Abort. Create a method called abort_custom() to customize this in a subclass. Too many unguarded bells and whistles are at risk if we just allow overriding this. @param int $code HTTP error code.
[ "Abort", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L603-L613
bfitech/zapcore
src/Router.php
Router.redirect_default
private function redirect_default(string $destination) { extract(self::get_header_string(301)); static::start_header($code, 0, [ "Location: $destination", ]); $dst = htmlspecialchars($destination, ENT_QUOTES); echo "<!doctype html> <html> <head> <meta charset='utf-8'/> <meta name=viewport content='...
php
private function redirect_default(string $destination) { extract(self::get_header_string(301)); static::start_header($code, 0, [ "Location: $destination", ]); $dst = htmlspecialchars($destination, ENT_QUOTES); echo "<!doctype html> <html> <head> <meta charset='utf-8'/> <meta name=viewport content='...
[ "private", "function", "redirect_default", "(", "string", "$", "destination", ")", "{", "extract", "(", "self", "::", "get_header_string", "(", "301", ")", ")", ";", "static", "::", "start_header", "(", "$", "code", ",", "0", ",", "[", "\"Location: $destinat...
Default redirect.
[ "Default", "redirect", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L618-L647
bfitech/zapcore
src/Router.php
Router.redirect
final public function redirect(string $destination) { $this->request_handled = true; self::$logger->info(sprintf( "Router: redirect: '%s' -> '%s'.", $this->request_path, $destination)); if (!method_exists($this, 'redirect_custom')) $this->redirect_default($destination); else $this->redirect_custom($...
php
final public function redirect(string $destination) { $this->request_handled = true; self::$logger->info(sprintf( "Router: redirect: '%s' -> '%s'.", $this->request_path, $destination)); if (!method_exists($this, 'redirect_custom')) $this->redirect_default($destination); else $this->redirect_custom($...
[ "final", "public", "function", "redirect", "(", "string", "$", "destination", ")", "{", "$", "this", "->", "request_handled", "=", "true", ";", "self", "::", "$", "logger", "->", "info", "(", "sprintf", "(", "\"Router: redirect: '%s' -> '%s'.\"", ",", "$", "...
Redirect. Create method called redirect_custom() to customize this in a subclass. @param string $destination Destination URL.
[ "Redirect", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L657-L667
bfitech/zapcore
src/Router.php
Router.static_file_default
private function static_file_default( string $path, int $cache=0, string $disposition=null ) { if (file_exists($path)) static::send_file($path, $disposition, 200, $cache); $this->abort(404); }
php
private function static_file_default( string $path, int $cache=0, string $disposition=null ) { if (file_exists($path)) static::send_file($path, $disposition, 200, $cache); $this->abort(404); }
[ "private", "function", "static_file_default", "(", "string", "$", "path", ",", "int", "$", "cache", "=", "0", ",", "string", "$", "disposition", "=", "null", ")", "{", "if", "(", "file_exists", "(", "$", "path", ")", ")", "static", "::", "send_file", "...
Default static file.
[ "Default", "static", "file", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L672-L678
bfitech/zapcore
src/Router.php
Router.static_file
final public function static_file( string $path, int $cache=0, $disposition=null ) { self::$logger->info("Router: static: '$path'."); if (!method_exists($this, 'static_file_custom')) return $this->static_file_default($path, $cache, $disposition); return $this->static_file_custom($path, $cache, $disposit...
php
final public function static_file( string $path, int $cache=0, $disposition=null ) { self::$logger->info("Router: static: '$path'."); if (!method_exists($this, 'static_file_custom')) return $this->static_file_default($path, $cache, $disposition); return $this->static_file_custom($path, $cache, $disposit...
[ "final", "public", "function", "static_file", "(", "string", "$", "path", ",", "int", "$", "cache", "=", "0", ",", "$", "disposition", "=", "null", ")", "{", "self", "::", "$", "logger", "->", "info", "(", "\"Router: static: '$path'.\"", ")", ";", "if", ...
Static file. Create method called static_file_custom() to customize this in a subclass. @param string $path Absolute path to file. @param int $cache Cache age in seconds. @param mixed $disposition If string, use it as content-disposition in header. If true, infer from basename. If null, no content-disposition header ...
[ "Static", "file", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L692-L700
bfitech/zapcore
src/Router.php
Router.shutdown
final public function shutdown() { if ($this->request_handled) return; $code = 501; if (in_array($this->request_method, $this->method_collection)) $code = 404; self::$logger->info(sprintf( "Router: shutdown %s in %s '%s'.", $code, $this->request_method, $this->request_path)); $this->abort($code); ...
php
final public function shutdown() { if ($this->request_handled) return; $code = 501; if (in_array($this->request_method, $this->method_collection)) $code = 404; self::$logger->info(sprintf( "Router: shutdown %s in %s '%s'.", $code, $this->request_method, $this->request_path)); $this->abort($code); ...
[ "final", "public", "function", "shutdown", "(", ")", "{", "if", "(", "$", "this", "->", "request_handled", ")", "return", ";", "$", "code", "=", "501", ";", "if", "(", "in_array", "(", "$", "this", "->", "request_method", ",", "$", "this", "->", "met...
Shutdown function. If no request is handled at this point, show a 501 or 404.
[ "Shutdown", "function", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L707-L717
bfitech/zapcore
src/Router.php
Router.get_request_comp
public function get_request_comp(int $index=null) { $comp = $this->request_comp; if ($index === null) return $comp; if (isset($comp[$index])) return $comp[$index]; return null; }
php
public function get_request_comp(int $index=null) { $comp = $this->request_comp; if ($index === null) return $comp; if (isset($comp[$index])) return $comp[$index]; return null; }
[ "public", "function", "get_request_comp", "(", "int", "$", "index", "=", "null", ")", "{", "$", "comp", "=", "$", "this", "->", "request_comp", ";", "if", "(", "$", "index", "===", "null", ")", "return", "$", "comp", ";", "if", "(", "isset", "(", "...
Get request component. @param int $index Index of component array. Set to null to return the whole array. @return mixed If no index is set, the whole component array is returned. Otherwise, indexed element is returned or null if index falls out of range.
[ "Get", "request", "component", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Router.php#L758-L765
bigpaulie/yii2-fancybox
src/FancyGallery.php
FancyGallery.run
public function run() { echo Html::beginTag($this->tag, $this->htmlOptions['containerOptions']); if (!empty($this->items)) { foreach ($this->items as $item) { echo $this->parseTemplate($item); } } echo Html::endTag($this->tag); }
php
public function run() { echo Html::beginTag($this->tag, $this->htmlOptions['containerOptions']); if (!empty($this->items)) { foreach ($this->items as $item) { echo $this->parseTemplate($item); } } echo Html::endTag($this->tag); }
[ "public", "function", "run", "(", ")", "{", "echo", "Html", "::", "beginTag", "(", "$", "this", "->", "tag", ",", "$", "this", "->", "htmlOptions", "[", "'containerOptions'", "]", ")", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "items", ...
Run the widget
[ "Run", "the", "widget" ]
train
https://github.com/bigpaulie/yii2-fancybox/blob/a961789a9ab94b0ebb129f3c6c57489d1298525b/src/FancyGallery.php#L88-L96
bigpaulie/yii2-fancybox
src/FancyGallery.php
FancyGallery.parseTemplate
protected function parseTemplate(array $item) { /** * Check if a title has been assigned to the element */ if (isset($item['title'])) { $this->htmlOptions['linkOptions']['title'] = $item['title']; } /** * Parse the template */ $repl...
php
protected function parseTemplate(array $item) { /** * Check if a title has been assigned to the element */ if (isset($item['title'])) { $this->htmlOptions['linkOptions']['title'] = $item['title']; } /** * Parse the template */ $repl...
[ "protected", "function", "parseTemplate", "(", "array", "$", "item", ")", "{", "/**\n * Check if a title has been assigned to the element\n */", "if", "(", "isset", "(", "$", "item", "[", "'title'", "]", ")", ")", "{", "$", "this", "->", "htmlOptions...
Parse template @param array $item @return string
[ "Parse", "template" ]
train
https://github.com/bigpaulie/yii2-fancybox/blob/a961789a9ab94b0ebb129f3c6c57489d1298525b/src/FancyGallery.php#L103-L116