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 |
|---|---|---|---|---|---|---|---|---|---|---|
acasademont/wurfl | WURFL/Handlers/Matcher/RISMatcher.php | WURFL_Handlers_Matcher_RISMatcher.longestCommonPrefixLength | private function longestCommonPrefixLength($s, $t)
{
$length = min(strlen($s), strlen($t));
$i = 0;
while ($i < $length) {
if ($s [$i] !== $t [$i]) {
break;
}
$i++;
}
return $i;
} | php | private function longestCommonPrefixLength($s, $t)
{
$length = min(strlen($s), strlen($t));
$i = 0;
while ($i < $length) {
if ($s [$i] !== $t [$i]) {
break;
}
$i++;
}
return $i;
} | [
"private",
"function",
"longestCommonPrefixLength",
"(",
"$",
"s",
",",
"$",
"t",
")",
"{",
"$",
"length",
"=",
"min",
"(",
"strlen",
"(",
"$",
"s",
")",
",",
"strlen",
"(",
"$",
"t",
")",
")",
";",
"$",
"i",
"=",
"0",
";",
"while",
"(",
"$",
... | Returns the largest number of matching characters between $s and $t
@param $s string String 1
@param $t string String 2
@return integer Longest prefix length | [
"Returns",
"the",
"largest",
"number",
"of",
"matching",
"characters",
"between",
"$s",
"and",
"$t"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Matcher/RISMatcher.php#L111-L122 |
stubbles/stubbles-webapp-core | src/main/php/auth/Auth.php | Auth.with | public static function with(
string $authenticationProvider,
string $authorizationProvider = null
): self {
return new self($authenticationProvider, $authorizationProvider);
} | php | public static function with(
string $authenticationProvider,
string $authorizationProvider = null
): self {
return new self($authenticationProvider, $authorizationProvider);
} | [
"public",
"static",
"function",
"with",
"(",
"string",
"$",
"authenticationProvider",
",",
"string",
"$",
"authorizationProvider",
"=",
"null",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"$",
"authenticationProvider",
",",
"$",
"authorizationProvider",
... | factory method
@param string $authenticationProvider
@param string $authorizationProvider optional
@return \stubbles\webapp\ioc\Auth | [
"factory",
"method"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/Auth.php#L75-L80 |
stubbles/stubbles-webapp-core | src/main/php/auth/Auth.php | Auth.configure | public function configure(Binder $binder, string $projectPath = null)
{
if ($this->enableSessionCaching) {
$binder->bind(AuthenticationProvider::class)
->to(CachingAuthenticationProvider::class);
$binder->bind(AuthenticationProvider::class)
->named('... | php | public function configure(Binder $binder, string $projectPath = null)
{
if ($this->enableSessionCaching) {
$binder->bind(AuthenticationProvider::class)
->to(CachingAuthenticationProvider::class);
$binder->bind(AuthenticationProvider::class)
->named('... | [
"public",
"function",
"configure",
"(",
"Binder",
"$",
"binder",
",",
"string",
"$",
"projectPath",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"enableSessionCaching",
")",
"{",
"$",
"binder",
"->",
"bind",
"(",
"AuthenticationProvider",
"::",
"cl... | configure the binder
@param \stubbles\ioc\Binder $binder
@param string $projectPath optional project base path | [
"configure",
"the",
"binder"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/Auth.php#L117-L148 |
gregorybesson/PlaygroundCore | src/Module.php | Module.onMergeConfig | public function onMergeConfig(\Zend\ModuleManager\ModuleEvent $e)
{
$config = $e->getConfigListener()->getMergedConfig(false);
if (isset($config['playgroundLocale']) && isset($config['playgroundLocale']['enable']) && $config['playgroundLocale']['enable']) {
$config['router']['routes']['... | php | public function onMergeConfig(\Zend\ModuleManager\ModuleEvent $e)
{
$config = $e->getConfigListener()->getMergedConfig(false);
if (isset($config['playgroundLocale']) && isset($config['playgroundLocale']['enable']) && $config['playgroundLocale']['enable']) {
$config['router']['routes']['... | [
"public",
"function",
"onMergeConfig",
"(",
"\\",
"Zend",
"\\",
"ModuleManager",
"\\",
"ModuleEvent",
"$",
"e",
")",
"{",
"$",
"config",
"=",
"$",
"e",
"->",
"getConfigListener",
"(",
")",
"->",
"getMergedConfig",
"(",
"false",
")",
";",
"if",
"(",
"isse... | This method is called only when the config is not cached.
@param \Zend\ModuleManager\ModuleEvent $e | [
"This",
"method",
"is",
"called",
"only",
"when",
"the",
"config",
"is",
"not",
"cached",
"."
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Module.php#L40-L51 |
tonicospinelli/class-generation | src/ClassGeneration/PhpClass.php | PhpClass.init | public function init()
{
$this->setTabulation(0);
$this->setDocBlock(new DocBlock());
$this->setMethodCollection(new MethodCollection());
$this->setPropertyCollection(new PropertyCollection());
$this->setConstantCollection(new ConstantCollection());
$this->setInterfac... | php | public function init()
{
$this->setTabulation(0);
$this->setDocBlock(new DocBlock());
$this->setMethodCollection(new MethodCollection());
$this->setPropertyCollection(new PropertyCollection());
$this->setConstantCollection(new ConstantCollection());
$this->setInterfac... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"setTabulation",
"(",
"0",
")",
";",
"$",
"this",
"->",
"setDocBlock",
"(",
"new",
"DocBlock",
"(",
")",
")",
";",
"$",
"this",
"->",
"setMethodCollection",
"(",
"new",
"MethodCollection",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/PhpClass.php#L122-L133 |
tonicospinelli/class-generation | src/ClassGeneration/PhpClass.php | PhpClass.createMethodsFromInterface | protected function createMethodsFromInterface($interfaceName)
{
if (!interface_exists($interfaceName)) {
return;
}
$refInterface = new \ReflectionClass($interfaceName);
$methodsReflected = $refInterface->getMethods();
foreach ($methodsReflected as $methodReflecte... | php | protected function createMethodsFromInterface($interfaceName)
{
if (!interface_exists($interfaceName)) {
return;
}
$refInterface = new \ReflectionClass($interfaceName);
$methodsReflected = $refInterface->getMethods();
foreach ($methodsReflected as $methodReflecte... | [
"protected",
"function",
"createMethodsFromInterface",
"(",
"$",
"interfaceName",
")",
"{",
"if",
"(",
"!",
"interface_exists",
"(",
"$",
"interfaceName",
")",
")",
"{",
"return",
";",
"}",
"$",
"refInterface",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
... | Creates methods from Interface.
@param string $interfaceName | [
"Creates",
"methods",
"from",
"Interface",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/PhpClass.php#L348-L363 |
tonicospinelli/class-generation | src/ClassGeneration/PhpClass.php | PhpClass.createMethodsFromAbstractClass | protected function createMethodsFromAbstractClass($abstractClass)
{
if (!class_exists($abstractClass)) {
return;
}
$refExtends = new \ReflectionClass($abstractClass);
$methodsRef = $refExtends->getMethods();
foreach ($methodsRef as $methodRef) {
if (!... | php | protected function createMethodsFromAbstractClass($abstractClass)
{
if (!class_exists($abstractClass)) {
return;
}
$refExtends = new \ReflectionClass($abstractClass);
$methodsRef = $refExtends->getMethods();
foreach ($methodsRef as $methodRef) {
if (!... | [
"protected",
"function",
"createMethodsFromAbstractClass",
"(",
"$",
"abstractClass",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"abstractClass",
")",
")",
"{",
"return",
";",
"}",
"$",
"refExtends",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"a... | Creates methods from Abstract.
@param string $abstractClass
@return void | [
"Creates",
"methods",
"from",
"Abstract",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/PhpClass.php#L373-L389 |
tonicospinelli/class-generation | src/ClassGeneration/PhpClass.php | PhpClass.generateGettersAndSettersFromProperties | public function generateGettersAndSettersFromProperties()
{
$propertyIterator = $this->getPropertyCollection()->getIterator();
foreach ($propertyIterator as $property) {
$this->getMethodCollection()->add(Method::createGetterFromProperty($property));
$this->getMethodCollection... | php | public function generateGettersAndSettersFromProperties()
{
$propertyIterator = $this->getPropertyCollection()->getIterator();
foreach ($propertyIterator as $property) {
$this->getMethodCollection()->add(Method::createGetterFromProperty($property));
$this->getMethodCollection... | [
"public",
"function",
"generateGettersAndSettersFromProperties",
"(",
")",
"{",
"$",
"propertyIterator",
"=",
"$",
"this",
"->",
"getPropertyCollection",
"(",
")",
"->",
"getIterator",
"(",
")",
";",
"foreach",
"(",
"$",
"propertyIterator",
"as",
"$",
"property",
... | Create all getters and setters from Property Collection.
@return void | [
"Create",
"all",
"getters",
"and",
"setters",
"from",
"Property",
"Collection",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/PhpClass.php#L473-L480 |
tonicospinelli/class-generation | src/ClassGeneration/PhpClass.php | PhpClass.setIsAbstract | public function setIsAbstract($isAbstract = true)
{
if ($this->isInterface()) {
throw new \RuntimeException('This class is an interface and it not be an abstract too.');
}
$this->isAbstract = (bool)$isAbstract;
return $this;
} | php | public function setIsAbstract($isAbstract = true)
{
if ($this->isInterface()) {
throw new \RuntimeException('This class is an interface and it not be an abstract too.');
}
$this->isAbstract = (bool)$isAbstract;
return $this;
} | [
"public",
"function",
"setIsAbstract",
"(",
"$",
"isAbstract",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isInterface",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'This class is an interface and it not be an abstract too.'",
")"... | {@inheritdoc} | [
"{"
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/PhpClass.php#L550-L559 |
tonicospinelli/class-generation | src/ClassGeneration/PhpClass.php | PhpClass.toStringType | protected function toStringType()
{
$type = 'class ';
switch (true) {
case $this->isInterface():
$type = 'interface ';
break;
case $this->isAbstract():
$type = 'abstract class ';
break;
case $this->i... | php | protected function toStringType()
{
$type = 'class ';
switch (true) {
case $this->isInterface():
$type = 'interface ';
break;
case $this->isAbstract():
$type = 'abstract class ';
break;
case $this->i... | [
"protected",
"function",
"toStringType",
"(",
")",
"{",
"$",
"type",
"=",
"'class '",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"$",
"this",
"->",
"isInterface",
"(",
")",
":",
"$",
"type",
"=",
"'interface '",
";",
"break",
";",
"case",
"$",
"th... | Get string based on type set.
@return string | [
"Get",
"string",
"based",
"on",
"type",
"set",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/PhpClass.php#L565-L584 |
faustbrian/Laravel-Countries | src/Models/Country.php | Country.listBy | public static function listBy($keyColumn, $valueColumn)
{
$valueColumnKey = explode('.', $valueColumn)[0];
return static::get([$keyColumn, $valueColumnKey])->keyBy($keyColumn)->map(function ($item, $keyColumn) use ($valueColumn) {
return array_get($item->toArray(), $valueColumn);
... | php | public static function listBy($keyColumn, $valueColumn)
{
$valueColumnKey = explode('.', $valueColumn)[0];
return static::get([$keyColumn, $valueColumnKey])->keyBy($keyColumn)->map(function ($item, $keyColumn) use ($valueColumn) {
return array_get($item->toArray(), $valueColumn);
... | [
"public",
"static",
"function",
"listBy",
"(",
"$",
"keyColumn",
",",
"$",
"valueColumn",
")",
"{",
"$",
"valueColumnKey",
"=",
"explode",
"(",
"'.'",
",",
"$",
"valueColumn",
")",
"[",
"0",
"]",
";",
"return",
"static",
"::",
"get",
"(",
"[",
"$",
"... | @param $keyColumn
@param $valueColumn
@return mixed | [
"@param",
"$keyColumn",
"@param",
"$valueColumn"
] | train | https://github.com/faustbrian/Laravel-Countries/blob/3d72301acd37e7f351d9b991dba41807ab68362b/src/Models/Country.php#L98-L105 |
okvpn/fixture-bundle | src/Event/DataFixturesEvent.php | DataFixturesEvent.log | public function log($message)
{
if (null !== $this->logger) {
$logger = $this->logger;
$logger($message);
}
} | php | public function log($message)
{
if (null !== $this->logger) {
$logger = $this->logger;
$logger($message);
}
} | [
"public",
"function",
"log",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"logger",
";",
"$",
"logger",
"(",
"$",
"message",
")",
";",
"}",
"}"
] | Adds a message to the logger.
@param string $message | [
"Adds",
"a",
"message",
"to",
"the",
"logger",
"."
] | train | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Event/DataFixturesEvent.php#L59-L65 |
phramework/jsonapi | src/Model/Get.php | Get.getById | public static function getById($id, Fields $fields = null, ...$additionalParameters)
{
if (!is_array($id) && ($cached = static::getCache($id)) !== null) {
//Return a single resource immediately if cached
return $cached;
} elseif (is_array($id)) {
$id = array_uniqu... | php | public static function getById($id, Fields $fields = null, ...$additionalParameters)
{
if (!is_array($id) && ($cached = static::getCache($id)) !== null) {
//Return a single resource immediately if cached
return $cached;
} elseif (is_array($id)) {
$id = array_uniqu... | [
"public",
"static",
"function",
"getById",
"(",
"$",
"id",
",",
"Fields",
"$",
"fields",
"=",
"null",
",",
"...",
"$",
"additionalParameters",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"id",
")",
"&&",
"(",
"$",
"cached",
"=",
"static",
"::",
... | Get a single resource by id or multiple resource by id array
@param string|string[] $id An id of a single resource or ids of multiple resources
@param Fields|null $fields *[Optional]*
@param mixed ...$additionalParameters
@return Resource|object|null Returns null when item is not available,
returns o... | [
"Get",
"a",
"single",
"resource",
"by",
"id",
"or",
"multiple",
"resource",
"by",
"id",
"array",
"@param",
"string|string",
"[]",
"$id",
"An",
"id",
"of",
"a",
"single",
"resource",
"or",
"ids",
"of",
"multiple",
"resources",
"@param",
"Fields|null",
"$field... | train | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Model/Get.php#L76-L141 |
stubbles/stubbles-webapp-core | src/main/php/auth/AuthConstraint.php | AuthConstraint.requiresLogin | private function requiresLogin(): bool
{
if ($this->requiresLogin) {
return true;
}
$this->requiresLogin = $this->callbackAnnotatedWith->requiresLogin();
return $this->requiresLogin;
} | php | private function requiresLogin(): bool
{
if ($this->requiresLogin) {
return true;
}
$this->requiresLogin = $this->callbackAnnotatedWith->requiresLogin();
return $this->requiresLogin;
} | [
"private",
"function",
"requiresLogin",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"requiresLogin",
")",
"{",
"return",
"true",
";",
"}",
"$",
"this",
"->",
"requiresLogin",
"=",
"$",
"this",
"->",
"callbackAnnotatedWith",
"->",
"requiresLog... | checks whether login is required
@return bool
@XmlAttribute(attributeName='requiresLogin') | [
"checks",
"whether",
"login",
"is",
"required"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/AuthConstraint.php#L102-L110 |
stubbles/stubbles-webapp-core | src/main/php/auth/AuthConstraint.php | AuthConstraint.requiredRole | public function requiredRole()
{
if (null === $this->requiredRole) {
$this->requiredRole = $this->callbackAnnotatedWith->requiredRole();
}
return $this->requiredRole;
} | php | public function requiredRole()
{
if (null === $this->requiredRole) {
$this->requiredRole = $this->callbackAnnotatedWith->requiredRole();
}
return $this->requiredRole;
} | [
"public",
"function",
"requiredRole",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"requiredRole",
")",
"{",
"$",
"this",
"->",
"requiredRole",
"=",
"$",
"this",
"->",
"callbackAnnotatedWith",
"->",
"requiredRole",
"(",
")",
";",
"}",
"ret... | returns required role for this route
@return string|null
@XmlAttribute(attributeName='role', skipEmpty=true) | [
"returns",
"required",
"role",
"for",
"this",
"route"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/AuthConstraint.php#L152-L159 |
stubbles/stubbles-webapp-core | src/main/php/auth/AuthConstraint.php | AuthConstraint.satisfiedByRoles | public function satisfiedByRoles(Roles $roles = null): bool
{
if (null === $roles) {
return false;
}
if ($this->callbackAnnotatedWith->rolesAware()) {
return true;
}
return $roles->contain($this->requiredRole());
} | php | public function satisfiedByRoles(Roles $roles = null): bool
{
if (null === $roles) {
return false;
}
if ($this->callbackAnnotatedWith->rolesAware()) {
return true;
}
return $roles->contain($this->requiredRole());
} | [
"public",
"function",
"satisfiedByRoles",
"(",
"Roles",
"$",
"roles",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"null",
"===",
"$",
"roles",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"callbackAnnotatedWith",
"->",
"roles... | checks whether route is satisfied by the given roles
@param \stubbles\webapp\auth\Roles $roles
@return bool | [
"checks",
"whether",
"route",
"is",
"satisfied",
"by",
"the",
"given",
"roles"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/AuthConstraint.php#L167-L178 |
stubbles/stubbles-webapp-core | src/main/php/auth/AuthConstraint.php | AuthConstraint.jsonSerialize | public function jsonSerialize(): array
{
$data = ['required' => $this->requiresAuth()];
if ($this->requiresAuth()) {
$data['requiresLogin'] = $this->requiresLogin();
}
if ($this->requiresRoles()) {
$data['requiresRoles'] = true;
$data['requiredRol... | php | public function jsonSerialize(): array
{
$data = ['required' => $this->requiresAuth()];
if ($this->requiresAuth()) {
$data['requiresLogin'] = $this->requiresLogin();
}
if ($this->requiresRoles()) {
$data['requiresRoles'] = true;
$data['requiredRol... | [
"public",
"function",
"jsonSerialize",
"(",
")",
":",
"array",
"{",
"$",
"data",
"=",
"[",
"'required'",
"=>",
"$",
"this",
"->",
"requiresAuth",
"(",
")",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"requiresAuth",
"(",
")",
")",
"{",
"$",
"data",
"["... | returns data suitable for encoding to JSON
@return array
@since 6.1.0
@XmlIgnore | [
"returns",
"data",
"suitable",
"for",
"encoding",
"to",
"JSON"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/AuthConstraint.php#L187-L200 |
mremi/Dolist | src/Mremi/Dolist/Contact/ContactManager.php | ContactManager.save | public function save(Contact $contact)
{
$try = 0;
while (true) {
$try++;
try {
$response = $this->soapClient->__soapCall('SaveContact', array(array(
'token' => $this->authenticationManager->getAuthenticationTokenContext()->toArray(),
... | php | public function save(Contact $contact)
{
$try = 0;
while (true) {
$try++;
try {
$response = $this->soapClient->__soapCall('SaveContact', array(array(
'token' => $this->authenticationManager->getAuthenticationTokenContext()->toArray(),
... | [
"public",
"function",
"save",
"(",
"Contact",
"$",
"contact",
")",
"{",
"$",
"try",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"$",
"try",
"++",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"soapClient",
"->",
"__soapCall",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/mremi/Dolist/blob/452c863aba12ef2965bafdb619c0278f8fc732d0/src/Mremi/Dolist/Contact/ContactManager.php#L72-L99 |
mremi/Dolist | src/Mremi/Dolist/Contact/ContactManager.php | ContactManager.getStatusByTicket | public function getStatusByTicket($ticket)
{
$try = 0;
while (true) {
$try++;
try {
$response = $this->soapClient->__soapCall('GetStatusByTicket', array(array(
'token' => $this->authenticationManager->getAuthenticationTokenContext()->toA... | php | public function getStatusByTicket($ticket)
{
$try = 0;
while (true) {
$try++;
try {
$response = $this->soapClient->__soapCall('GetStatusByTicket', array(array(
'token' => $this->authenticationManager->getAuthenticationTokenContext()->toA... | [
"public",
"function",
"getStatusByTicket",
"(",
"$",
"ticket",
")",
"{",
"$",
"try",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"$",
"try",
"++",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"soapClient",
"->",
"__soapCall",
"(",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/mremi/Dolist/blob/452c863aba12ef2965bafdb619c0278f8fc732d0/src/Mremi/Dolist/Contact/ContactManager.php#L104-L145 |
mremi/Dolist | src/Mremi/Dolist/Contact/ContactManager.php | ContactManager.getContacts | public function getContacts(GetContactRequest $request = null)
{
if (!$request) {
$request = new GetContactRequest;
}
$try = 0;
while (true) {
$try++;
try {
$response = $this->soapClient->__soapCall('GetContact', array(array(
... | php | public function getContacts(GetContactRequest $request = null)
{
if (!$request) {
$request = new GetContactRequest;
}
$try = 0;
while (true) {
$try++;
try {
$response = $this->soapClient->__soapCall('GetContact', array(array(
... | [
"public",
"function",
"getContacts",
"(",
"GetContactRequest",
"$",
"request",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"request",
")",
"{",
"$",
"request",
"=",
"new",
"GetContactRequest",
";",
"}",
"$",
"try",
"=",
"0",
";",
"while",
"(",
"true",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/mremi/Dolist/blob/452c863aba12ef2965bafdb619c0278f8fc732d0/src/Mremi/Dolist/Contact/ContactManager.php#L150-L225 |
slogsdon/staticwp | includes/staticwp.class.php | StaticWP.addComment | public function addComment($id, $status)
{
if ($status == 0) {
return;
}
$comment = get_comment($id);
$this->updateHtml($comment->comment_post_ID);
wp_safe_redirect(get_permalink($comment->comment_post_ID));
exit();
} | php | public function addComment($id, $status)
{
if ($status == 0) {
return;
}
$comment = get_comment($id);
$this->updateHtml($comment->comment_post_ID);
wp_safe_redirect(get_permalink($comment->comment_post_ID));
exit();
} | [
"public",
"function",
"addComment",
"(",
"$",
"id",
",",
"$",
"status",
")",
"{",
"if",
"(",
"$",
"status",
"==",
"0",
")",
"{",
"return",
";",
"}",
"$",
"comment",
"=",
"get_comment",
"(",
"$",
"id",
")",
";",
"$",
"this",
"->",
"updateHtml",
"(... | Updates static HTML after an approved comment is added.
@param int $id
@param int @status
@return void | [
"Updates",
"static",
"HTML",
"after",
"an",
"approved",
"comment",
"is",
"added",
"."
] | train | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp.class.php#L47-L57 |
slogsdon/staticwp | includes/staticwp.class.php | StaticWP.load | public function load()
{
// We only care about GET requests at the moment
if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
return;
}
$file = $_SERVER['REQUEST_URI'] . 'index.html';
if (is_file($this->destination . $file)) {
$contents = file_get_contents($t... | php | public function load()
{
// We only care about GET requests at the moment
if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
return;
}
$file = $_SERVER['REQUEST_URI'] . 'index.html';
if (is_file($this->destination . $file)) {
$contents = file_get_contents($t... | [
"public",
"function",
"load",
"(",
")",
"{",
"// We only care about GET requests at the moment",
"if",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
"!==",
"'GET'",
")",
"{",
"return",
";",
"}",
"$",
"file",
"=",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",... | Presents a compiled static HTML file when present.
@since 1.0.0
@return void | [
"Presents",
"a",
"compiled",
"static",
"HTML",
"file",
"when",
"present",
"."
] | train | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp.class.php#L80-L97 |
slogsdon/staticwp | includes/staticwp.class.php | StaticWP.updateHtml | public function updateHtml($id, $post = null)
{
if ($post != null && $post->post_status != 'publish') {
return;
}
$permalink = get_permalink($id);
$uri = substr($permalink, strlen(get_option('home')));
$filename = $this->destination . $uri . 'index.html';
... | php | public function updateHtml($id, $post = null)
{
if ($post != null && $post->post_status != 'publish') {
return;
}
$permalink = get_permalink($id);
$uri = substr($permalink, strlen(get_option('home')));
$filename = $this->destination . $uri . 'index.html';
... | [
"public",
"function",
"updateHtml",
"(",
"$",
"id",
",",
"$",
"post",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"post",
"!=",
"null",
"&&",
"$",
"post",
"->",
"post_status",
"!=",
"'publish'",
")",
"{",
"return",
";",
"}",
"$",
"permalink",
"=",
"get_... | Updates the static HTML for a post.
@since 1.0.0
@param int $id
@param \WP_Post|null $post
@return void | [
"Updates",
"the",
"static",
"HTML",
"for",
"a",
"post",
"."
] | train | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp.class.php#L108-L141 |
slogsdon/staticwp | includes/staticwp.class.php | StaticWP.resolveDestination | protected function resolveDestination()
{
$dir = '';
$uploads = wp_upload_dir();
if (isset($uploads['basedir'])) {
$dir = $uploads['basedir'] . '/' . $this->plugin . '/_site';
} else {
$dir = WP_CONTENT_DIR . '/uploads/' . $this->plugin . '/_site';
}
... | php | protected function resolveDestination()
{
$dir = '';
$uploads = wp_upload_dir();
if (isset($uploads['basedir'])) {
$dir = $uploads['basedir'] . '/' . $this->plugin . '/_site';
} else {
$dir = WP_CONTENT_DIR . '/uploads/' . $this->plugin . '/_site';
}
... | [
"protected",
"function",
"resolveDestination",
"(",
")",
"{",
"$",
"dir",
"=",
"''",
";",
"$",
"uploads",
"=",
"wp_upload_dir",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"uploads",
"[",
"'basedir'",
"]",
")",
")",
"{",
"$",
"dir",
"=",
"$",
"upl... | Recursively deletes a directory and its contents.
@since 1.2.0
@return string | [
"Recursively",
"deletes",
"a",
"directory",
"and",
"its",
"contents",
"."
] | train | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp.class.php#L150-L162 |
acasademont/wurfl | WURFL/Configuration/ArrayConfig.php | WURFL_Configuration_ArrayConfig.initialize | protected function initialize()
{
include parent::getConfigFilePath();
if (!isset($configuration) || !is_array($configuration)) {
throw new WURFL_WURFLException("Configuration array must be defined in the configuraiton file");
}
$this->init($configuration);
} | php | protected function initialize()
{
include parent::getConfigFilePath();
if (!isset($configuration) || !is_array($configuration)) {
throw new WURFL_WURFLException("Configuration array must be defined in the configuraiton file");
}
$this->init($configuration);
} | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"include",
"parent",
"::",
"getConfigFilePath",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"configuration",
")",
"||",
"!",
"is_array",
"(",
"$",
"configuration",
")",
")",
"{",
"throw",
"new",... | Initialize class - gets called from the parent constructor
@throws WURFL_WURFLException configuration not present | [
"Initialize",
"class",
"-",
"gets",
"called",
"from",
"the",
"parent",
"constructor"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Configuration/ArrayConfig.php#L83-L91 |
puli/twig-extension | src/NodeVisitor/PuliDirTagger.php | PuliDirTagger.doEnterNode | protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
{
if ($node instanceof Twig_Node_Module) {
$this->moduleNode = $node;
}
return $node;
} | php | protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
{
if ($node instanceof Twig_Node_Module) {
$this->moduleNode = $node;
}
return $node;
} | [
"protected",
"function",
"doEnterNode",
"(",
"Twig_Node",
"$",
"node",
",",
"Twig_Environment",
"$",
"env",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"Twig_Node_Module",
")",
"{",
"$",
"this",
"->",
"moduleNode",
"=",
"$",
"node",
";",
"}",
"return",... | Called before child nodes are visited.
@param Twig_Node $node The node to visit
@param Twig_Environment $env The Twig environment instance
@return Twig_Node The modified node | [
"Called",
"before",
"child",
"nodes",
"are",
"visited",
"."
] | train | https://github.com/puli/twig-extension/blob/b19fce610aa9fda5d86c73045ed5b9d378c47b93/src/NodeVisitor/PuliDirTagger.php#L48-L55 |
puli/twig-extension | src/NodeVisitor/PuliDirTagger.php | PuliDirTagger.doLeaveNode | protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
{
// Tag the node if it contains a LoadedByPuliNode
// This cannot be done in enterNode(), because only leaveNode() may
// return false in order to remove a node
if ($node instanceof LoadedByPuliNode) {
... | php | protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
{
// Tag the node if it contains a LoadedByPuliNode
// This cannot be done in enterNode(), because only leaveNode() may
// return false in order to remove a node
if ($node instanceof LoadedByPuliNode) {
... | [
"protected",
"function",
"doLeaveNode",
"(",
"Twig_Node",
"$",
"node",
",",
"Twig_Environment",
"$",
"env",
")",
"{",
"// Tag the node if it contains a LoadedByPuliNode",
"// This cannot be done in enterNode(), because only leaveNode() may",
"// return false in order to remove a node",... | Called after child nodes are visited.
@param Twig_Node $node The node to visit
@param Twig_Environment $env The Twig environment instance
@return Twig_Node|false The modified node or false if the node must be removed | [
"Called",
"after",
"child",
"nodes",
"are",
"visited",
"."
] | train | https://github.com/puli/twig-extension/blob/b19fce610aa9fda5d86c73045ed5b9d378c47b93/src/NodeVisitor/PuliDirTagger.php#L65-L92 |
iter8-au/builder | src/Builder/Provider/Silex/BuilderServiceProvider.php | BuilderServiceProvider.register | public function register(Container $app)
{
$app['builder.default_options'] = [
'default' => 'phpspreadsheet',
// defaults to project_root/cache/builder
'cache_dir' => __DIR__.'/../../../../../../../../cache/builder',
];
// Merge default builder option.
... | php | public function register(Container $app)
{
$app['builder.default_options'] = [
'default' => 'phpspreadsheet',
// defaults to project_root/cache/builder
'cache_dir' => __DIR__.'/../../../../../../../../cache/builder',
];
// Merge default builder option.
... | [
"public",
"function",
"register",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"app",
"[",
"'builder.default_options'",
"]",
"=",
"[",
"'default'",
"=>",
"'phpspreadsheet'",
",",
"// defaults to project_root/cache/builder",
"'cache_dir'",
"=>",
"__DIR__",
".",
"'/..... | {@inheritdoc} | [
"{"
] | train | https://github.com/iter8-au/builder/blob/95105636c2490c5c7a88da466702c523a9d0901c/src/Builder/Provider/Silex/BuilderServiceProvider.php#L26-L63 |
FrenchFrogs/framework | src/Core/Remote.php | Remote.enableCallback | public function enableCallback($method = null)
{
$this->is_callback = true;
$this->disableRemote();// disable remte, we can have both
if (!is_null($method) && method_exists($this, 'addAttribute')) {
$this->addAttribute('data-method', $method);
}
return $this;
... | php | public function enableCallback($method = null)
{
$this->is_callback = true;
$this->disableRemote();// disable remte, we can have both
if (!is_null($method) && method_exists($this, 'addAttribute')) {
$this->addAttribute('data-method', $method);
}
return $this;
... | [
"public",
"function",
"enableCallback",
"(",
"$",
"method",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"is_callback",
"=",
"true",
";",
"$",
"this",
"->",
"disableRemote",
"(",
")",
";",
"// disable remte, we can have both",
"if",
"(",
"!",
"is_null",
"(",
... | Set $is_callback attribute to TRUE
@return $this | [
"Set",
"$is_callback",
"attribute",
"to",
"TRUE"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Core/Remote.php#L35-L45 |
FrenchFrogs/framework | src/Core/Remote.php | Remote.enableRemote | public function enableRemote($method = null)
{
$this->is_remote = true;
$this->disableCallback();// disable callback, we cannot have both
if (!is_null($method) && method_exists($this, 'addAttribute')) {
$this->addAttribute('data-method', $method);
}
return $this... | php | public function enableRemote($method = null)
{
$this->is_remote = true;
$this->disableCallback();// disable callback, we cannot have both
if (!is_null($method) && method_exists($this, 'addAttribute')) {
$this->addAttribute('data-method', $method);
}
return $this... | [
"public",
"function",
"enableRemote",
"(",
"$",
"method",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"is_remote",
"=",
"true",
";",
"$",
"this",
"->",
"disableCallback",
"(",
")",
";",
"// disable callback, we cannot have both",
"if",
"(",
"!",
"is_null",
"("... | Setter for $is_remoter attribute
@return $this | [
"Setter",
"for",
"$is_remoter",
"attribute"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Core/Remote.php#L96-L106 |
huasituo/hstcms | src/Libraries/HuasituoApi/ApiSign.php | ApiSign.verifySign | public function verifySign($para_temp, $secretKey = '', $privateKey = '', $publicKey = '') {
$prestr = $para_temp;
if(is_array($para_temp)) {
//除去待签名参数数组中的空值和签名参数
$para_filter = $this->paraFilter($para_temp);
//对待签名参数数组排序
$para_sort = $this->argSort($para_... | php | public function verifySign($para_temp, $secretKey = '', $privateKey = '', $publicKey = '') {
$prestr = $para_temp;
if(is_array($para_temp)) {
//除去待签名参数数组中的空值和签名参数
$para_filter = $this->paraFilter($para_temp);
//对待签名参数数组排序
$para_sort = $this->argSort($para_... | [
"public",
"function",
"verifySign",
"(",
"$",
"para_temp",
",",
"$",
"secretKey",
"=",
"''",
",",
"$",
"privateKey",
"=",
"''",
",",
"$",
"publicKey",
"=",
"''",
")",
"{",
"$",
"prestr",
"=",
"$",
"para_temp",
";",
"if",
"(",
"is_array",
"(",
"$",
... | 获取返回时的签名验证结果
@param $para_temp 数据数组
@param $sign 返回的签名结果
@return 签名验证结果 | [
"获取返回时的签名验证结果"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HuasituoApi/ApiSign.php#L49-L78 |
huasituo/hstcms | src/Libraries/HuasituoApi/ApiSign.php | ApiSign.paraFilter | public function paraFilter($para)
{
$para_filter = array();
foreach ($para as $key => $val) {
if($key == "sign" || $key == "sign_type" || $val == "") continue;
else $para_filter[$key] = $para[$key];
}
return $para_filter;
} | php | public function paraFilter($para)
{
$para_filter = array();
foreach ($para as $key => $val) {
if($key == "sign" || $key == "sign_type" || $val == "") continue;
else $para_filter[$key] = $para[$key];
}
return $para_filter;
} | [
"public",
"function",
"paraFilter",
"(",
"$",
"para",
")",
"{",
"$",
"para_filter",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"para",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"$",
"key",
"==",
"\"sign\"",
"||",
"$",
"key",... | 除去数组中的空值和签名参数
@param $para 签名参数组
return 去掉空值与签名参数后的新签名参数组 | [
"除去数组中的空值和签名参数"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HuasituoApi/ApiSign.php#L85-L93 |
aindong/pluggables | src/Aindong/Pluggables/Console/PluggableEnableCommand.php | PluggableEnableCommand.fire | public function fire()
{
$pluggable = $this->argument('pluggable');
if ($this->laravel['pluggables']->isDisabled($this->argument('pluggable'))) {
$this->laravel['pluggables']->enable($pluggable);
$this->info("Pluggable [{$pluggable}] was enabled successfully.");
} e... | php | public function fire()
{
$pluggable = $this->argument('pluggable');
if ($this->laravel['pluggables']->isDisabled($this->argument('pluggable'))) {
$this->laravel['pluggables']->enable($pluggable);
$this->info("Pluggable [{$pluggable}] was enabled successfully.");
} e... | [
"public",
"function",
"fire",
"(",
")",
"{",
"$",
"pluggable",
"=",
"$",
"this",
"->",
"argument",
"(",
"'pluggable'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"laravel",
"[",
"'pluggables'",
"]",
"->",
"isDisabled",
"(",
"$",
"this",
"->",
"argument",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Console/PluggableEnableCommand.php#L33-L44 |
czim/laravel-pxlcms | src/Relations/HasOne.php | HasOne.save | public function save(Model $model)
{
if ($this->fieldId) {
$model->setAttribute($this->fieldKey, $this->fieldId);
}
return parent::save($model);
} | php | public function save(Model $model)
{
if ($this->fieldId) {
$model->setAttribute($this->fieldKey, $this->fieldId);
}
return parent::save($model);
} | [
"public",
"function",
"save",
"(",
"Model",
"$",
"model",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"fieldId",
")",
"{",
"$",
"model",
"->",
"setAttribute",
"(",
"$",
"this",
"->",
"fieldKey",
",",
"$",
"this",
"->",
"fieldId",
")",
";",
"}",
"return... | Attach a model instance to the parent model.
This adds the field_id value
@param \Illuminate\Database\Eloquent\Model $model
@return \Illuminate\Database\Eloquent\Model | [
"Attach",
"a",
"model",
"instance",
"to",
"the",
"parent",
"model",
"."
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Relations/HasOne.php#L73-L80 |
gdbots/pbjx-bundle-php | src/Command/ReplayEventsCommand.php | ReplayEventsCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$dryRun = $input->getOption('dry-run');
$skipErrors = $input->getOption('skip-errors');
$batchSize = NumberUtils::bound($input->getOption('batch-size'), 1, 1000);
$batchDelay = NumberUtils::bound($input->get... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$dryRun = $input->getOption('dry-run');
$skipErrors = $input->getOption('skip-errors');
$batchSize = NumberUtils::bound($input->getOption('batch-size'), 1, 1000);
$batchDelay = NumberUtils::bound($input->get... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"dryRun",
"=",
"$",
"input",
"->",
"getOption",
"(",
"'dry-run'",
")",
";",
"$",
"skipErrors",
"=",
"$",
"input",
"->",
"getOptio... | @param InputInterface $input
@param OutputInterface $output
@return null | [
"@param",
"InputInterface",
"$input",
"@param",
"OutputInterface",
"$output"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Command/ReplayEventsCommand.php#L118-L223 |
JoffreyPoreeCoding/MongoDB-ODM | src/DocumentManager.php | DocumentManager.getRepository | public function getRepository($modelName, $collection = null)
{
return $this->repositoryFactory->getRepository($this, $modelName, $collection);
} | php | public function getRepository($modelName, $collection = null)
{
return $this->repositoryFactory->getRepository($this, $modelName, $collection);
} | [
"public",
"function",
"getRepository",
"(",
"$",
"modelName",
",",
"$",
"collection",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"repositoryFactory",
"->",
"getRepository",
"(",
"$",
"this",
",",
"$",
"modelName",
",",
"$",
"collection",
")",
";",... | Allow to get repository for specified model
@param string $modelName Name of the model
@param string $collection Name of the collection (null for get collection from document annotation)
@return Repository Repository for model | [
"Allow",
"to",
"get",
"repository",
"for",
"specified",
"model"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/DocumentManager.php#L97-L100 |
JoffreyPoreeCoding/MongoDB-ODM | src/DocumentManager.php | DocumentManager.persist | public function persist($object, $collection = null)
{
$repository = $this->getRepository(get_class($object), $collection);
$repository->getClassMetadata()->getEventManager()->execute(EventManager::EVENT_PRE_PERSIST, $object);
$this->addObject($object, ObjectManager::OBJ_NEW, $repository);
... | php | public function persist($object, $collection = null)
{
$repository = $this->getRepository(get_class($object), $collection);
$repository->getClassMetadata()->getEventManager()->execute(EventManager::EVENT_PRE_PERSIST, $object);
$this->addObject($object, ObjectManager::OBJ_NEW, $repository);
... | [
"public",
"function",
"persist",
"(",
"$",
"object",
",",
"$",
"collection",
"=",
"null",
")",
"{",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
"get_class",
"(",
"$",
"object",
")",
",",
"$",
"collection",
")",
";",
"$",
"repositor... | Persist object in document manager
@param mixed $object Object to persist
@param string $collection Collection where object is persisted
@return void | [
"Persist",
"object",
"in",
"document",
"manager"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/DocumentManager.php#L109-L117 |
JoffreyPoreeCoding/MongoDB-ODM | src/DocumentManager.php | DocumentManager.refresh | public function refresh(&$object)
{
if (!isset($this->objectsRepository[spl_object_hash($object)])) {
return;
}
$repository = $this->objectsRepository[spl_object_hash($object)];
$id = $repository->getHydrator()->unhydrate($object)["_id"];
$projection = $repository... | php | public function refresh(&$object)
{
if (!isset($this->objectsRepository[spl_object_hash($object)])) {
return;
}
$repository = $this->objectsRepository[spl_object_hash($object)];
$id = $repository->getHydrator()->unhydrate($object)["_id"];
$projection = $repository... | [
"public",
"function",
"refresh",
"(",
"&",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"objectsRepository",
"[",
"spl_object_hash",
"(",
"$",
"object",
")",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"repository",
"=",... | Refresh an object to last MongoDB values
@param mixed $object Object to refresh | [
"Refresh",
"an",
"object",
"to",
"last",
"MongoDB",
"values"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/DocumentManager.php#L154-L172 |
JoffreyPoreeCoding/MongoDB-ODM | src/DocumentManager.php | DocumentManager.perfomOperations | private function perfomOperations($insert, $update, $remove)
{
$bulkOperations = [];
foreach ($insert as $id => $document) {
$repository = $this->getObjectRepository($document);
if ($repository instanceof GridFSRepository) {
$repository->insertOne($document);
... | php | private function perfomOperations($insert, $update, $remove)
{
$bulkOperations = [];
foreach ($insert as $id => $document) {
$repository = $this->getObjectRepository($document);
if ($repository instanceof GridFSRepository) {
$repository->insertOne($document);
... | [
"private",
"function",
"perfomOperations",
"(",
"$",
"insert",
",",
"$",
"update",
",",
"$",
"remove",
")",
"{",
"$",
"bulkOperations",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"insert",
"as",
"$",
"id",
"=>",
"$",
"document",
")",
"{",
"$",
"reposit... | Perfom operation on collections
@param array $insert Objects to insert
@param array $update Objects to update
@param array $remove Objects to remove
@return void | [
"Perfom",
"operation",
"on",
"collections"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/DocumentManager.php#L200-L253 |
JoffreyPoreeCoding/MongoDB-ODM | src/DocumentManager.php | DocumentManager.clear | public function clear()
{
foreach ($this->objectsRepository as $repository) {
if ($repository instanceof Repository) {
$repository->clear();
}
}
parent::clear();
$this->objectsRepository = [];
} | php | public function clear()
{
foreach ($this->objectsRepository as $repository) {
if ($repository instanceof Repository) {
$repository->clear();
}
}
parent::clear();
$this->objectsRepository = [];
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"objectsRepository",
"as",
"$",
"repository",
")",
"{",
"if",
"(",
"$",
"repository",
"instanceof",
"Repository",
")",
"{",
"$",
"repository",
"->",
"clear",
"(",
")",
";",
... | Unmanaged (unpersist) all object | [
"Unmanaged",
"(",
"unpersist",
")",
"all",
"object"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/DocumentManager.php#L258-L267 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Dropdown.php | Dropdown.generate | public function generate()
{
$toggle = clone $this->toggle;
$toggle->addAttributes($this->attributes);
$toggle->setLabel($toggle->getLabel() . ' ' . Bootstrap::getConfigVar('dropdown.toggle'));
return sprintf(
'%s<ul class="dropdown-menu">%s%s</ul>',
$toggle,... | php | public function generate()
{
$toggle = clone $this->toggle;
$toggle->addAttributes($this->attributes);
$toggle->setLabel($toggle->getLabel() . ' ' . Bootstrap::getConfigVar('dropdown.toggle'));
return sprintf(
'%s<ul class="dropdown-menu">%s%s</ul>',
$toggle,... | [
"public",
"function",
"generate",
"(",
")",
"{",
"$",
"toggle",
"=",
"clone",
"$",
"this",
"->",
"toggle",
";",
"$",
"toggle",
"->",
"addAttributes",
"(",
"$",
"this",
"->",
"attributes",
")",
";",
"$",
"toggle",
"->",
"setLabel",
"(",
"$",
"toggle",
... | Generate the dropdown.
@return string | [
"Generate",
"the",
"dropdown",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Dropdown.php#L78-L90 |
withfatpanda/illuminate-wordpress | src/WordPress/Models/Post.php | Post.getCalled | public function getCalled($count = 1)
{
$called = $this->called;
if (is_null($called)) {
$called = basename(str_replace('\\', '/', get_class($this)));
}
if ($count === 1) {
return $called;
} else {
$plural = $this->called_plural;
if (is_null($plural)) {
$plural = Str::plural($called);
... | php | public function getCalled($count = 1)
{
$called = $this->called;
if (is_null($called)) {
$called = basename(str_replace('\\', '/', get_class($this)));
}
if ($count === 1) {
return $called;
} else {
$plural = $this->called_plural;
if (is_null($plural)) {
$plural = Str::plural($called);
... | [
"public",
"function",
"getCalled",
"(",
"$",
"count",
"=",
"1",
")",
"{",
"$",
"called",
"=",
"$",
"this",
"->",
"called",
";",
"if",
"(",
"is_null",
"(",
"$",
"called",
")",
")",
"{",
"$",
"called",
"=",
"basename",
"(",
"str_replace",
"(",
"'\\\\... | What should this post type be called on screen?
To set a specific value, override the protected property $called;
note that for the base Post and Page types, this value is ingored
@param int Context for the label; if $count is 1, the singular form
will be returned; otherwise, the label will be plural.
@see \Illuminate\... | [
"What",
"should",
"this",
"post",
"type",
"be",
"called",
"on",
"screen?",
"To",
"set",
"a",
"specific",
"value",
"override",
"the",
"protected",
"property",
"$called",
";",
"note",
"that",
"for",
"the",
"base",
"Post",
"and",
"Page",
"types",
"this",
"val... | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Models/Post.php#L205-L223 |
withfatpanda/illuminate-wordpress | src/WordPress/Models/Post.php | Post.updateTimestamps | protected function updateTimestamps()
{
$time = $this->freshTimestamp();
$gmt = new Carbon;
$gmt->timestamp = $time->timestamp - ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
if (! $this->isDirty(static::UPDATED_AT)) {
$this->setUpdatedAt($time);
}
if (! $this->exists && ! $this->isDirty... | php | protected function updateTimestamps()
{
$time = $this->freshTimestamp();
$gmt = new Carbon;
$gmt->timestamp = $time->timestamp - ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
if (! $this->isDirty(static::UPDATED_AT)) {
$this->setUpdatedAt($time);
}
if (! $this->exists && ! $this->isDirty... | [
"protected",
"function",
"updateTimestamps",
"(",
")",
"{",
"$",
"time",
"=",
"$",
"this",
"->",
"freshTimestamp",
"(",
")",
";",
"$",
"gmt",
"=",
"new",
"Carbon",
";",
"$",
"gmt",
"->",
"timestamp",
"=",
"$",
"time",
"->",
"timestamp",
"-",
"(",
"ge... | Update the creation and update timestamps;
WordPress has two timestamp fields, obviously.
@return void | [
"Update",
"the",
"creation",
"and",
"update",
"timestamps",
";",
"WordPress",
"has",
"two",
"timestamp",
"fields",
"obviously",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Models/Post.php#L472-L494 |
withfatpanda/illuminate-wordpress | src/WordPress/Models/Post.php | Post.getRelationValue | public function getRelationValue($key)
{
// If the key already exists in the relationships array, it just means the
// relationship has already been loaded, so we'll just return it out of
// here because there is no need to query within the relations twice.
if ($this->relationLoaded($key)) {
retu... | php | public function getRelationValue($key)
{
// If the key already exists in the relationships array, it just means the
// relationship has already been loaded, so we'll just return it out of
// here because there is no need to query within the relations twice.
if ($this->relationLoaded($key)) {
retu... | [
"public",
"function",
"getRelationValue",
"(",
"$",
"key",
")",
"{",
"// If the key already exists in the relationships array, it just means the",
"// relationship has already been loaded, so we'll just return it out of",
"// here because there is no need to query within the relations twice.",
... | Get a relationship.
@param string $key
@return mixed | [
"Get",
"a",
"relationship",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Models/Post.php#L579-L603 |
belgattitude/soluble-metadata | src/Soluble/Metadata/Reader/MysqliMetadataReader.php | MysqliMetadataReader.readColumnsMetadata | protected function readColumnsMetadata(string $sql): ColumnsMetadata
{
$metadata = new ColumnsMetadata();
$fields = $this->readFields($sql);
$type_map = MysqliMapping::getDatatypeMapping();
foreach ($fields as $idx => $field) {
$name = $field->orgname === '' ? $field->na... | php | protected function readColumnsMetadata(string $sql): ColumnsMetadata
{
$metadata = new ColumnsMetadata();
$fields = $this->readFields($sql);
$type_map = MysqliMapping::getDatatypeMapping();
foreach ($fields as $idx => $field) {
$name = $field->orgname === '' ? $field->na... | [
"protected",
"function",
"readColumnsMetadata",
"(",
"string",
"$",
"sql",
")",
":",
"ColumnsMetadata",
"{",
"$",
"metadata",
"=",
"new",
"ColumnsMetadata",
"(",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"readFields",
"(",
"$",
"sql",
")",
";",
"$... | {@inheritdoc}
@throws \Soluble\Metadata\Exception\ConnectionException
@throws \Soluble\Metadata\Exception\EmptyQueryException
@throws \Soluble\Metadata\Exception\InvalidQueryException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/belgattitude/soluble-metadata/blob/6285461c40a619070f601184d58e6c772b769d5c/src/Soluble/Metadata/Reader/MysqliMetadataReader.php#L56-L145 |
belgattitude/soluble-metadata | src/Soluble/Metadata/Reader/MysqliMetadataReader.php | MysqliMetadataReader.readFields | protected function readFields(string $sql): array
{
if (trim($sql) === '') {
throw new Exception\EmptyQueryException('Cannot read fields for an empty query');
}
$sql = $this->getEmptiedQuery($sql);
$stmt = $this->mysqli->prepare($sql);
if ($stmt === false) {
... | php | protected function readFields(string $sql): array
{
if (trim($sql) === '') {
throw new Exception\EmptyQueryException('Cannot read fields for an empty query');
}
$sql = $this->getEmptiedQuery($sql);
$stmt = $this->mysqli->prepare($sql);
if ($stmt === false) {
... | [
"protected",
"function",
"readFields",
"(",
"string",
"$",
"sql",
")",
":",
"array",
"{",
"if",
"(",
"trim",
"(",
"$",
"sql",
")",
"===",
"''",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"EmptyQueryException",
"(",
"'Cannot read fields for an empty query'",
... | @throws Exception\ConnectionException
@throws \Soluble\Metadata\Exception\EmptyQueryException
@throws \Soluble\Metadata\Exception\InvalidQueryException
@return array<int, mixed> | [
"@throws",
"Exception",
"\\",
"ConnectionException",
"@throws",
"\\",
"Soluble",
"\\",
"Metadata",
"\\",
"Exception",
"\\",
"EmptyQueryException",
"@throws",
"\\",
"Soluble",
"\\",
"Metadata",
"\\",
"Exception",
"\\",
"InvalidQueryException"
] | train | https://github.com/belgattitude/soluble-metadata/blob/6285461c40a619070f601184d58e6c772b769d5c/src/Soluble/Metadata/Reader/MysqliMetadataReader.php#L154-L193 |
wizbii/pipeline | Factory/PipelineFactory.php | PipelineFactory.buildName | public function buildName($pipeline, $configuration)
{
$name = is_array($configuration) && array_key_exists("name", $configuration) ? $configuration["name"] : null;
if (empty($name)) {
throw new InvalidConfigurationException("Missing pipeline name");
}
$pipeline->setName(... | php | public function buildName($pipeline, $configuration)
{
$name = is_array($configuration) && array_key_exists("name", $configuration) ? $configuration["name"] : null;
if (empty($name)) {
throw new InvalidConfigurationException("Missing pipeline name");
}
$pipeline->setName(... | [
"public",
"function",
"buildName",
"(",
"$",
"pipeline",
",",
"$",
"configuration",
")",
"{",
"$",
"name",
"=",
"is_array",
"(",
"$",
"configuration",
")",
"&&",
"array_key_exists",
"(",
"\"name\"",
",",
"$",
"configuration",
")",
"?",
"$",
"configuration",
... | Set the pipeline name. Empty name will throw an exception
@param Pipeline $pipeline
@param array $configuration
@throws InvalidConfigurationException | [
"Set",
"the",
"pipeline",
"name",
".",
"Empty",
"name",
"will",
"throw",
"an",
"exception"
] | train | https://github.com/wizbii/pipeline/blob/8d22b976a53bb52abf0333b62b308ec7127cf414/Factory/PipelineFactory.php#L50-L57 |
wizbii/pipeline | Factory/PipelineFactory.php | PipelineFactory.buildAction | public function buildAction($pipeline, $actionName, $actionConfiguration = [])
{
$triggeredByEvents = is_array($actionConfiguration) && array_key_exists("triggered_by_events", $actionConfiguration) ? $actionConfiguration["triggered_by_events"] : [];
if (empty($triggeredByEvents)) {
// d... | php | public function buildAction($pipeline, $actionName, $actionConfiguration = [])
{
$triggeredByEvents = is_array($actionConfiguration) && array_key_exists("triggered_by_events", $actionConfiguration) ? $actionConfiguration["triggered_by_events"] : [];
if (empty($triggeredByEvents)) {
// d... | [
"public",
"function",
"buildAction",
"(",
"$",
"pipeline",
",",
"$",
"actionName",
",",
"$",
"actionConfiguration",
"=",
"[",
"]",
")",
"{",
"$",
"triggeredByEvents",
"=",
"is_array",
"(",
"$",
"actionConfiguration",
")",
"&&",
"array_key_exists",
"(",
"\"trig... | Add actions inside Pipeline based on the configuration provided by Symfony Configuration
@param Pipeline $pipeline
@param string $actionName
@param array $actionConfiguration | [
"Add",
"actions",
"inside",
"Pipeline",
"based",
"on",
"the",
"configuration",
"provided",
"by",
"Symfony",
"Configuration"
] | train | https://github.com/wizbii/pipeline/blob/8d22b976a53bb52abf0333b62b308ec7127cf414/Factory/PipelineFactory.php#L65-L84 |
FrenchFrogs/framework | src/Ruler/Ruler/Permission.php | Permission.removePermission | public function removePermission($permission)
{
if ($this->hasPermission($permission)) {
$index = array_search($permission, $this->permissions);
unset($this->permissions[$index]);
}
return $this;
} | php | public function removePermission($permission)
{
if ($this->hasPermission($permission)) {
$index = array_search($permission, $this->permissions);
unset($this->permissions[$index]);
}
return $this;
} | [
"public",
"function",
"removePermission",
"(",
"$",
"permission",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasPermission",
"(",
"$",
"permission",
")",
")",
"{",
"$",
"index",
"=",
"array_search",
"(",
"$",
"permission",
",",
"$",
"this",
"->",
"permissi... | Remove permission from ermission container
@param $permission
@return $this | [
"Remove",
"permission",
"from",
"ermission",
"container"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Ruler/Ruler/Permission.php#L71-L79 |
braincrafted/arrayquery | src/Braincrafted/ArrayQuery/ArrayQuery.php | ArrayQuery.select | public function select($select, $filters = array())
{
if (false === is_array($select)) {
$newSelect = [ $select => $filters ];
} else {
$newSelect = [];
foreach ($select as $key => $filters) {
if (true === is_int($key) || '*' === $key) {
... | php | public function select($select, $filters = array())
{
if (false === is_array($select)) {
$newSelect = [ $select => $filters ];
} else {
$newSelect = [];
foreach ($select as $key => $filters) {
if (true === is_int($key) || '*' === $key) {
... | [
"public",
"function",
"select",
"(",
"$",
"select",
",",
"$",
"filters",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"select",
")",
")",
"{",
"$",
"newSelect",
"=",
"[",
"$",
"select",
"=>",
"$",
"filters",
... | The names of the fields that should be selected by the query.
Example 1: **One field**
`$query->select('name');`
Example 2: **One field with filters**
`$query->select('name', 'length')`
Example 3: **Two fields as array**
`$query->select([ 'name', 'age' ]);`
Example 4: **Two fields with filters**
`$query->select... | [
"The",
"names",
"of",
"the",
"fields",
"that",
"should",
"be",
"selected",
"by",
"the",
"query",
"."
] | train | https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/ArrayQuery.php#L73-L90 |
braincrafted/arrayquery | src/Braincrafted/ArrayQuery/ArrayQuery.php | ArrayQuery.where | public function where($key, $value, $operator = '=', $filters = array())
{
$this->where[] = [
'key' => $key,
'value' => $value,
'operator' => $operator,
'filters' => $filters
];
return $this;
} | php | public function where($key, $value, $operator = '=', $filters = array())
{
$this->where[] = [
'key' => $key,
'value' => $value,
'operator' => $operator,
'filters' => $filters
];
return $this;
} | [
"public",
"function",
"where",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"operator",
"=",
"'='",
",",
"$",
"filters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"where",
"[",
"]",
"=",
"[",
"'key'",
"=>",
"$",
"key",
",",
"'value'... | Add a clause that elements have to match to be returned.
Example 1: **Simple where**
`$select->where('name', 'Bilbo Baggings');`
Example 2: **Different operator**
`$select->where('age', 50, '>=');`
Example 3: **Add filters**
`$select->where('name', 5, '=', [ 'trim', 'count' ]);`
@param mixed $key Key of th... | [
"Add",
"a",
"clause",
"that",
"elements",
"have",
"to",
"match",
"to",
"be",
"returned",
"."
] | train | https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/ArrayQuery.php#L128-L138 |
braincrafted/arrayquery | src/Braincrafted/ArrayQuery/ArrayQuery.php | ArrayQuery.execute | public function execute($one = false, $scalar = false, $preserveKeys = false)
{
if (true === $scalar && (count($this->select) > 1 || true === isset($this->select['*']))) {
throw new \InvalidArgumentException('$scalar can only be true if only one field is selected.');
}
$result =... | php | public function execute($one = false, $scalar = false, $preserveKeys = false)
{
if (true === $scalar && (count($this->select) > 1 || true === isset($this->select['*']))) {
throw new \InvalidArgumentException('$scalar can only be true if only one field is selected.');
}
$result =... | [
"public",
"function",
"execute",
"(",
"$",
"one",
"=",
"false",
",",
"$",
"scalar",
"=",
"false",
",",
"$",
"preserveKeys",
"=",
"false",
")",
"{",
"if",
"(",
"true",
"===",
"$",
"scalar",
"&&",
"(",
"count",
"(",
"$",
"this",
"->",
"select",
")",
... | Executes the query and returns the result.
@return array Array of elements that match the query
@throws \InvalidArgumentException when `$scalar` is `true` and more than one field is selected. | [
"Executes",
"the",
"query",
"and",
"returns",
"the",
"result",
"."
] | train | https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/ArrayQuery.php#L187-L213 |
braincrafted/arrayquery | src/Braincrafted/ArrayQuery/ArrayQuery.php | ArrayQuery.evaluateWhere | protected function evaluateWhere(array $item)
{
$result = true;
foreach ($this->where as $clause) {
$result = $result && $this->whereEvaluation->evaluate($item, $clause);
}
return $result;
} | php | protected function evaluateWhere(array $item)
{
$result = true;
foreach ($this->where as $clause) {
$result = $result && $this->whereEvaluation->evaluate($item, $clause);
}
return $result;
} | [
"protected",
"function",
"evaluateWhere",
"(",
"array",
"$",
"item",
")",
"{",
"$",
"result",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"where",
"as",
"$",
"clause",
")",
"{",
"$",
"result",
"=",
"$",
"result",
"&&",
"$",
"this",
"->",
"... | Evaluates the where clauses on the given item.
@param array $item The item to evaluate
@return boolean `true` if all where clauses evaluate to `true`, `false` otherwise | [
"Evaluates",
"the",
"where",
"clauses",
"on",
"the",
"given",
"item",
"."
] | train | https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/ArrayQuery.php#L222-L231 |
braincrafted/arrayquery | src/Braincrafted/ArrayQuery/ArrayQuery.php | ArrayQuery.evaluateSelect | protected function evaluateSelect(array $item, $scalar)
{
$resultItem = [];
foreach ($item as $key => $value) {
if (true === isset($this->select['*']) || true === isset($this->select[$key])) {
if (true === isset($this->select[$key])) {
$value = $this->... | php | protected function evaluateSelect(array $item, $scalar)
{
$resultItem = [];
foreach ($item as $key => $value) {
if (true === isset($this->select['*']) || true === isset($this->select[$key])) {
if (true === isset($this->select[$key])) {
$value = $this->... | [
"protected",
"function",
"evaluateSelect",
"(",
"array",
"$",
"item",
",",
"$",
"scalar",
")",
"{",
"$",
"resultItem",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"item",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"true",
"===",
"isset... | Evaluates the select.
@param array $item
@param boolean $scalar
@return mixed | [
"Evaluates",
"the",
"select",
"."
] | train | https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/ArrayQuery.php#L241-L258 |
czim/laravel-pxlcms | src/Models/Scopes/PositionOrderedScope.php | PositionOrderedScope.apply | public function apply(Builder $builder, Model $model)
{
$column = $model->getQualifiedPositionColumn();
$builder->orderBy($column);
$this->addUnordered($builder);
} | php | public function apply(Builder $builder, Model $model)
{
$column = $model->getQualifiedPositionColumn();
$builder->orderBy($column);
$this->addUnordered($builder);
} | [
"public",
"function",
"apply",
"(",
"Builder",
"$",
"builder",
",",
"Model",
"$",
"model",
")",
"{",
"$",
"column",
"=",
"$",
"model",
"->",
"getQualifiedPositionColumn",
"(",
")",
";",
"$",
"builder",
"->",
"orderBy",
"(",
"$",
"column",
")",
";",
"$"... | Apply scope on the query
@param \Illuminate\Database\Eloquent\Builder $builder
@param \Illuminate\Database\Eloquent\Model $model | [
"Apply",
"scope",
"on",
"the",
"query"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Models/Scopes/PositionOrderedScope.php#L18-L25 |
czim/laravel-pxlcms | src/Models/Scopes/PositionOrderedScope.php | PositionOrderedScope.remove | public function remove(Builder $builder, Model $model)
{
$query = $builder->getQuery();
$column = $model->getQualifiedPositionColumn();
foreach ((array) $query->orders as $key => $order) {
if ($order['column'] == $column) {
$this->removeOrderBy($query, ... | php | public function remove(Builder $builder, Model $model)
{
$query = $builder->getQuery();
$column = $model->getQualifiedPositionColumn();
foreach ((array) $query->orders as $key => $order) {
if ($order['column'] == $column) {
$this->removeOrderBy($query, ... | [
"public",
"function",
"remove",
"(",
"Builder",
"$",
"builder",
",",
"Model",
"$",
"model",
")",
"{",
"$",
"query",
"=",
"$",
"builder",
"->",
"getQuery",
"(",
")",
";",
"$",
"column",
"=",
"$",
"model",
"->",
"getQualifiedPositionColumn",
"(",
")",
";... | Remove scope from the query
@param \Illuminate\Database\Eloquent\Builder $builder
@param \Illuminate\Database\Eloquent\Model $model | [
"Remove",
"scope",
"from",
"the",
"query"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Models/Scopes/PositionOrderedScope.php#L33-L44 |
czim/laravel-pxlcms | src/Models/Scopes/PositionOrderedScope.php | PositionOrderedScope.removeOrderBy | protected function removeOrderBy(BaseBuilder $query, $key)
{
unset($query->orders[ $key ]);
$query->orders = array_values( $query->orders );
if ( ! count($query->orders)) {
$query->orders = null;
}
} | php | protected function removeOrderBy(BaseBuilder $query, $key)
{
unset($query->orders[ $key ]);
$query->orders = array_values( $query->orders );
if ( ! count($query->orders)) {
$query->orders = null;
}
} | [
"protected",
"function",
"removeOrderBy",
"(",
"BaseBuilder",
"$",
"query",
",",
"$",
"key",
")",
"{",
"unset",
"(",
"$",
"query",
"->",
"orders",
"[",
"$",
"key",
"]",
")",
";",
"$",
"query",
"->",
"orders",
"=",
"array_values",
"(",
"$",
"query",
"... | Remove scope constraint from the query
@param \Illuminate\Database\Query\Builder $query
@param int $key | [
"Remove",
"scope",
"constraint",
"from",
"the",
"query"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Models/Scopes/PositionOrderedScope.php#L52-L61 |
czim/laravel-pxlcms | src/Models/Scopes/PositionOrderedScope.php | PositionOrderedScope.addUnordered | protected function addUnordered(Builder $builder)
{
$builder->macro('unordered', function (Builder $builder) {
$this->remove($builder, $builder->getModel());
return $builder;
});
} | php | protected function addUnordered(Builder $builder)
{
$builder->macro('unordered', function (Builder $builder) {
$this->remove($builder, $builder->getModel());
return $builder;
});
} | [
"protected",
"function",
"addUnordered",
"(",
"Builder",
"$",
"builder",
")",
"{",
"$",
"builder",
"->",
"macro",
"(",
"'unordered'",
",",
"function",
"(",
"Builder",
"$",
"builder",
")",
"{",
"$",
"this",
"->",
"remove",
"(",
"$",
"builder",
",",
"$",
... | Extend Builder with custom method
@param \Illuminate\Database\Eloquent\Builder $builder | [
"Extend",
"Builder",
"with",
"custom",
"method"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Models/Scopes/PositionOrderedScope.php#L68-L75 |
activecollab/databasestructure | src/Behaviour/IsArchivedInterface/Implementation.php | Implementation.moveToArchive | public function moveToArchive($bulk = false)
{
$this->connection->transact(function () use ($bulk) {
$this->triggerEvent('on_before_move_to_archive', [$bulk]);
if ($bulk && method_exists($this, 'setOriginalIsArchived')) {
$this->setOriginalIsArchived($this->getIsArch... | php | public function moveToArchive($bulk = false)
{
$this->connection->transact(function () use ($bulk) {
$this->triggerEvent('on_before_move_to_archive', [$bulk]);
if ($bulk && method_exists($this, 'setOriginalIsArchived')) {
$this->setOriginalIsArchived($this->getIsArch... | [
"public",
"function",
"moveToArchive",
"(",
"$",
"bulk",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"transact",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"bulk",
")",
"{",
"$",
"this",
"->",
"triggerEvent",
"(",
"'on_before_move_to_... | Move to archive.
@param bool $bulk | [
"Move",
"to",
"archive",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Behaviour/IsArchivedInterface/Implementation.php#L32-L46 |
activecollab/databasestructure | src/Behaviour/IsArchivedInterface/Implementation.php | Implementation.restoreFromArchive | public function restoreFromArchive($bulk = false)
{
if ($this->getIsArchived()) {
$this->connection->transact(function () use ($bulk) {
$this->triggerEvent('on_before_restore_from_archive', [$bulk]);
if ($bulk && method_exists($this, 'getOriginalIsArchived') && m... | php | public function restoreFromArchive($bulk = false)
{
if ($this->getIsArchived()) {
$this->connection->transact(function () use ($bulk) {
$this->triggerEvent('on_before_restore_from_archive', [$bulk]);
if ($bulk && method_exists($this, 'getOriginalIsArchived') && m... | [
"public",
"function",
"restoreFromArchive",
"(",
"$",
"bulk",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsArchived",
"(",
")",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"transact",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"b... | Restore from archive.
@param bool $bulk | [
"Restore",
"from",
"archive",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Behaviour/IsArchivedInterface/Implementation.php#L53-L71 |
Agares/MicroORM | src/PDODbAdapter.php | PDODbAdapter.executeQuery | public function executeQuery(string $query, array $parameters = array()) : array
{
$statement = $this->executeParameterisedQuery($query, $parameters);
return $statement->fetchAll(\PDO::FETCH_ASSOC);
} | php | public function executeQuery(string $query, array $parameters = array()) : array
{
$statement = $this->executeParameterisedQuery($query, $parameters);
return $statement->fetchAll(\PDO::FETCH_ASSOC);
} | [
"public",
"function",
"executeQuery",
"(",
"string",
"$",
"query",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
":",
"array",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"executeParameterisedQuery",
"(",
"$",
"query",
",",
"$",
"param... | {@inheritdoc} | [
"{"
] | train | https://github.com/Agares/MicroORM/blob/2852bdff07d91c436725b574cf6dea4e4dab7060/src/PDODbAdapter.php#L28-L33 |
huasituo/hstcms | src/Http/Middleware/CheckAuth.php | CheckAuth.handle | public function handle($request, Closure $next)
{
$manager = $request->session()->get('manager');
if(!$manager) {
return redirect()->route('manageAuthLogin');
}
$managers = decrypt($manager);
list($uid, $username, $mobile, $email, $time) = explode('|', $managers);... | php | public function handle($request, Closure $next)
{
$manager = $request->session()->get('manager');
if(!$manager) {
return redirect()->route('manageAuthLogin');
}
$managers = decrypt($manager);
list($uid, $username, $mobile, $email, $time) = explode('|', $managers);... | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
")",
"{",
"$",
"manager",
"=",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"get",
"(",
"'manager'",
")",
";",
"if",
"(",
"!",
"$",
"manager",
")",
"{",
"return",... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Http/Middleware/CheckAuth.php#L26-L83 |
verschoof/bunq-api | src/Client.php | Client.requestAPI | private function requestAPI($method, $url, array $options = [])
{
try {
return $this->sendRequest((string)$method, (string)$url, $options);
} catch (SessionWasExpiredException $e) {
return $this->sendRequest((string)$method, (string)$url, $options);
} catch (ClientExc... | php | private function requestAPI($method, $url, array $options = [])
{
try {
return $this->sendRequest((string)$method, (string)$url, $options);
} catch (SessionWasExpiredException $e) {
return $this->sendRequest((string)$method, (string)$url, $options);
} catch (ClientExc... | [
"private",
"function",
"requestAPI",
"(",
"$",
"method",
",",
"$",
"url",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"sendRequest",
"(",
"(",
"string",
")",
"$",
"method",
",",
"(",
"string",
")"... | Handles the API Calling.
@param string $method
@param string $url
@param array $options
@return array
@throws BunqException | [
"Handles",
"the",
"API",
"Calling",
"."
] | train | https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Client.php#L68-L77 |
verschoof/bunq-api | src/Client.php | Client.sendRequest | private function sendRequest($method, $url, array $options = [])
{
$response = $this->httpClient->request((string)$method, $url, $options);
return json_decode($response->getBody(), true);
} | php | private function sendRequest($method, $url, array $options = [])
{
$response = $this->httpClient->request((string)$method, $url, $options);
return json_decode($response->getBody(), true);
} | [
"private",
"function",
"sendRequest",
"(",
"$",
"method",
",",
"$",
"url",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"httpClient",
"->",
"request",
"(",
"(",
"string",
")",
"$",
"method",
",",
"... | @param string $method
@param string $url
@param array $options
@return mixed | [
"@param",
"string",
"$method",
"@param",
"string",
"$url",
"@param",
"array",
"$options"
] | train | https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Client.php#L86-L91 |
baleen/cli | src/Provider/CommandsProvider.php | CommandsProvider.register | public function register()
{
$container = $this->getContainer();
$commands = $this->commands;
// add all message classes to the container
foreach ($commands as $alias => $config) {
$container->add($alias, function (Container $container, $config) {
/** @v... | php | public function register()
{
$container = $this->getContainer();
$commands = $this->commands;
// add all message classes to the container
foreach ($commands as $alias => $config) {
$container->add($alias, function (Container $container, $config) {
/** @v... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"$",
"commands",
"=",
"$",
"this",
"->",
"commands",
";",
"// add all message classes to the container",
"foreach",
"(",
"$",
"commands",
... | Use the register method to register items with the container via the
protected $this->container property or the `getContainer` method
from the ContainerAwareTrait. | [
"Use",
"the",
"register",
"method",
"to",
"register",
"items",
"with",
"the",
"container",
"via",
"the",
"protected",
"$this",
"-",
">",
"container",
"property",
"or",
"the",
"getContainer",
"method",
"from",
"the",
"ContainerAwareTrait",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/Provider/CommandsProvider.php#L109-L153 |
refinery29/piston | src/Router/MiddlewareStrategy.php | MiddlewareStrategy.dispatch | public function dispatch(callable $controller, array $vars = [], BaseRoute $route = null)
{
if ($group = $route->getParentGroup()) {
$this->response = (new PipelineProcessor())
->handlePayload(new Payload($group, $this->request, $this->response))
->getResponse();
... | php | public function dispatch(callable $controller, array $vars = [], BaseRoute $route = null)
{
if ($group = $route->getParentGroup()) {
$this->response = (new PipelineProcessor())
->handlePayload(new Payload($group, $this->request, $this->response))
->getResponse();
... | [
"public",
"function",
"dispatch",
"(",
"callable",
"$",
"controller",
",",
"array",
"$",
"vars",
"=",
"[",
"]",
",",
"BaseRoute",
"$",
"route",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"group",
"=",
"$",
"route",
"->",
"getParentGroup",
"(",
")",
")",
... | @param callable|string $controller
@param array $vars
@param BaseRoute $route
@throws \Exception
@return ApiResponse | [
"@param",
"callable|string",
"$controller",
"@param",
"array",
"$vars",
"@param",
"BaseRoute",
"$route"
] | train | https://github.com/refinery29/piston/blob/75c402e814136577fa9a02479e8803aca664c865/src/Router/MiddlewareStrategy.php#L30-L46 |
withfatpanda/illuminate-wordpress | src/WordPress/Console/Kernel.php | Kernel.defineConsoleSchedule | protected function defineConsoleSchedule()
{
$this->app->instance(
'Illuminate\Console\Scheduling\Schedule', $schedule = new Schedule($this->app[Cache::class])
);
$this->schedule($schedule);
} | php | protected function defineConsoleSchedule()
{
$this->app->instance(
'Illuminate\Console\Scheduling\Schedule', $schedule = new Schedule($this->app[Cache::class])
);
$this->schedule($schedule);
} | [
"protected",
"function",
"defineConsoleSchedule",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"instance",
"(",
"'Illuminate\\Console\\Scheduling\\Schedule'",
",",
"$",
"schedule",
"=",
"new",
"Schedule",
"(",
"$",
"this",
"->",
"app",
"[",
"Cache",
"::",
"c... | Define the application's command schedule.
@return void | [
"Define",
"the",
"application",
"s",
"command",
"schedule",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Console/Kernel.php#L65-L72 |
stubbles/stubbles-webapp-core | src/main/php/routing/api/Index.php | Index.resolve | public function resolve(Request $request, Response $response, UriPath $uriPath)
{
$uri = $request->uri();
$resources = new Resources();
foreach ($this->routes as $route) {
/* @var $route \stubbles\webapp\routing\Route */
if (!$route->shouldBeIgnoredInApiIndex()) {
... | php | public function resolve(Request $request, Response $response, UriPath $uriPath)
{
$uri = $request->uri();
$resources = new Resources();
foreach ($this->routes as $route) {
/* @var $route \stubbles\webapp\routing\Route */
if (!$route->shouldBeIgnoredInApiIndex()) {
... | [
"public",
"function",
"resolve",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"UriPath",
"$",
"uriPath",
")",
"{",
"$",
"uri",
"=",
"$",
"request",
"->",
"uri",
"(",
")",
";",
"$",
"resources",
"=",
"new",
"Resources",
"(",
... | resolves the request and returns resource data
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@param \stubbles\webapp\UriPath $uriPath information about called uri path
@return \stubbles\webapp\routing\api\Resources | [
"resolves",
"the",
"request",
"and",
"returns",
"resource",
"data"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/api/Index.php#L59-L71 |
esperecyan/dictionary-php | src/validator/ImageValidator.php | ImageValidator.convertExifToJFIF | protected function convertExifToJFIF(\Imagick $imagick)
{
if ($imagick->getImageProperties('exif:*')) {
$this->logger->error(sprintf(_('「%s」はExif形式です。'), $this->filename));
switch ($imagick->getImageOrientation()) {
case \Imagick::ORIENTATION_TOPRIGHT:
... | php | protected function convertExifToJFIF(\Imagick $imagick)
{
if ($imagick->getImageProperties('exif:*')) {
$this->logger->error(sprintf(_('「%s」はExif形式です。'), $this->filename));
switch ($imagick->getImageOrientation()) {
case \Imagick::ORIENTATION_TOPRIGHT:
... | [
"protected",
"function",
"convertExifToJFIF",
"(",
"\\",
"Imagick",
"$",
"imagick",
")",
"{",
"if",
"(",
"$",
"imagick",
"->",
"getImageProperties",
"(",
"'exif:*'",
")",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"error",
"(",
"sprintf",
"(",
"_",
"("... | 入力された画像がExifであればエラーを記録し、JFIFに変換します。
@param \Imagick $imagick JFIFかExif。 | [
"入力された画像がExifであればエラーを記録し、JFIFに変換します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/validator/ImageValidator.php#L50-L82 |
esperecyan/dictionary-php | src/validator/ImageValidator.php | ImageValidator.checkSize | protected function checkSize($imagick)
{
$width = $imagick->getImageWidth();
if ($width > self::MAX_RECOMMENDED_IMAGE_WIDTH) {
$this->logger->warning(sprintf(
_('画像の幅は %1$s 以下にすべきです。「%2$s」の幅は %3$s です。'),
self::MAX_RECOMMENDED_IMAGE_WIDTH . 'px',
... | php | protected function checkSize($imagick)
{
$width = $imagick->getImageWidth();
if ($width > self::MAX_RECOMMENDED_IMAGE_WIDTH) {
$this->logger->warning(sprintf(
_('画像の幅は %1$s 以下にすべきです。「%2$s」の幅は %3$s です。'),
self::MAX_RECOMMENDED_IMAGE_WIDTH . 'px',
... | [
"protected",
"function",
"checkSize",
"(",
"$",
"imagick",
")",
"{",
"$",
"width",
"=",
"$",
"imagick",
"->",
"getImageWidth",
"(",
")",
";",
"if",
"(",
"$",
"width",
">",
"self",
"::",
"MAX_RECOMMENDED_IMAGE_WIDTH",
")",
"{",
"$",
"this",
"->",
"logger"... | 幅と高さをチェックします。
@param \Imagick $imagick | [
"幅と高さをチェックします。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/validator/ImageValidator.php#L88-L109 |
esperecyan/dictionary-php | src/validator/ImageValidator.php | ImageValidator.generateErrorMessage | protected function generateErrorMessage(): string
{
switch ($this->type) {
case 'image/png':
$readableType = _('PNGファイル');
break;
case 'image/jpeg':
$readableType = _('JFIF (JPEG) ファイル');
break;
case 'image/s... | php | protected function generateErrorMessage(): string
{
switch ($this->type) {
case 'image/png':
$readableType = _('PNGファイル');
break;
case 'image/jpeg':
$readableType = _('JFIF (JPEG) ファイル');
break;
case 'image/s... | [
"protected",
"function",
"generateErrorMessage",
"(",
")",
":",
"string",
"{",
"switch",
"(",
"$",
"this",
"->",
"type",
")",
"{",
"case",
"'image/png'",
":",
"$",
"readableType",
"=",
"_",
"(",
"'PNGファイル');",
"",
"",
"break",
";",
"case",
"'image/jpeg'",
... | MIMEタイプをもとにエラーメッセージを生成します。
@return string | [
"MIMEタイプをもとにエラーメッセージを生成します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/validator/ImageValidator.php#L115-L129 |
ejsmont-artur/phpProxyBuilder | src/PhpProxyBuilder/Adapter/Log/DummyArrayLog.php | DummyArrayLog.logDebug | public function logDebug($message, $attachment = null) {
$this->messages[] = "debug: " . $message . print_r($attachment, true);
} | php | public function logDebug($message, $attachment = null) {
$this->messages[] = "debug: " . $message . print_r($attachment, true);
} | [
"public",
"function",
"logDebug",
"(",
"$",
"message",
",",
"$",
"attachment",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"messages",
"[",
"]",
"=",
"\"debug: \"",
".",
"$",
"message",
".",
"print_r",
"(",
"$",
"attachment",
",",
"true",
")",
";",
"}"... | Log message as debug level
@param string $message
@param mixed $attachment optional array or structure of data to be attached
@return void | [
"Log",
"message",
"as",
"debug",
"level"
] | train | https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Adapter/Log/DummyArrayLog.php#L37-L39 |
ejsmont-artur/phpProxyBuilder | src/PhpProxyBuilder/Adapter/Log/DummyArrayLog.php | DummyArrayLog.logWarning | public function logWarning($message, $attachment = null) {
$this->messages[] = "warning: " . $message . print_r($attachment, true);
} | php | public function logWarning($message, $attachment = null) {
$this->messages[] = "warning: " . $message . print_r($attachment, true);
} | [
"public",
"function",
"logWarning",
"(",
"$",
"message",
",",
"$",
"attachment",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"messages",
"[",
"]",
"=",
"\"warning: \"",
".",
"$",
"message",
".",
"print_r",
"(",
"$",
"attachment",
",",
"true",
")",
";",
... | Log message as warning level
@param string $message
@param mixed $attachment optional array or structure of data to be attached
@return void | [
"Log",
"message",
"as",
"warning",
"level"
] | train | https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Adapter/Log/DummyArrayLog.php#L48-L50 |
ejsmont-artur/phpProxyBuilder | src/PhpProxyBuilder/Adapter/Log/DummyArrayLog.php | DummyArrayLog.logError | public function logError($message, $attachment = null) {
$this->messages[] = "error: " . $message . print_r($attachment, true);
} | php | public function logError($message, $attachment = null) {
$this->messages[] = "error: " . $message . print_r($attachment, true);
} | [
"public",
"function",
"logError",
"(",
"$",
"message",
",",
"$",
"attachment",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"messages",
"[",
"]",
"=",
"\"error: \"",
".",
"$",
"message",
".",
"print_r",
"(",
"$",
"attachment",
",",
"true",
")",
";",
"}"... | Log message as error level
@param string $message
@param mixed $attachment optional array or structure of data to be attached
@return void | [
"Log",
"message",
"as",
"error",
"level"
] | train | https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Adapter/Log/DummyArrayLog.php#L59-L61 |
ejsmont-artur/phpProxyBuilder | src/PhpProxyBuilder/Adapter/Log/DummyArrayLog.php | DummyArrayLog.getLastMessage | public function getLastMessage() {
$messagesClone = $this->messages;
$keys = array_keys($messagesClone);
$key = array_pop($keys);
return $this->messages[$key];
} | php | public function getLastMessage() {
$messagesClone = $this->messages;
$keys = array_keys($messagesClone);
$key = array_pop($keys);
return $this->messages[$key];
} | [
"public",
"function",
"getLastMessage",
"(",
")",
"{",
"$",
"messagesClone",
"=",
"$",
"this",
"->",
"messages",
";",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"messagesClone",
")",
";",
"$",
"key",
"=",
"array_pop",
"(",
"$",
"keys",
")",
";",
"return... | Get most recent log entry as string
@return string | [
"Get",
"most",
"recent",
"log",
"entry",
"as",
"string"
] | train | https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Adapter/Log/DummyArrayLog.php#L75-L80 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php | RolePermissionQuery.filterByPrimaryKey | public function filterByPrimaryKey($key)
{
$this->addUsingAlias(RolePermissionTableMap::COL_ROLE_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(RolePermissionTableMap::COL_PERMISSION_ID, $key[1], Criteria::EQUAL);
return $this;
} | php | public function filterByPrimaryKey($key)
{
$this->addUsingAlias(RolePermissionTableMap::COL_ROLE_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(RolePermissionTableMap::COL_PERMISSION_ID, $key[1], Criteria::EQUAL);
return $this;
} | [
"public",
"function",
"filterByPrimaryKey",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RolePermissionTableMap",
"::",
"COL_ROLE_ID",
",",
"$",
"key",
"[",
"0",
"]",
",",
"Criteria",
"::",
"EQUAL",
")",
";",
"$",
"this",
"->",
"a... | Filter the query by primary key
@param mixed $key Primary key to use for the query
@return $this|ChildRolePermissionQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"by",
"primary",
"key"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php#L213-L219 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php | RolePermissionQuery.filterByRoleId | public function filterByRoleId($roleId = null, $comparison = null)
{
if (is_array($roleId)) {
$useMinMax = false;
if (isset($roleId['min'])) {
$this->addUsingAlias(RolePermissionTableMap::COL_ROLE_ID, $roleId['min'], Criteria::GREATER_EQUAL);
$useMinMa... | php | public function filterByRoleId($roleId = null, $comparison = null)
{
if (is_array($roleId)) {
$useMinMax = false;
if (isset($roleId['min'])) {
$this->addUsingAlias(RolePermissionTableMap::COL_ROLE_ID, $roleId['min'], Criteria::GREATER_EQUAL);
$useMinMa... | [
"public",
"function",
"filterByRoleId",
"(",
"$",
"roleId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"roleId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"ro... | Filter the query on the role_id column
Example usage:
<code>
$query->filterByRoleId(1234); // WHERE role_id = 1234
$query->filterByRoleId(array(12, 34)); // WHERE role_id IN (12, 34)
$query->filterByRoleId(array('min' => 12)); // WHERE role_id > 12
</code>
@see filterByRole()
@param mixed $roleId The value... | [
"Filter",
"the",
"query",
"on",
"the",
"role_id",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php#L263-L284 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php | RolePermissionQuery.filterByPermissionId | public function filterByPermissionId($permissionId = null, $comparison = null)
{
if (is_array($permissionId)) {
$useMinMax = false;
if (isset($permissionId['min'])) {
$this->addUsingAlias(RolePermissionTableMap::COL_PERMISSION_ID, $permissionId['min'], Criteria::GREAT... | php | public function filterByPermissionId($permissionId = null, $comparison = null)
{
if (is_array($permissionId)) {
$useMinMax = false;
if (isset($permissionId['min'])) {
$this->addUsingAlias(RolePermissionTableMap::COL_PERMISSION_ID, $permissionId['min'], Criteria::GREAT... | [
"public",
"function",
"filterByPermissionId",
"(",
"$",
"permissionId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"permissionId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
... | Filter the query on the permission_id column
Example usage:
<code>
$query->filterByPermissionId(1234); // WHERE permission_id = 1234
$query->filterByPermissionId(array(12, 34)); // WHERE permission_id IN (12, 34)
$query->filterByPermissionId(array('min' => 12)); // WHERE permission_id > 12
</code>
@see filterBy... | [
"Filter",
"the",
"query",
"on",
"the",
"permission_id",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php#L306-L327 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php | RolePermissionQuery.filterByRole | public function filterByRole($role, $comparison = null)
{
if ($role instanceof \Alchemy\Component\Cerberus\Model\Role) {
return $this
->addUsingAlias(RolePermissionTableMap::COL_ROLE_ID, $role->getId(), $comparison);
} elseif ($role instanceof ObjectCollection) {
... | php | public function filterByRole($role, $comparison = null)
{
if ($role instanceof \Alchemy\Component\Cerberus\Model\Role) {
return $this
->addUsingAlias(RolePermissionTableMap::COL_ROLE_ID, $role->getId(), $comparison);
} elseif ($role instanceof ObjectCollection) {
... | [
"public",
"function",
"filterByRole",
"(",
"$",
"role",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"role",
"instanceof",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"Role",
")",
"{",
"return",
"$",
"th... | Filter the query by a related \Alchemy\Component\Cerberus\Model\Role object
@param \Alchemy\Component\Cerberus\Model\Role|ObjectCollection $role The related object(s) to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildRolePermissionQuery The ... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"Role",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php#L337-L352 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php | RolePermissionQuery.filterByPermission | public function filterByPermission($permission, $comparison = null)
{
if ($permission instanceof \Alchemy\Component\Cerberus\Model\Permission) {
return $this
->addUsingAlias(RolePermissionTableMap::COL_PERMISSION_ID, $permission->getId(), $comparison);
} elseif ($permissi... | php | public function filterByPermission($permission, $comparison = null)
{
if ($permission instanceof \Alchemy\Component\Cerberus\Model\Permission) {
return $this
->addUsingAlias(RolePermissionTableMap::COL_PERMISSION_ID, $permission->getId(), $comparison);
} elseif ($permissi... | [
"public",
"function",
"filterByPermission",
"(",
"$",
"permission",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"permission",
"instanceof",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"Permission",
")",
"{",
... | Filter the query by a related \Alchemy\Component\Cerberus\Model\Permission object
@param \Alchemy\Component\Cerberus\Model\Permission|ObjectCollection $permission The related object(s) to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildRolePe... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"Permission",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php#L412-L427 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php | RolePermissionQuery.usePermissionQuery | public function usePermissionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinPermission($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Permission', '\Alchemy\Component\Cerberus\Model\PermissionQuery');
} | php | public function usePermissionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinPermission($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Permission', '\Alchemy\Component\Cerberus\Model\PermissionQuery');
} | [
"public",
"function",
"usePermissionQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinPermission",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->"... | Use the Permission relation Permission 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\Permi... | [
"Use",
"the",
"Permission",
"relation",
"Permission",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php#L472-L477 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php | RolePermissionQuery.prune | public function prune($rolePermission = null)
{
if ($rolePermission) {
$this->addCond('pruneCond0', $this->getAliasedColName(RolePermissionTableMap::COL_ROLE_ID), $rolePermission->getRoleId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(RolePermissionT... | php | public function prune($rolePermission = null)
{
if ($rolePermission) {
$this->addCond('pruneCond0', $this->getAliasedColName(RolePermissionTableMap::COL_ROLE_ID), $rolePermission->getRoleId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(RolePermissionT... | [
"public",
"function",
"prune",
"(",
"$",
"rolePermission",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"rolePermission",
")",
"{",
"$",
"this",
"->",
"addCond",
"(",
"'pruneCond0'",
",",
"$",
"this",
"->",
"getAliasedColName",
"(",
"RolePermissionTableMap",
"::",... | Exclude object from result
@param ChildRolePermission $rolePermission Object to remove from the list of results
@return $this|ChildRolePermissionQuery The current query, for fluid interface | [
"Exclude",
"object",
"from",
"result"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermissionQuery.php#L486-L495 |
delboy1978uk/form | src/Renderer/AbstractFormRenderer.php | AbstractFormRenderer.resetDom | private function resetDom()
{
$this->setDom(new DOMDocument());
$this->form = $this->getDom()->createElement('form');
$this->errorRenderer = new DefaultErrorRender($this->dom);
} | php | private function resetDom()
{
$this->setDom(new DOMDocument());
$this->form = $this->getDom()->createElement('form');
$this->errorRenderer = new DefaultErrorRender($this->dom);
} | [
"private",
"function",
"resetDom",
"(",
")",
"{",
"$",
"this",
"->",
"setDom",
"(",
"new",
"DOMDocument",
"(",
")",
")",
";",
"$",
"this",
"->",
"form",
"=",
"$",
"this",
"->",
"getDom",
"(",
")",
"->",
"createElement",
"(",
"'form'",
")",
";",
"$"... | resets dom | [
"resets",
"dom"
] | train | https://github.com/delboy1978uk/form/blob/fbbb042d95deef4603a19edf08c0497f720398a6/src/Renderer/AbstractFormRenderer.php#L68-L73 |
delboy1978uk/form | src/Renderer/AbstractFormRenderer.php | AbstractFormRenderer.createNewDynamicContainerBlockIfNeeded | private function createNewDynamicContainerBlockIfNeeded($dynamicTriggerValue)
{
if (!isset($this->dynamicContainerBlock) && $dynamicTriggerValue !== null) {
$this->dynamicContainerBlock = $this->createElement('div');
$this->dynamicContainerBlock->setAttribute('data-dynamic-form', $th... | php | private function createNewDynamicContainerBlockIfNeeded($dynamicTriggerValue)
{
if (!isset($this->dynamicContainerBlock) && $dynamicTriggerValue !== null) {
$this->dynamicContainerBlock = $this->createElement('div');
$this->dynamicContainerBlock->setAttribute('data-dynamic-form', $th... | [
"private",
"function",
"createNewDynamicContainerBlockIfNeeded",
"(",
"$",
"dynamicTriggerValue",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"dynamicContainerBlock",
")",
"&&",
"$",
"dynamicTriggerValue",
"!==",
"null",
")",
"{",
"$",
"this",
"->... | This creates a containing div for dynamic fields which appear only on another fields value
@param null|string $dynamicTriggerValue | [
"This",
"creates",
"a",
"containing",
"div",
"for",
"dynamic",
"fields",
"which",
"appear",
"only",
"on",
"another",
"fields",
"value"
] | train | https://github.com/delboy1978uk/form/blob/fbbb042d95deef4603a19edf08c0497f720398a6/src/Renderer/AbstractFormRenderer.php#L177-L187 |
delboy1978uk/form | src/Renderer/AbstractFormRenderer.php | AbstractFormRenderer.dynamicFormCheck | private function dynamicFormCheck()
{
if ($this->field->hasDynamicForms()) {
$this->dynamicFormParentName = $this->field->getName();
$value = $this->field->getValue();
$forms = $this->field->getDynamicForms();
$this->includeDynamicFormJavascript = true;
... | php | private function dynamicFormCheck()
{
if ($this->field->hasDynamicForms()) {
$this->dynamicFormParentName = $this->field->getName();
$value = $this->field->getValue();
$forms = $this->field->getDynamicForms();
$this->includeDynamicFormJavascript = true;
... | [
"private",
"function",
"dynamicFormCheck",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"field",
"->",
"hasDynamicForms",
"(",
")",
")",
"{",
"$",
"this",
"->",
"dynamicFormParentName",
"=",
"$",
"this",
"->",
"field",
"->",
"getName",
"(",
")",
";",
"... | Checks current field being processed for dynamic sub forms | [
"Checks",
"current",
"field",
"being",
"processed",
"for",
"dynamic",
"sub",
"forms"
] | train | https://github.com/delboy1978uk/form/blob/fbbb042d95deef4603a19edf08c0497f720398a6/src/Renderer/AbstractFormRenderer.php#L192-L206 |
php-ddd/command | src/Bus/CommandBusEventDispatcher.php | CommandBusEventDispatcher.dispatch | public function dispatch(CommandInterface $command)
{
$aggregateRoots = $this->commandBus->dispatch($command);
$this->dispatchEvents($aggregateRoots);
return $aggregateRoots;
} | php | public function dispatch(CommandInterface $command)
{
$aggregateRoots = $this->commandBus->dispatch($command);
$this->dispatchEvents($aggregateRoots);
return $aggregateRoots;
} | [
"public",
"function",
"dispatch",
"(",
"CommandInterface",
"$",
"command",
")",
"{",
"$",
"aggregateRoots",
"=",
"$",
"this",
"->",
"commandBus",
"->",
"dispatch",
"(",
"$",
"command",
")",
";",
"$",
"this",
"->",
"dispatchEvents",
"(",
"$",
"aggregateRoots"... | @param CommandInterface $command
@return AbstractAggregateRoot[] | [
"@param",
"CommandInterface",
"$command"
] | train | https://github.com/php-ddd/command/blob/dbad1d35c8d740c29c3a28d34f4a787c2b14688a/src/Bus/CommandBusEventDispatcher.php#L44-L51 |
php-ddd/command | src/Bus/CommandBusEventDispatcher.php | CommandBusEventDispatcher.publish | public function publish(EventInterface $event)
{
$commandsToDispatch = $this->eventBus->publish($event);
$commands = $this->extractCommands($commandsToDispatch);
foreach ($commands as $command) {
$this->dispatch($command);
}
} | php | public function publish(EventInterface $event)
{
$commandsToDispatch = $this->eventBus->publish($event);
$commands = $this->extractCommands($commandsToDispatch);
foreach ($commands as $command) {
$this->dispatch($command);
}
} | [
"public",
"function",
"publish",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"commandsToDispatch",
"=",
"$",
"this",
"->",
"eventBus",
"->",
"publish",
"(",
"$",
"event",
")",
";",
"$",
"commands",
"=",
"$",
"this",
"->",
"extractCommands",
"(",
... | Publishes the event $event to every EventListener that wants to.
@param EventInterface $event
@return string[]|null data returned by each EventListener | [
"Publishes",
"the",
"event",
"$event",
"to",
"every",
"EventListener",
"that",
"wants",
"to",
"."
] | train | https://github.com/php-ddd/command/blob/dbad1d35c8d740c29c3a28d34f4a787c2b14688a/src/Bus/CommandBusEventDispatcher.php#L68-L76 |
php-ddd/command | src/Bus/CommandBusEventDispatcher.php | CommandBusEventDispatcher.extractCommands | private function extractCommands(array $commandsToDispatch)
{
$commands = array();
foreach ($commandsToDispatch as $command) {
if (is_array($command)) {
$commands = array_merge($commands, $this->extractCommands($command));
} elseif ($command instanceof Command... | php | private function extractCommands(array $commandsToDispatch)
{
$commands = array();
foreach ($commandsToDispatch as $command) {
if (is_array($command)) {
$commands = array_merge($commands, $this->extractCommands($command));
} elseif ($command instanceof Command... | [
"private",
"function",
"extractCommands",
"(",
"array",
"$",
"commandsToDispatch",
")",
"{",
"$",
"commands",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"commandsToDispatch",
"as",
"$",
"command",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"command"... | @param array $commandsToDispatch
@return CommandInterface[] | [
"@param",
"array",
"$commandsToDispatch"
] | train | https://github.com/php-ddd/command/blob/dbad1d35c8d740c29c3a28d34f4a787c2b14688a/src/Bus/CommandBusEventDispatcher.php#L123-L135 |
movoin/one-swoole | src/Protocol/Responders/HttpResponder.php | HttpResponder.handlePayload | protected function handlePayload(Request $request, Response $response, Payload $payload): Response
{
$handler = $this->getHandler($request);
return $response
->withBody(Factory::newStream($handler->body($payload)))
->withHeader('Content-Type', $handler->type())
-... | php | protected function handlePayload(Request $request, Response $response, Payload $payload): Response
{
$handler = $this->getHandler($request);
return $response
->withBody(Factory::newStream($handler->body($payload)))
->withHeader('Content-Type', $handler->type())
-... | [
"protected",
"function",
"handlePayload",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"Payload",
"$",
"payload",
")",
":",
"Response",
"{",
"$",
"handler",
"=",
"$",
"this",
"->",
"getHandler",
"(",
"$",
"request",
")",
";",
"r... | 处理截荷
@param \One\Protocol\Contracts\Request $request
@param \One\Protocol\Contracts\Response $response
@param \One\Context\Contracts\Payload $payload
@return \One\Protocol\Contracts\Response | [
"处理截荷"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Responders/HttpResponder.php#L88-L97 |
movoin/one-swoole | src/Protocol/Responders/HttpResponder.php | HttpResponder.handleRequestHeader | protected function handleRequestHeader(Request $request, Response $response): Response
{
// 处理 No-Cache
if ($request->header('Cache-Control') === 'no-cache') {
$response = $response->withHeader('Cache-Control', [
'no-store',
'no-cache',
'mu... | php | protected function handleRequestHeader(Request $request, Response $response): Response
{
// 处理 No-Cache
if ($request->header('Cache-Control') === 'no-cache') {
$response = $response->withHeader('Cache-Control', [
'no-store',
'no-cache',
'mu... | [
"protected",
"function",
"handleRequestHeader",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
":",
"Response",
"{",
"// 处理 No-Cache",
"if",
"(",
"$",
"request",
"->",
"header",
"(",
"'Cache-Control'",
")",
"===",
"'no-cache'",
")",
"{"... | 处理请求头
@param \One\Protocol\Contracts\Request $request
@param \One\Protocol\Contracts\Response $response
@return \One\Protocol\Contracts\Response | [
"处理请求头"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Responders/HttpResponder.php#L107-L137 |
movoin/one-swoole | src/Protocol/Responders/HttpResponder.php | HttpResponder.getAcceptHandler | public function getAcceptHandler(Request $request)
{
$accept = $request->getHeaderLine('Accept');
$priorities = $this->priorities();
if (! empty($accept)) {
$preferred = $this->negotiator->getBest($accept, array_keys($priorities));
}
if (! empty($preferred))... | php | public function getAcceptHandler(Request $request)
{
$accept = $request->getHeaderLine('Accept');
$priorities = $this->priorities();
if (! empty($accept)) {
$preferred = $this->negotiator->getBest($accept, array_keys($priorities));
}
if (! empty($preferred))... | [
"public",
"function",
"getAcceptHandler",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"accept",
"=",
"$",
"request",
"->",
"getHeaderLine",
"(",
"'Accept'",
")",
";",
"$",
"priorities",
"=",
"$",
"this",
"->",
"priorities",
"(",
")",
";",
"if",
"(",
... | 返回请求内容句柄
@param \One\Protocol\Contracts\Request $request
@return \One\Protocol\Contracts\RespondHandler|null | [
"返回请求内容句柄"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Responders/HttpResponder.php#L146-L164 |
movoin/one-swoole | src/Protocol/Responders/HttpResponder.php | HttpResponder.getHandler | protected function getHandler(Request $request): RespondHandler
{
if (($handler = $this->getAcceptHandler($request)) === null) {
$priorities = $this->priorities();
return array_shift($priorities);
}
return $handler;
} | php | protected function getHandler(Request $request): RespondHandler
{
if (($handler = $this->getAcceptHandler($request)) === null) {
$priorities = $this->priorities();
return array_shift($priorities);
}
return $handler;
} | [
"protected",
"function",
"getHandler",
"(",
"Request",
"$",
"request",
")",
":",
"RespondHandler",
"{",
"if",
"(",
"(",
"$",
"handler",
"=",
"$",
"this",
"->",
"getAcceptHandler",
"(",
"$",
"request",
")",
")",
"===",
"null",
")",
"{",
"$",
"priorities",... | 获得响应处理句柄
@param \One\Protocol\Contracts\Request $request
@return \One\Protocol\Contracts\RespondHandler | [
"获得响应处理句柄"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Responders/HttpResponder.php#L173-L182 |
movoin/one-swoole | src/Protocol/Responders/HttpResponder.php | HttpResponder.priorities | protected function priorities(): array
{
if ($this->priorities !== []) {
return $this->priorities;
}
foreach ($this->handlers as $handler) {
foreach ($handler->accepts() as $type) {
$this->priorities[$type] = $handler;
}
}
... | php | protected function priorities(): array
{
if ($this->priorities !== []) {
return $this->priorities;
}
foreach ($this->handlers as $handler) {
foreach ($handler->accepts() as $type) {
$this->priorities[$type] = $handler;
}
}
... | [
"protected",
"function",
"priorities",
"(",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"priorities",
"!==",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"priorities",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"handlers",
"as",
"$",
... | 返回响应器的优先级
@return array | [
"返回响应器的优先级"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Responders/HttpResponder.php#L189-L202 |
adminarchitect/contacts | src/Terranet/Contacts/Traits/HasContacts.php | HasContacts.prepareArrays | protected function prepareArrays(array $items = [])
{
$items = array_map(function ($item) {
return trim($item);
}, $items);
return array_filter($items, function ($item) {
return ! empty($item);
});
} | php | protected function prepareArrays(array $items = [])
{
$items = array_map(function ($item) {
return trim($item);
}, $items);
return array_filter($items, function ($item) {
return ! empty($item);
});
} | [
"protected",
"function",
"prepareArrays",
"(",
"array",
"$",
"items",
"=",
"[",
"]",
")",
"{",
"$",
"items",
"=",
"array_map",
"(",
"function",
"(",
"$",
"item",
")",
"{",
"return",
"trim",
"(",
"$",
"item",
")",
";",
"}",
",",
"$",
"items",
")",
... | Prepare arrays before accepting
@param array $items
@return array | [
"Prepare",
"arrays",
"before",
"accepting"
] | train | https://github.com/adminarchitect/contacts/blob/f46e6a13a2d5802ad32c446d5a7e0fbc878a4b5e/src/Terranet/Contacts/Traits/HasContacts.php#L65-L74 |
Teamsisu/contao-mm-frontendInput | src/Teamsisu/MetaModelsFrontendInput/Handler/Save/UploadSaveHandler.php | UploadSaveHandler.parseWidget | public function parseWidget($widget)
{
/**
* Check if file in session exists
*/
if(!isset($_SESSION['FILES'][$this->field->getColName()])){
return false;
}
/**
* Rename the file (move) to the new location with the new name
*/
... | php | public function parseWidget($widget)
{
/**
* Check if file in session exists
*/
if(!isset($_SESSION['FILES'][$this->field->getColName()])){
return false;
}
/**
* Rename the file (move) to the new location with the new name
*/
... | [
"public",
"function",
"parseWidget",
"(",
"$",
"widget",
")",
"{",
"/**\n * Check if file in session exists\n */",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SESSION",
"[",
"'FILES'",
"]",
"[",
"$",
"this",
"->",
"field",
"->",
"getColName",
"(",
")",
... | Parses the widget and returns either the uuid of the file or false if moving the file failed
@param $widget
@return mixed
@throws \Exception | [
"Parses",
"the",
"widget",
"and",
"returns",
"either",
"the",
"uuid",
"of",
"the",
"file",
"or",
"false",
"if",
"moving",
"the",
"file",
"failed"
] | train | https://github.com/Teamsisu/contao-mm-frontendInput/blob/ab92e61c24644f1e61265304b6a35e505007d021/src/Teamsisu/MetaModelsFrontendInput/Handler/Save/UploadSaveHandler.php#L37-L75 |
someline/someline-image | src/migrations/2015_05_09_104821_create_someline_image_hashes_table.php | CreateSomelineImageHashesTable.up | public function up()
{
Schema::create('someline_image_hashes', function(Blueprint $table)
{
$table->increments('someline_image_hash_id');
$table->unsignedInteger('user_id')->nullable()->index();
$table->unsignedInteger('someline_image_id')->index();
$table->char('fil... | php | public function up()
{
Schema::create('someline_image_hashes', function(Blueprint $table)
{
$table->increments('someline_image_hash_id');
$table->unsignedInteger('user_id')->nullable()->index();
$table->unsignedInteger('someline_image_id')->index();
$table->char('fil... | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"create",
"(",
"'someline_image_hashes'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"increments",
"(",
"'someline_image_hash_id'",
")",
";",
"$",
"table",
"->",
... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/someline/someline-image/blob/a48d760c5292ad24859ff6f4b14b7735fe6f4d42/src/migrations/2015_05_09_104821_create_someline_image_hashes_table.php#L13-L28 |
phramework/jsonapi | src/Filter.php | Filter.validate | public function validate($modelClass)
{
$idAttribute = $modelClass::getIdAttribute();
$filterValidationModel = $modelClass::getFilterValidationModel();
$validationModel = $modelClass::getValidationModel();
/**
* Validate primary
*/
//Use fi... | php | public function validate($modelClass)
{
$idAttribute = $modelClass::getIdAttribute();
$filterValidationModel = $modelClass::getFilterValidationModel();
$validationModel = $modelClass::getValidationModel();
/**
* Validate primary
*/
//Use fi... | [
"public",
"function",
"validate",
"(",
"$",
"modelClass",
")",
"{",
"$",
"idAttribute",
"=",
"$",
"modelClass",
"::",
"getIdAttribute",
"(",
")",
";",
"$",
"filterValidationModel",
"=",
"$",
"modelClass",
"::",
"getFilterValidationModel",
"(",
")",
";",
"$",
... | Validate against a resource model class
@param string $modelClass Resource model class
@throws RequestException
@throws \Exception
@throws IncorrectParametersException When filter for primary id attribute is incorrect
@throws IncorrectParametersException When filter for relationship is incorrect
@example
```php
$filter... | [
"Validate",
"against",
"a",
"resource",
"model",
"class",
"@param",
"string",
"$modelClass",
"Resource",
"model",
"class",
"@throws",
"RequestException",
"@throws",
"\\",
"Exception",
"@throws",
"IncorrectParametersException",
"When",
"filter",
"for",
"primary",
"id",
... | train | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Filter.php#L146-L295 |
comodojo/dispatcher.framework | src/Comodojo/Dispatcher/Response/Preprocessor/Status301.php | Status301.consolidate | public function consolidate(Response $response) {
$location = $response->getLocation()->get();
if (empty($location)) {
throw new Exception("Invalid location, cannot redirect");
}
$response->getHeaders()->set("Location", $location);
$content = $response->getContent... | php | public function consolidate(Response $response) {
$location = $response->getLocation()->get();
if (empty($location)) {
throw new Exception("Invalid location, cannot redirect");
}
$response->getHeaders()->set("Location", $location);
$content = $response->getContent... | [
"public",
"function",
"consolidate",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"location",
"=",
"$",
"response",
"->",
"getLocation",
"(",
")",
"->",
"get",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"location",
")",
")",
"{",
"throw",
"new"... | {@inheritdoc} | [
"{"
] | train | https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Response/Preprocessor/Status301.php#L29-L59 |
movoin/one-swoole | src/FileSystem/FileSystem.php | FileSystem.exists | public function exists(string $path): bool
{
$path = $this->normalizePath($path);
return strlen($path) === 0 ? false : $this->getAdapter()->exists($path);
} | php | public function exists(string $path): bool
{
$path = $this->normalizePath($path);
return strlen($path) === 0 ? false : $this->getAdapter()->exists($path);
} | [
"public",
"function",
"exists",
"(",
"string",
"$",
"path",
")",
":",
"bool",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"path",
")",
";",
"return",
"strlen",
"(",
"$",
"path",
")",
"===",
"0",
"?",
"false",
":",
"$",
"t... | 判断路径是否存在
@param string $path
@return bool
@throws \One\FileSystem\Exceptions\FileSystemException | [
"判断路径是否存在"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L70-L75 |
movoin/one-swoole | src/FileSystem/FileSystem.php | FileSystem.read | public function read(string $path): string
{
$path = $this->normalizePath($path);
$this->assertPresent($path);
return $this->getAdapter()->read($path);
} | php | public function read(string $path): string
{
$path = $this->normalizePath($path);
$this->assertPresent($path);
return $this->getAdapter()->read($path);
} | [
"public",
"function",
"read",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"assertPresent",
"(",
"$",
"path",
")",
";",
"return",
"$",
"thi... | 读取文件内容
@param string $path
@return string
@throws \One\FileSystem\Exceptions\FileSystemException
@throws \One\FileSystem\Exceptions\FileNotExistsException | [
"读取文件内容"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L86-L92 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.