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
Speicher210/Reflection
src/ReflectionClassUse.php
ReflectionClassUse.isSearchedTrait
private function isSearchedTrait($name) { if ($this->name === $name) { return true; } if (strpos($name, '\\') === 0) { return $this->name === $name || '\\' . $this->name === $name; } $name = $this->declaringClass->getNamespaceName() . '\\' . $name; return $this->name === $name || $this->name === '\\' . $name; }
php
private function isSearchedTrait($name) { if ($this->name === $name) { return true; } if (strpos($name, '\\') === 0) { return $this->name === $name || '\\' . $this->name === $name; } $name = $this->declaringClass->getNamespaceName() . '\\' . $name; return $this->name === $name || $this->name === '\\' . $name; }
[ "private", "function", "isSearchedTrait", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "name", "===", "$", "name", ")", "{", "return", "true", ";", "}", "if", "(", "strpos", "(", "$", "name", ",", "'\\\\'", ")", "===", "0", ")", "{",...
Check if the found trait name is the one that we need to reflect. @param string $name The name of the trait found. @return boolean
[ "Check", "if", "the", "found", "trait", "name", "is", "the", "one", "that", "we", "need", "to", "reflect", "." ]
3d0f5033077b6a3f47cebbeded6538caeb0a1909
https://github.com/Speicher210/Reflection/blob/3d0f5033077b6a3f47cebbeded6538caeb0a1909/src/ReflectionClassUse.php#L183-L196
train
Speicher210/Reflection
src/ReflectionClassUse.php
ReflectionClassUse.next
private function next($includeWhiteSpace = false) { for ($i = $this->tokenPos; $i < $this->tokensCount; $i++) { $this->tokenPos++; if (($includeWhiteSpace === false && $this->tokens[$i][0] === T_WHITESPACE) || $this->tokens[$i][0] === T_COMMENT) { continue; } return $this->tokens[$i]; } return null; }
php
private function next($includeWhiteSpace = false) { for ($i = $this->tokenPos; $i < $this->tokensCount; $i++) { $this->tokenPos++; if (($includeWhiteSpace === false && $this->tokens[$i][0] === T_WHITESPACE) || $this->tokens[$i][0] === T_COMMENT) { continue; } return $this->tokens[$i]; } return null; }
[ "private", "function", "next", "(", "$", "includeWhiteSpace", "=", "false", ")", "{", "for", "(", "$", "i", "=", "$", "this", "->", "tokenPos", ";", "$", "i", "<", "$", "this", "->", "tokensCount", ";", "$", "i", "++", ")", "{", "$", "this", "->"...
Return the next token that is not a whitespace or comment. @param boolean $includeWhiteSpace Flag if the whitespace should also be returned. @return mixed
[ "Return", "the", "next", "token", "that", "is", "not", "a", "whitespace", "or", "comment", "." ]
3d0f5033077b6a3f47cebbeded6538caeb0a1909
https://github.com/Speicher210/Reflection/blob/3d0f5033077b6a3f47cebbeded6538caeb0a1909/src/ReflectionClassUse.php#L204-L216
train
Speicher210/Reflection
src/ReflectionClassUse.php
ReflectionClassUse.export
public static function export($className, $name, $return = false) { $export = new self($className, $name); $export = (string)$export; if ($return === true) { return $export; } else { echo $export; return null; } }
php
public static function export($className, $name, $return = false) { $export = new self($className, $name); $export = (string)$export; if ($return === true) { return $export; } else { echo $export; return null; } }
[ "public", "static", "function", "export", "(", "$", "className", ",", "$", "name", ",", "$", "return", "=", "false", ")", "{", "$", "export", "=", "new", "self", "(", "$", "className", ",", "$", "name", ")", ";", "$", "export", "=", "(", "string", ...
Export the current use statement reflection. @param string $className The class name where the use statement is defined. @param string $name The name of the trait. @param boolean $return Flag if the export should be returned or not. @return string
[ "Export", "the", "current", "use", "statement", "reflection", "." ]
3d0f5033077b6a3f47cebbeded6538caeb0a1909
https://github.com/Speicher210/Reflection/blob/3d0f5033077b6a3f47cebbeded6538caeb0a1909/src/ReflectionClassUse.php#L226-L237
train
chippyash/Monad
src/chippyash/Monad/Map.php
Map.vUnion
final public function vUnion(Collection $other, $sortOrder = SORT_REGULAR) { throw new \BadMethodCallException(sprintf(self::ERR_TPL_BADM, __METHOD__)); }
php
final public function vUnion(Collection $other, $sortOrder = SORT_REGULAR) { throw new \BadMethodCallException(sprintf(self::ERR_TPL_BADM, __METHOD__)); }
[ "final", "public", "function", "vUnion", "(", "Collection", "$", "other", ",", "$", "sortOrder", "=", "SORT_REGULAR", ")", "{", "throw", "new", "\\", "BadMethodCallException", "(", "sprintf", "(", "self", "::", "ERR_TPL_BADM", ",", "__METHOD__", ")", ")", ";...
Value union is meaningless for a Map @inheritdoc @throws \BadMethodCallException
[ "Value", "union", "is", "meaningless", "for", "a", "Map" ]
56b0d0177880932448e41b07c1d8e4ba16f8804f
https://github.com/chippyash/Monad/blob/56b0d0177880932448e41b07c1d8e4ba16f8804f/src/chippyash/Monad/Map.php#L81-L84
train
iwyg/jitimage
src/Thapp/JitImage/JitImageResolver.php
JitImageResolver.canResolve
protected function canResolve() { return is_array($this->input) && array_key_exists('parameter', $this->input) && array_key_exists('source', $this->input) && array_key_exists('filter', $this->input); }
php
protected function canResolve() { return is_array($this->input) && array_key_exists('parameter', $this->input) && array_key_exists('source', $this->input) && array_key_exists('filter', $this->input); }
[ "protected", "function", "canResolve", "(", ")", "{", "return", "is_array", "(", "$", "this", "->", "input", ")", "&&", "array_key_exists", "(", "'parameter'", ",", "$", "this", "->", "input", ")", "&&", "array_key_exists", "(", "'source'", ",", "$", "this...
determine if all params are set @access protected @return bool
[ "determine", "if", "all", "params", "are", "set" ]
25300cc5bb17835634ec60d71f5ac2ba870abbe4
https://github.com/iwyg/jitimage/blob/25300cc5bb17835634ec60d71f5ac2ba870abbe4/src/Thapp/JitImage/JitImageResolver.php#L249-L255
train
iwyg/jitimage
src/Thapp/JitImage/JitImageResolver.php
JitImageResolver.parseFilter
protected function parseFilter() { if (isset($this->input['filter'])) { $fragments = preg_split('%:%', $this->input['filter'], -1, PREG_SPLIT_NO_EMPTY); $this->parameter['filter'] = $this->parseImageFilter($fragments); return; } $this->parameter['filter'] = []; }
php
protected function parseFilter() { if (isset($this->input['filter'])) { $fragments = preg_split('%:%', $this->input['filter'], -1, PREG_SPLIT_NO_EMPTY); $this->parameter['filter'] = $this->parseImageFilter($fragments); return; } $this->parameter['filter'] = []; }
[ "protected", "function", "parseFilter", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "input", "[", "'filter'", "]", ")", ")", "{", "$", "fragments", "=", "preg_split", "(", "'%:%'", ",", "$", "this", "->", "input", "[", "'filter'", "]",...
parse the filter input parameter @access protected @return mixed
[ "parse", "the", "filter", "input", "parameter" ]
25300cc5bb17835634ec60d71f5ac2ba870abbe4
https://github.com/iwyg/jitimage/blob/25300cc5bb17835634ec60d71f5ac2ba870abbe4/src/Thapp/JitImage/JitImageResolver.php#L355-L365
train
iwyg/jitimage
src/Thapp/JitImage/JitImageResolver.php
JitImageResolver.getOptionalColor
protected function getOptionalColor(array &$parameter) { preg_match('/^[0-9A-Fa-f]{3,6}/', $parameter['source'], $color); $length = strpos($parameter['source'], '/'); $hasColor = (6 === $length && 3 === $length) && $length === strlen(current($color)); if (!empty($color)) { $parameter['source'] = substr($parameter['source'], strlen(current($color))); } if ($hasColor) { $parameter['background'] = '#' . current($color); } }
php
protected function getOptionalColor(array &$parameter) { preg_match('/^[0-9A-Fa-f]{3,6}/', $parameter['source'], $color); $length = strpos($parameter['source'], '/'); $hasColor = (6 === $length && 3 === $length) && $length === strlen(current($color)); if (!empty($color)) { $parameter['source'] = substr($parameter['source'], strlen(current($color))); } if ($hasColor) { $parameter['background'] = '#' . current($color); } }
[ "protected", "function", "getOptionalColor", "(", "array", "&", "$", "parameter", ")", "{", "preg_match", "(", "'/^[0-9A-Fa-f]{3,6}/'", ",", "$", "parameter", "[", "'source'", "]", ",", "$", "color", ")", ";", "$", "length", "=", "strpos", "(", "$", "param...
extract a possible color string from the parameter input @param array $parameter @access protected @return void
[ "extract", "a", "possible", "color", "string", "from", "the", "parameter", "input" ]
25300cc5bb17835634ec60d71f5ac2ba870abbe4
https://github.com/iwyg/jitimage/blob/25300cc5bb17835634ec60d71f5ac2ba870abbe4/src/Thapp/JitImage/JitImageResolver.php#L446-L461
train
iwyg/jitimage
src/Thapp/JitImage/JitImageResolver.php
JitImageResolver.getImageRequestId
protected function getImageRequestId($requestString, $source = null) { if (!isset($this->cachedNames[$requestString])) { $this->cachedNames[$requestString] = $this->processCache->createKey( $source, $requestString, $this->config->cache_prefix, pathinfo($source, PATHINFO_EXTENSION) ); } return $this->cachedNames[$requestString]; }
php
protected function getImageRequestId($requestString, $source = null) { if (!isset($this->cachedNames[$requestString])) { $this->cachedNames[$requestString] = $this->processCache->createKey( $source, $requestString, $this->config->cache_prefix, pathinfo($source, PATHINFO_EXTENSION) ); } return $this->cachedNames[$requestString]; }
[ "protected", "function", "getImageRequestId", "(", "$", "requestString", ",", "$", "source", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "cachedNames", "[", "$", "requestString", "]", ")", ")", "{", "$", "this", "->", "cache...
returns the image cache id string @param mixed $requestString @param mixed $width @param mixed $height @access protected @return string
[ "returns", "the", "image", "cache", "id", "string" ]
25300cc5bb17835634ec60d71f5ac2ba870abbe4
https://github.com/iwyg/jitimage/blob/25300cc5bb17835634ec60d71f5ac2ba870abbe4/src/Thapp/JitImage/JitImageResolver.php#L472-L485
train
funivan/PhpTokenizer
src/Pattern/Patterns/MethodPattern.php
MethodPattern.withoutDocComment
public function withoutDocComment() : self { $this->docCommentChecker = function (Token $token) { return $token->isValid() === false; }; return $this; }
php
public function withoutDocComment() : self { $this->docCommentChecker = function (Token $token) { return $token->isValid() === false; }; return $this; }
[ "public", "function", "withoutDocComment", "(", ")", ":", "self", "{", "$", "this", "->", "docCommentChecker", "=", "function", "(", "Token", "$", "token", ")", "{", "return", "$", "token", "->", "isValid", "(", ")", "===", "false", ";", "}", ";", "ret...
Find functions without doc comments
[ "Find", "functions", "without", "doc", "comments" ]
f31ec8f1440708518c2a785b3f129f130621e966
https://github.com/funivan/PhpTokenizer/blob/f31ec8f1440708518c2a785b3f129f130621e966/src/Pattern/Patterns/MethodPattern.php#L162-L168
train
thephpleague/flysystem-eventable-filesystem
src/EventableFilesystem.php
EventableFilesystem.delegateMethodCall
public function delegateMethodCall($method, array $arguments = []) { $config = $arguments['config']; if (isset($config['silent']) && $config['silent'] === true) { return $this->callFilesystemMethod($method, $arguments); } list($continue, $result) = $this->emitBefore($method, $arguments); if (! $continue) { return $result; } $result = $this->callFilesystemMethod($method, $result); return $this->emitAfter($method, $result, $arguments); }
php
public function delegateMethodCall($method, array $arguments = []) { $config = $arguments['config']; if (isset($config['silent']) && $config['silent'] === true) { return $this->callFilesystemMethod($method, $arguments); } list($continue, $result) = $this->emitBefore($method, $arguments); if (! $continue) { return $result; } $result = $this->callFilesystemMethod($method, $result); return $this->emitAfter($method, $result, $arguments); }
[ "public", "function", "delegateMethodCall", "(", "$", "method", ",", "array", "$", "arguments", "=", "[", "]", ")", "{", "$", "config", "=", "$", "arguments", "[", "'config'", "]", ";", "if", "(", "isset", "(", "$", "config", "[", "'silent'", "]", ")...
Do all the work to call the method and emit the events. @param string $method @param array $arguments @return mixed
[ "Do", "all", "the", "work", "to", "call", "the", "method", "and", "emit", "the", "events", "." ]
784ddbf1a1c0144c04686b439548286279f0f920
https://github.com/thephpleague/flysystem-eventable-filesystem/blob/784ddbf1a1c0144c04686b439548286279f0f920/src/EventableFilesystem.php#L381-L398
train
thephpleague/flysystem-eventable-filesystem
src/EventableFilesystem.php
EventableFilesystem.emitBefore
protected function emitBefore($method, array $arguments) { $event = new BeforeEvent($this, $method, $arguments); $this->emit($event, $method); if ($event->isPropagationStopped()) { return [false, $event->getResult()]; } return [true, $event->getArguments()]; }
php
protected function emitBefore($method, array $arguments) { $event = new BeforeEvent($this, $method, $arguments); $this->emit($event, $method); if ($event->isPropagationStopped()) { return [false, $event->getResult()]; } return [true, $event->getArguments()]; }
[ "protected", "function", "emitBefore", "(", "$", "method", ",", "array", "$", "arguments", ")", "{", "$", "event", "=", "new", "BeforeEvent", "(", "$", "this", ",", "$", "method", ",", "$", "arguments", ")", ";", "$", "this", "->", "emit", "(", "$", ...
Emit the before event. @param string $method @param array $arguments @return array [continue, call result]
[ "Emit", "the", "before", "event", "." ]
784ddbf1a1c0144c04686b439548286279f0f920
https://github.com/thephpleague/flysystem-eventable-filesystem/blob/784ddbf1a1c0144c04686b439548286279f0f920/src/EventableFilesystem.php#L408-L418
train
thephpleague/flysystem-eventable-filesystem
src/EventableFilesystem.php
EventableFilesystem.emitAfter
protected function emitAfter($method, $result, array $arguments) { $event = new AfterEvent($this, $method, $result, $arguments); $this->emit($event); return $event->getResult(); }
php
protected function emitAfter($method, $result, array $arguments) { $event = new AfterEvent($this, $method, $result, $arguments); $this->emit($event); return $event->getResult(); }
[ "protected", "function", "emitAfter", "(", "$", "method", ",", "$", "result", ",", "array", "$", "arguments", ")", "{", "$", "event", "=", "new", "AfterEvent", "(", "$", "this", ",", "$", "method", ",", "$", "result", ",", "$", "arguments", ")", ";",...
Emit the after event. @param string $method @param mixed $result @param array $arguments @return mixed
[ "Emit", "the", "after", "event", "." ]
784ddbf1a1c0144c04686b439548286279f0f920
https://github.com/thephpleague/flysystem-eventable-filesystem/blob/784ddbf1a1c0144c04686b439548286279f0f920/src/EventableFilesystem.php#L445-L451
train
funivan/PhpTokenizer
src/Collection.php
Collection.refresh
public function refresh() : self { $string = $this->assemble(); $this->cleanCollection(); $tokens = Helper::getTokensFromString($string); $this->setItems($tokens); $this->rewind(); return $this; }
php
public function refresh() : self { $string = $this->assemble(); $this->cleanCollection(); $tokens = Helper::getTokensFromString($string); $this->setItems($tokens); $this->rewind(); return $this; }
[ "public", "function", "refresh", "(", ")", ":", "self", "{", "$", "string", "=", "$", "this", "->", "assemble", "(", ")", ";", "$", "this", "->", "cleanCollection", "(", ")", ";", "$", "tokens", "=", "Helper", "::", "getTokensFromString", "(", "$", "...
Remove all invalid tokens in collection Refresh index. @return Collection
[ "Remove", "all", "invalid", "tokens", "in", "collection", "Refresh", "index", "." ]
f31ec8f1440708518c2a785b3f129f130621e966
https://github.com/funivan/PhpTokenizer/blob/f31ec8f1440708518c2a785b3f129f130621e966/src/Collection.php#L422-L431
train
funivan/PhpTokenizer
src/Collection.php
Collection.cleanCollection
protected function cleanCollection() : self { foreach ($this as $index => $token) { if ($token->isValid()) { continue; } unset($this->items[$index]); } return $this; }
php
protected function cleanCollection() : self { foreach ($this as $index => $token) { if ($token->isValid()) { continue; } unset($this->items[$index]); } return $this; }
[ "protected", "function", "cleanCollection", "(", ")", ":", "self", "{", "foreach", "(", "$", "this", "as", "$", "index", "=>", "$", "token", ")", "{", "if", "(", "$", "token", "->", "isValid", "(", ")", ")", "{", "continue", ";", "}", "unset", "(",...
Remove invalid tokens from collection @return $this
[ "Remove", "invalid", "tokens", "from", "collection" ]
f31ec8f1440708518c2a785b3f129f130621e966
https://github.com/funivan/PhpTokenizer/blob/f31ec8f1440708518c2a785b3f129f130621e966/src/Collection.php#L503-L512
train
iwyg/jitimage
src/Thapp/JitImage/Controller/JitController.php
JitController.getImage
public function getImage($parameter, $source, $filter = null) { $this->imageResolver->setParameter($parameter); $this->imageResolver->setSource($source); $this->imageResolver->setFilter($filter); if ($image = $this->imageResolver->resolve()) { return $this->render($image); } return $this->notFound(); }
php
public function getImage($parameter, $source, $filter = null) { $this->imageResolver->setParameter($parameter); $this->imageResolver->setSource($source); $this->imageResolver->setFilter($filter); if ($image = $this->imageResolver->resolve()) { return $this->render($image); } return $this->notFound(); }
[ "public", "function", "getImage", "(", "$", "parameter", ",", "$", "source", ",", "$", "filter", "=", "null", ")", "{", "$", "this", "->", "imageResolver", "->", "setParameter", "(", "$", "parameter", ")", ";", "$", "this", "->", "imageResolver", "->", ...
Handler method that's being called for dynamic image processing. @param string $mode @param string $height @param string $width @param string $gravity @param string $options @access public @return void
[ "Handler", "method", "that", "s", "being", "called", "for", "dynamic", "image", "processing", "." ]
25300cc5bb17835634ec60d71f5ac2ba870abbe4
https://github.com/iwyg/jitimage/blob/25300cc5bb17835634ec60d71f5ac2ba870abbe4/src/Thapp/JitImage/Controller/JitController.php#L80-L91
train
iwyg/jitimage
src/Thapp/JitImage/Controller/JitController.php
JitController.getResource
public function getResource($parameter, $source) { if ($params = $this->recipes->resolve($parameter)) { extract($params); return $this->getImage($parameters, $source, $filter); } return $this->notFound(); }
php
public function getResource($parameter, $source) { if ($params = $this->recipes->resolve($parameter)) { extract($params); return $this->getImage($parameters, $source, $filter); } return $this->notFound(); }
[ "public", "function", "getResource", "(", "$", "parameter", ",", "$", "source", ")", "{", "if", "(", "$", "params", "=", "$", "this", "->", "recipes", "->", "resolve", "(", "$", "parameter", ")", ")", "{", "extract", "(", "$", "params", ")", ";", "...
Handler method that's being called for aliased image processing. @param string $source the source image to be processed @access public @return mixed
[ "Handler", "method", "that", "s", "being", "called", "for", "aliased", "image", "processing", "." ]
25300cc5bb17835634ec60d71f5ac2ba870abbe4
https://github.com/iwyg/jitimage/blob/25300cc5bb17835634ec60d71f5ac2ba870abbe4/src/Thapp/JitImage/Controller/JitController.php#L101-L109
train
iwyg/jitimage
src/Thapp/JitImage/Controller/JitController.php
JitController.getCached
public function getCached($key) { if ($image = $this->imageResolver->resolveFromCache($key)) { return $this->render($image); } return $this->notFound(); }
php
public function getCached($key) { if ($image = $this->imageResolver->resolveFromCache($key)) { return $this->render($image); } return $this->notFound(); }
[ "public", "function", "getCached", "(", "$", "key", ")", "{", "if", "(", "$", "image", "=", "$", "this", "->", "imageResolver", "->", "resolveFromCache", "(", "$", "key", ")", ")", "{", "return", "$", "this", "->", "render", "(", "$", "image", ")", ...
Handler method for resolving cached images. @param mixed $key @access public @return void
[ "Handler", "method", "for", "resolving", "cached", "images", "." ]
25300cc5bb17835634ec60d71f5ac2ba870abbe4
https://github.com/iwyg/jitimage/blob/25300cc5bb17835634ec60d71f5ac2ba870abbe4/src/Thapp/JitImage/Controller/JitController.php#L118-L125
train
iwyg/jitimage
src/Thapp/JitImage/Controller/JitController.php
JitController.render
protected function render(ImageInterface $image) { $this->response->make($image); $image->close(); return $this->response->getResponse(); }
php
protected function render(ImageInterface $image) { $this->response->make($image); $image->close(); return $this->response->getResponse(); }
[ "protected", "function", "render", "(", "ImageInterface", "$", "image", ")", "{", "$", "this", "->", "response", "->", "make", "(", "$", "image", ")", ";", "$", "image", "->", "close", "(", ")", ";", "return", "$", "this", "->", "response", "->", "ge...
Create a new response and send its contents. @access protected @return void
[ "Create", "a", "new", "response", "and", "send", "its", "contents", "." ]
25300cc5bb17835634ec60d71f5ac2ba870abbe4
https://github.com/iwyg/jitimage/blob/25300cc5bb17835634ec60d71f5ac2ba870abbe4/src/Thapp/JitImage/Controller/JitController.php#L160-L166
train
iwyg/jitimage
src/Thapp/JitImage/Shell/ShellCommand.php
ShellCommand.runCmd
public function runCmd( $cmd, $exception = '\RuntimeException', Closure $callback = null, array $noEscapeChars = null ) { $cmd = escapeshellcmd($cmd); if (is_array($noEscapeChars) and !empty($noEscapeChars)) { $repl = "\\\\" . implode("|\\\\", $noEscapeChars); $cmd = preg_replace_callback( "~$repl~", function ($found) { return trim($found[0], "\\"); }, $cmd ); } $this->cmds[] = $cmd; $exitStatus = $this->execCmd($cmd, $stdout, $stderr); if ($exitStatus > 0) { if (!is_null($callback)) { $callback($stderr); } throw new $exception(sprintf('Command exited with %d: %s', $exitStatus, $stderr)); } return $stdout; }
php
public function runCmd( $cmd, $exception = '\RuntimeException', Closure $callback = null, array $noEscapeChars = null ) { $cmd = escapeshellcmd($cmd); if (is_array($noEscapeChars) and !empty($noEscapeChars)) { $repl = "\\\\" . implode("|\\\\", $noEscapeChars); $cmd = preg_replace_callback( "~$repl~", function ($found) { return trim($found[0], "\\"); }, $cmd ); } $this->cmds[] = $cmd; $exitStatus = $this->execCmd($cmd, $stdout, $stderr); if ($exitStatus > 0) { if (!is_null($callback)) { $callback($stderr); } throw new $exception(sprintf('Command exited with %d: %s', $exitStatus, $stderr)); } return $stdout; }
[ "public", "function", "runCmd", "(", "$", "cmd", ",", "$", "exception", "=", "'\\RuntimeException'", ",", "Closure", "$", "callback", "=", "null", ",", "array", "$", "noEscapeChars", "=", "null", ")", "{", "$", "cmd", "=", "escapeshellcmd", "(", "$", "cm...
run a shell command @param string $cmd the shell command @param string $exception exeption class @param Closure $callback in case of an error call a callback right before an exception is thrown @access public @throws \RuntimeException; @return string the command result
[ "run", "a", "shell", "command" ]
25300cc5bb17835634ec60d71f5ac2ba870abbe4
https://github.com/iwyg/jitimage/blob/25300cc5bb17835634ec60d71f5ac2ba870abbe4/src/Thapp/JitImage/Shell/ShellCommand.php#L48-L80
train
jack-theripper/transcoder
src/Format/VideoFormat.php
VideoFormat.setVideoBitrate
public function setVideoBitrate($bitrate) { if ( ! is_numeric($bitrate) || $bitrate < 0) { throw new \InvalidArgumentException('The video bit rate value must be a integer type.'); } $this->videoBitrate = (int) $bitrate; return $this; }
php
public function setVideoBitrate($bitrate) { if ( ! is_numeric($bitrate) || $bitrate < 0) { throw new \InvalidArgumentException('The video bit rate value must be a integer type.'); } $this->videoBitrate = (int) $bitrate; return $this; }
[ "public", "function", "setVideoBitrate", "(", "$", "bitrate", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "bitrate", ")", "||", "$", "bitrate", "<", "0", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The video bit rate value must be ...
Set the bitrate value. @param int $bitrate @return VideoFormat @throws \InvalidArgumentException
[ "Set", "the", "bitrate", "value", "." ]
bd87db4c76ccceafa9fc271b14013ebf12e0b32e
https://github.com/jack-theripper/transcoder/blob/bd87db4c76ccceafa9fc271b14013ebf12e0b32e/src/Format/VideoFormat.php#L103-L113
train
jack-theripper/transcoder
src/Format/VideoFormat.php
VideoFormat.setPasses
public function setPasses($passes) { if ( ! is_int($passes) || $passes < 1) { throw new \InvalidArgumentException('The passes value must be a number greater then zero.'); } $this->passes = $passes; return $this; }
php
public function setPasses($passes) { if ( ! is_int($passes) || $passes < 1) { throw new \InvalidArgumentException('The passes value must be a number greater then zero.'); } $this->passes = $passes; return $this; }
[ "public", "function", "setPasses", "(", "$", "passes", ")", "{", "if", "(", "!", "is_int", "(", "$", "passes", ")", "||", "$", "passes", "<", "1", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The passes value must be a number greater then...
Sets the number of passes. @param int $passes @return VideoFormat @throws \InvalidArgumentException
[ "Sets", "the", "number", "of", "passes", "." ]
bd87db4c76ccceafa9fc271b14013ebf12e0b32e
https://github.com/jack-theripper/transcoder/blob/bd87db4c76ccceafa9fc271b14013ebf12e0b32e/src/Format/VideoFormat.php#L123-L133
train
jack-theripper/transcoder
src/Format/VideoFormat.php
VideoFormat.setFrameRate
public function setFrameRate($frameRate) { if ( ! is_numeric($frameRate) || $frameRate < 0) { throw new \InvalidArgumentException('Wrong the frame rate value.'); } $this->videoFrameRate = $frameRate; return $this; }
php
public function setFrameRate($frameRate) { if ( ! is_numeric($frameRate) || $frameRate < 0) { throw new \InvalidArgumentException('Wrong the frame rate value.'); } $this->videoFrameRate = $frameRate; return $this; }
[ "public", "function", "setFrameRate", "(", "$", "frameRate", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "frameRate", ")", "||", "$", "frameRate", "<", "0", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Wrong the frame rate value.'",...
Set the frame rate value. @param float $frameRate @return VideoFormat @throws \InvalidArgumentException
[ "Set", "the", "frame", "rate", "value", "." ]
bd87db4c76ccceafa9fc271b14013ebf12e0b32e
https://github.com/jack-theripper/transcoder/blob/bd87db4c76ccceafa9fc271b14013ebf12e0b32e/src/Format/VideoFormat.php#L153-L163
train
jack-theripper/transcoder
src/Format/VideoFormat.php
VideoFormat.setHeight
protected function setHeight($height) { if ( ! is_numeric($height) || $height < 1) { throw new \InvalidArgumentException('Wrong the height value.'); } $this->height = $height; return $this; }
php
protected function setHeight($height) { if ( ! is_numeric($height) || $height < 1) { throw new \InvalidArgumentException('Wrong the height value.'); } $this->height = $height; return $this; }
[ "protected", "function", "setHeight", "(", "$", "height", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "height", ")", "||", "$", "height", "<", "1", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Wrong the height value.'", ")", ";"...
Set the height value. @param int $height @return self @throws \InvalidArgumentException
[ "Set", "the", "height", "value", "." ]
bd87db4c76ccceafa9fc271b14013ebf12e0b32e
https://github.com/jack-theripper/transcoder/blob/bd87db4c76ccceafa9fc271b14013ebf12e0b32e/src/Format/VideoFormat.php#L264-L274
train
mmanos/laravel-api
src/Mmanos/Api/Api.php
Api.transform
public static function transform($object, $request = null) { return Transformations::transform($object, $request ?: Request::instance()); }
php
public static function transform($object, $request = null) { return Transformations::transform($object, $request ?: Request::instance()); }
[ "public", "static", "function", "transform", "(", "$", "object", ",", "$", "request", "=", "null", ")", "{", "return", "Transformations", "::", "transform", "(", "$", "object", ",", "$", "request", "?", ":", "Request", "::", "instance", "(", ")", ")", ...
Apply any available transformations to the given model and return the result. @param Model $model @param Request $request @return mixed
[ "Apply", "any", "available", "transformations", "to", "the", "given", "model", "and", "return", "the", "result", "." ]
8fac248d91c797f4a8f960e7cd7466df5a814975
https://github.com/mmanos/laravel-api/blob/8fac248d91c797f4a8f960e7cd7466df5a814975/src/Mmanos/Api/Api.php#L69-L72
train
mmanos/laravel-api
src/Mmanos/Api/Transformations.php
Transformations.getTransformer
public static function getTransformer($object) { $class = get_class($object); if (isset(static::$transformations[$class])) { return new static::$transformations[$class]; } if (isset($object->transformer)) { return new $object->transformer; } return null; }
php
public static function getTransformer($object) { $class = get_class($object); if (isset(static::$transformations[$class])) { return new static::$transformations[$class]; } if (isset($object->transformer)) { return new $object->transformer; } return null; }
[ "public", "static", "function", "getTransformer", "(", "$", "object", ")", "{", "$", "class", "=", "get_class", "(", "$", "object", ")", ";", "if", "(", "isset", "(", "static", "::", "$", "transformations", "[", "$", "class", "]", ")", ")", "{", "ret...
Return a transformer instance for the requested object. @param object $object @return object|null
[ "Return", "a", "transformer", "instance", "for", "the", "requested", "object", "." ]
8fac248d91c797f4a8f960e7cd7466df5a814975
https://github.com/mmanos/laravel-api/blob/8fac248d91c797f4a8f960e7cd7466df5a814975/src/Mmanos/Api/Transformations.php#L27-L40
train
mmanos/laravel-api
src/Mmanos/Api/Transformations.php
Transformations.transform
public static function transform($object, $request) { $transformer = static::getTransformer($object); if (!$transformer) { return $object; } return $transformer->transform($object, $request); }
php
public static function transform($object, $request) { $transformer = static::getTransformer($object); if (!$transformer) { return $object; } return $transformer->transform($object, $request); }
[ "public", "static", "function", "transform", "(", "$", "object", ",", "$", "request", ")", "{", "$", "transformer", "=", "static", "::", "getTransformer", "(", "$", "object", ")", ";", "if", "(", "!", "$", "transformer", ")", "{", "return", "$", "objec...
Transform the given object. @param object $object @param Request $request @return mixed
[ "Transform", "the", "given", "object", "." ]
8fac248d91c797f4a8f960e7cd7466df5a814975
https://github.com/mmanos/laravel-api/blob/8fac248d91c797f4a8f960e7cd7466df5a814975/src/Mmanos/Api/Transformations.php#L50-L58
train
jack-theripper/transcoder
src/Video.php
Video.getFrame
public function getFrame($interval) { if ( ! $interval instanceof TimeInterval) { $interval = new TimeInterval($interval); } if ($interval->getSeconds() > $this->getDuration()) { throw new \OutOfRangeException('The interval may not be a more than '.$this->getDuration()); } $frame = new Frame($this->getFilePath(), $this->getService()); $frame->addFilter(new SimpleFilter(['seek_start' => $interval->__toString()]), 99); return $frame; }
php
public function getFrame($interval) { if ( ! $interval instanceof TimeInterval) { $interval = new TimeInterval($interval); } if ($interval->getSeconds() > $this->getDuration()) { throw new \OutOfRangeException('The interval may not be a more than '.$this->getDuration()); } $frame = new Frame($this->getFilePath(), $this->getService()); $frame->addFilter(new SimpleFilter(['seek_start' => $interval->__toString()]), 99); return $frame; }
[ "public", "function", "getFrame", "(", "$", "interval", ")", "{", "if", "(", "!", "$", "interval", "instanceof", "TimeInterval", ")", "{", "$", "interval", "=", "new", "TimeInterval", "(", "$", "interval", ")", ";", "}", "if", "(", "$", "interval", "->...
Return a new Frame from by time interval. @param TimeInterval|int|float $interval @return Frame
[ "Return", "a", "new", "Frame", "from", "by", "time", "interval", "." ]
bd87db4c76ccceafa9fc271b14013ebf12e0b32e
https://github.com/jack-theripper/transcoder/blob/bd87db4c76ccceafa9fc271b14013ebf12e0b32e/src/Video.php#L134-L150
train
caffeinated/SEO
src/Handlers/Metadata.php
Metadata.setDescription
public function setDescription($description) { $description = strip_tags($description); if (strlen($description) > $this->maxDescriptionLength) { $description = substr($description, 0, $this->maxDescriptionLength); } $this->description = $description; }
php
public function setDescription($description) { $description = strip_tags($description); if (strlen($description) > $this->maxDescriptionLength) { $description = substr($description, 0, $this->maxDescriptionLength); } $this->description = $description; }
[ "public", "function", "setDescription", "(", "$", "description", ")", "{", "$", "description", "=", "strip_tags", "(", "$", "description", ")", ";", "if", "(", "strlen", "(", "$", "description", ")", ">", "$", "this", "->", "maxDescriptionLength", ")", "{"...
Set the metadata description. @param string $description @return null
[ "Set", "the", "metadata", "description", "." ]
b2b93c08d11be06631bd72a89acdd6693681fa91
https://github.com/caffeinated/SEO/blob/b2b93c08d11be06631bd72a89acdd6693681fa91/src/Handlers/Metadata.php#L73-L82
train
caffeinated/SEO
src/Handlers/Metadata.php
Metadata.set
public function set($name, $content) { $content = strip_tags($content); $this->miscellaneous[$name] = $content; }
php
public function set($name, $content) { $content = strip_tags($content); $this->miscellaneous[$name] = $content; }
[ "public", "function", "set", "(", "$", "name", ",", "$", "content", ")", "{", "$", "content", "=", "strip_tags", "(", "$", "content", ")", ";", "$", "this", "->", "miscellaneous", "[", "$", "name", "]", "=", "$", "content", ";", "}" ]
Set miscellaneous metadata. @param string $name @param string $content @return null
[ "Set", "miscellaneous", "metadata", "." ]
b2b93c08d11be06631bd72a89acdd6693681fa91
https://github.com/caffeinated/SEO/blob/b2b93c08d11be06631bd72a89acdd6693681fa91/src/Handlers/Metadata.php#L113-L118
train
caffeinated/SEO
src/Handlers/Metadata.php
Metadata.generate
public function generate() { $title = $this->getTitle(); $description = $this->getDescription(); $keywords = $this->getKeywords(); $miscellaneous = $this->getMiscellaneous(); $canonical = $this->getCanonical(); $html[] = '<title>'.$title.'</title>'.PHP_EOL; if (! is_null($description)) { $html[] = '<meta name="description" content="'.$description.'">'; } if (! is_null($keywords)) { $html[] = '<meta name="keywords" content="'.$keywords.'">'; } if (! is_null($miscellaneous)) { foreach ($miscellaneous as $name => $content) { $html[] = '<meta name="'.$name.'" content="'.$content.'">'; } } if (! is_null($canonical)) { $currentUrl = $this->request->fullUrl(); if ($canonical != $currentUrl) { $html[] = PHP_EOL.'<link rel="canonical" href="'.$canonical.'">'; } } return implode(PHP_EOL, $html); }
php
public function generate() { $title = $this->getTitle(); $description = $this->getDescription(); $keywords = $this->getKeywords(); $miscellaneous = $this->getMiscellaneous(); $canonical = $this->getCanonical(); $html[] = '<title>'.$title.'</title>'.PHP_EOL; if (! is_null($description)) { $html[] = '<meta name="description" content="'.$description.'">'; } if (! is_null($keywords)) { $html[] = '<meta name="keywords" content="'.$keywords.'">'; } if (! is_null($miscellaneous)) { foreach ($miscellaneous as $name => $content) { $html[] = '<meta name="'.$name.'" content="'.$content.'">'; } } if (! is_null($canonical)) { $currentUrl = $this->request->fullUrl(); if ($canonical != $currentUrl) { $html[] = PHP_EOL.'<link rel="canonical" href="'.$canonical.'">'; } } return implode(PHP_EOL, $html); }
[ "public", "function", "generate", "(", ")", "{", "$", "title", "=", "$", "this", "->", "getTitle", "(", ")", ";", "$", "description", "=", "$", "this", "->", "getDescription", "(", ")", ";", "$", "keywords", "=", "$", "this", "->", "getKeywords", "("...
Generate and render the HTML metadata tags. @return string
[ "Generate", "and", "render", "the", "HTML", "metadata", "tags", "." ]
b2b93c08d11be06631bd72a89acdd6693681fa91
https://github.com/caffeinated/SEO/blob/b2b93c08d11be06631bd72a89acdd6693681fa91/src/Handlers/Metadata.php#L189-L222
train
chippyash/Monad
src/chippyash/Monad/Collection.php
Collection.each
public function each(\Closure $function, array $args = []) { $content = $this->getArrayCopy(); return new static( \array_combine( \array_keys($content), \array_map( function ($value) use ($function, $args) { return $this->callFunction($function, $value, $args); }, \array_values($content) ) ) ); }
php
public function each(\Closure $function, array $args = []) { $content = $this->getArrayCopy(); return new static( \array_combine( \array_keys($content), \array_map( function ($value) use ($function, $args) { return $this->callFunction($function, $value, $args); }, \array_values($content) ) ) ); }
[ "public", "function", "each", "(", "\\", "Closure", "$", "function", ",", "array", "$", "args", "=", "[", "]", ")", "{", "$", "content", "=", "$", "this", "->", "getArrayCopy", "(", ")", ";", "return", "new", "static", "(", "\\", "array_combine", "("...
For each item in the collection apply the function and return a new collection @param callable|\Closure $function @param array $args @return Collection
[ "For", "each", "item", "in", "the", "collection", "apply", "the", "function", "and", "return", "a", "new", "collection" ]
56b0d0177880932448e41b07c1d8e4ba16f8804f
https://github.com/chippyash/Monad/blob/56b0d0177880932448e41b07c1d8e4ba16f8804f/src/chippyash/Monad/Collection.php#L104-L119
train
chippyash/Monad
src/chippyash/Monad/Collection.php
Collection.flatten
public function flatten() { $ret = []; foreach ($this as $key => $value) { $ret[$key] = Match::on($value) ->Closure(function ($v) { return $v(); }) ->Monad_Monadic(function ($v) { return $v->flatten(); }) ->any() ->flatten(); } return new static($ret); }
php
public function flatten() { $ret = []; foreach ($this as $key => $value) { $ret[$key] = Match::on($value) ->Closure(function ($v) { return $v(); }) ->Monad_Monadic(function ($v) { return $v->flatten(); }) ->any() ->flatten(); } return new static($ret); }
[ "public", "function", "flatten", "(", ")", "{", "$", "ret", "=", "[", "]", ";", "foreach", "(", "$", "this", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "ret", "[", "$", "key", "]", "=", "Match", "::", "on", "(", "$", "value", ")", ...
Return value of Monad as a base type. If value === \Closure, will evaluate the function and return it's value If value === \Monadic, will recurse @return Collection
[ "Return", "value", "of", "Monad", "as", "a", "base", "type", "." ]
56b0d0177880932448e41b07c1d8e4ba16f8804f
https://github.com/chippyash/Monad/blob/56b0d0177880932448e41b07c1d8e4ba16f8804f/src/chippyash/Monad/Collection.php#L180-L196
train
chippyash/Monad
src/chippyash/Monad/Collection.php
Collection.kDiff
public function kDiff(Collection $other, \Closure $function = null) { if (is_null($function)) { return new static(\array_diff_key($this->getArrayCopy(), $other->getArrayCopy()), $this->type); } return new static(\array_diff_ukey($this->getArrayCopy(), $other->getArrayCopy(), $function), $this->type); }
php
public function kDiff(Collection $other, \Closure $function = null) { if (is_null($function)) { return new static(\array_diff_key($this->getArrayCopy(), $other->getArrayCopy()), $this->type); } return new static(\array_diff_ukey($this->getArrayCopy(), $other->getArrayCopy(), $function), $this->type); }
[ "public", "function", "kDiff", "(", "Collection", "$", "other", ",", "\\", "Closure", "$", "function", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "function", ")", ")", "{", "return", "new", "static", "(", "\\", "array_diff_key", "(", "$", ...
Compares this collection against another collection using its keys for comparison and returns a new Collection with the values in this collection that are not present in the other collection. Note that keys are preserved If the optional comparison function is supplied it must have signature function(mixed $a, mixed $b){}. The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. @param Collection $other @param \Closure $function optional function to compare values @return Collection
[ "Compares", "this", "collection", "against", "another", "collection", "using", "its", "keys", "for", "comparison", "and", "returns", "a", "new", "Collection", "with", "the", "values", "in", "this", "collection", "that", "are", "not", "present", "in", "the", "o...
56b0d0177880932448e41b07c1d8e4ba16f8804f
https://github.com/chippyash/Monad/blob/56b0d0177880932448e41b07c1d8e4ba16f8804f/src/chippyash/Monad/Collection.php#L288-L295
train
chippyash/Monad
src/chippyash/Monad/Collection.php
Collection.vIntersect
public function vIntersect(Collection $other, \Closure $function = null) { if (is_null($function)) { return new static(\array_intersect($this->getArrayCopy(), $other->getArrayCopy()), $this->type); } return new static(\array_uintersect($this->getArrayCopy(), $other->getArrayCopy(), $function), $this->type); }
php
public function vIntersect(Collection $other, \Closure $function = null) { if (is_null($function)) { return new static(\array_intersect($this->getArrayCopy(), $other->getArrayCopy()), $this->type); } return new static(\array_uintersect($this->getArrayCopy(), $other->getArrayCopy(), $function), $this->type); }
[ "public", "function", "vIntersect", "(", "Collection", "$", "other", ",", "\\", "Closure", "$", "function", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "function", ")", ")", "{", "return", "new", "static", "(", "\\", "array_intersect", "(", ...
Returns a Collection containing all the values of this Collection that are present in the other Collection. Note that keys are preserved If the optional comparison function is supplied it must have signature function(mixed $a, mixed $b){}. The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. @param Collection $other @param callable|\Closure $function Optional function to compare values @return Collection
[ "Returns", "a", "Collection", "containing", "all", "the", "values", "of", "this", "Collection", "that", "are", "present", "in", "the", "other", "Collection", ".", "Note", "that", "keys", "are", "preserved" ]
56b0d0177880932448e41b07c1d8e4ba16f8804f
https://github.com/chippyash/Monad/blob/56b0d0177880932448e41b07c1d8e4ba16f8804f/src/chippyash/Monad/Collection.php#L324-L331
train
chippyash/Monad
src/chippyash/Monad/Collection.php
Collection.kIntersect
public function kIntersect(Collection $other, \Closure $function = null) { return new static( Match::on(Option::create($function)) ->Monad_Option_Some(function () use ($other, $function) { return \array_intersect_ukey($this->getArrayCopy(), $other->getArrayCopy(), $function); }) ->Monad_Option_None(function () use ($other) { return \array_intersect_key($this->getArrayCopy(), $other->getArrayCopy()); }) ->value(), $this->type ); }
php
public function kIntersect(Collection $other, \Closure $function = null) { return new static( Match::on(Option::create($function)) ->Monad_Option_Some(function () use ($other, $function) { return \array_intersect_ukey($this->getArrayCopy(), $other->getArrayCopy(), $function); }) ->Monad_Option_None(function () use ($other) { return \array_intersect_key($this->getArrayCopy(), $other->getArrayCopy()); }) ->value(), $this->type ); }
[ "public", "function", "kIntersect", "(", "Collection", "$", "other", ",", "\\", "Closure", "$", "function", "=", "null", ")", "{", "return", "new", "static", "(", "Match", "::", "on", "(", "Option", "::", "create", "(", "$", "function", ")", ")", "->",...
Returns a Collection containing all the values of this Collection that are present in the other Collection. Keys are used for comparison If the optional comparison function is supplied it must have signature function(mixed $a, mixed $b){}. The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. @param Collection $other @param \Closure $function Optional function to compare values @return Collection
[ "Returns", "a", "Collection", "containing", "all", "the", "values", "of", "this", "Collection", "that", "are", "present", "in", "the", "other", "Collection", ".", "Keys", "are", "used", "for", "comparison" ]
56b0d0177880932448e41b07c1d8e4ba16f8804f
https://github.com/chippyash/Monad/blob/56b0d0177880932448e41b07c1d8e4ba16f8804f/src/chippyash/Monad/Collection.php#L347-L360
train
chippyash/Monad
src/chippyash/Monad/Collection.php
Collection.vUnion
public function vUnion(Collection $other, $sortOrder = SORT_REGULAR) { return new static( \array_unique( \array_merge($this->getArrayCopy(), $other->getArrayCopy()), $sortOrder ) , $this->type ); }
php
public function vUnion(Collection $other, $sortOrder = SORT_REGULAR) { return new static( \array_unique( \array_merge($this->getArrayCopy(), $other->getArrayCopy()), $sortOrder ) , $this->type ); }
[ "public", "function", "vUnion", "(", "Collection", "$", "other", ",", "$", "sortOrder", "=", "SORT_REGULAR", ")", "{", "return", "new", "static", "(", "\\", "array_unique", "(", "\\", "array_merge", "(", "$", "this", "->", "getArrayCopy", "(", ")", ",", ...
Return a Collection that is the union of the values of this Collection and the other Collection. Note that keys may be discarded and new ones set @param Collection $other @param int $sortOrder arrayUnique sort order. one of SORT_... @return Collection
[ "Return", "a", "Collection", "that", "is", "the", "union", "of", "the", "values", "of", "this", "Collection", "and", "the", "other", "Collection", ".", "Note", "that", "keys", "may", "be", "discarded", "and", "new", "ones", "set" ]
56b0d0177880932448e41b07c1d8e4ba16f8804f
https://github.com/chippyash/Monad/blob/56b0d0177880932448e41b07c1d8e4ba16f8804f/src/chippyash/Monad/Collection.php#L371-L380
train
chippyash/Monad
src/chippyash/Monad/Collection.php
Collection.append
public function append($value) { $nValue = (is_array($value) ? $value : [$value]); return $this->vUnion(new static($nValue)); }
php
public function append($value) { $nValue = (is_array($value) ? $value : [$value]); return $this->vUnion(new static($nValue)); }
[ "public", "function", "append", "(", "$", "value", ")", "{", "$", "nValue", "=", "(", "is_array", "(", "$", "value", ")", "?", "$", "value", ":", "[", "$", "value", "]", ")", ";", "return", "$", "this", "->", "vUnion", "(", "new", "static", "(", ...
Append value and return a new collection NB this uses vUnion Value will be forced into an array if not already one @param mixed $value @return Collection
[ "Append", "value", "and", "return", "a", "new", "collection", "NB", "this", "uses", "vUnion" ]
56b0d0177880932448e41b07c1d8e4ba16f8804f
https://github.com/chippyash/Monad/blob/56b0d0177880932448e41b07c1d8e4ba16f8804f/src/chippyash/Monad/Collection.php#L426-L430
train
chippyash/Monad
src/chippyash/Monad/Collection.php
Collection.callFunction
protected function callFunction(\Closure $function, $value, array $args = []) { if ($value instanceof Monadic && !$value instanceof Collection) { return $value->bind($function, $args); } $val = ($value instanceof \Closure ? $value() : $value); array_unshift($args, $val); return call_user_func_array($function, $args); }
php
protected function callFunction(\Closure $function, $value, array $args = []) { if ($value instanceof Monadic && !$value instanceof Collection) { return $value->bind($function, $args); } $val = ($value instanceof \Closure ? $value() : $value); array_unshift($args, $val); return call_user_func_array($function, $args); }
[ "protected", "function", "callFunction", "(", "\\", "Closure", "$", "function", ",", "$", "value", ",", "array", "$", "args", "=", "[", "]", ")", "{", "if", "(", "$", "value", "instanceof", "Monadic", "&&", "!", "$", "value", "instanceof", "Collection", ...
Call function on value @param \Closure $function @param mixed $value @param array $args additional arguments to pass to function @return Monadic
[ "Call", "function", "on", "value" ]
56b0d0177880932448e41b07c1d8e4ba16f8804f
https://github.com/chippyash/Monad/blob/56b0d0177880932448e41b07c1d8e4ba16f8804f/src/chippyash/Monad/Collection.php#L560-L570
train
mjarestad/Filtry
src/Mjarestad/Filtry/Http/Requests/Request.php
Request.sanitize
public function sanitize() { if (method_exists($this, 'filters')) { $filtry = \Filtry::make($this->all(), $this->filters()); $this->merge($filtry->getFiltered()); } }
php
public function sanitize() { if (method_exists($this, 'filters')) { $filtry = \Filtry::make($this->all(), $this->filters()); $this->merge($filtry->getFiltered()); } }
[ "public", "function", "sanitize", "(", ")", "{", "if", "(", "method_exists", "(", "$", "this", ",", "'filters'", ")", ")", "{", "$", "filtry", "=", "\\", "Filtry", "::", "make", "(", "$", "this", "->", "all", "(", ")", ",", "$", "this", "->", "fi...
Add filters from the filters method if it exists.
[ "Add", "filters", "from", "the", "filters", "method", "if", "it", "exists", "." ]
fcf701090b79dfb7f1736928915082190539a658
https://github.com/mjarestad/Filtry/blob/fcf701090b79dfb7f1736928915082190539a658/src/Mjarestad/Filtry/Http/Requests/Request.php#L10-L16
train
monarkee/bumble
Models/BumbleModel.php
BumbleModel.bootTraits
protected static function bootTraits() { $segment = Request::segment(1); if ($segment == config('bumble.admin_prefix') && self::enableTraits() == true) { parent::bootTraits(); } elseif ($segment !== config('bumble.admin_prefix')) { parent::bootTraits(); } // Boot soft-delete trait all the time if (method_exists(get_called_class(), $method = 'bootSoftDeletes')) { forward_static_call([get_called_class(), $method]); } }
php
protected static function bootTraits() { $segment = Request::segment(1); if ($segment == config('bumble.admin_prefix') && self::enableTraits() == true) { parent::bootTraits(); } elseif ($segment !== config('bumble.admin_prefix')) { parent::bootTraits(); } // Boot soft-delete trait all the time if (method_exists(get_called_class(), $method = 'bootSoftDeletes')) { forward_static_call([get_called_class(), $method]); } }
[ "protected", "static", "function", "bootTraits", "(", ")", "{", "$", "segment", "=", "Request", "::", "segment", "(", "1", ")", ";", "if", "(", "$", "segment", "==", "config", "(", "'bumble.admin_prefix'", ")", "&&", "self", "::", "enableTraits", "(", ")...
If not in the admin, boot the traits of the model @return void
[ "If", "not", "in", "the", "admin", "boot", "the", "traits", "of", "the", "model" ]
6e140e341980d6f9467418594eed48c3859c00f7
https://github.com/monarkee/bumble/blob/6e140e341980d6f9467418594eed48c3859c00f7/Models/BumbleModel.php#L21-L39
train
monarkee/bumble
Models/BumbleModel.php
BumbleModel.hasFieldTypes
public function hasFieldTypes($type) { foreach ($this->getFields() as $component) { if ($component->isFieldType($type)) return true; } }
php
public function hasFieldTypes($type) { foreach ($this->getFields() as $component) { if ($component->isFieldType($type)) return true; } }
[ "public", "function", "hasFieldTypes", "(", "$", "type", ")", "{", "foreach", "(", "$", "this", "->", "getFields", "(", ")", "as", "$", "component", ")", "{", "if", "(", "$", "component", "->", "isFieldType", "(", "$", "type", ")", ")", "return", "tr...
Check for arbitrary Field Types on the model @param $type @return bool
[ "Check", "for", "arbitrary", "Field", "Types", "on", "the", "model" ]
6e140e341980d6f9467418594eed48c3859c00f7
https://github.com/monarkee/bumble/blob/6e140e341980d6f9467418594eed48c3859c00f7/Models/BumbleModel.php#L293-L299
train
monarkee/bumble
Models/BumbleModel.php
BumbleModel.editingTitle
public function editingTitle() { $editingTitle = $this->admin()->editingTitle; // Check for the custom option first and // return it if it exists if ($this->columnExists($editingTitle)) return $this->{$editingTitle}; // As a last-ditch effort, see if there's a title option // we can use so the user doesn't have to ask for it if ($this->columnExists('title')) return $this->title; return; }
php
public function editingTitle() { $editingTitle = $this->admin()->editingTitle; // Check for the custom option first and // return it if it exists if ($this->columnExists($editingTitle)) return $this->{$editingTitle}; // As a last-ditch effort, see if there's a title option // we can use so the user doesn't have to ask for it if ($this->columnExists('title')) return $this->title; return; }
[ "public", "function", "editingTitle", "(", ")", "{", "$", "editingTitle", "=", "$", "this", "->", "admin", "(", ")", "->", "editingTitle", ";", "// Check for the custom option first and", "// return it if it exists", "if", "(", "$", "this", "->", "columnExists", "...
Get the editing title for the model @return mixed
[ "Get", "the", "editing", "title", "for", "the", "model" ]
6e140e341980d6f9467418594eed48c3859c00f7
https://github.com/monarkee/bumble/blob/6e140e341980d6f9467418594eed48c3859c00f7/Models/BumbleModel.php#L328-L341
train
cawaphp/cawa
src/Intl/Translator.php
Translator.initLocale
private function initLocale() { $this->locale = $this->detectLocale(); // datetime format if (!setlocale(LC_TIME, $this->locales[$this->locale])) { throw new \Exception(sprintf("Unable to set locale to '%s'", $this->locales[$this->locale])); } // punic default value Data::setDefaultLocale($this->getIETF()); if ('cli' !== PHP_SAPI) { if (!self::request()->getCookie(self::COOKIE_LANGUAGE)) { self::response()->addCookie(new Cookie(self::COOKIE_LANGUAGE, $this->locale, 60 * 60 * 24 * 365)); } } }
php
private function initLocale() { $this->locale = $this->detectLocale(); // datetime format if (!setlocale(LC_TIME, $this->locales[$this->locale])) { throw new \Exception(sprintf("Unable to set locale to '%s'", $this->locales[$this->locale])); } // punic default value Data::setDefaultLocale($this->getIETF()); if ('cli' !== PHP_SAPI) { if (!self::request()->getCookie(self::COOKIE_LANGUAGE)) { self::response()->addCookie(new Cookie(self::COOKIE_LANGUAGE, $this->locale, 60 * 60 * 24 * 365)); } } }
[ "private", "function", "initLocale", "(", ")", "{", "$", "this", "->", "locale", "=", "$", "this", "->", "detectLocale", "(", ")", ";", "// datetime format", "if", "(", "!", "setlocale", "(", "LC_TIME", ",", "$", "this", "->", "locales", "[", "$", "thi...
detect locale & set cookie if neccesary. @throws \Exception
[ "detect", "locale", "&", "set", "cookie", "if", "neccesary", "." ]
bd250532200121e7aa1da44e547c04c4c148fb37
https://github.com/cawaphp/cawa/blob/bd250532200121e7aa1da44e547c04c4c148fb37/src/Intl/Translator.php#L119-L136
train
rymanalu/laravel-circuit-breaker
src/CircuitBreaker.php
CircuitBreaker.tooManyFailures
public function tooManyFailures($key, $maxFailures, $decayMinutes = 1) { if ($this->cache->has($key.':breakout')) { return true; } if ($this->failures($key) > $maxFailures) { $this->cache->add($key.':breakout', Carbon::now()->getTimestamp() + ($decayMinutes * 60), $decayMinutes); $this->resetFailures($key); return true; } return false; }
php
public function tooManyFailures($key, $maxFailures, $decayMinutes = 1) { if ($this->cache->has($key.':breakout')) { return true; } if ($this->failures($key) > $maxFailures) { $this->cache->add($key.':breakout', Carbon::now()->getTimestamp() + ($decayMinutes * 60), $decayMinutes); $this->resetFailures($key); return true; } return false; }
[ "public", "function", "tooManyFailures", "(", "$", "key", ",", "$", "maxFailures", ",", "$", "decayMinutes", "=", "1", ")", "{", "if", "(", "$", "this", "->", "cache", "->", "has", "(", "$", "key", ".", "':breakout'", ")", ")", "{", "return", "true",...
Determine if the given key has too many failures. @param string $key @param int $maxFailures @param int $decayMinutes @return bool
[ "Determine", "if", "the", "given", "key", "has", "too", "many", "failures", "." ]
cea249e048eb0276c8a54fe3c81db830328298fe
https://github.com/rymanalu/laravel-circuit-breaker/blob/cea249e048eb0276c8a54fe3c81db830328298fe/src/CircuitBreaker.php#L72-L87
train
chippyash/Builder-Pattern
examples/Builder/PurchaseCollectionBuilder.php
PurchaseCollectionBuilder.setModifier
public function setModifier(EventManagerAwareInterface $modifier) { parent::setModifier($modifier); $this->modifier->getEventManager()->attach(ModifiableInterface::PHASE_PRE_BUILD, [$this,'preBuildListener']); }
php
public function setModifier(EventManagerAwareInterface $modifier) { parent::setModifier($modifier); $this->modifier->getEventManager()->attach(ModifiableInterface::PHASE_PRE_BUILD, [$this,'preBuildListener']); }
[ "public", "function", "setModifier", "(", "EventManagerAwareInterface", "$", "modifier", ")", "{", "parent", "::", "setModifier", "(", "$", "modifier", ")", ";", "$", "this", "->", "modifier", "->", "getEventManager", "(", ")", "->", "attach", "(", "Modifiable...
Extend setModifier to add our listeners @param EventManagerAwareInterface $modifier
[ "Extend", "setModifier", "to", "add", "our", "listeners" ]
00be4830438542abe494ac9be0bbd27723a0c984
https://github.com/chippyash/Builder-Pattern/blob/00be4830438542abe494ac9be0bbd27723a0c984/examples/Builder/PurchaseCollectionBuilder.php#L28-L32
train
monarkee/bumble
Fields/PasswordField.php
PasswordField.process
public function process($model, $input) { $column = $this->getColumn(); // If the column is empty then it means they don't require it // and so we can just return the model unchanged. if (empty($input[$column])) return $model; // Use our built-in hashing using Laravel's Hasher if ($this->getHashOption()) { $model->{$column} = $this->hasher->make($input[$column]); return $model; } // The user hasn't disabled hashing or is using their own mutator // so just save the value to the model and return it $model->{$column} = $input[$column]; return $model; }
php
public function process($model, $input) { $column = $this->getColumn(); // If the column is empty then it means they don't require it // and so we can just return the model unchanged. if (empty($input[$column])) return $model; // Use our built-in hashing using Laravel's Hasher if ($this->getHashOption()) { $model->{$column} = $this->hasher->make($input[$column]); return $model; } // The user hasn't disabled hashing or is using their own mutator // so just save the value to the model and return it $model->{$column} = $input[$column]; return $model; }
[ "public", "function", "process", "(", "$", "model", ",", "$", "input", ")", "{", "$", "column", "=", "$", "this", "->", "getColumn", "(", ")", ";", "// If the column is empty then it means they don't require it", "// and so we can just return the model unchanged.", "if"...
Process the password input and hash unless otherwise specified @param $model @param $input @return mixed
[ "Process", "the", "password", "input", "and", "hash", "unless", "otherwise", "specified" ]
6e140e341980d6f9467418594eed48c3859c00f7
https://github.com/monarkee/bumble/blob/6e140e341980d6f9467418594eed48c3859c00f7/Fields/PasswordField.php#L51-L71
train
axypro/sourcemap
helpers/MapBuilder.php
MapBuilder.build
public static function build($pointer) { if (is_string($pointer)) { return SourceMap::loadFromFile($pointer); } if (is_array($pointer)) { return new SourceMap($pointer); } if ($pointer instanceof SourceMap) { return $pointer; } throw new \InvalidArgumentException('Argument must be a SourceMap or a data array or a file name'); }
php
public static function build($pointer) { if (is_string($pointer)) { return SourceMap::loadFromFile($pointer); } if (is_array($pointer)) { return new SourceMap($pointer); } if ($pointer instanceof SourceMap) { return $pointer; } throw new \InvalidArgumentException('Argument must be a SourceMap or a data array or a file name'); }
[ "public", "static", "function", "build", "(", "$", "pointer", ")", "{", "if", "(", "is_string", "(", "$", "pointer", ")", ")", "{", "return", "SourceMap", "::", "loadFromFile", "(", "$", "pointer", ")", ";", "}", "if", "(", "is_array", "(", "$", "poi...
Builds a source map instance @param \axy\sourcemap\SourceMap|array|string $pointer a source map, an array of data or a file name @return \axy\sourcemap\SourceMap @throws \axy\sourcemap\errors\IOError @throws \axy\sourcemap\errors\InvalidFormat @throws \InvalidArgumentException
[ "Builds", "a", "source", "map", "instance" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/helpers/MapBuilder.php#L26-L38
train
mailmotor/mailchimp-bundle
Gateway/MailChimpSubscriberGateway.php
MailChimpSubscriberGateway.get
private function get(string $email, string $listId): array { try { /** @var Collection $result */ $result = $this->api->request( 'lists/' . $listId . '/members/' . $this->getHashedEmail($email), array(), 'get' ); // will return the one and only member array('id', ...) from Collection return $result->all(); } catch (\Exception $e) { return []; } }
php
private function get(string $email, string $listId): array { try { /** @var Collection $result */ $result = $this->api->request( 'lists/' . $listId . '/members/' . $this->getHashedEmail($email), array(), 'get' ); // will return the one and only member array('id', ...) from Collection return $result->all(); } catch (\Exception $e) { return []; } }
[ "private", "function", "get", "(", "string", "$", "email", ",", "string", "$", "listId", ")", ":", "array", "{", "try", "{", "/** @var Collection $result */", "$", "result", "=", "$", "this", "->", "api", "->", "request", "(", "'lists/'", ".", "$", "list...
Get a subscriber @param string $email @param string $listId @return array
[ "Get", "a", "subscriber" ]
97e5b409000cc60ea3e9e985b786b36ae0dc3175
https://github.com/mailmotor/mailchimp-bundle/blob/97e5b409000cc60ea3e9e985b786b36ae0dc3175/Gateway/MailChimpSubscriberGateway.php#L51-L66
train
youngguns-nl/moneybird_php_api
HttpClient/Oauth.php
Oauth.setConsumerAndToken
public function setConsumerAndToken(OAuthConsumer $consumer, OAuthConsumer $token) { $this->consumer = $consumer; $this->token = $token; return $this; }
php
public function setConsumerAndToken(OAuthConsumer $consumer, OAuthConsumer $token) { $this->consumer = $consumer; $this->token = $token; return $this; }
[ "public", "function", "setConsumerAndToken", "(", "OAuthConsumer", "$", "consumer", ",", "OAuthConsumer", "$", "token", ")", "{", "$", "this", "->", "consumer", "=", "$", "consumer", ";", "$", "this", "->", "token", "=", "$", "token", ";", "return", "$", ...
Set Consumer and Token @param Lib\OAuthConsumer $consumer @param Lib\OAuthConsumer $token @return HttpClient_Oauth
[ "Set", "Consumer", "and", "Token" ]
bb5035dd60cf087c7a055458d207be418355ab74
https://github.com/youngguns-nl/moneybird_php_api/blob/bb5035dd60cf087c7a055458d207be418355ab74/HttpClient/Oauth.php#L44-L49
train
axypro/sourcemap
parsing/Line.php
Line.loadFromPlainList
public static function loadFromPlainList($num, array $positions) { $rPositions = []; foreach ($positions as $pos) { $rPositions[$pos->generated->column] = $pos; } return new self($num, $rPositions); }
php
public static function loadFromPlainList($num, array $positions) { $rPositions = []; foreach ($positions as $pos) { $rPositions[$pos->generated->column] = $pos; } return new self($num, $rPositions); }
[ "public", "static", "function", "loadFromPlainList", "(", "$", "num", ",", "array", "$", "positions", ")", "{", "$", "rPositions", "=", "[", "]", ";", "foreach", "(", "$", "positions", "as", "$", "pos", ")", "{", "$", "rPositions", "[", "$", "pos", "...
Loads the positions list from a numeric array @param int $num @param \axy\sourcemap\PosMap[] $positions @return \axy\sourcemap\parsing\Line
[ "Loads", "the", "positions", "list", "from", "a", "numeric", "array" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/parsing/Line.php#L38-L45
train
axypro/sourcemap
parsing/Line.php
Line.loadFromMappings
public static function loadFromMappings($num, $lMappings, SegmentParser $parser, Context $context) { $positions = []; $names = $context->names; $files = $context->sources; $parser->nextLine($num); foreach (explode(',', $lMappings) as $segment) { $pos = $parser->parse($segment); $positions[$pos->generated->column] = $pos; $source = $pos->source; $fi = $source->fileIndex; if ($fi !== null) { if (isset($files[$fi])) { $source->fileName = $files[$fi]; } else { $message = 'Invalid segment "'.$segment.'" (source offset '.$fi.')'; throw new InvalidMappings($message); } $ni = $source->nameIndex; if ($ni !== null) { if (isset($names[$ni])) { $source->name = $names[$ni]; } else { $message = 'Invalid segment "'.$segment.'" (name offset '.$ni.')'; throw new InvalidMappings($message); } } } } return new self($num, $positions); }
php
public static function loadFromMappings($num, $lMappings, SegmentParser $parser, Context $context) { $positions = []; $names = $context->names; $files = $context->sources; $parser->nextLine($num); foreach (explode(',', $lMappings) as $segment) { $pos = $parser->parse($segment); $positions[$pos->generated->column] = $pos; $source = $pos->source; $fi = $source->fileIndex; if ($fi !== null) { if (isset($files[$fi])) { $source->fileName = $files[$fi]; } else { $message = 'Invalid segment "'.$segment.'" (source offset '.$fi.')'; throw new InvalidMappings($message); } $ni = $source->nameIndex; if ($ni !== null) { if (isset($names[$ni])) { $source->name = $names[$ni]; } else { $message = 'Invalid segment "'.$segment.'" (name offset '.$ni.')'; throw new InvalidMappings($message); } } } } return new self($num, $positions); }
[ "public", "static", "function", "loadFromMappings", "(", "$", "num", ",", "$", "lMappings", ",", "SegmentParser", "$", "parser", ",", "Context", "$", "context", ")", "{", "$", "positions", "=", "[", "]", ";", "$", "names", "=", "$", "context", "->", "n...
Loads the positions list from a mappings line @param int $num @param string $lMappings @param \axy\sourcemap\parsing\SegmentParser $parser @param \axy\sourcemap\parsing\Context $context @return \axy\sourcemap\parsing\Line @throws \axy\sourcemap\errors\InvalidMappings
[ "Loads", "the", "positions", "list", "from", "a", "mappings", "line" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/parsing/Line.php#L57-L87
train
axypro/sourcemap
parsing/Line.php
Line.pack
public function pack(SegmentParser $parser) { ksort($this->positions); $segments = []; foreach ($this->positions as $pos) { $segments[] = $parser->pack($pos); } return implode(',', $segments); }
php
public function pack(SegmentParser $parser) { ksort($this->positions); $segments = []; foreach ($this->positions as $pos) { $segments[] = $parser->pack($pos); } return implode(',', $segments); }
[ "public", "function", "pack", "(", "SegmentParser", "$", "parser", ")", "{", "ksort", "(", "$", "this", "->", "positions", ")", ";", "$", "segments", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "positions", "as", "$", "pos", ")", "{", "$...
Packs the line to the mappings @param \axy\sourcemap\parsing\SegmentParser $parser @return string
[ "Packs", "the", "line", "to", "the", "mappings" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/parsing/Line.php#L115-L123
train
axypro/sourcemap
parsing/Line.php
Line.breakLine
public function breakLine($sColumn, $length, $newNum) { $newPositions = []; foreach ($this->positions as $column => $position) { if ($column >= $sColumn) { $newColumn = $column + $length; $position->generated->line = $newNum; $position->generated->column = $newColumn; $newPositions[$newColumn] = $position; unset($this->positions[$column]); } } if (empty($newPositions)) { return null; } return new self($newNum, $newPositions); }
php
public function breakLine($sColumn, $length, $newNum) { $newPositions = []; foreach ($this->positions as $column => $position) { if ($column >= $sColumn) { $newColumn = $column + $length; $position->generated->line = $newNum; $position->generated->column = $newColumn; $newPositions[$newColumn] = $position; unset($this->positions[$column]); } } if (empty($newPositions)) { return null; } return new self($newNum, $newPositions); }
[ "public", "function", "breakLine", "(", "$", "sColumn", ",", "$", "length", ",", "$", "newNum", ")", "{", "$", "newPositions", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "positions", "as", "$", "column", "=>", "$", "position", ")", "{", ...
Breaks the line on a column @param int $sColumn @param int $length @param int $newNum @return \axy\sourcemap\parsing\Line
[ "Breaks", "the", "line", "on", "a", "column" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/parsing/Line.php#L344-L360
train
axypro/sourcemap
parsing/Line.php
Line.removeBlockBegin
public function removeBlockBegin($eColumn) { $shifts = []; foreach ($this->positions as $column => $position) { if ($column >= $eColumn) { $newColumn = $column - $eColumn; $position->generated->column = $newColumn; $shifts[$newColumn] = $position; } unset($this->positions[$column]); } if (!empty($shifts)) { $this->positions = array_replace($this->positions, $shifts); } }
php
public function removeBlockBegin($eColumn) { $shifts = []; foreach ($this->positions as $column => $position) { if ($column >= $eColumn) { $newColumn = $column - $eColumn; $position->generated->column = $newColumn; $shifts[$newColumn] = $position; } unset($this->positions[$column]); } if (!empty($shifts)) { $this->positions = array_replace($this->positions, $shifts); } }
[ "public", "function", "removeBlockBegin", "(", "$", "eColumn", ")", "{", "$", "shifts", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "positions", "as", "$", "column", "=>", "$", "position", ")", "{", "if", "(", "$", "column", ">=", "$", "...
Removes a block from the begin of the line @param int $eColumn
[ "Removes", "a", "block", "from", "the", "begin", "of", "the", "line" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/parsing/Line.php#L392-L406
train
axypro/sourcemap
parsing/Line.php
Line.setNum
public function setNum($num) { $this->num = $num; foreach ($this->positions as $position) { $position->generated->line = $num; } }
php
public function setNum($num) { $this->num = $num; foreach ($this->positions as $position) { $position->generated->line = $num; } }
[ "public", "function", "setNum", "(", "$", "num", ")", "{", "$", "this", "->", "num", "=", "$", "num", ";", "foreach", "(", "$", "this", "->", "positions", "as", "$", "position", ")", "{", "$", "position", "->", "generated", "->", "line", "=", "$", ...
Sets num of the line @param int $num
[ "Sets", "num", "of", "the", "line" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/parsing/Line.php#L433-L439
train
praxisnetau/silverstripe-moderno-admin
code/extensions/ModernoAdminExtension.php
ModernoAdminExtension.init
public function init() { if (class_exists("SiteConfig") && $SiteConfig = SiteConfig::current_site_config()) { // Load Moderno Custom CSS: Requirements::customCSS($SiteConfig->renderWith('ModernoAdminCustomCSS')); // Customise Application Name: if ($application_name = $SiteConfig->ModernoApplicationName) { Config::inst()->update( 'LeftAndMain', 'application_name', $application_name ); } // Customise Application Link: if ($application_link = $SiteConfig->ModernoApplicationLink) { Config::inst()->update( 'LeftAndMain', 'application_link', $SiteConfig->dbObject('ModernoApplicationLink')->URL() ); } } }
php
public function init() { if (class_exists("SiteConfig") && $SiteConfig = SiteConfig::current_site_config()) { // Load Moderno Custom CSS: Requirements::customCSS($SiteConfig->renderWith('ModernoAdminCustomCSS')); // Customise Application Name: if ($application_name = $SiteConfig->ModernoApplicationName) { Config::inst()->update( 'LeftAndMain', 'application_name', $application_name ); } // Customise Application Link: if ($application_link = $SiteConfig->ModernoApplicationLink) { Config::inst()->update( 'LeftAndMain', 'application_link', $SiteConfig->dbObject('ModernoApplicationLink')->URL() ); } } }
[ "public", "function", "init", "(", ")", "{", "if", "(", "class_exists", "(", "\"SiteConfig\"", ")", "&&", "$", "SiteConfig", "=", "SiteConfig", "::", "current_site_config", "(", ")", ")", "{", "// Load Moderno Custom CSS:", "Requirements", "::", "customCSS", "("...
Initialises the extension by generating custom CSS for the CMS interface.
[ "Initialises", "the", "extension", "by", "generating", "custom", "CSS", "for", "the", "CMS", "interface", "." ]
8e09b43ca84eea6d3d556fe0f459860c2a397703
https://github.com/praxisnetau/silverstripe-moderno-admin/blob/8e09b43ca84eea6d3d556fe0f459860c2a397703/code/extensions/ModernoAdminExtension.php#L11-L44
train
mmanos/laravel-api
src/Mmanos/Api/Authentication/Client.php
Client.scopes
public function scopes() { if (isset($this->scopes)) { return $this->scopes; } return $this->scopes = DB::table('oauth_client_scopes') ->select('scope_id') ->where('client_id', $this->id) ->lists('scope_id'); }
php
public function scopes() { if (isset($this->scopes)) { return $this->scopes; } return $this->scopes = DB::table('oauth_client_scopes') ->select('scope_id') ->where('client_id', $this->id) ->lists('scope_id'); }
[ "public", "function", "scopes", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "scopes", ")", ")", "{", "return", "$", "this", "->", "scopes", ";", "}", "return", "$", "this", "->", "scopes", "=", "DB", "::", "table", "(", "'oauth_clien...
Return the allowed scopes for this client. @return array
[ "Return", "the", "allowed", "scopes", "for", "this", "client", "." ]
8fac248d91c797f4a8f960e7cd7466df5a814975
https://github.com/mmanos/laravel-api/blob/8fac248d91c797f4a8f960e7cd7466df5a814975/src/Mmanos/Api/Authentication/Client.php#L32-L42
train
mmanos/laravel-api
src/Mmanos/Api/Authentication/Client.php
Client.endpoints
public function endpoints() { if (isset($this->endpoints)) { return $this->endpoints; } return $this->endpoints = DB::table('oauth_client_endpoints') ->select('redirect_uri') ->where('client_id', $this->id) ->lists('redirect_uri'); }
php
public function endpoints() { if (isset($this->endpoints)) { return $this->endpoints; } return $this->endpoints = DB::table('oauth_client_endpoints') ->select('redirect_uri') ->where('client_id', $this->id) ->lists('redirect_uri'); }
[ "public", "function", "endpoints", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "endpoints", ")", ")", "{", "return", "$", "this", "->", "endpoints", ";", "}", "return", "$", "this", "->", "endpoints", "=", "DB", "::", "table", "(", "...
Return the allowed endpoints for this client. @return array
[ "Return", "the", "allowed", "endpoints", "for", "this", "client", "." ]
8fac248d91c797f4a8f960e7cd7466df5a814975
https://github.com/mmanos/laravel-api/blob/8fac248d91c797f4a8f960e7cd7466df5a814975/src/Mmanos/Api/Authentication/Client.php#L49-L59
train
mmanos/laravel-api
src/Mmanos/Api/Authentication/Client.php
Client.grants
public function grants() { if (isset($this->grants)) { return $this->grants; } return $this->grants = DB::table('oauth_client_grants') ->select('grant_id') ->where('client_id', $this->id) ->lists('grant_id'); }
php
public function grants() { if (isset($this->grants)) { return $this->grants; } return $this->grants = DB::table('oauth_client_grants') ->select('grant_id') ->where('client_id', $this->id) ->lists('grant_id'); }
[ "public", "function", "grants", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "grants", ")", ")", "{", "return", "$", "this", "->", "grants", ";", "}", "return", "$", "this", "->", "grants", "=", "DB", "::", "table", "(", "'oauth_clien...
Return the allowed grants for this client. @return array
[ "Return", "the", "allowed", "grants", "for", "this", "client", "." ]
8fac248d91c797f4a8f960e7cd7466df5a814975
https://github.com/mmanos/laravel-api/blob/8fac248d91c797f4a8f960e7cd7466df5a814975/src/Mmanos/Api/Authentication/Client.php#L66-L76
train
jack-theripper/transcoder
src/Filter/Volume.php
Volume.setPrecision
public function setPrecision($precision) { $available = [self::PRECISION_FIXED, self::PRECISION_DOUBLE, self::PRECISION_FLOAT]; if ( ! is_scalar($precision) || ! in_array($precision, $available, false)) { throw new \InvalidArgumentException(sprintf('Wrong precision value for %s, available values are %s', (string) $precision, implode(', ', $available))); } $this->precision = (string) $precision; return $this; }
php
public function setPrecision($precision) { $available = [self::PRECISION_FIXED, self::PRECISION_DOUBLE, self::PRECISION_FLOAT]; if ( ! is_scalar($precision) || ! in_array($precision, $available, false)) { throw new \InvalidArgumentException(sprintf('Wrong precision value for %s, available values are %s', (string) $precision, implode(', ', $available))); } $this->precision = (string) $precision; return $this; }
[ "public", "function", "setPrecision", "(", "$", "precision", ")", "{", "$", "available", "=", "[", "self", "::", "PRECISION_FIXED", ",", "self", "::", "PRECISION_DOUBLE", ",", "self", "::", "PRECISION_FLOAT", "]", ";", "if", "(", "!", "is_scalar", "(", "$"...
Set the precision value. @param string $precision @return Volume @throws \InvalidArgumentException
[ "Set", "the", "precision", "value", "." ]
bd87db4c76ccceafa9fc271b14013ebf12e0b32e
https://github.com/jack-theripper/transcoder/blob/bd87db4c76ccceafa9fc271b14013ebf12e0b32e/src/Filter/Volume.php#L184-L197
train
jack-theripper/transcoder
src/Filter/Volume.php
Volume.setReplayGain
public function setReplayGain($replayGain) { $values = [self::REPLAY_GAIN_DROP, self::REPLAY_GAIN_IGNORE, self::REPLAY_GAIN_TRACK, self::REPLAY_GAIN_ALBUM]; if ( ! is_scalar($replayGain) || ! in_array($replayGain, $values, false)) { throw new \InvalidArgumentException(sprintf('Wrong replayGain value for %s, available values are %s', (string) $replayGain, implode(', ', $values))); } $this->replayGain = (string) $replayGain; return $this; }
php
public function setReplayGain($replayGain) { $values = [self::REPLAY_GAIN_DROP, self::REPLAY_GAIN_IGNORE, self::REPLAY_GAIN_TRACK, self::REPLAY_GAIN_ALBUM]; if ( ! is_scalar($replayGain) || ! in_array($replayGain, $values, false)) { throw new \InvalidArgumentException(sprintf('Wrong replayGain value for %s, available values are %s', (string) $replayGain, implode(', ', $values))); } $this->replayGain = (string) $replayGain; return $this; }
[ "public", "function", "setReplayGain", "(", "$", "replayGain", ")", "{", "$", "values", "=", "[", "self", "::", "REPLAY_GAIN_DROP", ",", "self", "::", "REPLAY_GAIN_IGNORE", ",", "self", "::", "REPLAY_GAIN_TRACK", ",", "self", "::", "REPLAY_GAIN_ALBUM", "]", ";...
Set the replay gain value. @param string $replayGain @return Volume @throws \InvalidArgumentException
[ "Set", "the", "replay", "gain", "value", "." ]
bd87db4c76ccceafa9fc271b14013ebf12e0b32e
https://github.com/jack-theripper/transcoder/blob/bd87db4c76ccceafa9fc271b14013ebf12e0b32e/src/Filter/Volume.php#L217-L230
train
jack-theripper/transcoder
src/Filter/Volume.php
Volume.setEval
public function setEval($eval) { $available = [self::EVAL_ONCE, self::EVAL_FRAME]; if ( ! is_scalar($eval) || ! in_array($eval, $available, false)) { throw new \InvalidArgumentException(sprintf('Wrong eval value for %s, available values are %s', (string) $eval, implode(', ', $available))); } $this->eval = (string) $eval; return $this; }
php
public function setEval($eval) { $available = [self::EVAL_ONCE, self::EVAL_FRAME]; if ( ! is_scalar($eval) || ! in_array($eval, $available, false)) { throw new \InvalidArgumentException(sprintf('Wrong eval value for %s, available values are %s', (string) $eval, implode(', ', $available))); } $this->eval = (string) $eval; return $this; }
[ "public", "function", "setEval", "(", "$", "eval", ")", "{", "$", "available", "=", "[", "self", "::", "EVAL_ONCE", ",", "self", "::", "EVAL_FRAME", "]", ";", "if", "(", "!", "is_scalar", "(", "$", "eval", ")", "||", "!", "in_array", "(", "$", "eva...
Set the eval value. @param string $eval @return Volume @throws \InvalidArgumentException
[ "Set", "the", "eval", "value", "." ]
bd87db4c76ccceafa9fc271b14013ebf12e0b32e
https://github.com/jack-theripper/transcoder/blob/bd87db4c76ccceafa9fc271b14013ebf12e0b32e/src/Filter/Volume.php#L280-L293
train
nineinchnick/yii2-usr
models/ExampleUserRemoteIdentity.php
ExampleUserRemoteIdentity.isUnique
public function isUnique($attribute, $params) { return null === self::find([ 'user_id' => $this->user_id, 'provider' => $this->provider, 'identifier' => $this->identifier, ]); }
php
public function isUnique($attribute, $params) { return null === self::find([ 'user_id' => $this->user_id, 'provider' => $this->provider, 'identifier' => $this->identifier, ]); }
[ "public", "function", "isUnique", "(", "$", "attribute", ",", "$", "params", ")", "{", "return", "null", "===", "self", "::", "find", "(", "[", "'user_id'", "=>", "$", "this", "->", "user_id", ",", "'provider'", "=>", "$", "this", "->", "provider", ","...
An inline validator that checkes if there are no existing records with same provider and identifier for specified user. @param string $attribute @param array $params @return boolean
[ "An", "inline", "validator", "that", "checkes", "if", "there", "are", "no", "existing", "records", "with", "same", "provider", "and", "identifier", "for", "specified", "user", "." ]
d51fbe95eeba0068cc4543efa3bca7baa30ed5e6
https://github.com/nineinchnick/yii2-usr/blob/d51fbe95eeba0068cc4543efa3bca7baa30ed5e6/models/ExampleUserRemoteIdentity.php#L50-L57
train
mmanos/laravel-api
src/Mmanos/Api/Cors.php
Cors.attachHeaders
public static function attachHeaders($response) { $response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); $response->headers->set('Access-Control-Allow-Headers', config('api.cors_allowed_headers', 'Origin, Content-Type, Accept, Authorization, X-Requested-With')); $response->headers->set('Access-Control-Allow-Credentials', 'true'); if ($exposed = config('api.cors_exposed_headers', 'Pagination-Page, Pagination-Num, Pagination-Total, Pagination-Last-Page')) { $response->headers->set('Access-Control-Expose-Headers', $exposed); } }
php
public static function attachHeaders($response) { $response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); $response->headers->set('Access-Control-Allow-Headers', config('api.cors_allowed_headers', 'Origin, Content-Type, Accept, Authorization, X-Requested-With')); $response->headers->set('Access-Control-Allow-Credentials', 'true'); if ($exposed = config('api.cors_exposed_headers', 'Pagination-Page, Pagination-Num, Pagination-Total, Pagination-Last-Page')) { $response->headers->set('Access-Control-Expose-Headers', $exposed); } }
[ "public", "static", "function", "attachHeaders", "(", "$", "response", ")", "{", "$", "response", "->", "headers", "->", "set", "(", "'Access-Control-Allow-Methods'", ",", "'GET, POST, PUT, DELETE, OPTIONS'", ")", ";", "$", "response", "->", "headers", "->", "set"...
Attach CORS headers to the given response. @param Response $response @return void
[ "Attach", "CORS", "headers", "to", "the", "given", "response", "." ]
8fac248d91c797f4a8f960e7cd7466df5a814975
https://github.com/mmanos/laravel-api/blob/8fac248d91c797f4a8f960e7cd7466df5a814975/src/Mmanos/Api/Cors.php#L18-L27
train
mmanos/laravel-api
src/Mmanos/Api/Cors.php
Cors.attachOriginHeader
public static function attachOriginHeader($response, $origin) { if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { $response->headers->set('Access-Control-Allow-Origin', $origin); return true; } if ('*' == config('api.cors_allowed_origin', 'client')) { $response->headers->set('Access-Control-Allow-Origin', '*'); return true; } if ('client' == config('api.cors_allowed_origin', 'client')) { $client = Authentication::instance()->client(); if (empty($client) || empty($client->endpoints())) { return false; } foreach ($client->endpoints() as $endpoint) { $parts = parse_url($endpoint); if (empty($parts['scheme']) || empty($parts['host'])) { continue; } $port = ''; if (array_get($parts, 'port')) { $port = ':' . array_get($parts, 'port'); } $url = $parts['scheme'] . '://' . $parts['host'] . $port; if ($origin == $url) { $response->headers->set('Access-Control-Allow-Origin', $url); return true; } } } return false; }
php
public static function attachOriginHeader($response, $origin) { if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { $response->headers->set('Access-Control-Allow-Origin', $origin); return true; } if ('*' == config('api.cors_allowed_origin', 'client')) { $response->headers->set('Access-Control-Allow-Origin', '*'); return true; } if ('client' == config('api.cors_allowed_origin', 'client')) { $client = Authentication::instance()->client(); if (empty($client) || empty($client->endpoints())) { return false; } foreach ($client->endpoints() as $endpoint) { $parts = parse_url($endpoint); if (empty($parts['scheme']) || empty($parts['host'])) { continue; } $port = ''; if (array_get($parts, 'port')) { $port = ':' . array_get($parts, 'port'); } $url = $parts['scheme'] . '://' . $parts['host'] . $port; if ($origin == $url) { $response->headers->set('Access-Control-Allow-Origin', $url); return true; } } } return false; }
[ "public", "static", "function", "attachOriginHeader", "(", "$", "response", ",", "$", "origin", ")", "{", "if", "(", "$", "_SERVER", "[", "'REQUEST_METHOD'", "]", "===", "'OPTIONS'", ")", "{", "$", "response", "->", "headers", "->", "set", "(", "'Access-Co...
Attach a CORS origin header to the given response, if allowed. Returns true if an origin header was set; false, otherwise. @param Response $response @param string $origin @return bool
[ "Attach", "a", "CORS", "origin", "header", "to", "the", "given", "response", "if", "allowed", ".", "Returns", "true", "if", "an", "origin", "header", "was", "set", ";", "false", "otherwise", "." ]
8fac248d91c797f4a8f960e7cd7466df5a814975
https://github.com/mmanos/laravel-api/blob/8fac248d91c797f4a8f960e7cd7466df5a814975/src/Mmanos/Api/Cors.php#L38-L77
train
monarkee/bumble
Fields/DateTimeField.php
DateTimeField.process
public function process($model, $input) { $column = $this->getColumn(); // Handle a special case where the data in the database is 0000-00-00 00:00:00 if ($input[$column] == '-0001-11-30 00:00:00' || $input[$column] == '0000-00-00 00:00:00') { $model->{$column} = Carbon::now(); } elseif (isset($input[$column])) { $model->{$column} = $input[$column]; } if (empty($input[$column])) $model->{$column} = null; return $model; }
php
public function process($model, $input) { $column = $this->getColumn(); // Handle a special case where the data in the database is 0000-00-00 00:00:00 if ($input[$column] == '-0001-11-30 00:00:00' || $input[$column] == '0000-00-00 00:00:00') { $model->{$column} = Carbon::now(); } elseif (isset($input[$column])) { $model->{$column} = $input[$column]; } if (empty($input[$column])) $model->{$column} = null; return $model; }
[ "public", "function", "process", "(", "$", "model", ",", "$", "input", ")", "{", "$", "column", "=", "$", "this", "->", "getColumn", "(", ")", ";", "// Handle a special case where the data in the database is 0000-00-00 00:00:00", "if", "(", "$", "input", "[", "$...
Process the DateTimeField data @param $model @param $input @return BumbleModel
[ "Process", "the", "DateTimeField", "data" ]
6e140e341980d6f9467418594eed48c3859c00f7
https://github.com/monarkee/bumble/blob/6e140e341980d6f9467418594eed48c3859c00f7/Fields/DateTimeField.php#L34-L51
train
Speicher210/Reflection
src/ReflectionFile.php
ReflectionFile.reflect
private function reflect() { $tokens = token_get_all($this->reflectedFileContent); $namespace = null; $classLevel = 0; $level = 0; $res = $uses = array(); while (list(, $token) = each($tokens)) { switch (is_array($token) ? $token[0] : $token) { case T_CLASS: case T_INTERFACE: case T_TRAIT: if ($name = $this->fetch($tokens, array(T_STRING))) { $classLevel = $level + 1; if ($namespace !== null) { $objectFQN = $namespace . '\\' . $name; } else { $objectFQN = $name; } $this->objects[] = new ReflectionClass($objectFQN); } break; case T_NAMESPACE: $namespace = '\\' . ltrim($this->fetch($tokens, array(T_STRING, T_NS_SEPARATOR)), '\\'); $res[$namespace] = array(); $uses = array(); break; case T_USE: if ($classLevel === 0) { while ($name = $this->fetch($tokens, array(T_STRING, T_NS_SEPARATOR))) { $name = '\\' . ltrim($name, '\\'); if ($this->fetch($tokens, array(T_AS))) { $uses[$this->fetch($tokens, array(T_STRING))] = $name; } else { $uses[$name] = $name; } if (!$this->fetch($tokens, array(','))) { break; } } $res[$namespace] = $uses; } break; case T_CURLY_OPEN: case T_DOLLAR_OPEN_CURLY_BRACES: case '{': $level++; break; case '}': if ($level === $classLevel) { $classLevel = 0; } $level--; break; } } $this->namespaces = array_keys($res); $this->uses = $res; }
php
private function reflect() { $tokens = token_get_all($this->reflectedFileContent); $namespace = null; $classLevel = 0; $level = 0; $res = $uses = array(); while (list(, $token) = each($tokens)) { switch (is_array($token) ? $token[0] : $token) { case T_CLASS: case T_INTERFACE: case T_TRAIT: if ($name = $this->fetch($tokens, array(T_STRING))) { $classLevel = $level + 1; if ($namespace !== null) { $objectFQN = $namespace . '\\' . $name; } else { $objectFQN = $name; } $this->objects[] = new ReflectionClass($objectFQN); } break; case T_NAMESPACE: $namespace = '\\' . ltrim($this->fetch($tokens, array(T_STRING, T_NS_SEPARATOR)), '\\'); $res[$namespace] = array(); $uses = array(); break; case T_USE: if ($classLevel === 0) { while ($name = $this->fetch($tokens, array(T_STRING, T_NS_SEPARATOR))) { $name = '\\' . ltrim($name, '\\'); if ($this->fetch($tokens, array(T_AS))) { $uses[$this->fetch($tokens, array(T_STRING))] = $name; } else { $uses[$name] = $name; } if (!$this->fetch($tokens, array(','))) { break; } } $res[$namespace] = $uses; } break; case T_CURLY_OPEN: case T_DOLLAR_OPEN_CURLY_BRACES: case '{': $level++; break; case '}': if ($level === $classLevel) { $classLevel = 0; } $level--; break; } } $this->namespaces = array_keys($res); $this->uses = $res; }
[ "private", "function", "reflect", "(", ")", "{", "$", "tokens", "=", "token_get_all", "(", "$", "this", "->", "reflectedFileContent", ")", ";", "$", "namespace", "=", "null", ";", "$", "classLevel", "=", "0", ";", "$", "level", "=", "0", ";", "$", "r...
Do the reflection to gather data.
[ "Do", "the", "reflection", "to", "gather", "data", "." ]
3d0f5033077b6a3f47cebbeded6538caeb0a1909
https://github.com/Speicher210/Reflection/blob/3d0f5033077b6a3f47cebbeded6538caeb0a1909/src/ReflectionFile.php#L67-L126
train
Speicher210/Reflection
src/ReflectionFile.php
ReflectionFile.fetch
private function fetch(& $tokens, array $take) { $res = null; while ($token = current($tokens)) { list($token, $s) = is_array($token) ? $token : array($token, $token); if (in_array($token, $take, true)) { $res .= $s; } elseif (!in_array($token, array(T_DOC_COMMENT, T_WHITESPACE, T_COMMENT), true)) { break; } next($tokens); } return $res; }
php
private function fetch(& $tokens, array $take) { $res = null; while ($token = current($tokens)) { list($token, $s) = is_array($token) ? $token : array($token, $token); if (in_array($token, $take, true)) { $res .= $s; } elseif (!in_array($token, array(T_DOC_COMMENT, T_WHITESPACE, T_COMMENT), true)) { break; } next($tokens); } return $res; }
[ "private", "function", "fetch", "(", "&", "$", "tokens", ",", "array", "$", "take", ")", "{", "$", "res", "=", "null", ";", "while", "(", "$", "token", "=", "current", "(", "$", "tokens", ")", ")", "{", "list", "(", "$", "token", ",", "$", "s",...
Get the token value for the next token of type. @param array $tokens The tokens array. @param array $take The tokens to look for. @return null|string
[ "Get", "the", "token", "value", "for", "the", "next", "token", "of", "type", "." ]
3d0f5033077b6a3f47cebbeded6538caeb0a1909
https://github.com/Speicher210/Reflection/blob/3d0f5033077b6a3f47cebbeded6538caeb0a1909/src/ReflectionFile.php#L135-L149
train
Speicher210/Reflection
src/ReflectionFile.php
ReflectionFile.resolveFqnToAlias
public function resolveFqnToAlias($fqn) { foreach ($this->getUses() as $namespace => $uses) { $alias = array_search($fqn, $uses, true); if ($alias) { $parts = explode('\\', $alias); return end($parts); } } return $fqn; }
php
public function resolveFqnToAlias($fqn) { foreach ($this->getUses() as $namespace => $uses) { $alias = array_search($fqn, $uses, true); if ($alias) { $parts = explode('\\', $alias); return end($parts); } } return $fqn; }
[ "public", "function", "resolveFqnToAlias", "(", "$", "fqn", ")", "{", "foreach", "(", "$", "this", "->", "getUses", "(", ")", "as", "$", "namespace", "=>", "$", "uses", ")", "{", "$", "alias", "=", "array_search", "(", "$", "fqn", ",", "$", "uses", ...
Resolve an alias for an FQN. @param string $fqn The fully qualified name to get the alias for. @return string
[ "Resolve", "an", "alias", "for", "an", "FQN", "." ]
3d0f5033077b6a3f47cebbeded6538caeb0a1909
https://github.com/Speicher210/Reflection/blob/3d0f5033077b6a3f47cebbeded6538caeb0a1909/src/ReflectionFile.php#L197-L209
train
cawaphp/cawa
src/Net/Ip.php
Ip.isValid
public static function isValid(string $ip = null) { if (is_null($ip)) { $ip = self::get(); } return filter_var($ip, FILTER_VALIDATE_IP) == $ip; }
php
public static function isValid(string $ip = null) { if (is_null($ip)) { $ip = self::get(); } return filter_var($ip, FILTER_VALIDATE_IP) == $ip; }
[ "public", "static", "function", "isValid", "(", "string", "$", "ip", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "ip", ")", ")", "{", "$", "ip", "=", "self", "::", "get", "(", ")", ";", "}", "return", "filter_var", "(", "$", "ip", ",...
Control an ip. @param string $ip @return bool
[ "Control", "an", "ip", "." ]
bd250532200121e7aa1da44e547c04c4c148fb37
https://github.com/cawaphp/cawa/blob/bd250532200121e7aa1da44e547c04c4c148fb37/src/Net/Ip.php#L62-L69
train
cawaphp/cawa
src/Net/Ip.php
Ip.isLocal
public static function isLocal(string $ip = null) { if (is_null($ip)) { $ip = self::get(); } if (stripos($ip, '127.') !== false) { return true; } return !(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) == $ip); }
php
public static function isLocal(string $ip = null) { if (is_null($ip)) { $ip = self::get(); } if (stripos($ip, '127.') !== false) { return true; } return !(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) == $ip); }
[ "public", "static", "function", "isLocal", "(", "string", "$", "ip", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "ip", ")", ")", "{", "$", "ip", "=", "self", "::", "get", "(", ")", ";", "}", "if", "(", "stripos", "(", "$", "ip", ",...
If ip is for local network. @param string $ip @return bool
[ "If", "ip", "is", "for", "local", "network", "." ]
bd250532200121e7aa1da44e547c04c4c148fb37
https://github.com/cawaphp/cawa/blob/bd250532200121e7aa1da44e547c04c4c148fb37/src/Net/Ip.php#L78-L89
train
cawaphp/cawa
src/Net/Ip.php
Ip.toLong
public static function toLong(string $ip = null) { if (is_null($ip)) { $ip = self::get(); } return ip2long($ip); }
php
public static function toLong(string $ip = null) { if (is_null($ip)) { $ip = self::get(); } return ip2long($ip); }
[ "public", "static", "function", "toLong", "(", "string", "$", "ip", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "ip", ")", ")", "{", "$", "ip", "=", "self", "::", "get", "(", ")", ";", "}", "return", "ip2long", "(", "$", "ip", ")", ...
Return numeric ip value. @param string $ip @return int
[ "Return", "numeric", "ip", "value", "." ]
bd250532200121e7aa1da44e547c04c4c148fb37
https://github.com/cawaphp/cawa/blob/bd250532200121e7aa1da44e547c04c4c148fb37/src/Net/Ip.php#L119-L126
train
jack-theripper/transcoder
src/Event/EventProgress.php
EventProgress.getPercent
public function getPercent() { if ($this->duration == 0) { return -1; } $percent = $this->time / $this->duration * 100 / $this->totalPass; return round(min(100, $percent + 100 / $this->totalPass * ($this->currentPass - 1)), 2); }
php
public function getPercent() { if ($this->duration == 0) { return -1; } $percent = $this->time / $this->duration * 100 / $this->totalPass; return round(min(100, $percent + 100 / $this->totalPass * ($this->currentPass - 1)), 2); }
[ "public", "function", "getPercent", "(", ")", "{", "if", "(", "$", "this", "->", "duration", "==", "0", ")", "{", "return", "-", "1", ";", "}", "$", "percent", "=", "$", "this", "->", "time", "/", "$", "this", "->", "duration", "*", "100", "/", ...
Get current percent or '-1'. @return float
[ "Get", "current", "percent", "or", "-", "1", "." ]
bd87db4c76ccceafa9fc271b14013ebf12e0b32e
https://github.com/jack-theripper/transcoder/blob/bd87db4c76ccceafa9fc271b14013ebf12e0b32e/src/Event/EventProgress.php#L120-L130
train
jack-theripper/transcoder
src/Event/EventProgress.php
EventProgress.setDuration
protected function setDuration($duration) { if ( ! is_numeric($duration)) { throw new \InvalidArgumentException('The duration value must be a float type.'); } $this->duration = abs($duration); return $this; }
php
protected function setDuration($duration) { if ( ! is_numeric($duration)) { throw new \InvalidArgumentException('The duration value must be a float type.'); } $this->duration = abs($duration); return $this; }
[ "protected", "function", "setDuration", "(", "$", "duration", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "duration", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The duration value must be a float type.'", ")", ";", "}", "$", ...
Sets duration value. @param float $duration @return EventProgress @throws \InvalidArgumentException
[ "Sets", "duration", "value", "." ]
bd87db4c76ccceafa9fc271b14013ebf12e0b32e
https://github.com/jack-theripper/transcoder/blob/bd87db4c76ccceafa9fc271b14013ebf12e0b32e/src/Event/EventProgress.php#L197-L207
train
cawaphp/cawa
src/Date/DateTime.php
DateTime.init
private static function init() { $day = Calendar::getFirstWeekday(); $day = $day == 0 ? 7 : $day; self::$weekStartsAt = $day; $days = self::$days; while (array_keys($days)[0] != $day) { $key = array_keys($days)[0]; $value = $days[$key]; unset($days[$key]); $days[$key] = $value; } self::$init = true; }
php
private static function init() { $day = Calendar::getFirstWeekday(); $day = $day == 0 ? 7 : $day; self::$weekStartsAt = $day; $days = self::$days; while (array_keys($days)[0] != $day) { $key = array_keys($days)[0]; $value = $days[$key]; unset($days[$key]); $days[$key] = $value; } self::$init = true; }
[ "private", "static", "function", "init", "(", ")", "{", "$", "day", "=", "Calendar", "::", "getFirstWeekday", "(", ")", ";", "$", "day", "=", "$", "day", "==", "0", "?", "7", ":", "$", "day", ";", "self", "::", "$", "weekStartsAt", "=", "$", "day...
Reorder the days property based on current language.
[ "Reorder", "the", "days", "property", "based", "on", "current", "language", "." ]
bd250532200121e7aa1da44e547c04c4c148fb37
https://github.com/cawaphp/cawa/blob/bd250532200121e7aa1da44e547c04c4c148fb37/src/Date/DateTime.php#L87-L102
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.error
public function error($message) { $this->message = $message; $this->type = 'danger'; $this->title = 'Whoops'; $this->icon = 'sl sl-icon-close danger ln-notify-icon'; $this->animate['enter'] = 'animated tada'; return $this->setNotifier(); }
php
public function error($message) { $this->message = $message; $this->type = 'danger'; $this->title = 'Whoops'; $this->icon = 'sl sl-icon-close danger ln-notify-icon'; $this->animate['enter'] = 'animated tada'; return $this->setNotifier(); }
[ "public", "function", "error", "(", "$", "message", ")", "{", "$", "this", "->", "message", "=", "$", "message", ";", "$", "this", "->", "type", "=", "'danger'", ";", "$", "this", "->", "title", "=", "'Whoops'", ";", "$", "this", "->", "icon", "=",...
Build error messages @param string $message @return mixed
[ "Build", "error", "messages" ]
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L157-L166
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.warning
public function warning($message) { $this->message = $message; $this->type = 'warning'; $this->title = 'Warning'; $this->icon = 'sl sl-icon-bell warning ln-notify-icon'; return $this->setNotifier(); }
php
public function warning($message) { $this->message = $message; $this->type = 'warning'; $this->title = 'Warning'; $this->icon = 'sl sl-icon-bell warning ln-notify-icon'; return $this->setNotifier(); }
[ "public", "function", "warning", "(", "$", "message", ")", "{", "$", "this", "->", "message", "=", "$", "message", ";", "$", "this", "->", "type", "=", "'warning'", ";", "$", "this", "->", "title", "=", "'Warning'", ";", "$", "this", "->", "icon", ...
Build warning messages @param string $message @return mixed
[ "Build", "warning", "messages" ]
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L173-L181
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.animate
public function animate($animation) { if (is_array($animation) && isset($animation[0]) && isset($animation[1])) { $this->animate['enter'] = "animated " . $animation[0]; $this->animate['exit'] = "animated " . $animation[1]; } if (is_array($animation) && isset($animation['enter']) && isset($animation['exit'])) { $this->animate['enter'] = "animated {$animation['enter']}"; $this->animate['exit'] = "animated {$animation['exit']}"; } if (is_bool($animation) && $animation == false) { $this->animate['enter'] = null; $this->animate['exit'] = null; } return $this->setNotifier(); }
php
public function animate($animation) { if (is_array($animation) && isset($animation[0]) && isset($animation[1])) { $this->animate['enter'] = "animated " . $animation[0]; $this->animate['exit'] = "animated " . $animation[1]; } if (is_array($animation) && isset($animation['enter']) && isset($animation['exit'])) { $this->animate['enter'] = "animated {$animation['enter']}"; $this->animate['exit'] = "animated {$animation['exit']}"; } if (is_bool($animation) && $animation == false) { $this->animate['enter'] = null; $this->animate['exit'] = null; } return $this->setNotifier(); }
[ "public", "function", "animate", "(", "$", "animation", ")", "{", "if", "(", "is_array", "(", "$", "animation", ")", "&&", "isset", "(", "$", "animation", "[", "0", "]", ")", "&&", "isset", "(", "$", "animation", "[", "1", "]", ")", ")", "{", "$"...
This will control the animation used to bring and remove the notification. Since version 1.0.0 all animations are controlled using css. Animate.css by Daniel Eden is already loaded for you on ln_header function. @param boolean|array $animation @return LaranotifyService
[ "This", "will", "control", "the", "animation", "used", "to", "bring", "and", "remove", "the", "notification", ".", "Since", "version", "1", ".", "0", ".", "0", "all", "animations", "are", "controlled", "using", "css", ".", "Animate", ".", "css", "by", "D...
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L230-L248
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.progress
public function progress($bool) { if (is_bool($bool)) { $this->progress = json_encode($bool); } return $this->setNotifier(); }
php
public function progress($bool) { if (is_bool($bool)) { $this->progress = json_encode($bool); } return $this->setNotifier(); }
[ "public", "function", "progress", "(", "$", "bool", ")", "{", "if", "(", "is_bool", "(", "$", "bool", ")", ")", "{", "$", "this", "->", "progress", "=", "json_encode", "(", "$", "bool", ")", ";", "}", "return", "$", "this", "->", "setNotifier", "("...
This boolean is used to determine if the notification should display a progress bar. @param boolean $bool @return LaranotifyService
[ "This", "boolean", "is", "used", "to", "determine", "if", "the", "notification", "should", "display", "a", "progress", "bar", "." ]
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L279-L286
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.message
public function message($message, $type = '') { if ($type == 'danger') { $this->animate['enter'] = 'animated tada'; } if ($type != '') { $this->type = $type; } $this->message = $message; return $this->setNotifier(); }
php
public function message($message, $type = '') { if ($type == 'danger') { $this->animate['enter'] = 'animated tada'; } if ($type != '') { $this->type = $type; } $this->message = $message; return $this->setNotifier(); }
[ "public", "function", "message", "(", "$", "message", ",", "$", "type", "=", "''", ")", "{", "if", "(", "$", "type", "==", "'danger'", ")", "{", "$", "this", "->", "animate", "[", "'enter'", "]", "=", "'animated tada'", ";", "}", "if", "(", "$", ...
This is the message that will be displayed within the notify notification. @param string $type danger, warning, info, success @param string $message @return LaranotifyService
[ "This", "is", "the", "message", "that", "will", "be", "displayed", "within", "the", "notify", "notification", "." ]
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L308-L320
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.allowDismiss
public function allowDismiss($bool) { if (is_bool($bool)) { $this->allowDismiss = json_encode($bool); } return $this->setNotifier(); }
php
public function allowDismiss($bool) { if (is_bool($bool)) { $this->allowDismiss = json_encode($bool); } return $this->setNotifier(); }
[ "public", "function", "allowDismiss", "(", "$", "bool", ")", "{", "if", "(", "is_bool", "(", "$", "bool", ")", ")", "{", "$", "this", "->", "allowDismiss", "=", "json_encode", "(", "$", "bool", ")", ";", "}", "return", "$", "this", "->", "setNotifier...
If this value is set to false it will hide the data-grow="dismiss" element. Please keep in mind if you modify the template setting and do not include a data-notify="dismiss" element even with this set to true, there will be no element for a user to click to close the notification. @param boolean $bool @return LaranotifyService
[ "If", "this", "value", "is", "set", "to", "false", "it", "will", "hide", "the", "data", "-", "grow", "=", "dismiss", "element", ".", "Please", "keep", "in", "mind", "if", "you", "modify", "the", "template", "setting", "and", "do", "not", "include", "a"...
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L505-L512
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.placement
public function placement($from, $align) { $this->placement['from'] = $from; $this->placement['align'] = $align; return $this->setNotifier(); }
php
public function placement($from, $align) { $this->placement['from'] = $from; $this->placement['align'] = $align; return $this->setNotifier(); }
[ "public", "function", "placement", "(", "$", "from", ",", "$", "align", ")", "{", "$", "this", "->", "placement", "[", "'from'", "]", "=", "$", "from", ";", "$", "this", "->", "placement", "[", "'align'", "]", "=", "$", "align", ";", "return", "$",...
This controls where the notification will be placed. @param string $from top, bottom @param string $align left, right, center @return LaranotifyService
[ "This", "controls", "where", "the", "notification", "will", "be", "placed", "." ]
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L520-L526
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.withSound
public function withSound($path) { $sound = url("public/" . $path); if (str_start('http://', $path) || str_start('https://', $path)) { $sound = $path; } $this->onShow(" function() { laranotifySound = new Audio('{$sound}'); laranotifySound.play(); } "); $this->onClosed(" function() { laranotifySound.currentTime = 0; laranotifySound.src = ''; } "); return $this; }
php
public function withSound($path) { $sound = url("public/" . $path); if (str_start('http://', $path) || str_start('https://', $path)) { $sound = $path; } $this->onShow(" function() { laranotifySound = new Audio('{$sound}'); laranotifySound.play(); } "); $this->onClosed(" function() { laranotifySound.currentTime = 0; laranotifySound.src = ''; } "); return $this; }
[ "public", "function", "withSound", "(", "$", "path", ")", "{", "$", "sound", "=", "url", "(", "\"public/\"", ".", "$", "path", ")", ";", "if", "(", "str_start", "(", "'http://'", ",", "$", "path", ")", "||", "str_start", "(", "'https://'", ",", "$", ...
Play a sound when the notification is shown and stop it when notification is closed. You can pass a relative path or url. We will check if it's a url or not. If you pass in path, we will assume it's coming from the public folder. We are setting the relative path to start with public folder because it's recommended by Laravel that all public files should come from the public folder. @param string $path @return $this
[ "Play", "a", "sound", "when", "the", "notification", "is", "shown", "and", "stop", "it", "when", "notification", "is", "closed", ".", "You", "can", "pass", "a", "relative", "path", "or", "url", ".", "We", "will", "check", "if", "it", "s", "a", "url", ...
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L609-L630
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.imageIcon
public function imageIcon($imageUrl = '') { $this->iconType = 'class'; $this->icon = "sl sl-icon-bell ln-notify-icon $this->type"; if ($imageUrl != '') { $this->iconType = 'img'; $this->icon = $imageUrl; } return $this->setNotifier(); }
php
public function imageIcon($imageUrl = '') { $this->iconType = 'class'; $this->icon = "sl sl-icon-bell ln-notify-icon $this->type"; if ($imageUrl != '') { $this->iconType = 'img'; $this->icon = $imageUrl; } return $this->setNotifier(); }
[ "public", "function", "imageIcon", "(", "$", "imageUrl", "=", "''", ")", "{", "$", "this", "->", "iconType", "=", "'class'", ";", "$", "this", "->", "icon", "=", "\"sl sl-icon-bell ln-notify-icon $this->type\"", ";", "if", "(", "$", "imageUrl", "!=", "''", ...
This will set set the icon to the image provided as @var $imageUrl If the image couldn't be found, we will revoke to a default icon [bell]. It's expected that your image must have equal dimensions i.e same width and height. @param string $imageUrl @return LaranotifyService
[ "This", "will", "set", "set", "the", "icon", "to", "the", "image", "provided", "as" ]
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L639-L650
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.template
public function template($template) { $this->template = view($template, $this->data); return $this->setNotifier(); }
php
public function template($template) { $this->template = view($template, $this->data); return $this->setNotifier(); }
[ "public", "function", "template", "(", "$", "template", ")", "{", "$", "this", "->", "template", "=", "view", "(", "$", "template", ",", "$", "this", "->", "data", ")", ";", "return", "$", "this", "->", "setNotifier", "(", ")", ";", "}" ]
This gives you control over the layout of the notification where you can build your own template and set it at the config file include the package. Provide the name of your template view file. This will then be set as the active template. @param string $template Your template view file @return LaranotifyService
[ "This", "gives", "you", "control", "over", "the", "layout", "of", "the", "notification", "where", "you", "can", "build", "your", "own", "template", "and", "set", "it", "at", "the", "config", "file", "include", "the", "package", ".", "Provide", "the", "name...
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L660-L665
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.updateAfterInterval
public function updateAfterInterval($target_element, $contents, $interval = 0) { if (is_int($interval) && $interval != 0) { $this->onShown(" function() { setInterval(function() { $('{$target_element}').html('{$contents}'); }, {$interval}); } "); } return $this->setNotifier(); }
php
public function updateAfterInterval($target_element, $contents, $interval = 0) { if (is_int($interval) && $interval != 0) { $this->onShown(" function() { setInterval(function() { $('{$target_element}').html('{$contents}'); }, {$interval}); } "); } return $this->setNotifier(); }
[ "public", "function", "updateAfterInterval", "(", "$", "target_element", ",", "$", "contents", ",", "$", "interval", "=", "0", ")", "{", "if", "(", "is_int", "(", "$", "interval", ")", "&&", "$", "interval", "!=", "0", ")", "{", "$", "this", "->", "o...
Update a particular element after the notification is displayed on screen. You can even change the contents of notification. This work with the DOM. @param string $target_element @param string $contents @param int $interval @return LaranotifyService
[ "Update", "a", "particular", "element", "after", "the", "notification", "is", "displayed", "on", "screen", ".", "You", "can", "even", "change", "the", "contents", "of", "notification", ".", "This", "work", "with", "the", "DOM", "." ]
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L777-L790
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.getTemplate
private function getTemplate() { $template = config('laranotify.template'); if ($template == '' && $this->template == '') { return $this->defaultTemplate(); } if ($this->template != '') { return ($this->template); } return view($template); }
php
private function getTemplate() { $template = config('laranotify.template'); if ($template == '' && $this->template == '') { return $this->defaultTemplate(); } if ($this->template != '') { return ($this->template); } return view($template); }
[ "private", "function", "getTemplate", "(", ")", "{", "$", "template", "=", "config", "(", "'laranotify.template'", ")", ";", "if", "(", "$", "template", "==", "''", "&&", "$", "this", "->", "template", "==", "''", ")", "{", "return", "$", "this", "->",...
Get the currently set template. This will return default template if none is set. @return string
[ "Get", "the", "currently", "set", "template", ".", "This", "will", "return", "default", "template", "if", "none", "is", "set", "." ]
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L797-L809
train
coderatio/laranotify
src/LaranotifyService.php
LaranotifyService.buildTemplate
private function buildTemplate($template) { $this->template = $template; $offset = "{ x: $this->offsetX, y: $this->offsetY }"; if ($this->offsetX == 20 && $this->offsetY == 20 || $this->offset == 20) { $offset = $this->offset; } $this->placement['enter'] = 'right'; return "{ icon: '$this->icon', title: '$this->title', message: '$this->message', url: '$this->url', target: '$this->target' }, { element: '$this->element', position: $this->position, type: '$this->type', allow_dismiss: $this->allowDismiss, newest_on_top: $this->newestFirst, showProgressbar: $this->progress, placement: " . json_encode($this->placement) . ", offset: $offset, spacing: $this->spacing, z_index: $this->zIndex, mouse_over: '$this->mouseOver', delay: $this->delay, timer: $this->timer, url_target: '$this->urlTarget', animate: " . json_encode($this->animate) . ", onShow: $this->onShow, onShown: $this->onShown, onClose: $this->onClose, onClosed: $this->onClosed, icon_type: '$this->iconType', template: `$this->template` } "; }
php
private function buildTemplate($template) { $this->template = $template; $offset = "{ x: $this->offsetX, y: $this->offsetY }"; if ($this->offsetX == 20 && $this->offsetY == 20 || $this->offset == 20) { $offset = $this->offset; } $this->placement['enter'] = 'right'; return "{ icon: '$this->icon', title: '$this->title', message: '$this->message', url: '$this->url', target: '$this->target' }, { element: '$this->element', position: $this->position, type: '$this->type', allow_dismiss: $this->allowDismiss, newest_on_top: $this->newestFirst, showProgressbar: $this->progress, placement: " . json_encode($this->placement) . ", offset: $offset, spacing: $this->spacing, z_index: $this->zIndex, mouse_over: '$this->mouseOver', delay: $this->delay, timer: $this->timer, url_target: '$this->urlTarget', animate: " . json_encode($this->animate) . ", onShow: $this->onShow, onShown: $this->onShown, onClose: $this->onClose, onClosed: $this->onClosed, icon_type: '$this->iconType', template: `$this->template` } "; }
[ "private", "function", "buildTemplate", "(", "$", "template", ")", "{", "$", "this", "->", "template", "=", "$", "template", ";", "$", "offset", "=", "\"{\n x: $this->offsetX,\n y: $this->offsetY\n }\"", ";", "if", "(", "$", "this", "->"...
Build template for notification. You only need to pass the template content as the parameter. Template can come from anywhere within your laravel project. @param string $template @return string, json
[ "Build", "template", "for", "notification", ".", "You", "only", "need", "to", "pass", "the", "template", "content", "as", "the", "parameter", ".", "Template", "can", "come", "from", "anywhere", "within", "your", "laravel", "project", "." ]
f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d
https://github.com/coderatio/laranotify/blob/f5dc28b4c5fec00fc4f83270e5331ba00f15aa9d/src/LaranotifyService.php#L831-L875
train
youngguns-nl/moneybird_php_api
Domainmodel/AbstractModel.php
AbstractModel._initDisclosedAttributes
protected function _initDisclosedAttributes() { foreach (array_keys(get_class_vars(get_class($this))) as $property) { if (substr($property, 0, 1) != '_') { $this->_discloseAttr[] = $property; } } }
php
protected function _initDisclosedAttributes() { foreach (array_keys(get_class_vars(get_class($this))) as $property) { if (substr($property, 0, 1) != '_') { $this->_discloseAttr[] = $property; } } }
[ "protected", "function", "_initDisclosedAttributes", "(", ")", "{", "foreach", "(", "array_keys", "(", "get_class_vars", "(", "get_class", "(", "$", "this", ")", ")", ")", "as", "$", "property", ")", "{", "if", "(", "substr", "(", "$", "property", ",", "...
Create disclosedAttributes array
[ "Create", "disclosedAttributes", "array" ]
bb5035dd60cf087c7a055458d207be418355ab74
https://github.com/youngguns-nl/moneybird_php_api/blob/bb5035dd60cf087c7a055458d207be418355ab74/Domainmodel/AbstractModel.php#L94-L101
train
youngguns-nl/moneybird_php_api
Domainmodel/AbstractModel.php
AbstractModel.isDirty
public function isDirty() { if ( !empty($this->_dirtyAttr) || (($this instanceof DeleteBySaving) && $this->isDeleted()) ) { return true; } foreach (array_keys(get_object_vars($this)) as $key) { foreach ((array) $this->$key as $sub) { if (($sub instanceof DirtyAware) && $sub->isDirty()) { return true; } } } return false; }
php
public function isDirty() { if ( !empty($this->_dirtyAttr) || (($this instanceof DeleteBySaving) && $this->isDeleted()) ) { return true; } foreach (array_keys(get_object_vars($this)) as $key) { foreach ((array) $this->$key as $sub) { if (($sub instanceof DirtyAware) && $sub->isDirty()) { return true; } } } return false; }
[ "public", "function", "isDirty", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "_dirtyAttr", ")", "||", "(", "(", "$", "this", "instanceof", "DeleteBySaving", ")", "&&", "$", "this", "->", "isDeleted", "(", ")", ")", ")", "{", "re...
Returns true if the object contains any dirty attributes @return bool @access public
[ "Returns", "true", "if", "the", "object", "contains", "any", "dirty", "attributes" ]
bb5035dd60cf087c7a055458d207be418355ab74
https://github.com/youngguns-nl/moneybird_php_api/blob/bb5035dd60cf087c7a055458d207be418355ab74/Domainmodel/AbstractModel.php#L186-L203
train
youngguns-nl/moneybird_php_api
Domainmodel/AbstractModel.php
AbstractModel.getDirtyAttributes
public function getDirtyAttributes() { $values = array(); foreach (array_keys(get_object_vars($this)) as $key) { if (in_array($key, $this->_dirtyAttr)) { $values[$key] = $this->$key; } elseif ($this->$key instanceof ArrayObject) { foreach ($this->$key as $sub) { if (($sub instanceof DirtyAware) && $sub->isDirty()) { if (!array_key_exists($key, $values)) { $values[$key] = new $this->$key; } $values[$key]->append($sub); } } } } return $values; }
php
public function getDirtyAttributes() { $values = array(); foreach (array_keys(get_object_vars($this)) as $key) { if (in_array($key, $this->_dirtyAttr)) { $values[$key] = $this->$key; } elseif ($this->$key instanceof ArrayObject) { foreach ($this->$key as $sub) { if (($sub instanceof DirtyAware) && $sub->isDirty()) { if (!array_key_exists($key, $values)) { $values[$key] = new $this->$key; } $values[$key]->append($sub); } } } } return $values; }
[ "public", "function", "getDirtyAttributes", "(", ")", "{", "$", "values", "=", "array", "(", ")", ";", "foreach", "(", "array_keys", "(", "get_object_vars", "(", "$", "this", ")", ")", "as", "$", "key", ")", "{", "if", "(", "in_array", "(", "$", "key...
Returns an array representation of this object's dirty attributes @return array @access public
[ "Returns", "an", "array", "representation", "of", "this", "object", "s", "dirty", "attributes" ]
bb5035dd60cf087c7a055458d207be418355ab74
https://github.com/youngguns-nl/moneybird_php_api/blob/bb5035dd60cf087c7a055458d207be418355ab74/Domainmodel/AbstractModel.php#L210-L228
train
youngguns-nl/moneybird_php_api
Domainmodel/AbstractModel.php
AbstractModel.selfToArray
protected function selfToArray(Array $filter = array()) { $filter = array_flip($filter); $hasFilter = count($filter) > 0; $values = array(); foreach ($this as $key => $value) { if (!$hasFilter || isset($filter[$key])) { $values[$key] = $this->$key; } } return $values; }
php
protected function selfToArray(Array $filter = array()) { $filter = array_flip($filter); $hasFilter = count($filter) > 0; $values = array(); foreach ($this as $key => $value) { if (!$hasFilter || isset($filter[$key])) { $values[$key] = $this->$key; } } return $values; }
[ "protected", "function", "selfToArray", "(", "Array", "$", "filter", "=", "array", "(", ")", ")", "{", "$", "filter", "=", "array_flip", "(", "$", "filter", ")", ";", "$", "hasFilter", "=", "count", "(", "$", "filter", ")", ">", "0", ";", "$", "val...
Returns an array representation of this object @return array @access protected
[ "Returns", "an", "array", "representation", "of", "this", "object" ]
bb5035dd60cf087c7a055458d207be418355ab74
https://github.com/youngguns-nl/moneybird_php_api/blob/bb5035dd60cf087c7a055458d207be418355ab74/Domainmodel/AbstractModel.php#L235-L246
train
youngguns-nl/moneybird_php_api
Domainmodel/AbstractModel.php
AbstractModel.setClean
protected function setClean($attr = null) { if ($attr === null) { $this->_dirtyAttr = array(); } else { foreach (array_keys($this->_dirtyAttr, $attr) as $key) { unset($this->_dirtyAttr[$key]); } } return $this; }
php
protected function setClean($attr = null) { if ($attr === null) { $this->_dirtyAttr = array(); } else { foreach (array_keys($this->_dirtyAttr, $attr) as $key) { unset($this->_dirtyAttr[$key]); } } return $this; }
[ "protected", "function", "setClean", "(", "$", "attr", "=", "null", ")", "{", "if", "(", "$", "attr", "===", "null", ")", "{", "$", "this", "->", "_dirtyAttr", "=", "array", "(", ")", ";", "}", "else", "{", "foreach", "(", "array_keys", "(", "$", ...
Set dirty state to clean @param string $attr Name of attribute, if null (default) set all attribures clean @return self
[ "Set", "dirty", "state", "to", "clean" ]
bb5035dd60cf087c7a055458d207be418355ab74
https://github.com/youngguns-nl/moneybird_php_api/blob/bb5035dd60cf087c7a055458d207be418355ab74/Domainmodel/AbstractModel.php#L292-L302
train
youngguns-nl/moneybird_php_api
Domainmodel/AbstractModel.php
AbstractModel.setDirty
protected function setDirty($attr = null) { if ($attr === null) { $this->setClean(); foreach (array_keys(get_object_vars($this)) as $key) { $this->setDirty($key); } } elseif ( !in_array($attr, $this->_dirtyAttr) && !in_array($attr, $this->_readonlyAttr) && substr($attr, 0, 1) != '_' && $attr != 'id' ) { $this->_dirtyAttr[] = $attr; } return $this; }
php
protected function setDirty($attr = null) { if ($attr === null) { $this->setClean(); foreach (array_keys(get_object_vars($this)) as $key) { $this->setDirty($key); } } elseif ( !in_array($attr, $this->_dirtyAttr) && !in_array($attr, $this->_readonlyAttr) && substr($attr, 0, 1) != '_' && $attr != 'id' ) { $this->_dirtyAttr[] = $attr; } return $this; }
[ "protected", "function", "setDirty", "(", "$", "attr", "=", "null", ")", "{", "if", "(", "$", "attr", "===", "null", ")", "{", "$", "this", "->", "setClean", "(", ")", ";", "foreach", "(", "array_keys", "(", "get_object_vars", "(", "$", "this", ")", ...
Set dirty state to dirty @param string $attr Name of attribute, if null (default) set all attribures dirty @return self
[ "Set", "dirty", "state", "to", "dirty" ]
bb5035dd60cf087c7a055458d207be418355ab74
https://github.com/youngguns-nl/moneybird_php_api/blob/bb5035dd60cf087c7a055458d207be418355ab74/Domainmodel/AbstractModel.php#L309-L325
train
youngguns-nl/moneybird_php_api
Domainmodel/AbstractModel.php
AbstractModel.setDirtyState
protected function setDirtyState($isDirty, $attr = null) { return $isDirty ? $this->setDirty($attr) : $this->setClean($attr); }
php
protected function setDirtyState($isDirty, $attr = null) { return $isDirty ? $this->setDirty($attr) : $this->setClean($attr); }
[ "protected", "function", "setDirtyState", "(", "$", "isDirty", ",", "$", "attr", "=", "null", ")", "{", "return", "$", "isDirty", "?", "$", "this", "->", "setDirty", "(", "$", "attr", ")", ":", "$", "this", "->", "setClean", "(", "$", "attr", ")", ...
Set dirty state based on bool @param bool $isDirty @param string $attr Name of attribute, if null (default) change state of all attribures @return self
[ "Set", "dirty", "state", "based", "on", "bool" ]
bb5035dd60cf087c7a055458d207be418355ab74
https://github.com/youngguns-nl/moneybird_php_api/blob/bb5035dd60cf087c7a055458d207be418355ab74/Domainmodel/AbstractModel.php#L333-L336
train
youngguns-nl/moneybird_php_api
Domainmodel/AbstractModel.php
AbstractModel.copy
protected function copy(Array $filter = array()) { $filter = array_flip(array_merge($filter, $this->_readonlyAttr)); $copy = new $this(); $attributes = $this->selfToArray(); foreach ($attributes as $key => &$value) { if (array_key_exists($key, $filter)) { unset($attributes[$key]); } elseif ($value instanceof ArrayObject) { try { $newElements = $value->copy($filter); $value = new $value; foreach ($newElements as $elmCopy) { $value->append($elmCopy); } } catch (ArrayObject\UndefinedMethodException $e) { // pass } } elseif ($value instanceof AbstractModel) { $value = $value->copy($filter); } } $copy->setData($attributes); return $copy; }
php
protected function copy(Array $filter = array()) { $filter = array_flip(array_merge($filter, $this->_readonlyAttr)); $copy = new $this(); $attributes = $this->selfToArray(); foreach ($attributes as $key => &$value) { if (array_key_exists($key, $filter)) { unset($attributes[$key]); } elseif ($value instanceof ArrayObject) { try { $newElements = $value->copy($filter); $value = new $value; foreach ($newElements as $elmCopy) { $value->append($elmCopy); } } catch (ArrayObject\UndefinedMethodException $e) { // pass } } elseif ($value instanceof AbstractModel) { $value = $value->copy($filter); } } $copy->setData($attributes); return $copy; }
[ "protected", "function", "copy", "(", "Array", "$", "filter", "=", "array", "(", ")", ")", "{", "$", "filter", "=", "array_flip", "(", "array_merge", "(", "$", "filter", ",", "$", "this", "->", "_readonlyAttr", ")", ")", ";", "$", "copy", "=", "new",...
Copy the object @param Array $filter Attributes not to copy @return self
[ "Copy", "the", "object" ]
bb5035dd60cf087c7a055458d207be418355ab74
https://github.com/youngguns-nl/moneybird_php_api/blob/bb5035dd60cf087c7a055458d207be418355ab74/Domainmodel/AbstractModel.php#L355-L380
train
axypro/sourcemap
parsing/Mappings.php
Mappings.addPosition
public function addPosition(PosMap $position) { $generated = $position->generated; $nl = $generated->line; if (isset($this->lines[$nl])) { $this->lines[$nl]->addPosition($position); } else { $this->lines[$nl] = new Line($nl, [$generated->column => $position]); } $this->sMappings = null; }
php
public function addPosition(PosMap $position) { $generated = $position->generated; $nl = $generated->line; if (isset($this->lines[$nl])) { $this->lines[$nl]->addPosition($position); } else { $this->lines[$nl] = new Line($nl, [$generated->column => $position]); } $this->sMappings = null; }
[ "public", "function", "addPosition", "(", "PosMap", "$", "position", ")", "{", "$", "generated", "=", "$", "position", "->", "generated", ";", "$", "nl", "=", "$", "generated", "->", "line", ";", "if", "(", "isset", "(", "$", "this", "->", "lines", "...
Adds a position to the mappings @param \axy\sourcemap\PosMap
[ "Adds", "a", "position", "to", "the", "mappings" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/parsing/Mappings.php#L46-L56
train
axypro/sourcemap
parsing/Mappings.php
Mappings.pack
public function pack() { $parser = new SegmentParser(); if ($this->sMappings === null) { $ln = []; $max = max(array_keys($this->lines)); for ($i = 0; $i <= $max; $i++) { if (isset($this->lines[$i])) { $parser->nextLine($i); $ln[] = $this->lines[$i]->pack($parser); } else { $ln[] = ''; } } $this->sMappings = implode(';', $ln); } return $this->sMappings; }
php
public function pack() { $parser = new SegmentParser(); if ($this->sMappings === null) { $ln = []; $max = max(array_keys($this->lines)); for ($i = 0; $i <= $max; $i++) { if (isset($this->lines[$i])) { $parser->nextLine($i); $ln[] = $this->lines[$i]->pack($parser); } else { $ln[] = ''; } } $this->sMappings = implode(';', $ln); } return $this->sMappings; }
[ "public", "function", "pack", "(", ")", "{", "$", "parser", "=", "new", "SegmentParser", "(", ")", ";", "if", "(", "$", "this", "->", "sMappings", "===", "null", ")", "{", "$", "ln", "=", "[", "]", ";", "$", "max", "=", "max", "(", "array_keys", ...
Packs the mappings @return string
[ "Packs", "the", "mappings" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/parsing/Mappings.php#L176-L193
train
axypro/sourcemap
parsing/Mappings.php
Mappings.getStat
public function getStat() { $sources = []; $names = []; foreach ($this->lines as $line) { $line->loadStat($sources, $names); } return [ 'sources' => $sources, 'names' => $names, ]; }
php
public function getStat() { $sources = []; $names = []; foreach ($this->lines as $line) { $line->loadStat($sources, $names); } return [ 'sources' => $sources, 'names' => $names, ]; }
[ "public", "function", "getStat", "(", ")", "{", "$", "sources", "=", "[", "]", ";", "$", "names", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "lines", "as", "$", "line", ")", "{", "$", "line", "->", "loadStat", "(", "$", "sources", "...
Returns statistic by sources and names @return array
[ "Returns", "statistic", "by", "sources", "and", "names" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/parsing/Mappings.php#L357-L368
train
axypro/sourcemap
parsing/Mappings.php
Mappings.parse
private function parse() { $this->lines = []; $parser = new SegmentParser(); foreach (explode(';', $this->sMappings) as $num => $sLine) { $sLine = trim($sLine); if ($sLine !== '') { $this->lines[$num] = Line::loadFromMappings($num, $sLine, $parser, $this->context); } } }
php
private function parse() { $this->lines = []; $parser = new SegmentParser(); foreach (explode(';', $this->sMappings) as $num => $sLine) { $sLine = trim($sLine); if ($sLine !== '') { $this->lines[$num] = Line::loadFromMappings($num, $sLine, $parser, $this->context); } } }
[ "private", "function", "parse", "(", ")", "{", "$", "this", "->", "lines", "=", "[", "]", ";", "$", "parser", "=", "new", "SegmentParser", "(", ")", ";", "foreach", "(", "explode", "(", "';'", ",", "$", "this", "->", "sMappings", ")", "as", "$", ...
Parses the mappings string
[ "Parses", "the", "mappings", "string" ]
f5793e5d166bf2a1735e27676007a21c121e20af
https://github.com/axypro/sourcemap/blob/f5793e5d166bf2a1735e27676007a21c121e20af/parsing/Mappings.php#L451-L461
train