repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
tarsana/filesystem
src/Adapters/Memory.php
Memory.isDir
public function isDir($path) { $node = $this->at($path); return null !== $node && 'dir' === $node->type; }
php
public function isDir($path) { $node = $this->at($path); return null !== $node && 'dir' === $node->type; }
[ "public", "function", "isDir", "(", "$", "path", ")", "{", "$", "node", "=", "$", "this", "->", "at", "(", "$", "path", ")", ";", "return", "null", "!==", "$", "node", "&&", "'dir'", "===", "$", "node", "->", "type", ";", "}" ]
Equivalent to PHP `is_dir` function. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "is_dir", "function", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L133-L137
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.md5File
public function md5File($path) { if (! $this->isFile($path)) return false; return md5($this->at($path)->content); }
php
public function md5File($path) { if (! $this->isFile($path)) return false; return md5($this->at($path)->content); }
[ "public", "function", "md5File", "(", "$", "path", ")", "{", "if", "(", "!", "$", "this", "->", "isFile", "(", "$", "path", ")", ")", "return", "false", ";", "return", "md5", "(", "$", "this", "->", "at", "(", "$", "path", ")", "->", "content", ...
Equivalent to PHP `md5_file` function. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "md5_file", "function", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L156-L161
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.fileGetContents
public function fileGetContents($path) { if (! $this->isFile($path)) return false; return $this->at($path)->content; }
php
public function fileGetContents($path) { if (! $this->isFile($path)) return false; return $this->at($path)->content; }
[ "public", "function", "fileGetContents", "(", "$", "path", ")", "{", "if", "(", "!", "$", "this", "->", "isFile", "(", "$", "path", ")", ")", "return", "false", ";", "return", "$", "this", "->", "at", "(", "$", "path", ")", "->", "content", ";", ...
Equivalent to PHP `file_get_contents` function. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "file_get_contents", "function", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L169-L174
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.filePutContents
public function filePutContents($path, $content, $flags = 0) { if (! $this->isFile($path) && !$this->createFile($path)) return false; if (($flags & FILE_APPEND) == FILE_APPEND) $this->at($path)->content .= $content; else $this->at($path)->content = $content; return true; }
php
public function filePutContents($path, $content, $flags = 0) { if (! $this->isFile($path) && !$this->createFile($path)) return false; if (($flags & FILE_APPEND) == FILE_APPEND) $this->at($path)->content .= $content; else $this->at($path)->content = $content; return true; }
[ "public", "function", "filePutContents", "(", "$", "path", ",", "$", "content", ",", "$", "flags", "=", "0", ")", "{", "if", "(", "!", "$", "this", "->", "isFile", "(", "$", "path", ")", "&&", "!", "$", "this", "->", "createFile", "(", "$", "path...
Equivalent to PHP `file_put_contents` function. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "file_put_contents", "function", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L182-L191
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.isReadable
public function isReadable($path) { $node = $this->at($path); return null !== $node && (0x0100 & $node->perms); }
php
public function isReadable($path) { $node = $this->at($path); return null !== $node && (0x0100 & $node->perms); }
[ "public", "function", "isReadable", "(", "$", "path", ")", "{", "$", "node", "=", "$", "this", "->", "at", "(", "$", "path", ")", ";", "return", "null", "!==", "$", "node", "&&", "(", "0x0100", "&", "$", "node", "->", "perms", ")", ";", "}" ]
Equivalent to PHP `is_readable` function. Assumes that the user is the file owner. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "is_readable", "function", ".", "Assumes", "that", "the", "user", "is", "the", "file", "owner", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L200-L204
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.isWritable
public function isWritable($path) { $node = $this->at($path); return null !== $node && (0x0080 & $node->perms); }
php
public function isWritable($path) { $node = $this->at($path); return null !== $node && (0x0080 & $node->perms); }
[ "public", "function", "isWritable", "(", "$", "path", ")", "{", "$", "node", "=", "$", "this", "->", "at", "(", "$", "path", ")", ";", "return", "null", "!==", "$", "node", "&&", "(", "0x0080", "&", "$", "node", "->", "perms", ")", ";", "}" ]
Equivalent to PHP `is_writable` function. Assumes that the user is the file owner. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "is_writable", "function", ".", "Assumes", "that", "the", "user", "is", "the", "file", "owner", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L213-L217
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.isExecutable
public function isExecutable($path) { $node = $this->at($path); return null !== $node && (0x0040 & $node->perms) && !(0x0800 & $node->perms); }
php
public function isExecutable($path) { $node = $this->at($path); return null !== $node && (0x0040 & $node->perms) && !(0x0800 & $node->perms); }
[ "public", "function", "isExecutable", "(", "$", "path", ")", "{", "$", "node", "=", "$", "this", "->", "at", "(", "$", "path", ")", ";", "return", "null", "!==", "$", "node", "&&", "(", "0x0040", "&", "$", "node", "->", "perms", ")", "&&", "!", ...
Equivalent to PHP `is_executable` function. Assumes that the user is the file owner. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "is_executable", "function", ".", "Assumes", "that", "the", "user", "is", "the", "file", "owner", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L226-L232
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.rmdir
public function rmdir($path) { $path = $this->realpath($path) . '/'; $length = strlen($path); foreach (array_keys($this->files) as $filename) { if (substr($filename, 0, $length) === $path) { return false; } } $this->at($path, null); return true; }
php
public function rmdir($path) { $path = $this->realpath($path) . '/'; $length = strlen($path); foreach (array_keys($this->files) as $filename) { if (substr($filename, 0, $length) === $path) { return false; } } $this->at($path, null); return true; }
[ "public", "function", "rmdir", "(", "$", "path", ")", "{", "$", "path", "=", "$", "this", "->", "realpath", "(", "$", "path", ")", ".", "'/'", ";", "$", "length", "=", "strlen", "(", "$", "path", ")", ";", "foreach", "(", "array_keys", "(", "$", ...
Equivalent to PHP `rmdir` function. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "rmdir", "function", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L252-L263
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.rename
public function rename($oldPath, $newPath) { $old = $this->at($oldPath); $new = $this->at($newPath); if (null === $old || (null !== $new && 'dir' === $new->type)) return false; if ('file' === $old->type) { $this->at($newPath, $old); } else { if (! $this->mkdir($newPath, $old->perms)) { return false; } $oldPath = $this->realpath($oldPath) . '/'; $newPath = $this->realpath($newPath) . '/'; $length = strlen($oldPath); foreach (array_keys($this->files) as $childPath) { if (substr($childPath, 0, $length) === $oldPath) { $newChildPath = $newPath . substr($childPath, $length); $this->at($newChildPath, $this->at($childPath)); $this->at($childPath, null); } } } $this->at($oldPath, null); return true; }
php
public function rename($oldPath, $newPath) { $old = $this->at($oldPath); $new = $this->at($newPath); if (null === $old || (null !== $new && 'dir' === $new->type)) return false; if ('file' === $old->type) { $this->at($newPath, $old); } else { if (! $this->mkdir($newPath, $old->perms)) { return false; } $oldPath = $this->realpath($oldPath) . '/'; $newPath = $this->realpath($newPath) . '/'; $length = strlen($oldPath); foreach (array_keys($this->files) as $childPath) { if (substr($childPath, 0, $length) === $oldPath) { $newChildPath = $newPath . substr($childPath, $length); $this->at($newChildPath, $this->at($childPath)); $this->at($childPath, null); } } } $this->at($oldPath, null); return true; }
[ "public", "function", "rename", "(", "$", "oldPath", ",", "$", "newPath", ")", "{", "$", "old", "=", "$", "this", "->", "at", "(", "$", "oldPath", ")", ";", "$", "new", "=", "$", "this", "->", "at", "(", "$", "newPath", ")", ";", "if", "(", "...
Equivalent to PHP `rename` function. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "rename", "function", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L271-L298
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.fileperms
public function fileperms($path) { $node = $this->at($path); if (null === $node) { return false; } return $node->perms; }
php
public function fileperms($path) { $node = $this->at($path); if (null === $node) { return false; } return $node->perms; }
[ "public", "function", "fileperms", "(", "$", "path", ")", "{", "$", "node", "=", "$", "this", "->", "at", "(", "$", "path", ")", ";", "if", "(", "null", "===", "$", "node", ")", "{", "return", "false", ";", "}", "return", "$", "node", "->", "pe...
Equivalent to PHP `fileperms` function. @param string $path @return int
[ "Equivalent", "to", "PHP", "fileperms", "function", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L306-L313
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.chmod
public function chmod($path, $value) { $node = $this->at($path); if (null === $node || !is_numeric($value)) { return false; } $node->perms = $value; return true; }
php
public function chmod($path, $value) { $node = $this->at($path); if (null === $node || !is_numeric($value)) { return false; } $node->perms = $value; return true; }
[ "public", "function", "chmod", "(", "$", "path", ",", "$", "value", ")", "{", "$", "node", "=", "$", "this", "->", "at", "(", "$", "path", ")", ";", "if", "(", "null", "===", "$", "node", "||", "!", "is_numeric", "(", "$", "value", ")", ")", ...
Equivalent to PHP `chmod` function. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "chmod", "function", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L321-L329
train
tarsana/filesystem
src/Adapters/Memory.php
Memory.mkdir
public function mkdir($path, $mode = 0777, $recursive = false) { if (null !== $this->at($path)) { trigger_error("mkdir(): File exists"); return false; } $parts = explode('/', $this->realpath($path)); $filesCount = 0; $missing = []; $item = array_shift($parts); foreach ($parts as $part) { $item .= "/{$part}"; $node = $this->at($item); if ($node === null) { $missing[] = $item; } else if ($node->type == 'file') { $filesCount ++; } } if ($filesCount > 0) { trigger_error("mkdir(): Not a directory"); return false; } if (count($missing) > 1 && !$recursive) { trigger_error("mkdir(): No such file or directory"); return false; } foreach ($missing as $path) { $this->at($path, (object) [ 'type' => 'dir', 'perms' => $mode ]); } return true; }
php
public function mkdir($path, $mode = 0777, $recursive = false) { if (null !== $this->at($path)) { trigger_error("mkdir(): File exists"); return false; } $parts = explode('/', $this->realpath($path)); $filesCount = 0; $missing = []; $item = array_shift($parts); foreach ($parts as $part) { $item .= "/{$part}"; $node = $this->at($item); if ($node === null) { $missing[] = $item; } else if ($node->type == 'file') { $filesCount ++; } } if ($filesCount > 0) { trigger_error("mkdir(): Not a directory"); return false; } if (count($missing) > 1 && !$recursive) { trigger_error("mkdir(): No such file or directory"); return false; } foreach ($missing as $path) { $this->at($path, (object) [ 'type' => 'dir', 'perms' => $mode ]); } return true; }
[ "public", "function", "mkdir", "(", "$", "path", ",", "$", "mode", "=", "0777", ",", "$", "recursive", "=", "false", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "at", "(", "$", "path", ")", ")", "{", "trigger_error", "(", "\"mkdir(): Fil...
Equivalent to PHP `mkdir` function. @param string $path @return boolean
[ "Equivalent", "to", "PHP", "mkdir", "function", "." ]
db6c8f040af38dfb01066e382645aff6c72530fa
https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Adapters/Memory.php#L348-L387
train
weew/app-error-handler-black-hole
src/Weew/App/ErrorHandler/BlackHole/BlackHoleErrorHandler.php
BlackHoleErrorHandler.enable
public function enable() { // suppress all errors $this->errorHandler->addErrorHandler(function() {return true;}); $this->errorHandler->addExceptionHandler(function(Exception $ex) {return true;}); }
php
public function enable() { // suppress all errors $this->errorHandler->addErrorHandler(function() {return true;}); $this->errorHandler->addExceptionHandler(function(Exception $ex) {return true;}); }
[ "public", "function", "enable", "(", ")", "{", "// suppress all errors", "$", "this", "->", "errorHandler", "->", "addErrorHandler", "(", "function", "(", ")", "{", "return", "true", ";", "}", ")", ";", "$", "this", "->", "errorHandler", "->", "addExceptionH...
Enable suppressing of errors.
[ "Enable", "suppressing", "of", "errors", "." ]
45a06fcf5dcf925d62ed070a49393687f473fdfa
https://github.com/weew/app-error-handler-black-hole/blob/45a06fcf5dcf925d62ed070a49393687f473fdfa/src/Weew/App/ErrorHandler/BlackHole/BlackHoleErrorHandler.php#L26-L30
train
praxisnetau/silverware-google
src/Extensions/GoogleConfig.php
GoogleConfig.getBodyAttributes
public function getBodyAttributes() { $attributes = []; $api = GoogleAPI::singleton(); if ($key = $api->getAPIKey()) { $attributes['data-google-api-key'] = $key; } if ($lang = $api->getAPILanguage()) { $attributes['data-google-api-lang'] = $lang; } if ($api->isAnalyticsEnabled()) { $attributes['data-google-tracking-id'] = $api->getAnalyticsTrackingID(); } return $attributes; }
php
public function getBodyAttributes() { $attributes = []; $api = GoogleAPI::singleton(); if ($key = $api->getAPIKey()) { $attributes['data-google-api-key'] = $key; } if ($lang = $api->getAPILanguage()) { $attributes['data-google-api-lang'] = $lang; } if ($api->isAnalyticsEnabled()) { $attributes['data-google-tracking-id'] = $api->getAnalyticsTrackingID(); } return $attributes; }
[ "public", "function", "getBodyAttributes", "(", ")", "{", "$", "attributes", "=", "[", "]", ";", "$", "api", "=", "GoogleAPI", "::", "singleton", "(", ")", ";", "if", "(", "$", "key", "=", "$", "api", "->", "getAPIKey", "(", ")", ")", "{", "$", "...
Answers the HTML tag attributes for the body as an array. @return array
[ "Answers", "the", "HTML", "tag", "attributes", "for", "the", "body", "as", "an", "array", "." ]
573632d33fe99c9d943fec8733fa5bbce57586f5
https://github.com/praxisnetau/silverware-google/blob/573632d33fe99c9d943fec8733fa5bbce57586f5/src/Extensions/GoogleConfig.php#L172-L191
train
praxisnetau/silverware-google
src/Extensions/GoogleConfig.php
GoogleConfig.getVerificationCode
protected function getVerificationCode($code) { // Trim Code: $code = trim($code); // Detect HTML: if (stripos($code, '<meta') === 0) { // Extract Verification Code: preg_match('/content="(.+)"/', $code, $matches); // Update or Nullify: $code = isset($matches[1]) ? $matches[1] : null; } // Answer Code: return $code; }
php
protected function getVerificationCode($code) { // Trim Code: $code = trim($code); // Detect HTML: if (stripos($code, '<meta') === 0) { // Extract Verification Code: preg_match('/content="(.+)"/', $code, $matches); // Update or Nullify: $code = isset($matches[1]) ? $matches[1] : null; } // Answer Code: return $code; }
[ "protected", "function", "getVerificationCode", "(", "$", "code", ")", "{", "// Trim Code:", "$", "code", "=", "trim", "(", "$", "code", ")", ";", "// Detect HTML:", "if", "(", "stripos", "(", "$", "code", ",", "'<meta'", ")", "===", "0", ")", "{", "//...
Removes any HTML present in the pasted value and answers the verification code. @param string $code @return string
[ "Removes", "any", "HTML", "present", "in", "the", "pasted", "value", "and", "answers", "the", "verification", "code", "." ]
573632d33fe99c9d943fec8733fa5bbce57586f5
https://github.com/praxisnetau/silverware-google/blob/573632d33fe99c9d943fec8733fa5bbce57586f5/src/Extensions/GoogleConfig.php#L227-L250
train
ongr-archive/ContentBundle
Service/ContentService.php
ContentService.getDocumentBySlug
public function getDocumentBySlug($slug) { $search = $this->repository->createSearch(); $search->addQuery(new TermQuery('slug', $slug), 'must'); $results = $this->repository->execute($search); if (count($results) === 0) { $this->logger && $this->logger->warning( sprintf("Can not render snippet for '%s' because content was not found.", $slug) ); return null; } return $results->current(); }
php
public function getDocumentBySlug($slug) { $search = $this->repository->createSearch(); $search->addQuery(new TermQuery('slug', $slug), 'must'); $results = $this->repository->execute($search); if (count($results) === 0) { $this->logger && $this->logger->warning( sprintf("Can not render snippet for '%s' because content was not found.", $slug) ); return null; } return $results->current(); }
[ "public", "function", "getDocumentBySlug", "(", "$", "slug", ")", "{", "$", "search", "=", "$", "this", "->", "repository", "->", "createSearch", "(", ")", ";", "$", "search", "->", "addQuery", "(", "new", "TermQuery", "(", "'slug'", ",", "$", "slug", ...
Retrieves document by slug. @param string $slug @return DocumentInterface|null
[ "Retrieves", "document", "by", "slug", "." ]
453a02c0c89c16f66dc9caed000243534dbeffa5
https://github.com/ongr-archive/ContentBundle/blob/453a02c0c89c16f66dc9caed000243534dbeffa5/Service/ContentService.php#L46-L62
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.setDescription
public function setDescription($description = null) { if ( empty($description) ) $this->description = null; else if ( !is_string($description) ) throw new InvalidArgumentException("Invalid RpcMethod description"); else $this->description = $description; return $this; }
php
public function setDescription($description = null) { if ( empty($description) ) $this->description = null; else if ( !is_string($description) ) throw new InvalidArgumentException("Invalid RpcMethod description"); else $this->description = $description; return $this; }
[ "public", "function", "setDescription", "(", "$", "description", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "description", ")", ")", "$", "this", "->", "description", "=", "null", ";", "else", "if", "(", "!", "is_string", "(", "$", "descripti...
Set the method's description @param string $description @return self @throws InvalidArgumentException
[ "Set", "the", "method", "s", "description" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L153-L163
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.addSignature
public function addSignature() { $signature = [ "PARAMETERS" => [], "RETURNTYPE" => 'undefined' ]; array_push($this->signatures, $signature); $this->current_signature = max(array_keys($this->signatures)); return $this; }
php
public function addSignature() { $signature = [ "PARAMETERS" => [], "RETURNTYPE" => 'undefined' ]; array_push($this->signatures, $signature); $this->current_signature = max(array_keys($this->signatures)); return $this; }
[ "public", "function", "addSignature", "(", ")", "{", "$", "signature", "=", "[", "\"PARAMETERS\"", "=>", "[", "]", ",", "\"RETURNTYPE\"", "=>", "'undefined'", "]", ";", "array_push", "(", "$", "this", "->", "signatures", ",", "$", "signature", ")", ";", ...
Add a signature and switch internal pointer @return self
[ "Add", "a", "signature", "and", "switch", "internal", "pointer" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L192-L205
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.getSignatures
public function getSignatures($compact = true) { if ( $compact ) { $signatures = []; foreach ( $this->signatures as $signature ) { $signatures[] = array_merge([$signature["RETURNTYPE"]], array_values($signature["PARAMETERS"])); } return $signatures; } else { return $this->signatures; } }
php
public function getSignatures($compact = true) { if ( $compact ) { $signatures = []; foreach ( $this->signatures as $signature ) { $signatures[] = array_merge([$signature["RETURNTYPE"]], array_values($signature["PARAMETERS"])); } return $signatures; } else { return $this->signatures; } }
[ "public", "function", "getSignatures", "(", "$", "compact", "=", "true", ")", "{", "if", "(", "$", "compact", ")", "{", "$", "signatures", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "signatures", "as", "$", "signature", ")", "{", "$", "...
Get the method's signatures @param bool $compact (default) Compact signatures in a format compatible with system.methodSignature @return array
[ "Get", "the", "method", "s", "signatures" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L214-L234
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.getSignature
public function getSignature($compact = true) { if ( $compact ) { return array_merge([$this->signatures[$this->current_signature]["RETURNTYPE"]], array_values($this->signatures[$this->current_signature]["PARAMETERS"])); } else { return $this->signatures[$this->current_signature]; } }
php
public function getSignature($compact = true) { if ( $compact ) { return array_merge([$this->signatures[$this->current_signature]["RETURNTYPE"]], array_values($this->signatures[$this->current_signature]["PARAMETERS"])); } else { return $this->signatures[$this->current_signature]; } }
[ "public", "function", "getSignature", "(", "$", "compact", "=", "true", ")", "{", "if", "(", "$", "compact", ")", "{", "return", "array_merge", "(", "[", "$", "this", "->", "signatures", "[", "$", "this", "->", "current_signature", "]", "[", "\"RETURNTYP...
Get the current method's signature @param bool $compact (default) Compact signatures in a format compatible with system.methodSignature @return array
[ "Get", "the", "current", "method", "s", "signature" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L243-L255
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.deleteSignature
public function deleteSignature($signature) { if ( !is_integer($signature) || !isset($this->signatures[$signature]) ) { throw new InvalidArgumentException("Invalid RpcMethod signature reference"); } unset($this->signatures[$signature]); return true; }
php
public function deleteSignature($signature) { if ( !is_integer($signature) || !isset($this->signatures[$signature]) ) { throw new InvalidArgumentException("Invalid RpcMethod signature reference"); } unset($this->signatures[$signature]); return true; }
[ "public", "function", "deleteSignature", "(", "$", "signature", ")", "{", "if", "(", "!", "is_integer", "(", "$", "signature", ")", "||", "!", "isset", "(", "$", "this", "->", "signatures", "[", "$", "signature", "]", ")", ")", "{", "throw", "new", "...
Delete a signature @param integer $signature The signature's ID @return bool @throws InvalidArgumentException
[ "Delete", "a", "signature" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L265-L277
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.selectSignature
public function selectSignature($signature) { if ( !is_integer($signature) || !isset($this->signatures[$signature]) ) { throw new InvalidArgumentException("Invalid RpcMethod signature reference"); } $this->current_signature = $signature; return $this; }
php
public function selectSignature($signature) { if ( !is_integer($signature) || !isset($this->signatures[$signature]) ) { throw new InvalidArgumentException("Invalid RpcMethod signature reference"); } $this->current_signature = $signature; return $this; }
[ "public", "function", "selectSignature", "(", "$", "signature", ")", "{", "if", "(", "!", "is_integer", "(", "$", "signature", ")", "||", "!", "isset", "(", "$", "this", "->", "signatures", "[", "$", "signature", "]", ")", ")", "{", "throw", "new", "...
Select a signature @param integer $signature The signature's ID @return self @throws Exception
[ "Select", "a", "signature" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L287-L299
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.setReturnType
public function setReturnType($type) { if ( !in_array($type, self::$rpcvalues) ) throw new InvalidArgumentException("Invalid RpcMethod return type"); $this->signatures[$this->current_signature]["RETURNTYPE"] = self::$rpcvalues[$type]; return $this; }
php
public function setReturnType($type) { if ( !in_array($type, self::$rpcvalues) ) throw new InvalidArgumentException("Invalid RpcMethod return type"); $this->signatures[$this->current_signature]["RETURNTYPE"] = self::$rpcvalues[$type]; return $this; }
[ "public", "function", "setReturnType", "(", "$", "type", ")", "{", "if", "(", "!", "in_array", "(", "$", "type", ",", "self", "::", "$", "rpcvalues", ")", ")", "throw", "new", "InvalidArgumentException", "(", "\"Invalid RpcMethod return type\"", ")", ";", "$...
Set the current signature's return type @param string $type @return self @throws InvalidArgumentException
[ "Set", "the", "current", "signature", "s", "return", "type" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L309-L317
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.addParameter
public function addParameter($type, $name) { if ( !in_array($type, self::$rpcvalues) ) throw new InvalidArgumentException("Invalid type for parameter $name"); if ( empty($name) ) throw new InvalidArgumentException("Missing parameter name"); $this->signatures[$this->current_signature]["PARAMETERS"][$name] = self::$rpcvalues[$type]; return $this; }
php
public function addParameter($type, $name) { if ( !in_array($type, self::$rpcvalues) ) throw new InvalidArgumentException("Invalid type for parameter $name"); if ( empty($name) ) throw new InvalidArgumentException("Missing parameter name"); $this->signatures[$this->current_signature]["PARAMETERS"][$name] = self::$rpcvalues[$type]; return $this; }
[ "public", "function", "addParameter", "(", "$", "type", ",", "$", "name", ")", "{", "if", "(", "!", "in_array", "(", "$", "type", ",", "self", "::", "$", "rpcvalues", ")", ")", "throw", "new", "InvalidArgumentException", "(", "\"Invalid type for parameter $n...
Add a parameter to current signature @param string $type @param string $name @return self @throws InvalidArgumentException
[ "Add", "a", "parameter", "to", "current", "signature" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L339-L349
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.deleteParameter
public function deleteParameter($name) { if ( !array_key_exists($name, $this->signatures[$this->current_signature]["PARAMETERS"]) ) throw new Exception("Cannot find parameter $name"); unset($this->signatures[$this->current_signature]["PARAMETERS"][$name]); return $this; }
php
public function deleteParameter($name) { if ( !array_key_exists($name, $this->signatures[$this->current_signature]["PARAMETERS"]) ) throw new Exception("Cannot find parameter $name"); unset($this->signatures[$this->current_signature]["PARAMETERS"][$name]); return $this; }
[ "public", "function", "deleteParameter", "(", "$", "name", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "signatures", "[", "$", "this", "->", "current_signature", "]", "[", "\"PARAMETERS\"", "]", ")", ")", "thro...
Delete a parameter from current signature @param string $name @return self @throws Exception
[ "Delete", "a", "parameter", "from", "current", "signature" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L359-L367
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.getParameters
public function getParameters($format = self::FETCH_ASSOC) { if ( $format === self::FETCH_NUMERIC ) return array_values($this->signatures[$this->current_signature]["PARAMETERS"]); else return $this->signatures[$this->current_signature]["PARAMETERS"]; }
php
public function getParameters($format = self::FETCH_ASSOC) { if ( $format === self::FETCH_NUMERIC ) return array_values($this->signatures[$this->current_signature]["PARAMETERS"]); else return $this->signatures[$this->current_signature]["PARAMETERS"]; }
[ "public", "function", "getParameters", "(", "$", "format", "=", "self", "::", "FETCH_ASSOC", ")", "{", "if", "(", "$", "format", "===", "self", "::", "FETCH_NUMERIC", ")", "return", "array_values", "(", "$", "this", "->", "signatures", "[", "$", "this", ...
Get current signature's parameters @param string $format The output array format (ASSOC|NUMERIC) @return array
[ "Get", "current", "signature", "s", "parameters" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L376-L382
train
comodojo/rpcserver
src/Comodojo/RpcServer/RpcMethod.php
RpcMethod.create
public static function create($name, callable $callback, ...$arguments) { try { return new RpcMethod($name, $callback, ...$arguments); } catch (Exception $e) { throw $e; } }
php
public static function create($name, callable $callback, ...$arguments) { try { return new RpcMethod($name, $callback, ...$arguments); } catch (Exception $e) { throw $e; } }
[ "public", "static", "function", "create", "(", "$", "name", ",", "callable", "$", "callback", ",", "...", "$", "arguments", ")", "{", "try", "{", "return", "new", "RpcMethod", "(", "$", "name", ",", "$", "callback", ",", "...", "$", "arguments", ")", ...
Static class constructor - create an RpcMethod object @param string $name @param string $callback @return RpcMethod @throws Exception
[ "Static", "class", "constructor", "-", "create", "an", "RpcMethod", "object" ]
6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c
https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/RpcMethod.php#L393-L405
train
magnus-eriksson/file-db
src/Storage/FileSystem.php
FileSystem.loadTable
public function loadTable($table) { $file = $this->path . '/' . $table . '.json'; if (is_file($file)) { $data = file_get_contents($file); if (!$data) { return $this->blankTable(); } if (!$data = @json_decode($data, true, 512)) { throw new Exception("Unable to parse table file '{$table}.json'"); } return $data; } return $this->blankTable(); }
php
public function loadTable($table) { $file = $this->path . '/' . $table . '.json'; if (is_file($file)) { $data = file_get_contents($file); if (!$data) { return $this->blankTable(); } if (!$data = @json_decode($data, true, 512)) { throw new Exception("Unable to parse table file '{$table}.json'"); } return $data; } return $this->blankTable(); }
[ "public", "function", "loadTable", "(", "$", "table", ")", "{", "$", "file", "=", "$", "this", "->", "path", ".", "'/'", ".", "$", "table", ".", "'.json'", ";", "if", "(", "is_file", "(", "$", "file", ")", ")", "{", "$", "data", "=", "file_get_co...
Load table data @param string $table @return array $data
[ "Load", "table", "data" ]
61d50511b1dcb483eec13a9baf3994fdc86b70a2
https://github.com/magnus-eriksson/file-db/blob/61d50511b1dcb483eec13a9baf3994fdc86b70a2/src/Storage/FileSystem.php#L37-L54
train
magnus-eriksson/file-db
src/Storage/FileSystem.php
FileSystem.saveTable
public function saveTable($table, array &$data) { $file = $this->path . '/' . $table . '.json'; $data = $this->touchModified($data); $opt = is_numeric($this->opt['json_options']) ? $this->opt['json_options'] : 0; $dept = is_numeric($this->opt['json_depth']) ? $this->opt['json_depth'] : 512; return file_put_contents($file, json_encode($data, $opt, $dept), LOCK_EX) > 0; }
php
public function saveTable($table, array &$data) { $file = $this->path . '/' . $table . '.json'; $data = $this->touchModified($data); $opt = is_numeric($this->opt['json_options']) ? $this->opt['json_options'] : 0; $dept = is_numeric($this->opt['json_depth']) ? $this->opt['json_depth'] : 512; return file_put_contents($file, json_encode($data, $opt, $dept), LOCK_EX) > 0; }
[ "public", "function", "saveTable", "(", "$", "table", ",", "array", "&", "$", "data", ")", "{", "$", "file", "=", "$", "this", "->", "path", ".", "'/'", ".", "$", "table", ".", "'.json'", ";", "$", "data", "=", "$", "this", "->", "touchModified", ...
Save table data @param string $table @param array $data @return boolean
[ "Save", "table", "data" ]
61d50511b1dcb483eec13a9baf3994fdc86b70a2
https://github.com/magnus-eriksson/file-db/blob/61d50511b1dcb483eec13a9baf3994fdc86b70a2/src/Storage/FileSystem.php#L63-L77
train
erunion/laravel-examine-config
src/Erunion/Console/Commands/ExamineConfigCommand.php
ExamineConfigCommand.generateTree
private function generateTree($data, $total_depth, $current_depth = 1) { ksort($data); $table = []; foreach ($data as $key => $value) { $row = []; if ($current_depth > 1) { $row = array_merge($row, array_fill(0, ($current_depth - 1), '')); } $row[] = '<comment>' . $key . '</comment>'; if (!is_array($value)) { $row[] = (is_bool($value)) ? (($value) ? 'true' : 'false') : $value; } // Pad the row out with empty columns equal to the total subtracting the current recursive depth. $empty_columns = ($total_depth - $current_depth); $empty_columns = array_fill(count($row) - 1, $empty_columns, ''); $row = array_merge($row, $empty_columns); $table[] = $row; if (is_array($value)) { $table = array_merge($table, $this->generateTree($value, $total_depth, $current_depth + 1)); } } return $table; }
php
private function generateTree($data, $total_depth, $current_depth = 1) { ksort($data); $table = []; foreach ($data as $key => $value) { $row = []; if ($current_depth > 1) { $row = array_merge($row, array_fill(0, ($current_depth - 1), '')); } $row[] = '<comment>' . $key . '</comment>'; if (!is_array($value)) { $row[] = (is_bool($value)) ? (($value) ? 'true' : 'false') : $value; } // Pad the row out with empty columns equal to the total subtracting the current recursive depth. $empty_columns = ($total_depth - $current_depth); $empty_columns = array_fill(count($row) - 1, $empty_columns, ''); $row = array_merge($row, $empty_columns); $table[] = $row; if (is_array($value)) { $table = array_merge($table, $this->generateTree($value, $total_depth, $current_depth + 1)); } } return $table; }
[ "private", "function", "generateTree", "(", "$", "data", ",", "$", "total_depth", ",", "$", "current_depth", "=", "1", ")", "{", "ksort", "(", "$", "data", ")", ";", "$", "table", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "key", ...
Take a configuration array, recursively traverse and create a padded tree array to output as a table. @param array $data @param integer $total_depth @param integer $current_depth @return array
[ "Take", "a", "configuration", "array", "recursively", "traverse", "and", "create", "a", "padded", "tree", "array", "to", "output", "as", "a", "table", "." ]
bb31c21a80baefe5641bc8b1322d6ec0c750f505
https://github.com/erunion/laravel-examine-config/blob/bb31c21a80baefe5641bc8b1322d6ec0c750f505/src/Erunion/Console/Commands/ExamineConfigCommand.php#L70-L99
train
erunion/laravel-examine-config
src/Erunion/Console/Commands/ExamineConfigCommand.php
ExamineConfigCommand.getConfigDepth
private function getConfigDepth($config) { $total_depth = 1; foreach ($config as $data) { if (is_array($data)) { $depth = $this->getConfigDepth($data) + 1; if ($depth > $total_depth) { $total_depth = $depth; } } } return $total_depth; }
php
private function getConfigDepth($config) { $total_depth = 1; foreach ($config as $data) { if (is_array($data)) { $depth = $this->getConfigDepth($data) + 1; if ($depth > $total_depth) { $total_depth = $depth; } } } return $total_depth; }
[ "private", "function", "getConfigDepth", "(", "$", "config", ")", "{", "$", "total_depth", "=", "1", ";", "foreach", "(", "$", "config", "as", "$", "data", ")", "{", "if", "(", "is_array", "(", "$", "data", ")", ")", "{", "$", "depth", "=", "$", ...
Determine the depth of this configuration so we know how to pad the outputted table of data. @param array $config @return integer
[ "Determine", "the", "depth", "of", "this", "configuration", "so", "we", "know", "how", "to", "pad", "the", "outputted", "table", "of", "data", "." ]
bb31c21a80baefe5641bc8b1322d6ec0c750f505
https://github.com/erunion/laravel-examine-config/blob/bb31c21a80baefe5641bc8b1322d6ec0c750f505/src/Erunion/Console/Commands/ExamineConfigCommand.php#L106-L120
train
gorriecoe/silverstripe-sreg
src/SReg.php
SReg.sregValue
private function sregValue($value = '') { $owner = $this->owner; $values = explode('|', $value); $count = count($values); foreach ($values as $key => $fieldPath) { if ($fieldPath == '' || $fieldPath == 'null') { return null; } elseif ($relValue = $this->sregTraverse($fieldPath)) { if (is_object($relValue) && method_exists($relValue, 'AbsoluteLink')) { if ($link = $relValue->AbsoluteLink()) { return $link; } else { continue; } } else { return $relValue; } } elseif ($key + 1 == $count && !$owner->hasMethod($fieldPath) ) { return $fieldPath; } } }
php
private function sregValue($value = '') { $owner = $this->owner; $values = explode('|', $value); $count = count($values); foreach ($values as $key => $fieldPath) { if ($fieldPath == '' || $fieldPath == 'null') { return null; } elseif ($relValue = $this->sregTraverse($fieldPath)) { if (is_object($relValue) && method_exists($relValue, 'AbsoluteLink')) { if ($link = $relValue->AbsoluteLink()) { return $link; } else { continue; } } else { return $relValue; } } elseif ($key + 1 == $count && !$owner->hasMethod($fieldPath) ) { return $fieldPath; } } }
[ "private", "function", "sregValue", "(", "$", "value", "=", "''", ")", "{", "$", "owner", "=", "$", "this", "->", "owner", ";", "$", "values", "=", "explode", "(", "'|'", ",", "$", "value", ")", ";", "$", "count", "=", "count", "(", "$", "values"...
Splits string by |, loops each segment and returns the first non-null value @param string $value @param boolean $allowNoMatch @return string|null
[ "Splits", "string", "by", "|", "loops", "each", "segment", "and", "returns", "the", "first", "non", "-", "null", "value" ]
ef32e6c2bc4adb0af570be50cdbddce92202dcfa
https://github.com/gorriecoe/silverstripe-sreg/blob/ef32e6c2bc4adb0af570be50cdbddce92202dcfa/src/SReg.php#L45-L67
train
gourmet/common
Controller/CommonAppController.php
CommonAppController.forceSsl
public function forceSsl($type) { $host = env('SERVER_NAME'); if (empty($host)) { $host = env('HTTP_HOST'); } if ('secure' == $type) { $this->redirect('https://' . $host . $this->here); } }
php
public function forceSsl($type) { $host = env('SERVER_NAME'); if (empty($host)) { $host = env('HTTP_HOST'); } if ('secure' == $type) { $this->redirect('https://' . $host . $this->here); } }
[ "public", "function", "forceSsl", "(", "$", "type", ")", "{", "$", "host", "=", "env", "(", "'SERVER_NAME'", ")", ";", "if", "(", "empty", "(", "$", "host", ")", ")", "{", "$", "host", "=", "env", "(", "'HTTP_HOST'", ")", ";", "}", "if", "(", "...
Blackhole callback for the `SecurityComponent`. - Automatically redirect secured requests to HTTPS. @param string $type The type of blackhole. @return void
[ "Blackhole", "callback", "for", "the", "SecurityComponent", "." ]
53ad4e919c51606dc81f2c716267d01ee768ade5
https://github.com/gourmet/common/blob/53ad4e919c51606dc81f2c716267d01ee768ade5/Controller/CommonAppController.php#L292-L300
train
gourmet/common
Controller/CommonAppController.php
CommonAppController._edit
protected function _edit($id) { try { $result = $this->{$this->modelClass}->edit($id, $this->request->data); } catch (OutOfBoundsException $e) { return $this->alert($e, array('redirect' => $this->referer(array('action' => 'list'), true))); } $this->request->data = $this->{$this->modelClass}->data; if (!empty($this->request->data[$this->{$this->modelClass}->alias][$this->{$this->modelClass}->displayField])) { $this->_appendToCrumb($this->request->data[$this->{$this->modelClass}->alias][$this->{$this->modelClass}->displayField]); } if (false === $result) { $this->alert('save.fail'); } else if ($this->request->is('put')) { $this->alert('save.success'); } }
php
protected function _edit($id) { try { $result = $this->{$this->modelClass}->edit($id, $this->request->data); } catch (OutOfBoundsException $e) { return $this->alert($e, array('redirect' => $this->referer(array('action' => 'list'), true))); } $this->request->data = $this->{$this->modelClass}->data; if (!empty($this->request->data[$this->{$this->modelClass}->alias][$this->{$this->modelClass}->displayField])) { $this->_appendToCrumb($this->request->data[$this->{$this->modelClass}->alias][$this->{$this->modelClass}->displayField]); } if (false === $result) { $this->alert('save.fail'); } else if ($this->request->is('put')) { $this->alert('save.success'); } }
[ "protected", "function", "_edit", "(", "$", "id", ")", "{", "try", "{", "$", "result", "=", "$", "this", "->", "{", "$", "this", "->", "modelClass", "}", "->", "edit", "(", "$", "id", ",", "$", "this", "->", "request", "->", "data", ")", ";", "...
Common edit action. @param string $id Model's record primary key value. @return void
[ "Common", "edit", "action", "." ]
53ad4e919c51606dc81f2c716267d01ee768ade5
https://github.com/gourmet/common/blob/53ad4e919c51606dc81f2c716267d01ee768ade5/Controller/CommonAppController.php#L474-L492
train
gourmet/common
Controller/CommonAppController.php
CommonAppController._list
protected function _list($object = null, $scope = array(), $whitelist = array()) { $View = $this->_getViewObject(); if (!$View->Helpers->loaded('Common.Table')) { $this->_getViewObject()->loadHelper('Common.Table'); } $this->{$this->modelClass}->recursive = 0; $this->set('results', $this->paginate($object, $scope, $whitelist)); }
php
protected function _list($object = null, $scope = array(), $whitelist = array()) { $View = $this->_getViewObject(); if (!$View->Helpers->loaded('Common.Table')) { $this->_getViewObject()->loadHelper('Common.Table'); } $this->{$this->modelClass}->recursive = 0; $this->set('results', $this->paginate($object, $scope, $whitelist)); }
[ "protected", "function", "_list", "(", "$", "object", "=", "null", ",", "$", "scope", "=", "array", "(", ")", ",", "$", "whitelist", "=", "array", "(", ")", ")", "{", "$", "View", "=", "$", "this", "->", "_getViewObject", "(", ")", ";", "if", "("...
Common list action. @param Model|string $object Model to paginate (e.g: model instance, or 'Model', or 'Model.InnerModel') @param string|array $scope Additional find conditions to use while paginating @param array $whitelist List of allowed fields for ordering. This allows you to prevent ordering on non-indexed, or undesirable columns. @return void
[ "Common", "list", "action", "." ]
53ad4e919c51606dc81f2c716267d01ee768ade5
https://github.com/gourmet/common/blob/53ad4e919c51606dc81f2c716267d01ee768ade5/Controller/CommonAppController.php#L503-L510
train
gourmet/common
Controller/CommonAppController.php
CommonAppController._status
protected function _status($id, $status) { if (!$this->{$this->modelClass}->changeStatus($id, $status)) { return $this->alert('status.fail'); } $this->alert('status.success'); }
php
protected function _status($id, $status) { if (!$this->{$this->modelClass}->changeStatus($id, $status)) { return $this->alert('status.fail'); } $this->alert('status.success'); }
[ "protected", "function", "_status", "(", "$", "id", ",", "$", "status", ")", "{", "if", "(", "!", "$", "this", "->", "{", "$", "this", "->", "modelClass", "}", "->", "changeStatus", "(", "$", "id", ",", "$", "status", ")", ")", "{", "return", "$"...
Common status action. @param string $id Model's record primary key value. @param string $status New status to change to. @return void
[ "Common", "status", "action", "." ]
53ad4e919c51606dc81f2c716267d01ee768ade5
https://github.com/gourmet/common/blob/53ad4e919c51606dc81f2c716267d01ee768ade5/Controller/CommonAppController.php#L519-L524
train
cubicmushroom/slim-service-manager
src/CubicMushroom/Slim/ServiceManager/ServiceManager.php
ServiceManager.setupServices
public function setupServices() { $settings = $this->getApp()->container->get('settings'); if (!empty($settings['services'])) { if (!is_array($settings['services'])) { throw InvalidServiceConfigException::build([], ['serviceConfig' => $settings['services']]); } foreach ($settings['services'] as $service => $config) { $this->setupService($service, $config); } } }
php
public function setupServices() { $settings = $this->getApp()->container->get('settings'); if (!empty($settings['services'])) { if (!is_array($settings['services'])) { throw InvalidServiceConfigException::build([], ['serviceConfig' => $settings['services']]); } foreach ($settings['services'] as $service => $config) { $this->setupService($service, $config); } } }
[ "public", "function", "setupServices", "(", ")", "{", "$", "settings", "=", "$", "this", "->", "getApp", "(", ")", "->", "container", "->", "get", "(", "'settings'", ")", ";", "if", "(", "!", "empty", "(", "$", "settings", "[", "'services'", "]", ")"...
Registers the services with the application
[ "Registers", "the", "services", "with", "the", "application" ]
078dbe0d7dc97f42563b91571550b412350673b8
https://github.com/cubicmushroom/slim-service-manager/blob/078dbe0d7dc97f42563b91571550b412350673b8/src/CubicMushroom/Slim/ServiceManager/ServiceManager.php#L134-L147
train
cubicmushroom/slim-service-manager
src/CubicMushroom/Slim/ServiceManager/ServiceManager.php
ServiceManager.getService
public function getService($serviceName) { $serviceName = $this->getServiceName($serviceName); return $this->getApp()->container->get($serviceName); }
php
public function getService($serviceName) { $serviceName = $this->getServiceName($serviceName); return $this->getApp()->container->get($serviceName); }
[ "public", "function", "getService", "(", "$", "serviceName", ")", "{", "$", "serviceName", "=", "$", "this", "->", "getServiceName", "(", "$", "serviceName", ")", ";", "return", "$", "this", "->", "getApp", "(", ")", "->", "container", "->", "get", "(", ...
Returns a service using the service name given The service name will be prefixed with an '@' if it's not already @param string $serviceName Service name, with or without the '@' prefix @return mixed
[ "Returns", "a", "service", "using", "the", "service", "name", "given" ]
078dbe0d7dc97f42563b91571550b412350673b8
https://github.com/cubicmushroom/slim-service-manager/blob/078dbe0d7dc97f42563b91571550b412350673b8/src/CubicMushroom/Slim/ServiceManager/ServiceManager.php#L197-L202
train
meliorframework/melior
Classes/Helper/StringHelper.php
StringHelper.endsWith
public function endsWith(string $haystack, string $needle): bool { $escaped = preg_quote($needle); return (bool) preg_match("/$escaped$/", $haystack); }
php
public function endsWith(string $haystack, string $needle): bool { $escaped = preg_quote($needle); return (bool) preg_match("/$escaped$/", $haystack); }
[ "public", "function", "endsWith", "(", "string", "$", "haystack", ",", "string", "$", "needle", ")", ":", "bool", "{", "$", "escaped", "=", "preg_quote", "(", "$", "needle", ")", ";", "return", "(", "bool", ")", "preg_match", "(", "\"/$escaped$/\"", ",",...
Checks if a string ends with another one. @param string $haystack The string to search in @param string $needle The string to search for @return bool
[ "Checks", "if", "a", "string", "ends", "with", "another", "one", "." ]
f6469fa6e85f66a0507ae13603d19d78f2774e0b
https://github.com/meliorframework/melior/blob/f6469fa6e85f66a0507ae13603d19d78f2774e0b/Classes/Helper/StringHelper.php#L50-L55
train
hashstudio/Mindy_Application
src/Mindy/Application/Application.php
Application.processRequest
public function processRequest() { $this->signal->send($this, 'onProcessRequest'); if (Console::isCli()) { $exitCode = $this->_runner->run($_SERVER['argv']); if (is_int($exitCode)) { $this->end($exitCode); } } else { $this->runController($this->parseRoute()); } }
php
public function processRequest() { $this->signal->send($this, 'onProcessRequest'); if (Console::isCli()) { $exitCode = $this->_runner->run($_SERVER['argv']); if (is_int($exitCode)) { $this->end($exitCode); } } else { $this->runController($this->parseRoute()); } }
[ "public", "function", "processRequest", "(", ")", "{", "$", "this", "->", "signal", "->", "send", "(", "$", "this", ",", "'onProcessRequest'", ")", ";", "if", "(", "Console", "::", "isCli", "(", ")", ")", "{", "$", "exitCode", "=", "$", "this", "->",...
Processes the current request. It first resolves the request into controller and action, and then creates the controller to perform the action.
[ "Processes", "the", "current", "request", ".", "It", "first", "resolves", "the", "request", "into", "controller", "and", "action", "and", "then", "creates", "the", "controller", "to", "perform", "the", "action", "." ]
07f7e0f4a83e0f9a5f11edca2b3df540760757eb
https://github.com/hashstudio/Mindy_Application/blob/07f7e0f4a83e0f9a5f11edca2b3df540760757eb/src/Mindy/Application/Application.php#L61-L73
train
hashstudio/Mindy_Application
src/Mindy/Application/Application.php
Application.runController
public function runController($route) { if (($ca = $this->createController($route)) !== null) { /** @var \Mindy\Controller\BaseController $controller */ list($controller, $actionID, $params) = $ca; $_GET = array_merge($_GET, $params); $csrfExempt = $controller->getCsrfExempt(); if (Console::isCli() === false && in_array($actionID, $csrfExempt) === false) { /** @var \Mindy\Http\Request $request */ $request = $this->getComponent('request'); if ($request->enableCsrfValidation) { $request->csrf->validate(); } } $oldController = $this->_controller; $this->_controller = $controller; $controller->init(); $controller->run($actionID, $params); $this->_controller = $oldController; } else { throw new HttpException(404, Mindy::t('base', 'Unable to resolve the request "{route}".', [ '{route}' => $this->request->getPath() ])); } }
php
public function runController($route) { if (($ca = $this->createController($route)) !== null) { /** @var \Mindy\Controller\BaseController $controller */ list($controller, $actionID, $params) = $ca; $_GET = array_merge($_GET, $params); $csrfExempt = $controller->getCsrfExempt(); if (Console::isCli() === false && in_array($actionID, $csrfExempt) === false) { /** @var \Mindy\Http\Request $request */ $request = $this->getComponent('request'); if ($request->enableCsrfValidation) { $request->csrf->validate(); } } $oldController = $this->_controller; $this->_controller = $controller; $controller->init(); $controller->run($actionID, $params); $this->_controller = $oldController; } else { throw new HttpException(404, Mindy::t('base', 'Unable to resolve the request "{route}".', [ '{route}' => $this->request->getPath() ])); } }
[ "public", "function", "runController", "(", "$", "route", ")", "{", "if", "(", "(", "$", "ca", "=", "$", "this", "->", "createController", "(", "$", "route", ")", ")", "!==", "null", ")", "{", "/** @var \\Mindy\\Controller\\BaseController $controller */", "lis...
Creates the controller and performs the specified action. @param string $route the route of the current request. See {@link createController} for more details. @throws HttpException if the controller could not be created.
[ "Creates", "the", "controller", "and", "performs", "the", "specified", "action", "." ]
07f7e0f4a83e0f9a5f11edca2b3df540760757eb
https://github.com/hashstudio/Mindy_Application/blob/07f7e0f4a83e0f9a5f11edca2b3df540760757eb/src/Mindy/Application/Application.php#L102-L126
train
hashstudio/Mindy_Application
src/Mindy/Application/Application.php
Application.createController
public function createController($route, $owner = null) { if ($owner === null) { $owner = $this; } if ($route) { list($handler, $vars) = $route; if ($handler instanceof Closure) { $handler->__invoke($this->getComponent('request')); $this->end(); } else { list($className, $actionName) = $handler; $controller = Creator::createObject($className, time(), $owner === $this ? null : $owner, $this->getComponent('request')); return [$controller, $actionName, array_merge($_GET, $vars)]; } } return null; }
php
public function createController($route, $owner = null) { if ($owner === null) { $owner = $this; } if ($route) { list($handler, $vars) = $route; if ($handler instanceof Closure) { $handler->__invoke($this->getComponent('request')); $this->end(); } else { list($className, $actionName) = $handler; $controller = Creator::createObject($className, time(), $owner === $this ? null : $owner, $this->getComponent('request')); return [$controller, $actionName, array_merge($_GET, $vars)]; } } return null; }
[ "public", "function", "createController", "(", "$", "route", ",", "$", "owner", "=", "null", ")", "{", "if", "(", "$", "owner", "===", "null", ")", "{", "$", "owner", "=", "$", "this", ";", "}", "if", "(", "$", "route", ")", "{", "list", "(", "...
Creates a controller instance based on a route. The route should contain the controller ID and the action ID. It may also contain additional GET variables. All these must be concatenated together with slashes. This method will attempt to create a controller in the following order: <ol> <li>If the first segment is found in {@link controllerMap}, the corresponding controller configuration will be used to create the controller;</li> <li>If the first segment is found to be a module ID, the corresponding module will be used to create the controller;</li> <li>Otherwise, it will search under the {@link controllerPath} to create the corresponding controller. For example, if the route is "admin/user/create", then the controller will be created using the class file "protected/controllers/admin/UserController.php".</li> </ol> @param \Mindy\Router\Route $route the route of the request. @param \Mindy\Base\Module $owner the module that the new controller will belong to. Defaults to null, meaning the application instance is the owner. @return array the controller instance and the action ID. Null if the controller class does not exist or the route is invalid.
[ "Creates", "a", "controller", "instance", "based", "on", "a", "route", ".", "The", "route", "should", "contain", "the", "controller", "ID", "and", "the", "action", "ID", ".", "It", "may", "also", "contain", "additional", "GET", "variables", ".", "All", "th...
07f7e0f4a83e0f9a5f11edca2b3df540760757eb
https://github.com/hashstudio/Mindy_Application/blob/07f7e0f4a83e0f9a5f11edca2b3df540760757eb/src/Mindy/Application/Application.php#L148-L167
train
hashstudio/Mindy_Application
src/Mindy/Application/Application.php
Application.parseActionParams
protected function parseActionParams($pathInfo) { if (($pos = strpos($pathInfo, '/')) !== false) { $manager = $this->getUrlManager(); $manager->parsePathInfo((string)substr($pathInfo, $pos + 1)); $actionID = substr($pathInfo, 0, $pos); return $manager->caseSensitive ? $actionID : strtolower($actionID); } else { return $pathInfo; } }
php
protected function parseActionParams($pathInfo) { if (($pos = strpos($pathInfo, '/')) !== false) { $manager = $this->getUrlManager(); $manager->parsePathInfo((string)substr($pathInfo, $pos + 1)); $actionID = substr($pathInfo, 0, $pos); return $manager->caseSensitive ? $actionID : strtolower($actionID); } else { return $pathInfo; } }
[ "protected", "function", "parseActionParams", "(", "$", "pathInfo", ")", "{", "if", "(", "(", "$", "pos", "=", "strpos", "(", "$", "pathInfo", ",", "'/'", ")", ")", "!==", "false", ")", "{", "$", "manager", "=", "$", "this", "->", "getUrlManager", "(...
Parses a path info into an action ID and GET variables. @param string $pathInfo path info @return string action ID
[ "Parses", "a", "path", "info", "into", "an", "action", "ID", "and", "GET", "variables", "." ]
07f7e0f4a83e0f9a5f11edca2b3df540760757eb
https://github.com/hashstudio/Mindy_Application/blob/07f7e0f4a83e0f9a5f11edca2b3df540760757eb/src/Mindy/Application/Application.php#L174-L184
train
hashstudio/Mindy_Application
src/Mindy/Application/Application.php
Application.findModule
public function findModule($id) { if (($controller = $this->getController()) !== null && ($module = $controller->getModule()) !== null) { do { if (($m = $module->getModule($id)) !== null) { return $m; } } while (($module = $module->getParentModule()) !== null); } if (($m = $this->getModule($id)) !== null) { return $m; } }
php
public function findModule($id) { if (($controller = $this->getController()) !== null && ($module = $controller->getModule()) !== null) { do { if (($m = $module->getModule($id)) !== null) { return $m; } } while (($module = $module->getParentModule()) !== null); } if (($m = $this->getModule($id)) !== null) { return $m; } }
[ "public", "function", "findModule", "(", "$", "id", ")", "{", "if", "(", "(", "$", "controller", "=", "$", "this", "->", "getController", "(", ")", ")", "!==", "null", "&&", "(", "$", "module", "=", "$", "controller", "->", "getModule", "(", ")", "...
Do not call this method. This method is used internally to search for a module by its ID. @param string $id module ID @return \Mindy\Base\Module the module that has the specified ID. Null if no module is found.
[ "Do", "not", "call", "this", "method", ".", "This", "method", "is", "used", "internally", "to", "search", "for", "a", "module", "by", "its", "ID", "." ]
07f7e0f4a83e0f9a5f11edca2b3df540760757eb
https://github.com/hashstudio/Mindy_Application/blob/07f7e0f4a83e0f9a5f11edca2b3df540760757eb/src/Mindy/Application/Application.php#L246-L258
train
hashstudio/Mindy_Application
src/Mindy/Application/Application.php
Application.init
public function init() { if (Console::isCli()) { // fix for fcgi defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); if (!isset($_SERVER['argv'])) { die('This script must be run from the command line.'); } $this->_runner = $this->createCommandRunner(); $this->_runner->commands = $this->commandMap; $this->_runner->addCommands($this->getCommandPath()); $env = @getenv('CONSOLE_COMMANDS'); if (!empty($env)) { $this->_runner->addCommands($env); } foreach ($this->modules as $name => $settings) { $modulePath = Alias::get("Modules." . $name . ".Commands"); if ($modulePath) { $this->_runner->addCommands($modulePath); } } } else { // preload 'request' so that it has chance to respond to onBeginRequest event. $this->getComponent('request'); } }
php
public function init() { if (Console::isCli()) { // fix for fcgi defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); if (!isset($_SERVER['argv'])) { die('This script must be run from the command line.'); } $this->_runner = $this->createCommandRunner(); $this->_runner->commands = $this->commandMap; $this->_runner->addCommands($this->getCommandPath()); $env = @getenv('CONSOLE_COMMANDS'); if (!empty($env)) { $this->_runner->addCommands($env); } foreach ($this->modules as $name => $settings) { $modulePath = Alias::get("Modules." . $name . ".Commands"); if ($modulePath) { $this->_runner->addCommands($modulePath); } } } else { // preload 'request' so that it has chance to respond to onBeginRequest event. $this->getComponent('request'); } }
[ "public", "function", "init", "(", ")", "{", "if", "(", "Console", "::", "isCli", "(", ")", ")", "{", "// fix for fcgi", "defined", "(", "'STDIN'", ")", "or", "define", "(", "'STDIN'", ",", "fopen", "(", "'php://stdin'", ",", "'r'", ")", ")", ";", "i...
Initializes the application. This method overrides the parent implementation by preloading the 'request' component.
[ "Initializes", "the", "application", ".", "This", "method", "overrides", "the", "parent", "implementation", "by", "preloading", "the", "request", "component", "." ]
07f7e0f4a83e0f9a5f11edca2b3df540760757eb
https://github.com/hashstudio/Mindy_Application/blob/07f7e0f4a83e0f9a5f11edca2b3df540760757eb/src/Mindy/Application/Application.php#L365-L393
train
samurai-fw/samurai
src/Samurai/Component/Spec/Runner/Runner.php
Runner.findConfigurationFile
public function findConfigurationFile($filename = null, $pwd = null) { $filename = $filename ?: $this->getConfigurationFileName(); $pwd = $pwd ?: getcwd(); $dirs = explode(DS, $pwd); $find = false; do { $dir = join(DS, $dirs); $config_file_path = $dir . DS . $filename; if (file_exists($config_file_path) && is_file($config_file_path)) return $config_file_path; } while (array_pop($dirs)); return $pwd . DS . $filename; }
php
public function findConfigurationFile($filename = null, $pwd = null) { $filename = $filename ?: $this->getConfigurationFileName(); $pwd = $pwd ?: getcwd(); $dirs = explode(DS, $pwd); $find = false; do { $dir = join(DS, $dirs); $config_file_path = $dir . DS . $filename; if (file_exists($config_file_path) && is_file($config_file_path)) return $config_file_path; } while (array_pop($dirs)); return $pwd . DS . $filename; }
[ "public", "function", "findConfigurationFile", "(", "$", "filename", "=", "null", ",", "$", "pwd", "=", "null", ")", "{", "$", "filename", "=", "$", "filename", "?", ":", "$", "this", "->", "getConfigurationFileName", "(", ")", ";", "$", "pwd", "=", "$...
find configuration file @param string $filename @param string $pwd @return string
[ "find", "configuration", "file" ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Spec/Runner/Runner.php#L149-L164
train
samurai-fw/samurai
src/Samurai/Component/Spec/Runner/Runner.php
Runner.loadConfigurationFile
public function loadConfigurationFile($file = null) { $file = $file ?: $this->findConfigurationFile(); if (! file_exists($file)) return; $this->config = $this->yaml->load($file); }
php
public function loadConfigurationFile($file = null) { $file = $file ?: $this->findConfigurationFile(); if (! file_exists($file)) return; $this->config = $this->yaml->load($file); }
[ "public", "function", "loadConfigurationFile", "(", "$", "file", "=", "null", ")", "{", "$", "file", "=", "$", "file", "?", ":", "$", "this", "->", "findConfigurationFile", "(", ")", ";", "if", "(", "!", "file_exists", "(", "$", "file", ")", ")", "re...
load configuraton file @param string $file
[ "load", "configuraton", "file" ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Spec/Runner/Runner.php#L171-L178
train
tomvlk/sweet-orm
src/SweetORM/Structure/Annotation/Constraint.php
Constraint.valid
public function valid ($value) { $valid = true; $error = array(); if ($this->minLength !== null && ! (strlen($value) >= $this->minLength)) { $valid = false; $error[] = 'minimum length'; } if ($this->maxLength !== null && ! (strlen($value) <= $this->maxLength)) { $valid = false; $error[] = 'maximum length'; } // var_dump(array('cur' => $value, 'min' => $this->minValue)); if ($this->minValue !== null && (! is_numeric($value) || ! ($value >= $this->minValue))) { $valid = false; $error[] = 'minimum value'; } if ($this->maxValue !== null && (! is_numeric($value) || ! ($value <= $this->maxValue))) { $valid = false; $error[] = 'maximum value'; } if ($this->startsWith !== null && ! (strpos($value, $this->startsWith) === 0)) { $valid = false; $error[] = 'starts with'; } if ($this->endsWith !== null && ! (strpos($value, $this->endsWith) === strlen($value)-strlen($this->endsWith))) { $valid = false; $error[] = 'ends with'; } if ($this->regex !== null && ! preg_match($this->regex, $value)) { $valid = false; $error[] = 'valid custom field'; } if ($this->enum !== null && is_array($this->enum)) { if (! in_array($value, $this->enum)) { $valid = false; $error[] = 'is value of list'; } } if ($this->valid !== null) { switch ($this->valid) { case 'email': if (! filter_var($value, FILTER_VALIDATE_EMAIL)) $valid = false; break; case 'url': if (! filter_var($value, FILTER_VALIDATE_URL)) $valid = false; break; default: $valid = false; } } if (! $valid) { $error[] = 'valid \'' . $this->valid . '\''; } return $valid === true ? true : $error; }
php
public function valid ($value) { $valid = true; $error = array(); if ($this->minLength !== null && ! (strlen($value) >= $this->minLength)) { $valid = false; $error[] = 'minimum length'; } if ($this->maxLength !== null && ! (strlen($value) <= $this->maxLength)) { $valid = false; $error[] = 'maximum length'; } // var_dump(array('cur' => $value, 'min' => $this->minValue)); if ($this->minValue !== null && (! is_numeric($value) || ! ($value >= $this->minValue))) { $valid = false; $error[] = 'minimum value'; } if ($this->maxValue !== null && (! is_numeric($value) || ! ($value <= $this->maxValue))) { $valid = false; $error[] = 'maximum value'; } if ($this->startsWith !== null && ! (strpos($value, $this->startsWith) === 0)) { $valid = false; $error[] = 'starts with'; } if ($this->endsWith !== null && ! (strpos($value, $this->endsWith) === strlen($value)-strlen($this->endsWith))) { $valid = false; $error[] = 'ends with'; } if ($this->regex !== null && ! preg_match($this->regex, $value)) { $valid = false; $error[] = 'valid custom field'; } if ($this->enum !== null && is_array($this->enum)) { if (! in_array($value, $this->enum)) { $valid = false; $error[] = 'is value of list'; } } if ($this->valid !== null) { switch ($this->valid) { case 'email': if (! filter_var($value, FILTER_VALIDATE_EMAIL)) $valid = false; break; case 'url': if (! filter_var($value, FILTER_VALIDATE_URL)) $valid = false; break; default: $valid = false; } } if (! $valid) { $error[] = 'valid \'' . $this->valid . '\''; } return $valid === true ? true : $error; }
[ "public", "function", "valid", "(", "$", "value", ")", "{", "$", "valid", "=", "true", ";", "$", "error", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "minLength", "!==", "null", "&&", "!", "(", "strlen", "(", "$", "value", ")", "...
Validate constraints. @param $value @return true|array True on success, error will give array that contains error messages.
[ "Validate", "constraints", "." ]
bca014a9f83be34c87b14d6c8a36156e24577374
https://github.com/tomvlk/sweet-orm/blob/bca014a9f83be34c87b14d6c8a36156e24577374/src/SweetORM/Structure/Annotation/Constraint.php#L82-L149
train
zicht/z-plugin-qa
qa/Plugin.php
Plugin.appendConfiguration
public function appendConfiguration(ArrayNodeDefinition $rootNode) { $rootNode ->children() ->arrayNode('qa') ->children() ->arrayNode('phpcs') ->children() ->arrayNode('dir') ->prototype('scalar')->end() ->performNoDeepMerging() ->end() ->scalarNode('standard')->end() ->scalarNode('options')->end() ->end() ->end() ->arrayNode('jshint') ->children() ->arrayNode('files') ->beforeNormalization() ->ifString()->then( function($v) { return array_filter(array($v)); } ) ->end() ->prototype('scalar')->end() ->performNoDeepMerging() ->end() ->scalarNode('run')->end() ->end() ->end() ->end() ->end(); }
php
public function appendConfiguration(ArrayNodeDefinition $rootNode) { $rootNode ->children() ->arrayNode('qa') ->children() ->arrayNode('phpcs') ->children() ->arrayNode('dir') ->prototype('scalar')->end() ->performNoDeepMerging() ->end() ->scalarNode('standard')->end() ->scalarNode('options')->end() ->end() ->end() ->arrayNode('jshint') ->children() ->arrayNode('files') ->beforeNormalization() ->ifString()->then( function($v) { return array_filter(array($v)); } ) ->end() ->prototype('scalar')->end() ->performNoDeepMerging() ->end() ->scalarNode('run')->end() ->end() ->end() ->end() ->end(); }
[ "public", "function", "appendConfiguration", "(", "ArrayNodeDefinition", "$", "rootNode", ")", "{", "$", "rootNode", "->", "children", "(", ")", "->", "arrayNode", "(", "'qa'", ")", "->", "children", "(", ")", "->", "arrayNode", "(", "'phpcs'", ")", "->", ...
Appends the QA configuration @param \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $rootNode @return void
[ "Appends", "the", "QA", "configuration" ]
eea78e4eb604a41969108523f123d0f3a795503f
https://github.com/zicht/z-plugin-qa/blob/eea78e4eb604a41969108523f123d0f3a795503f/qa/Plugin.php#L25-L59
train
deasilworks/cef
src/Cassandra/Transformer.php
Transformer.transformRows
public function transformRows(\Cassandra\Rows $rows) { $entries = []; // page through all results and transform as we go while (true) { while ($rows->valid()) { // transform $entry = $this->transform($rows->current()); if ($entry) { array_push($entries, $entry); } $rows->next(); } if ($rows->isLastPage()) { break; } $rows = $rows->nextPage(); } return $entries; }
php
public function transformRows(\Cassandra\Rows $rows) { $entries = []; // page through all results and transform as we go while (true) { while ($rows->valid()) { // transform $entry = $this->transform($rows->current()); if ($entry) { array_push($entries, $entry); } $rows->next(); } if ($rows->isLastPage()) { break; } $rows = $rows->nextPage(); } return $entries; }
[ "public", "function", "transformRows", "(", "\\", "Cassandra", "\\", "Rows", "$", "rows", ")", "{", "$", "entries", "=", "[", "]", ";", "// page through all results and transform as we go", "while", "(", "true", ")", "{", "while", "(", "$", "rows", "->", "va...
Transform Cassandra Rows. @param \Cassandra\Rows $rows @return array
[ "Transform", "Cassandra", "Rows", "." ]
18c65f2b123512bba2208975dc655354f57670be
https://github.com/deasilworks/cef/blob/18c65f2b123512bba2208975dc655354f57670be/src/Cassandra/Transformer.php#L46-L72
train
novuso/common
src/Application/Logging/SqlLogger.php
SqlLogger.log
public function log(string $sql, array $parameters = []): void { $message = sprintf('[SQL]: %s', $this->removeWhitespace($sql)); $this->logger->log($this->logLevel, $message, $parameters); }
php
public function log(string $sql, array $parameters = []): void { $message = sprintf('[SQL]: %s', $this->removeWhitespace($sql)); $this->logger->log($this->logLevel, $message, $parameters); }
[ "public", "function", "log", "(", "string", "$", "sql", ",", "array", "$", "parameters", "=", "[", "]", ")", ":", "void", "{", "$", "message", "=", "sprintf", "(", "'[SQL]: %s'", ",", "$", "this", "->", "removeWhitespace", "(", "$", "sql", ")", ")", ...
Logs SQL and parameters @param string $sql The SQL statement @param array $parameters The parameters @return void
[ "Logs", "SQL", "and", "parameters" ]
7d0e5a4f4c79c9622e068efc8b7c70815c460863
https://github.com/novuso/common/blob/7d0e5a4f4c79c9622e068efc8b7c70815c460863/src/Application/Logging/SqlLogger.php#L51-L55
train
rozaverta/cmf
core/Cmd/IO/ConfigOption.php
ConfigOption.setValue
public function setValue($value) { // set default if( $value === "" ) { $value = $this->value; } if( $this->type === "boolean" ) { $value = is_bool($value) ? $value : in_array($value, ['y', 'yes', 'on', '1']); } else if( $this->type === "number" ) { if( ! is_numeric($value) ) { throw new \InvalidArgumentException($this->getTheTitle() . " must be a number"); } $value = (float) $value; if( $this->required && $value === 0 ) { throw new \InvalidArgumentException($this->getTheTitle() . " is required"); } } else if( $this->type === "enum" ) { if( ! in_array($value, $this->enum, true) ) { $variant = "'" . implode("' or '", $this->enum) . "'"; throw new \InvalidArgumentException($this->getTheTitle() . " must be equal " . $variant); } } else { $value = trim($value); if( $this->required && ! strlen($value) ) { throw new \InvalidArgumentException($this->getTheTitle() . " is required"); } } if( $this->type_of ) { $value = call_user_func($this->type_of, $value); if( $value === false && $this->type !== "boolean" ) { throw new \InvalidArgumentException($this->getTheTitle() . " value is invalid"); } } $this->value = $value; return $this; }
php
public function setValue($value) { // set default if( $value === "" ) { $value = $this->value; } if( $this->type === "boolean" ) { $value = is_bool($value) ? $value : in_array($value, ['y', 'yes', 'on', '1']); } else if( $this->type === "number" ) { if( ! is_numeric($value) ) { throw new \InvalidArgumentException($this->getTheTitle() . " must be a number"); } $value = (float) $value; if( $this->required && $value === 0 ) { throw new \InvalidArgumentException($this->getTheTitle() . " is required"); } } else if( $this->type === "enum" ) { if( ! in_array($value, $this->enum, true) ) { $variant = "'" . implode("' or '", $this->enum) . "'"; throw new \InvalidArgumentException($this->getTheTitle() . " must be equal " . $variant); } } else { $value = trim($value); if( $this->required && ! strlen($value) ) { throw new \InvalidArgumentException($this->getTheTitle() . " is required"); } } if( $this->type_of ) { $value = call_user_func($this->type_of, $value); if( $value === false && $this->type !== "boolean" ) { throw new \InvalidArgumentException($this->getTheTitle() . " value is invalid"); } } $this->value = $value; return $this; }
[ "public", "function", "setValue", "(", "$", "value", ")", "{", "// set default", "if", "(", "$", "value", "===", "\"\"", ")", "{", "$", "value", "=", "$", "this", "->", "value", ";", "}", "if", "(", "$", "this", "->", "type", "===", "\"boolean\"", ...
Set new value @param $value @return $this
[ "Set", "new", "value" ]
95ed38362e397d1c700ee255f7200234ef98d356
https://github.com/rozaverta/cmf/blob/95ed38362e397d1c700ee255f7200234ef98d356/core/Cmd/IO/ConfigOption.php#L91-L143
train
cstabor/screw
src/Screw/ProcessUtil.php
ProcessUtil.exec
public static function exec($cmd, $timeout, &$code) { $code = -11; // File descriptors passed to the process. $descriptors = [ 0 => ['pipe', 'r'], // stdin 1 => ['pipe', 'w'], // stdout 2 => ['pipe', 'w'] // stderr ]; // Start the process. $process = proc_open('exec ' . $cmd, $descriptors, $pipes); if (!is_resource($process)) { throw new \Exception('Could not execute process'); } // Set the stdout stream to none-blocking. stream_set_blocking($pipes[1], 0); stream_set_blocking($pipes[2], 0); // Turn the timeout into microseconds. $timeout *= 1000000; // Output buffer. $buffer = ''; // While we have time to wait. while ($timeout > 0) { $start = microtime(true); // Wait until we have output or the timer expired. $read = [$pipes[1]]; $write = $other = []; stream_select($read, $write, $other, 0, $timeout); // Get the status of the process. // Do this before we read from the stream, // this way we can't lose the last bit of output if the process dies between these functions. $status = proc_get_status($process); if (false === $status['running']) { $code = $status['exitcode']; } // Read the contents from the buffer. // This function will always return immediately as the stream is none-blocking. $buffer .= stream_get_contents($pipes[1]); if (!$status['running']) { break; // Break from this loop if the process exited before the timeout. } // Subtract the number of microseconds that we waited. $timeout -= (microtime(true) - $start) * 1000000; } // Check if there were any errors. $errors = stream_get_contents($pipes[2]); if (!empty($errors)) { throw new \Exception($errors); } // Kill the process in case the timeout expired and it's still running. // If the process already exited this won't do anything. proc_terminate($process, 9); // Close all streams. fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); return $buffer; }
php
public static function exec($cmd, $timeout, &$code) { $code = -11; // File descriptors passed to the process. $descriptors = [ 0 => ['pipe', 'r'], // stdin 1 => ['pipe', 'w'], // stdout 2 => ['pipe', 'w'] // stderr ]; // Start the process. $process = proc_open('exec ' . $cmd, $descriptors, $pipes); if (!is_resource($process)) { throw new \Exception('Could not execute process'); } // Set the stdout stream to none-blocking. stream_set_blocking($pipes[1], 0); stream_set_blocking($pipes[2], 0); // Turn the timeout into microseconds. $timeout *= 1000000; // Output buffer. $buffer = ''; // While we have time to wait. while ($timeout > 0) { $start = microtime(true); // Wait until we have output or the timer expired. $read = [$pipes[1]]; $write = $other = []; stream_select($read, $write, $other, 0, $timeout); // Get the status of the process. // Do this before we read from the stream, // this way we can't lose the last bit of output if the process dies between these functions. $status = proc_get_status($process); if (false === $status['running']) { $code = $status['exitcode']; } // Read the contents from the buffer. // This function will always return immediately as the stream is none-blocking. $buffer .= stream_get_contents($pipes[1]); if (!$status['running']) { break; // Break from this loop if the process exited before the timeout. } // Subtract the number of microseconds that we waited. $timeout -= (microtime(true) - $start) * 1000000; } // Check if there were any errors. $errors = stream_get_contents($pipes[2]); if (!empty($errors)) { throw new \Exception($errors); } // Kill the process in case the timeout expired and it's still running. // If the process already exited this won't do anything. proc_terminate($process, 9); // Close all streams. fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); return $buffer; }
[ "public", "static", "function", "exec", "(", "$", "cmd", ",", "$", "timeout", ",", "&", "$", "code", ")", "{", "$", "code", "=", "-", "11", ";", "// File descriptors passed to the process.", "$", "descriptors", "=", "[", "0", "=>", "[", "'pipe'", ",", ...
Execute a command and return it's output. Exit when the timeout has expired. @param string $cmd Command to execute. @param integer $timeout Timeout in seconds. @param integer $code @return string Output of the command. @throws \Exception
[ "Execute", "a", "command", "and", "return", "it", "s", "output", ".", "Exit", "when", "the", "timeout", "has", "expired", "." ]
c160c2b740bd1e0e72535fddf1c15cab99558669
https://github.com/cstabor/screw/blob/c160c2b740bd1e0e72535fddf1c15cab99558669/src/Screw/ProcessUtil.php#L17-L87
train
eureka-framework/Eurekon
Out.php
Out.err
public static function err($message, $endLine = PHP_EOL) { if (! Argument::getInstance()->has('quiet')) { fwrite(STDERR, $message . $endLine); } }
php
public static function err($message, $endLine = PHP_EOL) { if (! Argument::getInstance()->has('quiet')) { fwrite(STDERR, $message . $endLine); } }
[ "public", "static", "function", "err", "(", "$", "message", ",", "$", "endLine", "=", "PHP_EOL", ")", "{", "if", "(", "!", "Argument", "::", "getInstance", "(", ")", "->", "has", "(", "'quiet'", ")", ")", "{", "fwrite", "(", "STDERR", ",", "$", "me...
Display message on error output @param string $message @param string $endLine @return void
[ "Display", "message", "on", "error", "output" ]
86f958f9458ea369894286d8cdc4fe4ded33489a
https://github.com/eureka-framework/Eurekon/blob/86f958f9458ea369894286d8cdc4fe4ded33489a/Out.php#L28-L33
train
eureka-framework/Eurekon
Out.php
Out.std
public static function std($message, $endLine = PHP_EOL) { if (! Argument::getInstance()->has('quiet')) { fwrite(STDOUT, $message . $endLine); } }
php
public static function std($message, $endLine = PHP_EOL) { if (! Argument::getInstance()->has('quiet')) { fwrite(STDOUT, $message . $endLine); } }
[ "public", "static", "function", "std", "(", "$", "message", ",", "$", "endLine", "=", "PHP_EOL", ")", "{", "if", "(", "!", "Argument", "::", "getInstance", "(", ")", "->", "has", "(", "'quiet'", ")", ")", "{", "fwrite", "(", "STDOUT", ",", "$", "me...
Display message on standart output @param string $message @param string $endLine @return void
[ "Display", "message", "on", "standart", "output" ]
86f958f9458ea369894286d8cdc4fe4ded33489a
https://github.com/eureka-framework/Eurekon/blob/86f958f9458ea369894286d8cdc4fe4ded33489a/Out.php#L42-L47
train
lucavicidomini/blade-materialize
src/FormBuilder.php
FormBuilder.checkbox
public function checkbox( $name_id, $checked = false ) { $el = $this->element( 'input', $name_id, 'checkbox' ) ->value( 1 ) ->attribute( 'checked', $checked ? 'checked' : null ); return $el; }
php
public function checkbox( $name_id, $checked = false ) { $el = $this->element( 'input', $name_id, 'checkbox' ) ->value( 1 ) ->attribute( 'checked', $checked ? 'checked' : null ); return $el; }
[ "public", "function", "checkbox", "(", "$", "name_id", ",", "$", "checked", "=", "false", ")", "{", "$", "el", "=", "$", "this", "->", "element", "(", "'input'", ",", "$", "name_id", ",", "'checkbox'", ")", "->", "value", "(", "1", ")", "->", "attr...
Creates a checkbox. @param $name @param $label @param null $cssClasses @param bool $checked @param null $value @return array|HtmlElementsCollection
[ "Creates", "a", "checkbox", "." ]
4683c01f51c056d322fc9133eb5484a9b163e5d0
https://github.com/lucavicidomini/blade-materialize/blob/4683c01f51c056d322fc9133eb5484a9b163e5d0/src/FormBuilder.php#L134-L140
train
webforge-labs/webforge-utils
src/php/Webforge/Common/Url.php
Url.addRelativeUrl
public function addRelativeUrl($relativeUrl) { $this->pathTrailingSlash = S::endsWith($relativeUrl, '/'); $parts = array_filter(explode('/', trim($relativeUrl, '/'))); $this->path = array_merge($this->path, $parts); return $this; }
php
public function addRelativeUrl($relativeUrl) { $this->pathTrailingSlash = S::endsWith($relativeUrl, '/'); $parts = array_filter(explode('/', trim($relativeUrl, '/'))); $this->path = array_merge($this->path, $parts); return $this; }
[ "public", "function", "addRelativeUrl", "(", "$", "relativeUrl", ")", "{", "$", "this", "->", "pathTrailingSlash", "=", "S", "::", "endsWith", "(", "$", "relativeUrl", ",", "'/'", ")", ";", "$", "parts", "=", "array_filter", "(", "explode", "(", "'/'", "...
Modifies the current URL with adding an relative Url to the pathParts @param string $url only / slashes, first / is optional no query string, no fragment
[ "Modifies", "the", "current", "URL", "with", "adding", "an", "relative", "Url", "to", "the", "pathParts" ]
a476eeec046c22ad91794b0ab9fe15a1d3f92bfc
https://github.com/webforge-labs/webforge-utils/blob/a476eeec046c22ad91794b0ab9fe15a1d3f92bfc/src/php/Webforge/Common/Url.php#L211-L218
train
anklimsk/cakephp-basic-functions
Vendor/langcode-conv/zendframework/zend-filter/src/PregReplace.php
PregReplace.filter
public function filter($value) { if (!is_scalar($value) && !is_array($value)) { return $value; } if ($this->options['pattern'] === null) { throw new Exception\RuntimeException(sprintf( 'Filter %s does not have a valid pattern set', get_class($this) )); } return preg_replace($this->options['pattern'], $this->options['replacement'], $value); }
php
public function filter($value) { if (!is_scalar($value) && !is_array($value)) { return $value; } if ($this->options['pattern'] === null) { throw new Exception\RuntimeException(sprintf( 'Filter %s does not have a valid pattern set', get_class($this) )); } return preg_replace($this->options['pattern'], $this->options['replacement'], $value); }
[ "public", "function", "filter", "(", "$", "value", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "value", ")", "&&", "!", "is_array", "(", "$", "value", ")", ")", "{", "return", "$", "value", ";", "}", "if", "(", "$", "this", "->", "options", ...
Perform regexp replacement as filter @param mixed $value @return mixed @throws Exception\RuntimeException
[ "Perform", "regexp", "replacement", "as", "filter" ]
7554e8b0b420fd3155593af7bf76b7ccbdc8701e
https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-filter/src/PregReplace.php#L128-L142
train
anklimsk/cakephp-basic-functions
Vendor/langcode-conv/zendframework/zend-filter/src/PregReplace.php
PregReplace.validatePattern
protected function validatePattern($pattern) { if (!preg_match('/(?<modifier>[imsxeADSUXJu]+)$/', $pattern, $matches)) { return true; } if (false !== strstr($matches['modifier'], 'e')) { throw new Exception\InvalidArgumentException(sprintf( 'Pattern for a PregReplace filter may not contain the "e" pattern modifier; received "%s"', $pattern )); } }
php
protected function validatePattern($pattern) { if (!preg_match('/(?<modifier>[imsxeADSUXJu]+)$/', $pattern, $matches)) { return true; } if (false !== strstr($matches['modifier'], 'e')) { throw new Exception\InvalidArgumentException(sprintf( 'Pattern for a PregReplace filter may not contain the "e" pattern modifier; received "%s"', $pattern )); } }
[ "protected", "function", "validatePattern", "(", "$", "pattern", ")", "{", "if", "(", "!", "preg_match", "(", "'/(?<modifier>[imsxeADSUXJu]+)$/'", ",", "$", "pattern", ",", "$", "matches", ")", ")", "{", "return", "true", ";", "}", "if", "(", "false", "!==...
Validate a pattern and ensure it does not contain the "e" modifier @param string $pattern @return bool @throws Exception\InvalidArgumentException
[ "Validate", "a", "pattern", "and", "ensure", "it", "does", "not", "contain", "the", "e", "modifier" ]
7554e8b0b420fd3155593af7bf76b7ccbdc8701e
https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-filter/src/PregReplace.php#L151-L163
train
m-jch/ZagrosCore
src/models/User.php
User.getRules
public static function getRules($update, $id) { if (is_null($update)) { return static::$registerRules; } static::$updateRules['name'] .= ','.$id.',user_id'; static::$updateRules['email'] .= ','.$id.',user_id'; return static::$updateRules; }
php
public static function getRules($update, $id) { if (is_null($update)) { return static::$registerRules; } static::$updateRules['name'] .= ','.$id.',user_id'; static::$updateRules['email'] .= ','.$id.',user_id'; return static::$updateRules; }
[ "public", "static", "function", "getRules", "(", "$", "update", ",", "$", "id", ")", "{", "if", "(", "is_null", "(", "$", "update", ")", ")", "{", "return", "static", "::", "$", "registerRules", ";", "}", "static", "::", "$", "updateRules", "[", "'na...
Get rules for new or update @param $update string|null @param $id string|null @return array
[ "Get", "rules", "for", "new", "or", "update" ]
06771fe13e77f7663ea5cc561c6078be08b0f557
https://github.com/m-jch/ZagrosCore/blob/06771fe13e77f7663ea5cc561c6078be08b0f557/src/models/User.php#L73-L82
train
m-jch/ZagrosCore
src/models/User.php
User.getIsAdminAttribute
public function getIsAdminAttribute() { $project = Project::getProjectByUrl(Route::Input('project')); if ($project) { $admins = explode(',', $project->admins); if (in_array(Auth::id(), $admins)) { return $this->attributes['is_admin'] = true; } return $this->attributes['is_admin'] = false; } }
php
public function getIsAdminAttribute() { $project = Project::getProjectByUrl(Route::Input('project')); if ($project) { $admins = explode(',', $project->admins); if (in_array(Auth::id(), $admins)) { return $this->attributes['is_admin'] = true; } return $this->attributes['is_admin'] = false; } }
[ "public", "function", "getIsAdminAttribute", "(", ")", "{", "$", "project", "=", "Project", "::", "getProjectByUrl", "(", "Route", "::", "Input", "(", "'project'", ")", ")", ";", "if", "(", "$", "project", ")", "{", "$", "admins", "=", "explode", "(", ...
This attribute specified user is admin or not for logined user @return bool
[ "This", "attribute", "specified", "user", "is", "admin", "or", "not", "for", "logined", "user" ]
06771fe13e77f7663ea5cc561c6078be08b0f557
https://github.com/m-jch/ZagrosCore/blob/06771fe13e77f7663ea5cc561c6078be08b0f557/src/models/User.php#L88-L100
train
m-jch/ZagrosCore
src/models/User.php
User.getIsWriterAttribute
public function getIsWriterAttribute() { $project = Project::getProjectByUrl(Route::Input('project')); if ($project) { $writers = explode(',', $project->writers); if (in_array(Auth::id(), $writers)) { return $this->attributes['is_writer'] = true; } return $this->attributes['is_writer'] = false; } }
php
public function getIsWriterAttribute() { $project = Project::getProjectByUrl(Route::Input('project')); if ($project) { $writers = explode(',', $project->writers); if (in_array(Auth::id(), $writers)) { return $this->attributes['is_writer'] = true; } return $this->attributes['is_writer'] = false; } }
[ "public", "function", "getIsWriterAttribute", "(", ")", "{", "$", "project", "=", "Project", "::", "getProjectByUrl", "(", "Route", "::", "Input", "(", "'project'", ")", ")", ";", "if", "(", "$", "project", ")", "{", "$", "writers", "=", "explode", "(", ...
This attribute specified user is write or not for logined user @return bool
[ "This", "attribute", "specified", "user", "is", "write", "or", "not", "for", "logined", "user" ]
06771fe13e77f7663ea5cc561c6078be08b0f557
https://github.com/m-jch/ZagrosCore/blob/06771fe13e77f7663ea5cc561c6078be08b0f557/src/models/User.php#L106-L118
train
m-jch/ZagrosCore
src/models/User.php
User.getIsReaderAttribute
public function getIsReaderAttribute() { $project = Project::getProjectByUrl(Route::Input('project')); if ($project) { $readers = explode(',', $project->readers); if (in_array(Auth::id(), $readers)) { return $this->attributes['is_reader'] = true; } return $this->attributes['is_reader'] = false; } }
php
public function getIsReaderAttribute() { $project = Project::getProjectByUrl(Route::Input('project')); if ($project) { $readers = explode(',', $project->readers); if (in_array(Auth::id(), $readers)) { return $this->attributes['is_reader'] = true; } return $this->attributes['is_reader'] = false; } }
[ "public", "function", "getIsReaderAttribute", "(", ")", "{", "$", "project", "=", "Project", "::", "getProjectByUrl", "(", "Route", "::", "Input", "(", "'project'", ")", ")", ";", "if", "(", "$", "project", ")", "{", "$", "readers", "=", "explode", "(", ...
This attribute specified user is reader or not for logined user @return bool
[ "This", "attribute", "specified", "user", "is", "reader", "or", "not", "for", "logined", "user" ]
06771fe13e77f7663ea5cc561c6078be08b0f557
https://github.com/m-jch/ZagrosCore/blob/06771fe13e77f7663ea5cc561c6078be08b0f557/src/models/User.php#L124-L136
train
m-jch/ZagrosCore
src/models/User.php
User.getGroupIdName
public static function getGroupIdName($users) { $users = explode(",", $users); $usersArray = array(); foreach ($users as $user) { $user = User::find($user); if ($user) $usersArray[] = array('name' => $user->name, 'user_id' => $user->user_id); } return $usersArray; }
php
public static function getGroupIdName($users) { $users = explode(",", $users); $usersArray = array(); foreach ($users as $user) { $user = User::find($user); if ($user) $usersArray[] = array('name' => $user->name, 'user_id' => $user->user_id); } return $usersArray; }
[ "public", "static", "function", "getGroupIdName", "(", "$", "users", ")", "{", "$", "users", "=", "explode", "(", "\",\"", ",", "$", "users", ")", ";", "$", "usersArray", "=", "array", "(", ")", ";", "foreach", "(", "$", "users", "as", "$", "user", ...
Get id of groups permission @param $projectId int @return array
[ "Get", "id", "of", "groups", "permission" ]
06771fe13e77f7663ea5cc561c6078be08b0f557
https://github.com/m-jch/ZagrosCore/blob/06771fe13e77f7663ea5cc561c6078be08b0f557/src/models/User.php#L143-L154
train
joegreen88/zf1-component-locale
src/Zend/Locale/Data.php
Zend_Locale_Data._readFile
private static function _readFile($locale, $path, $attribute, $value, $temp) { // without attribute - read all values // with attribute - read only this value if (!empty(self::$_ldml[(string) $locale])) { $result = self::$_ldml[(string) $locale]->xpath($path); if (!empty($result)) { foreach ($result as &$found) { if (empty($value)) { if (empty($attribute)) { // Case 1 $temp[] = (string) $found; } else if (empty($temp[(string) $found[$attribute]])){ // Case 2 $temp[(string) $found[$attribute]] = (string) $found; } } else if (empty ($temp[$value])) { if (empty($attribute)) { // Case 3 $temp[$value] = (string) $found; } else { // Case 4 $temp[$value] = (string) $found[$attribute]; } } } } } return $temp; }
php
private static function _readFile($locale, $path, $attribute, $value, $temp) { // without attribute - read all values // with attribute - read only this value if (!empty(self::$_ldml[(string) $locale])) { $result = self::$_ldml[(string) $locale]->xpath($path); if (!empty($result)) { foreach ($result as &$found) { if (empty($value)) { if (empty($attribute)) { // Case 1 $temp[] = (string) $found; } else if (empty($temp[(string) $found[$attribute]])){ // Case 2 $temp[(string) $found[$attribute]] = (string) $found; } } else if (empty ($temp[$value])) { if (empty($attribute)) { // Case 3 $temp[$value] = (string) $found; } else { // Case 4 $temp[$value] = (string) $found[$attribute]; } } } } } return $temp; }
[ "private", "static", "function", "_readFile", "(", "$", "locale", ",", "$", "path", ",", "$", "attribute", ",", "$", "value", ",", "$", "temp", ")", "{", "// without attribute - read all values", "// with attribute - read only this value", "if", "(", "!", "empt...
Read the content from locale Can be called like: <ldml> <delimiter>test</delimiter> <second type='myone'>content</second> <second type='mysecond'>content2</second> <third type='mythird' /> </ldml> Case 1: _readFile('ar','/ldml/delimiter') -> returns [] = test Case 1: _readFile('ar','/ldml/second[@type=myone]') -> returns [] = content Case 2: _readFile('ar','/ldml/second','type') -> returns [myone] = content; [mysecond] = content2 Case 3: _readFile('ar','/ldml/delimiter',,'right') -> returns [right] = test Case 4: _readFile('ar','/ldml/third','type','myone') -> returns [myone] = mythird @param string $locale @param string $path @param string $attribute @param string $value @access private @return array
[ "Read", "the", "content", "from", "locale" ]
2e8dab3c9a1878f91ff2b934716638f4eb2e7f94
https://github.com/joegreen88/zf1-component-locale/blob/2e8dab3c9a1878f91ff2b934716638f4eb2e7f94/src/Zend/Locale/Data.php#L101-L136
train
joegreen88/zf1-component-locale
src/Zend/Locale/Data.php
Zend_Locale_Data._findRoute
private static function _findRoute($locale, $path, $attribute, $value, &$temp) { // load locale file if not already in cache // needed for alias tag when referring to other locale if (empty(self::$_ldml[(string) $locale])) { $filename = dirname(__FILE__) . '/Data/' . $locale . '.xml'; if (!file_exists($filename)) { throw new Zend_Locale_Exception("Missing locale file '$filename' for '$locale' locale."); } self::$_ldml[(string) $locale] = simplexml_load_file($filename); } // search for 'alias' tag in the search path for redirection $search = ''; $tok = strtok($path, '/'); // parse the complete path if (!empty(self::$_ldml[(string) $locale])) { while ($tok !== false) { $search .= '/' . $tok; if (strpos($search, '[@') !== false) { while (strrpos($search, '[@') > strrpos($search, ']')) { $tok = strtok('/'); if (empty($tok)) { $search .= '/'; } $search = $search . '/' . $tok; } } $result = self::$_ldml[(string) $locale]->xpath($search . '/alias'); // alias found if (!empty($result)) { $source = $result[0]['source']; $newpath = $result[0]['path']; // new path - path //ldml is to ignore if ($newpath != '//ldml') { // other path - parse to make real path while (substr($newpath,0,3) == '../') { $newpath = substr($newpath, 3); $search = substr($search, 0, strrpos($search, '/')); } // truncate ../ to realpath otherwise problems with alias $path = $search . '/' . $newpath; while (($tok = strtok('/'))!== false) { $path = $path . '/' . $tok; } } // reroute to other locale if ($source != 'locale') { $locale = $source; } $temp = self::_getFile($locale, $path, $attribute, $value, $temp); return false; } $tok = strtok('/'); } } return true; }
php
private static function _findRoute($locale, $path, $attribute, $value, &$temp) { // load locale file if not already in cache // needed for alias tag when referring to other locale if (empty(self::$_ldml[(string) $locale])) { $filename = dirname(__FILE__) . '/Data/' . $locale . '.xml'; if (!file_exists($filename)) { throw new Zend_Locale_Exception("Missing locale file '$filename' for '$locale' locale."); } self::$_ldml[(string) $locale] = simplexml_load_file($filename); } // search for 'alias' tag in the search path for redirection $search = ''; $tok = strtok($path, '/'); // parse the complete path if (!empty(self::$_ldml[(string) $locale])) { while ($tok !== false) { $search .= '/' . $tok; if (strpos($search, '[@') !== false) { while (strrpos($search, '[@') > strrpos($search, ']')) { $tok = strtok('/'); if (empty($tok)) { $search .= '/'; } $search = $search . '/' . $tok; } } $result = self::$_ldml[(string) $locale]->xpath($search . '/alias'); // alias found if (!empty($result)) { $source = $result[0]['source']; $newpath = $result[0]['path']; // new path - path //ldml is to ignore if ($newpath != '//ldml') { // other path - parse to make real path while (substr($newpath,0,3) == '../') { $newpath = substr($newpath, 3); $search = substr($search, 0, strrpos($search, '/')); } // truncate ../ to realpath otherwise problems with alias $path = $search . '/' . $newpath; while (($tok = strtok('/'))!== false) { $path = $path . '/' . $tok; } } // reroute to other locale if ($source != 'locale') { $locale = $source; } $temp = self::_getFile($locale, $path, $attribute, $value, $temp); return false; } $tok = strtok('/'); } } return true; }
[ "private", "static", "function", "_findRoute", "(", "$", "locale", ",", "$", "path", ",", "$", "attribute", ",", "$", "value", ",", "&", "$", "temp", ")", "{", "// load locale file if not already in cache", "// needed for alias tag when referring to other locale", "if...
Find possible routing to other path or locale @param string $locale @param string $path @param string $attribute @param string $value @param array $temp @throws Zend_Locale_Exception @access private
[ "Find", "possible", "routing", "to", "other", "path", "or", "locale" ]
2e8dab3c9a1878f91ff2b934716638f4eb2e7f94
https://github.com/joegreen88/zf1-component-locale/blob/2e8dab3c9a1878f91ff2b934716638f4eb2e7f94/src/Zend/Locale/Data.php#L149-L217
train
joegreen88/zf1-component-locale
src/Zend/Locale/Data.php
Zend_Locale_Data._getFile
private static function _getFile($locale, $path, $attribute = false, $value = false, $temp = array()) { $result = self::_findRoute($locale, $path, $attribute, $value, $temp); if ($result) { $temp = self::_readFile($locale, $path, $attribute, $value, $temp); } // parse required locales reversive // example: when given zh_Hans_CN // 1. -> zh_Hans_CN // 2. -> zh_Hans // 3. -> zh // 4. -> root if (($locale != 'root') && ($result)) { $locale = substr($locale, 0, -strlen(strrchr($locale, '_'))); if (!empty($locale)) { $temp = self::_getFile($locale, $path, $attribute, $value, $temp); } else { $temp = self::_getFile('root', $path, $attribute, $value, $temp); } } return $temp; }
php
private static function _getFile($locale, $path, $attribute = false, $value = false, $temp = array()) { $result = self::_findRoute($locale, $path, $attribute, $value, $temp); if ($result) { $temp = self::_readFile($locale, $path, $attribute, $value, $temp); } // parse required locales reversive // example: when given zh_Hans_CN // 1. -> zh_Hans_CN // 2. -> zh_Hans // 3. -> zh // 4. -> root if (($locale != 'root') && ($result)) { $locale = substr($locale, 0, -strlen(strrchr($locale, '_'))); if (!empty($locale)) { $temp = self::_getFile($locale, $path, $attribute, $value, $temp); } else { $temp = self::_getFile('root', $path, $attribute, $value, $temp); } } return $temp; }
[ "private", "static", "function", "_getFile", "(", "$", "locale", ",", "$", "path", ",", "$", "attribute", "=", "false", ",", "$", "value", "=", "false", ",", "$", "temp", "=", "array", "(", ")", ")", "{", "$", "result", "=", "self", "::", "_findRou...
Read the right LDML file @param string $locale @param string $path @param string $attribute @param string $value @access private
[ "Read", "the", "right", "LDML", "file" ]
2e8dab3c9a1878f91ff2b934716638f4eb2e7f94
https://github.com/joegreen88/zf1-component-locale/blob/2e8dab3c9a1878f91ff2b934716638f4eb2e7f94/src/Zend/Locale/Data.php#L228-L250
train
joegreen88/zf1-component-locale
src/Zend/Locale/Data.php
Zend_Locale_Data._calendarDetail
private static function _calendarDetail($locale, $list) { $ret = "001"; foreach ($list as $key => $value) { if (strpos($locale, '_') !== false) { $locale = substr($locale, strpos($locale, '_') + 1); } if (strpos($key, $locale) !== false) { $ret = $key; break; } } return $ret; }
php
private static function _calendarDetail($locale, $list) { $ret = "001"; foreach ($list as $key => $value) { if (strpos($locale, '_') !== false) { $locale = substr($locale, strpos($locale, '_') + 1); } if (strpos($key, $locale) !== false) { $ret = $key; break; } } return $ret; }
[ "private", "static", "function", "_calendarDetail", "(", "$", "locale", ",", "$", "list", ")", "{", "$", "ret", "=", "\"001\"", ";", "foreach", "(", "$", "list", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "strpos", "(", "$", "locale...
Find the details for supplemental calendar datas @param string $locale Locale for Detaildata @param array $list List to search @return string Key for Detaildata
[ "Find", "the", "details", "for", "supplemental", "calendar", "datas" ]
2e8dab3c9a1878f91ff2b934716638f4eb2e7f94
https://github.com/joegreen88/zf1-component-locale/blob/2e8dab3c9a1878f91ff2b934716638f4eb2e7f94/src/Zend/Locale/Data.php#L259-L272
train
joegreen88/zf1-component-locale
src/Zend/Locale/Data.php
Zend_Locale_Data._checkLocale
private static function _checkLocale($locale) { if (empty($locale)) { $locale = new Zend_Locale(); } if (!(Zend_Locale::isLocale((string) $locale, null, false))) { throw new Zend_Locale_Exception("Locale (" . (string) $locale . ") is a unknown locale"); } return (string) $locale; }
php
private static function _checkLocale($locale) { if (empty($locale)) { $locale = new Zend_Locale(); } if (!(Zend_Locale::isLocale((string) $locale, null, false))) { throw new Zend_Locale_Exception("Locale (" . (string) $locale . ") is a unknown locale"); } return (string) $locale; }
[ "private", "static", "function", "_checkLocale", "(", "$", "locale", ")", "{", "if", "(", "empty", "(", "$", "locale", ")", ")", "{", "$", "locale", "=", "new", "Zend_Locale", "(", ")", ";", "}", "if", "(", "!", "(", "Zend_Locale", "::", "isLocale", ...
Internal function for checking the locale @param string|Zend_Locale $locale Locale to check @return string
[ "Internal", "function", "for", "checking", "the", "locale" ]
2e8dab3c9a1878f91ff2b934716638f4eb2e7f94
https://github.com/joegreen88/zf1-component-locale/blob/2e8dab3c9a1878f91ff2b934716638f4eb2e7f94/src/Zend/Locale/Data.php#L280-L292
train
joegreen88/zf1-component-locale
src/Zend/Locale/Data.php
Zend_Locale_Data.clearCache
public static function clearCache() { if (self::$_cacheTags) { self::$_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('Zend_Locale')); } else { self::$_cache->clean(Zend_Cache::CLEANING_MODE_ALL); } }
php
public static function clearCache() { if (self::$_cacheTags) { self::$_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('Zend_Locale')); } else { self::$_cache->clean(Zend_Cache::CLEANING_MODE_ALL); } }
[ "public", "static", "function", "clearCache", "(", ")", "{", "if", "(", "self", "::", "$", "_cacheTags", ")", "{", "self", "::", "$", "_cache", "->", "clean", "(", "Zend_Cache", "::", "CLEANING_MODE_MATCHING_TAG", ",", "array", "(", "'Zend_Locale'", ")", "...
Clears all set cache data @return void
[ "Clears", "all", "set", "cache", "data" ]
2e8dab3c9a1878f91ff2b934716638f4eb2e7f94
https://github.com/joegreen88/zf1-component-locale/blob/2e8dab3c9a1878f91ff2b934716638f4eb2e7f94/src/Zend/Locale/Data.php#L1481-L1488
train
joegreen88/zf1-component-locale
src/Zend/Locale/Data.php
Zend_Locale_Data._getTagSupportForCache
private static function _getTagSupportForCache() { $backend = self::$_cache->getBackend(); if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) { $cacheOptions = $backend->getCapabilities(); self::$_cacheTags = $cacheOptions['tags']; } else { self::$_cacheTags = false; } return self::$_cacheTags; }
php
private static function _getTagSupportForCache() { $backend = self::$_cache->getBackend(); if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) { $cacheOptions = $backend->getCapabilities(); self::$_cacheTags = $cacheOptions['tags']; } else { self::$_cacheTags = false; } return self::$_cacheTags; }
[ "private", "static", "function", "_getTagSupportForCache", "(", ")", "{", "$", "backend", "=", "self", "::", "$", "_cache", "->", "getBackend", "(", ")", ";", "if", "(", "$", "backend", "instanceof", "Zend_Cache_Backend_ExtendedInterface", ")", "{", "$", "cach...
Internal method to check if the given cache supports tags @param Zend_Cache $cache
[ "Internal", "method", "to", "check", "if", "the", "given", "cache", "supports", "tags" ]
2e8dab3c9a1878f91ff2b934716638f4eb2e7f94
https://github.com/joegreen88/zf1-component-locale/blob/2e8dab3c9a1878f91ff2b934716638f4eb2e7f94/src/Zend/Locale/Data.php#L1505-L1516
train
kengoldfarb/underscore_libs
src/_Libs/_Log.php
_Log._getFile
protected static function _getFile($fullPath) { $file = ''; if (preg_match('/\/(_[A-Z].[A-Za-z]+)\.php$/', $fullPath, $matches)) { $file = isset($matches) && isset($matches[1]) ? $matches[1] : $file; self::$numFileLogs = 0; } else { switch (self::$numFileLogs) { case 0: self::_doLog('Unable to get filename for: ' . $fullPath); break; case 1: self::_doLog('MULTIPLE ERRORS ENCOUNTERED GETTING FILE NAMES (no more will be logged): ' . $fullPath); break; default: break; } self::$numFileLogs++; } return $file; }
php
protected static function _getFile($fullPath) { $file = ''; if (preg_match('/\/(_[A-Z].[A-Za-z]+)\.php$/', $fullPath, $matches)) { $file = isset($matches) && isset($matches[1]) ? $matches[1] : $file; self::$numFileLogs = 0; } else { switch (self::$numFileLogs) { case 0: self::_doLog('Unable to get filename for: ' . $fullPath); break; case 1: self::_doLog('MULTIPLE ERRORS ENCOUNTERED GETTING FILE NAMES (no more will be logged): ' . $fullPath); break; default: break; } self::$numFileLogs++; } return $file; }
[ "protected", "static", "function", "_getFile", "(", "$", "fullPath", ")", "{", "$", "file", "=", "''", ";", "if", "(", "preg_match", "(", "'/\\/(_[A-Z].[A-Za-z]+)\\.php$/'", ",", "$", "fullPath", ",", "$", "matches", ")", ")", "{", "$", "file", "=", "iss...
Extracts the filename from a full path @param string $fullPath The full path name @return string The file name
[ "Extracts", "the", "filename", "from", "a", "full", "path" ]
e0d584f25093b594e67b8a3068ebd41c7f6483c5
https://github.com/kengoldfarb/underscore_libs/blob/e0d584f25093b594e67b8a3068ebd41c7f6483c5/src/_Libs/_Log.php#L372-L393
train
ellipsephp/providers-session
src/SessionServiceProvider.php
SessionServiceProvider.getSessionHandler
public function getSessionHandler(ContainerInterface $container): SessionHandlerInterface { $prefix = $container->get('ellipse.session.id.prefix'); $ttl = $container->get('ellipse.session.ttl'); $cache = $container->get('ellipse.session.cache'); return new Psr6SessionHandler($cache, ['prefix' => $prefix, 'ttl' => $ttl]); }
php
public function getSessionHandler(ContainerInterface $container): SessionHandlerInterface { $prefix = $container->get('ellipse.session.id.prefix'); $ttl = $container->get('ellipse.session.ttl'); $cache = $container->get('ellipse.session.cache'); return new Psr6SessionHandler($cache, ['prefix' => $prefix, 'ttl' => $ttl]); }
[ "public", "function", "getSessionHandler", "(", "ContainerInterface", "$", "container", ")", ":", "SessionHandlerInterface", "{", "$", "prefix", "=", "$", "container", "->", "get", "(", "'ellipse.session.id.prefix'", ")", ";", "$", "ttl", "=", "$", "container", ...
Return a session handler based on the cache item pool. @param \Psr\Container\ContainerInterface $container @return \SessionHandlerInterface
[ "Return", "a", "session", "handler", "based", "on", "the", "cache", "item", "pool", "." ]
ca1c677d4d345bd40c1cda7fc334bc845eaad197
https://github.com/ellipsephp/providers-session/blob/ca1c677d4d345bd40c1cda7fc334bc845eaad197/src/SessionServiceProvider.php#L87-L94
train
ellipsephp/providers-session
src/SessionServiceProvider.php
SessionServiceProvider.getSetSessionHandlerMiddleware
public function getSetSessionHandlerMiddleware(ContainerInterface $container): SetSessionHandlerMiddleware { $handler = $container->get(SessionHandlerInterface::class); return new SetSessionHandlerMiddleware($handler); }
php
public function getSetSessionHandlerMiddleware(ContainerInterface $container): SetSessionHandlerMiddleware { $handler = $container->get(SessionHandlerInterface::class); return new SetSessionHandlerMiddleware($handler); }
[ "public", "function", "getSetSessionHandlerMiddleware", "(", "ContainerInterface", "$", "container", ")", ":", "SetSessionHandlerMiddleware", "{", "$", "handler", "=", "$", "container", "->", "get", "(", "SessionHandlerInterface", "::", "class", ")", ";", "return", ...
Return a set session handler middleware. @param \Psr\Container\ContainerInterface $container @return \Ellipse\Session\SetSessionHandlerMiddleware
[ "Return", "a", "set", "session", "handler", "middleware", "." ]
ca1c677d4d345bd40c1cda7fc334bc845eaad197
https://github.com/ellipsephp/providers-session/blob/ca1c677d4d345bd40c1cda7fc334bc845eaad197/src/SessionServiceProvider.php#L102-L107
train
milkyway-multimedia/ss-mwm-core
code/Core/CookieJar.php
CookieJar.updateConfig
protected function updateConfig($key, $value = null, $default = null) { $value = $value ?: singleton('env')->get('Cookie.'.$key); if (!$value && !singleton('env')->get('Cookie.dont_use_same_config_as_sessions')) { $value = singleton('env')->get('Session.'.$key); } if(!$value && $default) { $value = $default; } return $value; }
php
protected function updateConfig($key, $value = null, $default = null) { $value = $value ?: singleton('env')->get('Cookie.'.$key); if (!$value && !singleton('env')->get('Cookie.dont_use_same_config_as_sessions')) { $value = singleton('env')->get('Session.'.$key); } if(!$value && $default) { $value = $default; } return $value; }
[ "protected", "function", "updateConfig", "(", "$", "key", ",", "$", "value", "=", "null", ",", "$", "default", "=", "null", ")", "{", "$", "value", "=", "$", "value", "?", ":", "singleton", "(", "'env'", ")", "->", "get", "(", "'Cookie.'", ".", "$"...
Allow setting cookie domain @param string $key @param mixed $value @param mixed $default @return mixed
[ "Allow", "setting", "cookie", "domain" ]
e7216653b7100ead5a7d56736a124bee1c76fcd5
https://github.com/milkyway-multimedia/ss-mwm-core/blob/e7216653b7100ead5a7d56736a124bee1c76fcd5/code/Core/CookieJar.php#L45-L58
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDBquery.append
public function append($query, $args = null) { if ($query instanceof PDBquery) { $args = $query->getArgs(); $query = $query->getQuery(); }; $this->_query .= ' ' . $query; if (is_array($args)) { foreach ($args as $arg) { $this->_args[] = $arg; // Faster than array_merge() which copies }; } elseif ($args !== null) { $this->_args[] = $args; }; return $this; }
php
public function append($query, $args = null) { if ($query instanceof PDBquery) { $args = $query->getArgs(); $query = $query->getQuery(); }; $this->_query .= ' ' . $query; if (is_array($args)) { foreach ($args as $arg) { $this->_args[] = $arg; // Faster than array_merge() which copies }; } elseif ($args !== null) { $this->_args[] = $args; }; return $this; }
[ "public", "function", "append", "(", "$", "query", ",", "$", "args", "=", "null", ")", "{", "if", "(", "$", "query", "instanceof", "PDBquery", ")", "{", "$", "args", "=", "$", "query", "->", "getArgs", "(", ")", ";", "$", "query", "=", "$", "quer...
Append to current query @param string|object $query String portion or other query @param array $args (Optional) List of arguments @return object PDBquery this same object, for chaining
[ "Append", "to", "current", "query" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L86-L101
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDBquery.implode
public function implode($glue, $queries) { $first = true; foreach ($queries as $query) { if ($first) { $first = false; } else { $this->_query .= ' ' . $glue; }; $this->append($query); }; return $this; }
php
public function implode($glue, $queries) { $first = true; foreach ($queries as $query) { if ($first) { $first = false; } else { $this->_query .= ' ' . $glue; }; $this->append($query); }; return $this; }
[ "public", "function", "implode", "(", "$", "glue", ",", "$", "queries", ")", "{", "$", "first", "=", "true", ";", "foreach", "(", "$", "queries", "as", "$", "query", ")", "{", "if", "(", "$", "first", ")", "{", "$", "first", "=", "false", ";", ...
Append multiple PDBquery objects @param string $glue What to insert between joined queries @param array $queries PDBquery objects or strings to join @return object PDBquery this same object, for chaining
[ "Append", "multiple", "PDBquery", "objects" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L155-L167
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDBquery.implodeClosed
public function implodeClosed($glue, $queries) { $this->_query .= ' ('; $this->implode($glue, $queries); $this->_query .= ' )'; return $this; }
php
public function implodeClosed($glue, $queries) { $this->_query .= ' ('; $this->implode($glue, $queries); $this->_query .= ' )'; return $this; }
[ "public", "function", "implodeClosed", "(", "$", "glue", ",", "$", "queries", ")", "{", "$", "this", "->", "_query", ".=", "' ('", ";", "$", "this", "->", "implode", "(", "$", "glue", ",", "$", "queries", ")", ";", "$", "this", "->", "_query", ".="...
Append multiple PDBquery objects, wrapped in parenthesis This is identical to our implode() except '(' and ')' are wrapped around the insertion. @param string $glue What to insert between joined queries @param array $queries PDBquery objects or strings to join @return object PDBquery this same object, for chaining
[ "Append", "multiple", "PDBquery", "objects", "wrapped", "in", "parenthesis" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L198-L204
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB._getColumns
private function _getColumns($table) { if (isset($this->_tables[$table])) { return $this->_tables[$table]; }; $this->_tables[$table] = false; if ($rows = $this->selectArray("PRAGMA table_info({$table})")) { $cols = array(); foreach ($rows as $row) { $cols[] = $row['name']; }; if (count($cols) > 0) { $this->_tables[$table] = $cols; }; }; return $this->_tables[$table]; }
php
private function _getColumns($table) { if (isset($this->_tables[$table])) { return $this->_tables[$table]; }; $this->_tables[$table] = false; if ($rows = $this->selectArray("PRAGMA table_info({$table})")) { $cols = array(); foreach ($rows as $row) { $cols[] = $row['name']; }; if (count($cols) > 0) { $this->_tables[$table] = $cols; }; }; return $this->_tables[$table]; }
[ "private", "function", "_getColumns", "(", "$", "table", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_tables", "[", "$", "table", "]", ")", ")", "{", "return", "$", "this", "->", "_tables", "[", "$", "table", "]", ";", "}", ";", "$", ...
Get list of column names for a table Cached in $this to minimize I/O @param string $table Name of table to inspect @return array List of column names, false on failure
[ "Get", "list", "of", "column", "names", "for", "a", "table" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L298-L314
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB._execute
private function _execute($args = array()) { if ($this->_err) { return false; }; if ($this->_sth) { if ($this->_sth->execute($args)) { return true; } else { $this->_err = implode(' ', $this->_sth->errorInfo()); return false; }; } else { $this->_err = "No statement to execute."; }; return false; }
php
private function _execute($args = array()) { if ($this->_err) { return false; }; if ($this->_sth) { if ($this->_sth->execute($args)) { return true; } else { $this->_err = implode(' ', $this->_sth->errorInfo()); return false; }; } else { $this->_err = "No statement to execute."; }; return false; }
[ "private", "function", "_execute", "(", "$", "args", "=", "array", "(", ")", ")", "{", "if", "(", "$", "this", "->", "_err", ")", "{", "return", "false", ";", "}", ";", "if", "(", "$", "this", "->", "_sth", ")", "{", "if", "(", "$", "this", "...
Execute stored prepared statement @param array $args (Optional) List of values corresponding to placeholders @return bool Whether it succeeded
[ "Execute", "stored", "prepared", "statement" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L339-L355
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB.exec
public function exec($q, $args = array()) { if ($q instanceof PDBquery) { $args = $q->getArgs(); $q = $q->getQuery(); }; return $this->_prepare($q)->_execute($args) ? $this->_sth->rowCount() : false; }
php
public function exec($q, $args = array()) { if ($q instanceof PDBquery) { $args = $q->getArgs(); $q = $q->getQuery(); }; return $this->_prepare($q)->_execute($args) ? $this->_sth->rowCount() : false; }
[ "public", "function", "exec", "(", "$", "q", ",", "$", "args", "=", "array", "(", ")", ")", "{", "if", "(", "$", "q", "instanceof", "PDBquery", ")", "{", "$", "args", "=", "$", "q", "->", "getArgs", "(", ")", ";", "$", "q", "=", "$", "q", "...
Execute a result-less statement Typically INSERT, UPDATE, DELETE. @param string|object $q SQL query with '?' placeholders or PDBquery object @param array $args (Optional) List of values corresponding to placeholders @return mixed Number of affected rows, false on error
[ "Execute", "a", "result", "-", "less", "statement" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L367-L374
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB.insert
public function insert($table, $values) { $colOK = $this->_getColumns($table); $query = $this->query('INSERT INTO ' . $table); $colQs = array(); $cols = array(); if (is_array($values)) { foreach ($values as $key => $val) { if (in_array($key, $colOK)) { $cols[] = $key; $colQs[] = $this->query('?', $val); }; }; }; $query->implodeClosed(',', $cols)->append('VALUES')->implodeClosed(',', $colQs); return $this->_prepare($query->getQuery())->_execute($query->getArgs()) ? $this->_dbh->lastInsertId() : false ; }
php
public function insert($table, $values) { $colOK = $this->_getColumns($table); $query = $this->query('INSERT INTO ' . $table); $colQs = array(); $cols = array(); if (is_array($values)) { foreach ($values as $key => $val) { if (in_array($key, $colOK)) { $cols[] = $key; $colQs[] = $this->query('?', $val); }; }; }; $query->implodeClosed(',', $cols)->append('VALUES')->implodeClosed(',', $colQs); return $this->_prepare($query->getQuery())->_execute($query->getArgs()) ? $this->_dbh->lastInsertId() : false ; }
[ "public", "function", "insert", "(", "$", "table", ",", "$", "values", ")", "{", "$", "colOK", "=", "$", "this", "->", "_getColumns", "(", "$", "table", ")", ";", "$", "query", "=", "$", "this", "->", "query", "(", "'INSERT INTO '", ".", "$", "tabl...
Execute INSERT statement with variable associative column data Note that the first time a table is referenced with insert() or update(), its list of columns will be fetched from the database to create a whitelist. It is thus safe to pass a form result directly to $values. @param string $table Name of table to update @param array $values Associative list of columns/values to set @return mixed New ID if supported/available, false on failure
[ "Execute", "INSERT", "statement", "with", "variable", "associative", "column", "data" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L412-L432
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB.update
public function update($table, $values, $tail, $tailArgs = array()) { $colOK = $this->_getColumns($table); $query = $this->query('UPDATE ' . $table . ' SET'); $cols = array(); if (!($tail instanceof PDBquery)) { $tail = $this->query($tail, $tailArgs); }; if (is_array($values)) { foreach ($values as $key => $val) { if (in_array($key, $colOK)) { $cols[] = $this->query("{$key}=?", array($val)); // Array to allow NULL }; }; }; $query->implode(',', $cols)->append($tail); return $this->_prepare($query->getQuery())->_execute($query->getArgs()) ? $this->_sth->rowCount() : false ; }
php
public function update($table, $values, $tail, $tailArgs = array()) { $colOK = $this->_getColumns($table); $query = $this->query('UPDATE ' . $table . ' SET'); $cols = array(); if (!($tail instanceof PDBquery)) { $tail = $this->query($tail, $tailArgs); }; if (is_array($values)) { foreach ($values as $key => $val) { if (in_array($key, $colOK)) { $cols[] = $this->query("{$key}=?", array($val)); // Array to allow NULL }; }; }; $query->implode(',', $cols)->append($tail); return $this->_prepare($query->getQuery())->_execute($query->getArgs()) ? $this->_sth->rowCount() : false ; }
[ "public", "function", "update", "(", "$", "table", ",", "$", "values", ",", "$", "tail", ",", "$", "tailArgs", "=", "array", "(", ")", ")", "{", "$", "colOK", "=", "$", "this", "->", "_getColumns", "(", "$", "table", ")", ";", "$", "query", "=", ...
Execute UPDATE statement with variable associative column data Note that the first time a table is referenced with insert() or update(), its list of columns will be fetched from the database to create a whitelist. It is thus safe to pass a form result directly to $values. Also, note that if you want to append custom column assignments, it is up to you to prepend ", " to $tail before your WHERE clause. $tail can be a string (in which case $tailArgs specifies any arguments) or a PDBquery object. @param string $table Name of table to update @param array $values Associative list of columns/values to set @param string|object $tail Final part of SQL query (i.e. custom columns, WHERE clause) @param array $tailArgs (Optional) List of values corresponding to placeholders in $tail @return mixed Last ID if supported/available, false on failure
[ "Execute", "UPDATE", "statement", "with", "variable", "associative", "column", "data" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L455-L478
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB.selectAtom
public function selectAtom($q, $args = array()) { $this->exec($q, $args); // FIXME: Test if it is indeed NULL return $this->_sth ? $this->_sth->fetchColumn() : false; }
php
public function selectAtom($q, $args = array()) { $this->exec($q, $args); // FIXME: Test if it is indeed NULL return $this->_sth ? $this->_sth->fetchColumn() : false; }
[ "public", "function", "selectAtom", "(", "$", "q", ",", "$", "args", "=", "array", "(", ")", ")", "{", "$", "this", "->", "exec", "(", "$", "q", ",", "$", "args", ")", ";", "// FIXME: Test if it is indeed NULL", "return", "$", "this", "->", "_sth", "...
Fetch a single value The result is the value returned in row 0, column 0. Useful for COUNT(*) and such. Extra columns/rows are safely ignored. @param string $q SQL query with '?' value placeholders @param array $args (Optional) List of values corresponding to placeholders @return mixed Single result cell, false if no results
[ "Fetch", "a", "single", "value" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L491-L496
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB.selectList
public function selectList($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetchAll(\PDO::FETCH_COLUMN, 0) : false; }
php
public function selectList($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetchAll(\PDO::FETCH_COLUMN, 0) : false; }
[ "public", "function", "selectList", "(", "$", "q", ",", "$", "args", "=", "array", "(", ")", ")", "{", "$", "this", "->", "exec", "(", "$", "q", ",", "$", "args", ")", ";", "return", "$", "this", "->", "_sth", "?", "$", "this", "->", "_sth", ...
Fetch a simple list of result values The result is a list of the values found in the first column of each row. @param string $q SQL query with '?' value placeholders @param array $args (Optional) List of values corresponding to placeholders @return array
[ "Fetch", "a", "simple", "list", "of", "result", "values" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L509-L513
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB.selectSingleArray
public function selectSingleArray($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetch(\PDO::FETCH_ASSOC) : false; }
php
public function selectSingleArray($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetch(\PDO::FETCH_ASSOC) : false; }
[ "public", "function", "selectSingleArray", "(", "$", "q", ",", "$", "args", "=", "array", "(", ")", ")", "{", "$", "this", "->", "exec", "(", "$", "q", ",", "$", "args", ")", ";", "return", "$", "this", "->", "_sth", "?", "$", "this", "->", "_s...
Fetch a single row as associative array Fetches the first row of results, so from the caller's side it's equivalent to selectArray()[0] however only the first row is ever fetched from the server. Note that if you're not selecting by a unique ID, a LIMIT of 1 should still be specified in SQL for optimal performance. @param string $q SQL query with '?' value placeholders @param array $args (Optional) List of values corresponding to placeholders @return array Single associative row
[ "Fetch", "a", "single", "row", "as", "associative", "array" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L530-L534
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB.selectArray
public function selectArray($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetchAll(\PDO::FETCH_ASSOC) : false; }
php
public function selectArray($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetchAll(\PDO::FETCH_ASSOC) : false; }
[ "public", "function", "selectArray", "(", "$", "q", ",", "$", "args", "=", "array", "(", ")", ")", "{", "$", "this", "->", "exec", "(", "$", "q", ",", "$", "args", ")", ";", "return", "$", "this", "->", "_sth", "?", "$", "this", "->", "_sth", ...
Fetch all results in an associative array @param string $q SQL query with '?' value placeholders @param array $args (Optional) List of values corresponding to placeholders @return array All associative rows
[ "Fetch", "all", "results", "in", "an", "associative", "array" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L544-L548
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB.selectArrayIndexed
public function selectArrayIndexed($q, $args = array()) { $this->exec($q, $args); if ($this->_sth) { $result = array(); while ($row = $this->_sth->fetch(\PDO::FETCH_ASSOC)) { $result[$row[key($row)]] = $row; }; return $result; } else { return false; }; }
php
public function selectArrayIndexed($q, $args = array()) { $this->exec($q, $args); if ($this->_sth) { $result = array(); while ($row = $this->_sth->fetch(\PDO::FETCH_ASSOC)) { $result[$row[key($row)]] = $row; }; return $result; } else { return false; }; }
[ "public", "function", "selectArrayIndexed", "(", "$", "q", ",", "$", "args", "=", "array", "(", ")", ")", "{", "$", "this", "->", "exec", "(", "$", "q", ",", "$", "args", ")", ";", "if", "(", "$", "this", "->", "_sth", ")", "{", "$", "result", ...
Fetch all results in an associative array, index by first column Whereas selectArray() returns a list of associative rows, this returns an associative array keyed on the first column of each row. @param string $q SQL query with '?' value placeholders @param array $args (Optional) List of values corresponding to placeholders @return array All associative rows, keyed on first column
[ "Fetch", "all", "results", "in", "an", "associative", "array", "index", "by", "first", "column" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L561-L573
train
vphantom/pyritephp
src/Pyrite/Core/PDB.php
PDB.selectArrayPairs
public function selectArrayPairs($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP) : false; }
php
public function selectArrayPairs($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP) : false; }
[ "public", "function", "selectArrayPairs", "(", "$", "q", ",", "$", "args", "=", "array", "(", ")", ")", "{", "$", "this", "->", "exec", "(", "$", "q", ",", "$", "args", ")", ";", "return", "$", "this", "->", "_sth", "?", "$", "this", "->", "_st...
Fetch 2-column result into associative array Create one key per row, indexed on the first column, containing the second column. Handy for retreiving key/value pairs. @param string $q SQL query with '?' value placeholders @param array $args (Optional) List of values corresponding to placeholders @return array Associative pairs
[ "Fetch", "2", "-", "column", "result", "into", "associative", "array" ]
e609daa714298a254bf5a945a1d6985c9d4d539d
https://github.com/vphantom/pyritephp/blob/e609daa714298a254bf5a945a1d6985c9d4d539d/src/Pyrite/Core/PDB.php#L586-L590
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.andAdd
public function andAdd() { $args = func_get_args(); $value = array_shift($args); $params = []; while ($args) { $param = array_shift($args); if (is_array($param)) { $params = array_merge($params, $param); } else { $params[] = $param; } } $value = new WhereConditionValue($this, $value, $params); $this->add($value); return $this; }
php
public function andAdd() { $args = func_get_args(); $value = array_shift($args); $params = []; while ($args) { $param = array_shift($args); if (is_array($param)) { $params = array_merge($params, $param); } else { $params[] = $param; } } $value = new WhereConditionValue($this, $value, $params); $this->add($value); return $this; }
[ "public", "function", "andAdd", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "value", "=", "array_shift", "(", "$", "args", ")", ";", "$", "params", "=", "[", "]", ";", "while", "(", "$", "args", ")", "{", "$", "param", ...
add condition. 1. $cond->where->add('foo = ?', $foo); 2. $cond->where->add('foo = ? AND bar = ?', [$foo, $bar]); 3. $cond->where->add('foo = ? AND bar = ?', $foo, $bar); 4. $cond->where->add('foo = :foo AND bar = :bar', [':foo' => $foo, ':bar' => $bar]); @return Samurai\Onikiri\Criteria\WhereCondition
[ "add", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L69-L88
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.andNot
public function andNot() { $args = func_get_args(); call_user_func_array(array($this, 'andAdd'), $args); $value = array_pop($this->conditions); $value->not(); $this->add($value); return $this; }
php
public function andNot() { $args = func_get_args(); call_user_func_array(array($this, 'andAdd'), $args); $value = array_pop($this->conditions); $value->not(); $this->add($value); return $this; }
[ "public", "function", "andNot", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "call_user_func_array", "(", "array", "(", "$", "this", ",", "'andAdd'", ")", ",", "$", "args", ")", ";", "$", "value", "=", "array_pop", "(", "$", "this...
add not condition. @return Samurai\Onikiri\Criteria\WhereCondition
[ "add", "not", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L95-L105
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.orAdd
public function orAdd() { $args = func_get_args(); $value = array_shift($args); $params = []; while ($args) { $param = array_shift($args); if (is_array($param)) { $params = array_merge($params, $param); } else { $params[] = $param; } } $value = new WhereConditionValue($this, $value, $params); $value->chain_by = WhereCondition::CHAIN_BY_OR; $this->add($value); return $this; }
php
public function orAdd() { $args = func_get_args(); $value = array_shift($args); $params = []; while ($args) { $param = array_shift($args); if (is_array($param)) { $params = array_merge($params, $param); } else { $params[] = $param; } } $value = new WhereConditionValue($this, $value, $params); $value->chain_by = WhereCondition::CHAIN_BY_OR; $this->add($value); return $this; }
[ "public", "function", "orAdd", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "value", "=", "array_shift", "(", "$", "args", ")", ";", "$", "params", "=", "[", "]", ";", "while", "(", "$", "args", ")", "{", "$", "param", ...
add or condition. @return Samurai\Onikiri\Criteria\WhereCondition
[ "add", "or", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L112-L132
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.andNotIn
public function andNotIn($key, array $values) { if ($values) { $value = sprintf('%s NOT IN (%s)', $key, join(', ', array_fill(0, count($values), '?'))); return $this->andAdd($value, $values); } else { $value = '1'; return $this->andAdd($value, $values); } }
php
public function andNotIn($key, array $values) { if ($values) { $value = sprintf('%s NOT IN (%s)', $key, join(', ', array_fill(0, count($values), '?'))); return $this->andAdd($value, $values); } else { $value = '1'; return $this->andAdd($value, $values); } }
[ "public", "function", "andNotIn", "(", "$", "key", ",", "array", "$", "values", ")", "{", "if", "(", "$", "values", ")", "{", "$", "value", "=", "sprintf", "(", "'%s NOT IN (%s)'", ",", "$", "key", ",", "join", "(", "', '", ",", "array_fill", "(", ...
add not in condition. @param string $key @param array $values @return Samurai\Onikiri\Criteria\WhereCondition
[ "add", "not", "in", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L177-L186
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.orIn
public function orIn($key, array $values) { if ($values) { $value = sprintf('%s IN (%s)', $key, join(', ', array_fill(0, count($values), '?'))); return $this->orAdd($value, $values); } else { $value = '0'; return $this->orAdd($value, $values); } }
php
public function orIn($key, array $values) { if ($values) { $value = sprintf('%s IN (%s)', $key, join(', ', array_fill(0, count($values), '?'))); return $this->orAdd($value, $values); } else { $value = '0'; return $this->orAdd($value, $values); } }
[ "public", "function", "orIn", "(", "$", "key", ",", "array", "$", "values", ")", "{", "if", "(", "$", "values", ")", "{", "$", "value", "=", "sprintf", "(", "'%s IN (%s)'", ",", "$", "key", ",", "join", "(", "', '", ",", "array_fill", "(", "0", "...
or in condition. @param string $key @param array $values @return Samurai\Onikiri\Criteria\WhereCondition
[ "or", "in", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L195-L204
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.andBetween
public function andBetween($key, $min, $max) { $value = sprintf('%s BETWEEN ? AND ?', $key); return $this->andAdd($value, [$min, $max]); }
php
public function andBetween($key, $min, $max) { $value = sprintf('%s BETWEEN ? AND ?', $key); return $this->andAdd($value, [$min, $max]); }
[ "public", "function", "andBetween", "(", "$", "key", ",", "$", "min", ",", "$", "max", ")", "{", "$", "value", "=", "sprintf", "(", "'%s BETWEEN ? AND ?'", ",", "$", "key", ")", ";", "return", "$", "this", "->", "andAdd", "(", "$", "value", ",", "[...
add between condition. @param string $key @param mixed $min @param mixed $max @return Samurai\Onikiri\Criteria\WhereCondition
[ "add", "between", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L233-L237
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.andNotBetween
public function andNotBetween($key, $min, $max) { $value = sprintf('%s NOT BETWEEN ? AND ?', $key); return $this->andAdd($value, [$min, $max]); }
php
public function andNotBetween($key, $min, $max) { $value = sprintf('%s NOT BETWEEN ? AND ?', $key); return $this->andAdd($value, [$min, $max]); }
[ "public", "function", "andNotBetween", "(", "$", "key", ",", "$", "min", ",", "$", "max", ")", "{", "$", "value", "=", "sprintf", "(", "'%s NOT BETWEEN ? AND ?'", ",", "$", "key", ")", ";", "return", "$", "this", "->", "andAdd", "(", "$", "value", ",...
add not between condition. @param string $key @param mixed $min @param mixed $max @return Samurai\Onikiri\Criteria\WhereCondition
[ "add", "not", "between", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L247-L251
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.orBetween
public function orBetween($key, $min, $max) { $value = sprintf('%s BETWEEN ? AND ?', $key); return $this->orAdd($value, [$min, $max]); }
php
public function orBetween($key, $min, $max) { $value = sprintf('%s BETWEEN ? AND ?', $key); return $this->orAdd($value, [$min, $max]); }
[ "public", "function", "orBetween", "(", "$", "key", ",", "$", "min", ",", "$", "max", ")", "{", "$", "value", "=", "sprintf", "(", "'%s BETWEEN ? AND ?'", ",", "$", "key", ")", ";", "return", "$", "this", "->", "orAdd", "(", "$", "value", ",", "[",...
or between condition. @param string $key @param mixed $min @param mixed $max @return Samurai\Onikiri\Criteria\WhereCondition
[ "or", "between", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L261-L265
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.orNotBetween
public function orNotBetween($key, $min, $max) { $value = sprintf('%s NOT BETWEEN ? AND ?', $key); return $this->orAdd($value, [$min, $max]); }
php
public function orNotBetween($key, $min, $max) { $value = sprintf('%s NOT BETWEEN ? AND ?', $key); return $this->orAdd($value, [$min, $max]); }
[ "public", "function", "orNotBetween", "(", "$", "key", ",", "$", "min", ",", "$", "max", ")", "{", "$", "value", "=", "sprintf", "(", "'%s NOT BETWEEN ? AND ?'", ",", "$", "key", ")", ";", "return", "$", "this", "->", "orAdd", "(", "$", "value", ",",...
or not between condition. @param string $key @param mixed $min @param mixed $max @return Samurai\Onikiri\Criteria\WhereCondition
[ "or", "not", "between", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L275-L279
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.andLike
public function andLike($key, $like) { $value = sprintf('%s LIKE ?', $key); return $this->andAdd($value, [$like]); }
php
public function andLike($key, $like) { $value = sprintf('%s LIKE ?', $key); return $this->andAdd($value, [$like]); }
[ "public", "function", "andLike", "(", "$", "key", ",", "$", "like", ")", "{", "$", "value", "=", "sprintf", "(", "'%s LIKE ?'", ",", "$", "key", ")", ";", "return", "$", "this", "->", "andAdd", "(", "$", "value", ",", "[", "$", "like", "]", ")", ...
add like condition. @param string $key @param string $like @return Samurai\Onikiri\Criteria\WhereCondition
[ "add", "like", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L289-L293
train
samurai-fw/samurai
src/Onikiri/Criteria/WhereCondition.php
WhereCondition.andNotLike
public function andNotLike($key, $like) { $value = sprintf('%s NOT LIKE ?', $key); return $this->andAdd($value, [$like]); }
php
public function andNotLike($key, $like) { $value = sprintf('%s NOT LIKE ?', $key); return $this->andAdd($value, [$like]); }
[ "public", "function", "andNotLike", "(", "$", "key", ",", "$", "like", ")", "{", "$", "value", "=", "sprintf", "(", "'%s NOT LIKE ?'", ",", "$", "key", ")", ";", "return", "$", "this", "->", "andAdd", "(", "$", "value", ",", "[", "$", "like", "]", ...
add not like condition. @param string $key @param string $like @return Samurai\Onikiri\Criteria\WhereCondition
[ "add", "not", "like", "condition", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Onikiri/Criteria/WhereCondition.php#L302-L306
train