repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
zicht/z | src/Zicht/Tool/Script/Node/Script/ForIn.php | ForIn.beforeScript | public function beforeScript(Buffer $buffer)
{
$buffer->write('foreach ((array)');
$this->nodes[0]->compile($buffer);
$buffer
->raw(' as $_key => $_value) {')->eol()->indent(1)
->writeln(sprintf('$z->push(\'%s\', $_key);', $this->key))
->writeln(sprintf('$... | php | public function beforeScript(Buffer $buffer)
{
$buffer->write('foreach ((array)');
$this->nodes[0]->compile($buffer);
$buffer
->raw(' as $_key => $_value) {')->eol()->indent(1)
->writeln(sprintf('$z->push(\'%s\', $_key);', $this->key))
->writeln(sprintf('$... | [
"public",
"function",
"beforeScript",
"(",
"Buffer",
"$",
"buffer",
")",
"{",
"$",
"buffer",
"->",
"write",
"(",
"'foreach ((array)'",
")",
";",
"$",
"this",
"->",
"nodes",
"[",
"0",
"]",
"->",
"compile",
"(",
"$",
"buffer",
")",
";",
"$",
"buffer",
... | Allows the annotation to modify the buffer before the script is compiled.
@param Buffer $buffer
@return void | [
"Allows",
"the",
"annotation",
"to",
"modify",
"the",
"buffer",
"before",
"the",
"script",
"is",
"compiled",
"."
] | train | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Script/Node/Script/ForIn.php#L41-L50 |
zicht/z | src/Zicht/Tool/Script/Node/Script/ForIn.php | ForIn.afterScript | public function afterScript(Buffer $buffer)
{
$buffer->write(sprintf('$z->pop(\'%s\');', $this->key));
$buffer->write(sprintf('$z->pop(\'%s\');', $this->value));
$buffer->indent(-1);
$buffer->writeln('}');
} | php | public function afterScript(Buffer $buffer)
{
$buffer->write(sprintf('$z->pop(\'%s\');', $this->key));
$buffer->write(sprintf('$z->pop(\'%s\');', $this->value));
$buffer->indent(-1);
$buffer->writeln('}');
} | [
"public",
"function",
"afterScript",
"(",
"Buffer",
"$",
"buffer",
")",
"{",
"$",
"buffer",
"->",
"write",
"(",
"sprintf",
"(",
"'$z->pop(\\'%s\\');'",
",",
"$",
"this",
"->",
"key",
")",
")",
";",
"$",
"buffer",
"->",
"write",
"(",
"sprintf",
"(",
"'$... | Allows the annotation to modify the buffer after the script is compiled.
@param Buffer $buffer
@return void | [
"Allows",
"the",
"annotation",
"to",
"modify",
"the",
"buffer",
"after",
"the",
"script",
"is",
"compiled",
"."
] | train | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Script/Node/Script/ForIn.php#L58-L64 |
sokil/php-mongo-yii | src/Sokil/Mongo/Yii/LogRoute.php | LogRoute._timeToMongoDate | protected function _timeToMongoDate($time)
{
if(!is_numeric($time)) {
$time = strtotime($time);
if(!$time) {
$time = time();
}
}
return new \MongoDate($time);
} | php | protected function _timeToMongoDate($time)
{
if(!is_numeric($time)) {
$time = strtotime($time);
if(!$time) {
$time = time();
}
}
return new \MongoDate($time);
} | [
"protected",
"function",
"_timeToMongoDate",
"(",
"$",
"time",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"{",
"$",
"time",
"=",
"strtotime",
"(",
"$",
"time",
")",
";",
"if",
"(",
"!",
"$",
"time",
")",
"{",
"$",
"time",... | Convert time in different formats to mongo date
@param mixed $time
@return \MongoDate | [
"Convert",
"time",
"in",
"different",
"formats",
"to",
"mongo",
"date"
] | train | https://github.com/sokil/php-mongo-yii/blob/d41b3b70953bc6521c73fcacc501e1596a9ed7d3/src/Sokil/Mongo/Yii/LogRoute.php#L16-L26 |
sokil/php-mongo-yii | src/Sokil/Mongo/Yii/LogRoute.php | LogRoute.processLogs | protected function processLogs($logs)
{
$logCollection = \Yii::app()
->{$this->serviceName}
->getCollection($this->collectionName);
foreach ($logs as $log) {
// time
$logCollection
->createDocument(array(
... | php | protected function processLogs($logs)
{
$logCollection = \Yii::app()
->{$this->serviceName}
->getCollection($this->collectionName);
foreach ($logs as $log) {
// time
$logCollection
->createDocument(array(
... | [
"protected",
"function",
"processLogs",
"(",
"$",
"logs",
")",
"{",
"$",
"logCollection",
"=",
"\\",
"Yii",
"::",
"app",
"(",
")",
"->",
"{",
"$",
"this",
"->",
"serviceName",
"}",
"->",
"getCollection",
"(",
"$",
"this",
"->",
"collectionName",
")",
"... | Write log messages
@param array $logs list of messages | [
"Write",
"log",
"messages"
] | train | https://github.com/sokil/php-mongo-yii/blob/d41b3b70953bc6521c73fcacc501e1596a9ed7d3/src/Sokil/Mongo/Yii/LogRoute.php#L32-L52 |
phootwork/lang | src/text/CheckerTrait.php | CheckerTrait.isSingular | public function isSingular(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return $pluralizer->isSingular($this->string);
} | php | public function isSingular(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return $pluralizer->isSingular($this->string);
} | [
"public",
"function",
"isSingular",
"(",
"Pluralizer",
"$",
"pluralizer",
"=",
"null",
")",
"{",
"$",
"pluralizer",
"=",
"$",
"pluralizer",
"?",
":",
"new",
"EnglishPluralizer",
"(",
")",
";",
"return",
"$",
"pluralizer",
"->",
"isSingular",
"(",
"$",
"thi... | Check if a string is singular form.
@param Pluralizer $pluralizer
A custom pluralizer. Default is the EnglishPluralizer
@return boolean | [
"Check",
"if",
"a",
"string",
"is",
"singular",
"form",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/text/CheckerTrait.php#L101-L105 |
phootwork/lang | src/text/CheckerTrait.php | CheckerTrait.isPlural | public function isPlural(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return $pluralizer->isPlural($this->string);
} | php | public function isPlural(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return $pluralizer->isPlural($this->string);
} | [
"public",
"function",
"isPlural",
"(",
"Pluralizer",
"$",
"pluralizer",
"=",
"null",
")",
"{",
"$",
"pluralizer",
"=",
"$",
"pluralizer",
"?",
":",
"new",
"EnglishPluralizer",
"(",
")",
";",
"return",
"$",
"pluralizer",
"->",
"isPlural",
"(",
"$",
"this",
... | Check if a string is plural form.
@param Pluralizer $pluralizer
A custom pluralizer. Default is the EnglishPluralizer
@return boolean | [
"Check",
"if",
"a",
"string",
"is",
"plural",
"form",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/text/CheckerTrait.php#L114-L118 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.output | public function output($tpl, $data = array(), Dwoo_ICompiler $compiler = null)
{
return $this->get($tpl, $data, $compiler, true);
} | php | public function output($tpl, $data = array(), Dwoo_ICompiler $compiler = null)
{
return $this->get($tpl, $data, $compiler, true);
} | [
"public",
"function",
"output",
"(",
"$",
"tpl",
",",
"$",
"data",
"=",
"array",
"(",
")",
",",
"Dwoo_ICompiler",
"$",
"compiler",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"tpl",
",",
"$",
"data",
",",
"$",
"compiler",
... | outputs the template instead of returning it, this is basically a shortcut for get(*, *, *, true)
@see get
@param mixed $tpl template, can either be a Dwoo_ITemplate object (i.e. Dwoo_Template_File), a valid path to a template, or
a template as a string it is recommended to provide a Dwoo_ITemplate as it will probably... | [
"outputs",
"the",
"template",
"instead",
"of",
"returning",
"it",
"this",
"is",
"basically",
"a",
"shortcut",
"for",
"get",
"(",
"*",
"*",
"*",
"true",
")"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L289-L292 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.get | public function get($_tpl, $data = array(), $_compiler = null, $_output = false)
{
// a render call came from within a template, so we need a new dwoo instance in order to avoid breaking this one
if ($this->template instanceof Dwoo_ITemplate) {
$proxy = clone $this;
return $proxy->get($_tpl, $data, $_compile... | php | public function get($_tpl, $data = array(), $_compiler = null, $_output = false)
{
// a render call came from within a template, so we need a new dwoo instance in order to avoid breaking this one
if ($this->template instanceof Dwoo_ITemplate) {
$proxy = clone $this;
return $proxy->get($_tpl, $data, $_compile... | [
"public",
"function",
"get",
"(",
"$",
"_tpl",
",",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"_compiler",
"=",
"null",
",",
"$",
"_output",
"=",
"false",
")",
"{",
"// a render call came from within a template, so we need a new dwoo instance in order to avoid ... | returns the given template rendered using the provided data and optional compiler
@param mixed $tpl template, can either be a Dwoo_ITemplate object (i.e. Dwoo_Template_File), a valid path to a template, or
a template as a string it is recommended to provide a Dwoo_ITemplate as it will probably make things faster,
espe... | [
"returns",
"the",
"given",
"template",
"rendered",
"using",
"the",
"provided",
"data",
"and",
"optional",
"compiler"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L307-L417 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.initRuntimeVars | protected function initRuntimeVars(Dwoo_ITemplate $tpl)
{
$this->runtimePlugins = array();
$this->scope =& $this->data;
$this->scopeTree = array();
$this->stack = array();
$this->curBlock = null;
$this->buffer = '';
} | php | protected function initRuntimeVars(Dwoo_ITemplate $tpl)
{
$this->runtimePlugins = array();
$this->scope =& $this->data;
$this->scopeTree = array();
$this->stack = array();
$this->curBlock = null;
$this->buffer = '';
} | [
"protected",
"function",
"initRuntimeVars",
"(",
"Dwoo_ITemplate",
"$",
"tpl",
")",
"{",
"$",
"this",
"->",
"runtimePlugins",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"scope",
"=",
"&",
"$",
"this",
"->",
"data",
";",
"$",
"this",
"->",
"scopeTr... | re-initializes the runtime variables before each template run
override this method to inject data in the globals array if needed, this
method is called before each template execution
@param Dwoo_ITemplate $tpl the template that is going to be rendered | [
"re",
"-",
"initializes",
"the",
"runtime",
"variables",
"before",
"each",
"template",
"run"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L443-L451 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.addPlugin | public function addPlugin($name, $callback, $compilable = false)
{
$compilable = $compilable ? self::COMPILABLE_PLUGIN : 0;
if (is_array($callback)) {
if (is_subclass_of(is_object($callback[0]) ? get_class($callback[0]) : $callback[0], 'Dwoo_Block_Plugin')) {
$this->plugins[$name] = array('type'=>self::BLOC... | php | public function addPlugin($name, $callback, $compilable = false)
{
$compilable = $compilable ? self::COMPILABLE_PLUGIN : 0;
if (is_array($callback)) {
if (is_subclass_of(is_object($callback[0]) ? get_class($callback[0]) : $callback[0], 'Dwoo_Block_Plugin')) {
$this->plugins[$name] = array('type'=>self::BLOC... | [
"public",
"function",
"addPlugin",
"(",
"$",
"name",
",",
"$",
"callback",
",",
"$",
"compilable",
"=",
"false",
")",
"{",
"$",
"compilable",
"=",
"$",
"compilable",
"?",
"self",
"::",
"COMPILABLE_PLUGIN",
":",
"0",
";",
"if",
"(",
"is_array",
"(",
"$"... | adds a custom plugin that is not in one of the plugin directories
@param string $name the plugin name to be used in the templates
@param callback $callback the plugin callback, either a function name,
a class name or an array containing an object
or class name and a method name
@param bool $compilable if set to true, ... | [
"adds",
"a",
"custom",
"plugin",
"that",
"is",
"not",
"in",
"one",
"of",
"the",
"plugin",
"directories"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L466-L486 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.addFilter | public function addFilter($callback, $autoload = false)
{
if ($autoload) {
$class = 'Dwoo_Filter_'.$callback;
if (!class_exists($class, false) && !function_exists($class)) {
try {
$this->getLoader()->loadPlugin($callback);
} catch (Dwoo_Exception $e) {
if (strstr($callback, 'Dwoo_Filter_')) ... | php | public function addFilter($callback, $autoload = false)
{
if ($autoload) {
$class = 'Dwoo_Filter_'.$callback;
if (!class_exists($class, false) && !function_exists($class)) {
try {
$this->getLoader()->loadPlugin($callback);
} catch (Dwoo_Exception $e) {
if (strstr($callback, 'Dwoo_Filter_')) ... | [
"public",
"function",
"addFilter",
"(",
"$",
"callback",
",",
"$",
"autoload",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"autoload",
")",
"{",
"$",
"class",
"=",
"'Dwoo_Filter_'",
".",
"$",
"callback",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"cl... | adds a filter to this Dwoo instance, it will be used to filter the output of all the templates rendered by this instance
@param mixed $callback a callback or a filter name if it is autoloaded from a plugin directory
@param bool $autoload if true, the first parameter must be a filter name from one of the plugin directo... | [
"adds",
"a",
"filter",
"to",
"this",
"Dwoo",
"instance",
"it",
"will",
"be",
"used",
"to",
"filter",
"the",
"output",
"of",
"all",
"the",
"templates",
"rendered",
"by",
"this",
"instance"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L506-L535 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.removeFilter | public function removeFilter($callback)
{
if (($index = array_search('Dwoo_Filter_'.$callback, $this->filters, true)) !== false) {
unset($this->filters[$index]);
} elseif (($index = array_search($callback, $this->filters, true)) !== false) {
unset($this->filters[$index]);
} else {
$class = 'Dwoo_Filter_... | php | public function removeFilter($callback)
{
if (($index = array_search('Dwoo_Filter_'.$callback, $this->filters, true)) !== false) {
unset($this->filters[$index]);
} elseif (($index = array_search($callback, $this->filters, true)) !== false) {
unset($this->filters[$index]);
} else {
$class = 'Dwoo_Filter_... | [
"public",
"function",
"removeFilter",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"(",
"$",
"index",
"=",
"array_search",
"(",
"'Dwoo_Filter_'",
".",
"$",
"callback",
",",
"$",
"this",
"->",
"filters",
",",
"true",
")",
")",
"!==",
"false",
")",
"{",
... | removes a filter
@param mixed $callback callback or filter name if it was autoloaded | [
"removes",
"a",
"filter"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L542-L557 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.addResource | public function addResource($name, $class, $compilerFactory = null)
{
if (strlen($name) < 2) {
throw new Dwoo_Exception('Resource names must be at least two-character long to avoid conflicts with Windows paths');
}
if (!class_exists($class)) {
throw new Dwoo_Exception('Resource class does not exist');
}... | php | public function addResource($name, $class, $compilerFactory = null)
{
if (strlen($name) < 2) {
throw new Dwoo_Exception('Resource names must be at least two-character long to avoid conflicts with Windows paths');
}
if (!class_exists($class)) {
throw new Dwoo_Exception('Resource class does not exist');
}... | [
"public",
"function",
"addResource",
"(",
"$",
"name",
",",
"$",
"class",
",",
"$",
"compilerFactory",
"=",
"null",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"name",
")",
"<",
"2",
")",
"{",
"throw",
"new",
"Dwoo_Exception",
"(",
"'Resource names must be ... | adds a resource or overrides a default one
@param string $name the resource name
@param string $class the resource class (which must implement Dwoo_ITemplate)
@param callback $compilerFactory the compiler factory callback, a function that must return a compiler instance used to compile this resource, if none is provid... | [
"adds",
"a",
"resource",
"or",
"overrides",
"a",
"default",
"one"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L566-L582 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.getLoader | public function getLoader()
{
if ($this->loader === null) {
$this->loader = new Dwoo_Loader($this->getCompileDir());
}
return $this->loader;
} | php | public function getLoader()
{
if ($this->loader === null) {
$this->loader = new Dwoo_Loader($this->getCompileDir());
}
return $this->loader;
} | [
"public",
"function",
"getLoader",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"loader",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"loader",
"=",
"new",
"Dwoo_Loader",
"(",
"$",
"this",
"->",
"getCompileDir",
"(",
")",
")",
";",
"}",
"return",
"... | returns the current loader object or a default one if none is currently found
@param Dwoo_ILoader | [
"returns",
"the",
"current",
"loader",
"object",
"or",
"a",
"default",
"one",
"if",
"none",
"is",
"currently",
"found"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L616-L623 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.getCacheDir | public function getCacheDir()
{
if ($this->cacheDir === null) {
$this->setCacheDir(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR);
}
return $this->cacheDir;
} | php | public function getCacheDir()
{
if ($this->cacheDir === null) {
$this->setCacheDir(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR);
}
return $this->cacheDir;
} | [
"public",
"function",
"getCacheDir",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacheDir",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setCacheDir",
"(",
"dirname",
"(",
"__FILE__",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'cache'",
".",
"DIRECTORY_SEPAR... | returns the cache directory with a trailing DIRECTORY_SEPARATOR
@return string | [
"returns",
"the",
"cache",
"directory",
"with",
"a",
"trailing",
"DIRECTORY_SEPARATOR"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L642-L649 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.setCacheDir | public function setCacheDir($dir)
{
$this->cacheDir = rtrim($dir, '/\\').DIRECTORY_SEPARATOR;
if (is_writable($this->cacheDir) === false) {
throw new Dwoo_Exception('The cache directory must be writable, chmod "'.$this->cacheDir.'" to make it writable');
}
} | php | public function setCacheDir($dir)
{
$this->cacheDir = rtrim($dir, '/\\').DIRECTORY_SEPARATOR;
if (is_writable($this->cacheDir) === false) {
throw new Dwoo_Exception('The cache directory must be writable, chmod "'.$this->cacheDir.'" to make it writable');
}
} | [
"public",
"function",
"setCacheDir",
"(",
"$",
"dir",
")",
"{",
"$",
"this",
"->",
"cacheDir",
"=",
"rtrim",
"(",
"$",
"dir",
",",
"'/\\\\'",
")",
".",
"DIRECTORY_SEPARATOR",
";",
"if",
"(",
"is_writable",
"(",
"$",
"this",
"->",
"cacheDir",
")",
"==="... | sets the cache directory and automatically appends a DIRECTORY_SEPARATOR
@param string $dir the cache directory | [
"sets",
"the",
"cache",
"directory",
"and",
"automatically",
"appends",
"a",
"DIRECTORY_SEPARATOR"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L656-L662 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.getCompileDir | public function getCompileDir()
{
if ($this->compileDir === null) {
$this->setCompileDir(dirname(__FILE__).DIRECTORY_SEPARATOR.'compiled'.DIRECTORY_SEPARATOR);
}
return $this->compileDir;
} | php | public function getCompileDir()
{
if ($this->compileDir === null) {
$this->setCompileDir(dirname(__FILE__).DIRECTORY_SEPARATOR.'compiled'.DIRECTORY_SEPARATOR);
}
return $this->compileDir;
} | [
"public",
"function",
"getCompileDir",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"compileDir",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setCompileDir",
"(",
"dirname",
"(",
"__FILE__",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'compiled'",
".",
"DIRECT... | returns the compile directory with a trailing DIRECTORY_SEPARATOR
@return string | [
"returns",
"the",
"compile",
"directory",
"with",
"a",
"trailing",
"DIRECTORY_SEPARATOR"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L669-L676 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.setCompileDir | public function setCompileDir($dir)
{
$this->compileDir = rtrim($dir, '/\\').DIRECTORY_SEPARATOR;
if (is_writable($this->compileDir) === false) {
throw new Dwoo_Exception('The compile directory must be writable, chmod "'.$this->compileDir.'" to make it writable');
}
} | php | public function setCompileDir($dir)
{
$this->compileDir = rtrim($dir, '/\\').DIRECTORY_SEPARATOR;
if (is_writable($this->compileDir) === false) {
throw new Dwoo_Exception('The compile directory must be writable, chmod "'.$this->compileDir.'" to make it writable');
}
} | [
"public",
"function",
"setCompileDir",
"(",
"$",
"dir",
")",
"{",
"$",
"this",
"->",
"compileDir",
"=",
"rtrim",
"(",
"$",
"dir",
",",
"'/\\\\'",
")",
".",
"DIRECTORY_SEPARATOR",
";",
"if",
"(",
"is_writable",
"(",
"$",
"this",
"->",
"compileDir",
")",
... | sets the compile directory and automatically appends a DIRECTORY_SEPARATOR
@param string $dir the compile directory | [
"sets",
"the",
"compile",
"directory",
"and",
"automatically",
"appends",
"a",
"DIRECTORY_SEPARATOR"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L683-L689 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.clearCache | public function clearCache($olderThan=-1)
{
$cacheDirs = new RecursiveDirectoryIterator($this->getCacheDir());
$cache = new RecursiveIteratorIterator($cacheDirs);
$expired = time() - $olderThan;
$count = 0;
foreach ($cache as $file) {
if ($cache->isDot() || $cache->isDir() || substr($file, -5) !== '.html'... | php | public function clearCache($olderThan=-1)
{
$cacheDirs = new RecursiveDirectoryIterator($this->getCacheDir());
$cache = new RecursiveIteratorIterator($cacheDirs);
$expired = time() - $olderThan;
$count = 0;
foreach ($cache as $file) {
if ($cache->isDot() || $cache->isDir() || substr($file, -5) !== '.html'... | [
"public",
"function",
"clearCache",
"(",
"$",
"olderThan",
"=",
"-",
"1",
")",
"{",
"$",
"cacheDirs",
"=",
"new",
"RecursiveDirectoryIterator",
"(",
"$",
"this",
"->",
"getCacheDir",
"(",
")",
")",
";",
"$",
"cache",
"=",
"new",
"RecursiveIteratorIterator",
... | [util function] clears the cached templates if they are older than the given time
@param int $olderThan minimum time (in seconds) required for a cached template to be cleared
@return int the amount of templates cleared | [
"[",
"util",
"function",
"]",
"clears",
"the",
"cached",
"templates",
"if",
"they",
"are",
"older",
"than",
"the",
"given",
"time"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L841-L856 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.templateFactory | public function templateFactory($resourceName, $resourceId, $cacheTime = null, $cacheId = null, $compileId = null, Dwoo_ITemplate $parentTemplate = null)
{
if (isset($this->resources[$resourceName])) {
// TODO could be changed to $this->resources[$resourceName]['class']::templateFactory(..) in 5.3 maybe
return... | php | public function templateFactory($resourceName, $resourceId, $cacheTime = null, $cacheId = null, $compileId = null, Dwoo_ITemplate $parentTemplate = null)
{
if (isset($this->resources[$resourceName])) {
// TODO could be changed to $this->resources[$resourceName]['class']::templateFactory(..) in 5.3 maybe
return... | [
"public",
"function",
"templateFactory",
"(",
"$",
"resourceName",
",",
"$",
"resourceId",
",",
"$",
"cacheTime",
"=",
"null",
",",
"$",
"cacheId",
"=",
"null",
",",
"$",
"compileId",
"=",
"null",
",",
"Dwoo_ITemplate",
"$",
"parentTemplate",
"=",
"null",
... | [util function] fetches a template object of the given resource
@param string $resourceName the resource name (i.e. file, string)
@param string $resourceId the resource identifier (i.e. file path)
@param int $cacheTime the cache time setting for this resource
@param string $cacheId the unique cache identifier
@param s... | [
"[",
"util",
"function",
"]",
"fetches",
"a",
"template",
"object",
"of",
"the",
"given",
"resource"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L868-L876 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.isArray | public function isArray($value, $checkIsEmpty=false)
{
if (is_array($value) === true) {
if ($checkIsEmpty === false) {
return true;
} else {
return count($value) > 0;
}
} elseif ($value instanceof Iterator) {
if ($checkIsEmpty === false) {
return true;
} elseif ($value instanceof Countab... | php | public function isArray($value, $checkIsEmpty=false)
{
if (is_array($value) === true) {
if ($checkIsEmpty === false) {
return true;
} else {
return count($value) > 0;
}
} elseif ($value instanceof Iterator) {
if ($checkIsEmpty === false) {
return true;
} elseif ($value instanceof Countab... | [
"public",
"function",
"isArray",
"(",
"$",
"value",
",",
"$",
"checkIsEmpty",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"===",
"true",
")",
"{",
"if",
"(",
"$",
"checkIsEmpty",
"===",
"false",
")",
"{",
"return",
"true",
... | [util function] checks if the input is an array or an iterator object, optionally it can also check if it's empty
@param mixed $value the variable to check
@param bool $checkIsEmpty if true, the function will also check if the array is empty,
and return true only if it's not empty
@return bool true if it's an array (a... | [
"[",
"util",
"function",
"]",
"checks",
"if",
"the",
"input",
"is",
"an",
"array",
"or",
"an",
"iterator",
"object",
"optionally",
"it",
"can",
"also",
"check",
"if",
"it",
"s",
"empty"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L886-L913 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.addStack | public function addStack($blockName, array $args=array())
{
if (isset($this->plugins[$blockName])) {
$class = $this->plugins[$blockName]['class'];
} else {
$class = 'Dwoo_Plugin_'.$blockName;
}
if ($this->curBlock !== null) {
$this->curBlock->buffer(ob_get_contents());
ob_clean();
} else {
$t... | php | public function addStack($blockName, array $args=array())
{
if (isset($this->plugins[$blockName])) {
$class = $this->plugins[$blockName]['class'];
} else {
$class = 'Dwoo_Plugin_'.$blockName;
}
if ($this->curBlock !== null) {
$this->curBlock->buffer(ob_get_contents());
ob_clean();
} else {
$t... | [
"public",
"function",
"addStack",
"(",
"$",
"blockName",
",",
"array",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"plugins",
"[",
"$",
"blockName",
"]",
")",
")",
"{",
"$",
"class",
"=",
"$",
"this"... | [runtime function] adds a block to the block stack
@param string $blockName the block name (without Dwoo_Plugin_ prefix)
@param array $args the arguments to be passed to the block's init() function
@return Dwoo_Block_Plugin the newly created block | [
"[",
"runtime",
"function",
"]",
"adds",
"a",
"block",
"to",
"the",
"block",
"stack"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L940-L975 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.delStack | public function delStack()
{
$args = func_get_args();
$this->curBlock->buffer(ob_get_contents());
ob_clean();
$cnt = count($args);
if ($cnt===0) {
$this->curBlock->end();
} elseif ($cnt===1) {
$this->curBlock->end($args[0]);
} elseif ($cnt===2) {
$this->curBlock->end($args[0], $args[1]);
} e... | php | public function delStack()
{
$args = func_get_args();
$this->curBlock->buffer(ob_get_contents());
ob_clean();
$cnt = count($args);
if ($cnt===0) {
$this->curBlock->end();
} elseif ($cnt===1) {
$this->curBlock->end($args[0]);
} elseif ($cnt===2) {
$this->curBlock->end($args[0], $args[1]);
} e... | [
"public",
"function",
"delStack",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"curBlock",
"->",
"buffer",
"(",
"ob_get_contents",
"(",
")",
")",
";",
"ob_clean",
"(",
")",
";",
"$",
"cnt",
"=",
"count",
"(",
... | [runtime function] removes the plugin at the top of the block stack
calls the block buffer() function, followed by a call to end()
and finally a call to process() | [
"[",
"runtime",
"function",
"]",
"removes",
"the",
"plugin",
"at",
"the",
"top",
"of",
"the",
"block",
"stack"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L983-L1016 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.getParentBlock | public function getParentBlock(Dwoo_Block_Plugin $block)
{
$index = array_search($block, $this->stack, true);
if ($index !== false && $index > 0) {
return $this->stack[$index-1];
}
return false;
} | php | public function getParentBlock(Dwoo_Block_Plugin $block)
{
$index = array_search($block, $this->stack, true);
if ($index !== false && $index > 0) {
return $this->stack[$index-1];
}
return false;
} | [
"public",
"function",
"getParentBlock",
"(",
"Dwoo_Block_Plugin",
"$",
"block",
")",
"{",
"$",
"index",
"=",
"array_search",
"(",
"$",
"block",
",",
"$",
"this",
"->",
"stack",
",",
"true",
")",
";",
"if",
"(",
"$",
"index",
"!==",
"false",
"&&",
"$",
... | [runtime function] returns the parent block of the given block
@param Dwoo_Block_Plugin $block
@return Dwoo_Block_Plugin or false if the given block isn't in the stack | [
"[",
"runtime",
"function",
"]",
"returns",
"the",
"parent",
"block",
"of",
"the",
"given",
"block"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L1024-L1031 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.findBlock | public function findBlock($type)
{
if (isset($this->plugins[$type])) {
$type = $this->plugins[$type]['class'];
} else {
$type = 'Dwoo_Plugin_'.str_replace('Dwoo_Plugin_', '', $type);
}
$keys = array_keys($this->stack);
while (($key = array_pop($keys)) !== false) {
if ($this->stack[$key] instanceof ... | php | public function findBlock($type)
{
if (isset($this->plugins[$type])) {
$type = $this->plugins[$type]['class'];
} else {
$type = 'Dwoo_Plugin_'.str_replace('Dwoo_Plugin_', '', $type);
}
$keys = array_keys($this->stack);
while (($key = array_pop($keys)) !== false) {
if ($this->stack[$key] instanceof ... | [
"public",
"function",
"findBlock",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"plugins",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"plugins",
"[",
"$",
"type",
"]",
"[",
"'class'",
"... | [runtime function] finds the closest block of the given type, starting at the top of the stack
@param string $type the type of plugin you want to find
@return Dwoo_Block_Plugin or false if no plugin of such type is in the stack | [
"[",
"runtime",
"function",
"]",
"finds",
"the",
"closest",
"block",
"of",
"the",
"given",
"type",
"starting",
"at",
"the",
"top",
"of",
"the",
"stack"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L1039-L1054 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.classCall | public function classCall($plugName, array $params = array())
{
$class = 'Dwoo_Plugin_'.$plugName;
$plugin = $this->getObjectPlugin($class);
$cnt = count($params);
if ($cnt===0) {
return $plugin->process();
} elseif ($cnt===1) {
return $plugin->process($params[0]);
} elseif ($cnt===2) {
return $... | php | public function classCall($plugName, array $params = array())
{
$class = 'Dwoo_Plugin_'.$plugName;
$plugin = $this->getObjectPlugin($class);
$cnt = count($params);
if ($cnt===0) {
return $plugin->process();
} elseif ($cnt===1) {
return $plugin->process($params[0]);
} elseif ($cnt===2) {
return $... | [
"public",
"function",
"classCall",
"(",
"$",
"plugName",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"class",
"=",
"'Dwoo_Plugin_'",
".",
"$",
"plugName",
";",
"$",
"plugin",
"=",
"$",
"this",
"->",
"getObjectPlugin",
"(",
"$",
... | [runtime function] calls the process() method of the given class-plugin name
@param string $plugName the class plugin name (without Dwoo_Plugin_ prefix)
@param array $params an array of parameters to send to the process() method
@return string the process() return value | [
"[",
"runtime",
"function",
"]",
"calls",
"the",
"process",
"()",
"method",
"of",
"the",
"given",
"class",
"-",
"plugin",
"name"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L1081-L1101 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.readVarInto | public function readVarInto($varstr, $data, $safeRead = false)
{
if ($data === null) {
return null;
}
if (is_array($varstr) === false) {
preg_match_all('#(\[|->|\.)?((?:[^.[\]-]|-(?!>))+)\]?#i', $varstr, $m);
} else {
$m = $varstr;
}
unset($varstr);
while (list($k, $sep) = each($m[1])) {
if... | php | public function readVarInto($varstr, $data, $safeRead = false)
{
if ($data === null) {
return null;
}
if (is_array($varstr) === false) {
preg_match_all('#(\[|->|\.)?((?:[^.[\]-]|-(?!>))+)\]?#i', $varstr, $m);
} else {
$m = $varstr;
}
unset($varstr);
while (list($k, $sep) = each($m[1])) {
if... | [
"public",
"function",
"readVarInto",
"(",
"$",
"varstr",
",",
"$",
"data",
",",
"$",
"safeRead",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"data",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"varstr",
")",
... | [runtime function] reads a variable into the given data array
@param string $varstr the variable string, using dwoo variable syntax (i.e. "var.subvar[subsubvar]->property")
@param mixed $data the data array or object to read from
@param bool $safeRead if true, the function will check whether the index exists to preven... | [
"[",
"runtime",
"function",
"]",
"reads",
"a",
"variable",
"into",
"the",
"given",
"data",
"array"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L1195-L1225 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.readParentVar | public function readParentVar($parentLevels, $varstr = null)
{
$tree = $this->scopeTree;
$cur = $this->data;
while ($parentLevels--!==0) {
array_pop($tree);
}
while (($i = array_shift($tree)) !== null) {
if (is_object($cur)) {
$cur = $cur->$i;
} else {
$cur = $cur[$i];
}
}
if ($var... | php | public function readParentVar($parentLevels, $varstr = null)
{
$tree = $this->scopeTree;
$cur = $this->data;
while ($parentLevels--!==0) {
array_pop($tree);
}
while (($i = array_shift($tree)) !== null) {
if (is_object($cur)) {
$cur = $cur->$i;
} else {
$cur = $cur[$i];
}
}
if ($var... | [
"public",
"function",
"readParentVar",
"(",
"$",
"parentLevels",
",",
"$",
"varstr",
"=",
"null",
")",
"{",
"$",
"tree",
"=",
"$",
"this",
"->",
"scopeTree",
";",
"$",
"cur",
"=",
"$",
"this",
"->",
"data",
";",
"while",
"(",
"$",
"parentLevels",
"--... | [runtime function] reads a variable into the parent scope
@param int $parentLevels the amount of parent levels to go from the current scope
@param string $varstr the variable string, using dwoo variable syntax (i.e. "var.subvar[subsubvar]->property")
@return mixed | [
"[",
"runtime",
"function",
"]",
"reads",
"a",
"variable",
"into",
"the",
"parent",
"scope"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L1234-L1256 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo.php | Dwoo.assignInScope | public function assignInScope($value, $scope)
{
$tree =& $this->scopeTree;
$data =& $this->data;
if (!is_string($scope)) {
return $this->triggerError('Assignments must be done into strings, ('.gettype($scope).') '.var_export($scope, true).' given', E_USER_ERROR);
}
if (strstr($scope, '.') === false && st... | php | public function assignInScope($value, $scope)
{
$tree =& $this->scopeTree;
$data =& $this->data;
if (!is_string($scope)) {
return $this->triggerError('Assignments must be done into strings, ('.gettype($scope).') '.var_export($scope, true).' given', E_USER_ERROR);
}
if (strstr($scope, '.') === false && st... | [
"public",
"function",
"assignInScope",
"(",
"$",
"value",
",",
"$",
"scope",
")",
"{",
"$",
"tree",
"=",
"&",
"$",
"this",
"->",
"scopeTree",
";",
"$",
"data",
"=",
"&",
"$",
"this",
"->",
"data",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"scop... | [runtime function] assign the value to the given variable
@param mixed $value the value to assign
@param string $scope the variable string, using dwoo variable syntax (i.e. "var.subvar[subsubvar]->property")
@return bool true if assigned correctly or false if a problem occured while parsing the var string | [
"[",
"runtime",
"function",
"]",
"assign",
"the",
"value",
"to",
"the",
"given",
"variable"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo.php#L1408-L1455 |
silvercommerce/geozones | src/Tasks/ZoneMigrationTask.php | ZoneMigrationTask.up | public function up() {
$zones = Zone::get();
$this->log('Migrating Zones');
$i = 0;
foreach ($zones as $zone) {
$countries = json_decode($zone->Country);
if (empty($countries) && isset($zone->Country)) {
$countries = [$zone->Country];
... | php | public function up() {
$zones = Zone::get();
$this->log('Migrating Zones');
$i = 0;
foreach ($zones as $zone) {
$countries = json_decode($zone->Country);
if (empty($countries) && isset($zone->Country)) {
$countries = [$zone->Country];
... | [
"public",
"function",
"up",
"(",
")",
"{",
"$",
"zones",
"=",
"Zone",
"::",
"get",
"(",
")",
";",
"$",
"this",
"->",
"log",
"(",
"'Migrating Zones'",
")",
";",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"zones",
"as",
"$",
"zone",
")",
"{",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/silvercommerce/geozones/blob/85af587805ae5cc6dce6a890ca04b338cf5552cb/src/Tasks/ZoneMigrationTask.php#L44-L62 |
silvercommerce/geozones | src/Tasks/ZoneMigrationTask.php | ZoneMigrationTask.down | public function down() {
$zones = Zone::get();
$this->log('Downgrading Zones');
$i = 0;
foreach ($zones as $zone) {
$countries = json_decode($zone->Country);
if (is_array($countries)) {
$zone->Country = $countries[0];
$zone->write();
... | php | public function down() {
$zones = Zone::get();
$this->log('Downgrading Zones');
$i = 0;
foreach ($zones as $zone) {
$countries = json_decode($zone->Country);
if (is_array($countries)) {
$zone->Country = $countries[0];
$zone->write();
... | [
"public",
"function",
"down",
"(",
")",
"{",
"$",
"zones",
"=",
"Zone",
"::",
"get",
"(",
")",
";",
"$",
"this",
"->",
"log",
"(",
"'Downgrading Zones'",
")",
";",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"zones",
"as",
"$",
"zone",
")",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/silvercommerce/geozones/blob/85af587805ae5cc6dce6a890ca04b338cf5552cb/src/Tasks/ZoneMigrationTask.php#L67-L84 |
nblum/silverstripe-flexible-content | code/GridFieldActiveAction.php | GridFieldActiveAction.handleAction | public function handleAction(\GridField $gridField, $actionName, $arguments, $data) {
if ($actionName == 'toggle-active') {
$item = $gridField->getList()->byID($arguments['RecordID']);
if (!$item) {
return;
}
if ($item->getField('Active')) {
... | php | public function handleAction(\GridField $gridField, $actionName, $arguments, $data) {
if ($actionName == 'toggle-active') {
$item = $gridField->getList()->byID($arguments['RecordID']);
if (!$item) {
return;
}
if ($item->getField('Active')) {
... | [
"public",
"function",
"handleAction",
"(",
"\\",
"GridField",
"$",
"gridField",
",",
"$",
"actionName",
",",
"$",
"arguments",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"actionName",
"==",
"'toggle-active'",
")",
"{",
"$",
"item",
"=",
"$",
"gridField"... | Handle the actions and apply any changes to the GridField
@param \GridField $gridField
@param string $actionName
@param mixed $arguments
@param array $data - form data
@return void | [
"Handle",
"the",
"actions",
"and",
"apply",
"any",
"changes",
"to",
"the",
"GridField"
] | train | https://github.com/nblum/silverstripe-flexible-content/blob/e20a06ee98b7f884965a951653d98af11eb6bc67/code/GridFieldActiveAction.php#L117-L131 |
ekuiter/feature-php | FeaturePhp/ProductLine/Product.php | Product.getAllGenerators | private function getAllGenerators() {
$allGenerators = array();
foreach (fphp\Generator\Generator::getGeneratorMap() as $key => $klass)
$allGenerators[$key] = new $klass($this->productLine->getGeneratorSettings($key));
return $allGenerators;
} | php | private function getAllGenerators() {
$allGenerators = array();
foreach (fphp\Generator\Generator::getGeneratorMap() as $key => $klass)
$allGenerators[$key] = new $klass($this->productLine->getGeneratorSettings($key));
return $allGenerators;
} | [
"private",
"function",
"getAllGenerators",
"(",
")",
"{",
"$",
"allGenerators",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"fphp",
"\\",
"Generator",
"\\",
"Generator",
"::",
"getGeneratorMap",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"klass",
")",
"$",
... | Returns all generators.
The generators are instantiated with their respective generator settings.
@return \FeaturePhp\Generator\Generator[] | [
"Returns",
"all",
"generators",
".",
"The",
"generators",
"are",
"instantiated",
"with",
"their",
"respective",
"generator",
"settings",
"."
] | train | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/ProductLine/Product.php#L69-L74 |
ekuiter/feature-php | FeaturePhp/ProductLine/Product.php | Product.addArtifactToUsedGenerators | private function addArtifactToUsedGenerators($allGenerators, $feature, $func) {
$artifact = $this->productLine->getArtifact($feature);
foreach ($artifact->getGenerators() as $key => $cfg) {
if (!array_key_exists($key, $allGenerators))
throw new ProductException("\"$key\" is n... | php | private function addArtifactToUsedGenerators($allGenerators, $feature, $func) {
$artifact = $this->productLine->getArtifact($feature);
foreach ($artifact->getGenerators() as $key => $cfg) {
if (!array_key_exists($key, $allGenerators))
throw new ProductException("\"$key\" is n... | [
"private",
"function",
"addArtifactToUsedGenerators",
"(",
"$",
"allGenerators",
",",
"$",
"feature",
",",
"$",
"func",
")",
"{",
"$",
"artifact",
"=",
"$",
"this",
"->",
"productLine",
"->",
"getArtifact",
"(",
"$",
"feature",
")",
";",
"foreach",
"(",
"$... | Adds a feature's artifact to all generators it specifies.
This is done independently from whether the corresponding feature is
selected or deselected to support generating code for both cases.
@param \FeaturePhp\Generator\Generator[] $allGenerators
@param \FeaturePhp\Model\Feature $feature
@param callable $func whether... | [
"Adds",
"a",
"feature",
"s",
"artifact",
"to",
"all",
"generators",
"it",
"specifies",
".",
"This",
"is",
"done",
"independently",
"from",
"whether",
"the",
"corresponding",
"feature",
"is",
"selected",
"or",
"deselected",
"to",
"support",
"generating",
"code",
... | train | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/ProductLine/Product.php#L84-L91 |
ekuiter/feature-php | FeaturePhp/ProductLine/Product.php | Product.getGeneratorElements | private function getGeneratorElements($func) {
$allGenerators = $this->getAllGenerators();
foreach ($this->configuration->getSelectedFeatures() as $feature)
$this->addArtifactToUsedGenerators($allGenerators, $feature, "addSelectedArtifact");
foreach ($this->configuration->getDesele... | php | private function getGeneratorElements($func) {
$allGenerators = $this->getAllGenerators();
foreach ($this->configuration->getSelectedFeatures() as $feature)
$this->addArtifactToUsedGenerators($allGenerators, $feature, "addSelectedArtifact");
foreach ($this->configuration->getDesele... | [
"private",
"function",
"getGeneratorElements",
"(",
"$",
"func",
")",
"{",
"$",
"allGenerators",
"=",
"$",
"this",
"->",
"getAllGenerators",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"configuration",
"->",
"getSelectedFeatures",
"(",
")",
"as",
"$",
... | Returns elements generated for the product.
To do this, every artifact is registered with the generators it specifies.
Then every generator generates some elements. Finally all the elements are merged.
@param callable $func
@return mixed[] | [
"Returns",
"elements",
"generated",
"for",
"the",
"product",
".",
"To",
"do",
"this",
"every",
"artifact",
"is",
"registered",
"with",
"the",
"generators",
"it",
"specifies",
".",
"Then",
"every",
"generator",
"generates",
"some",
"elements",
".",
"Finally",
"... | train | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/ProductLine/Product.php#L100-L114 |
ekuiter/feature-php | FeaturePhp/ProductLine/Product.php | Product.generateFiles | public function generateFiles() {
$files = $this->getGeneratorElements("generateFiles");
$files = fphp\Helper\_Array::assertNoDuplicates($files, "getTarget");
$files = fphp\Helper\_Array::sortByKey($files, "getTarget");
return $files;
} | php | public function generateFiles() {
$files = $this->getGeneratorElements("generateFiles");
$files = fphp\Helper\_Array::assertNoDuplicates($files, "getTarget");
$files = fphp\Helper\_Array::sortByKey($files, "getTarget");
return $files;
} | [
"public",
"function",
"generateFiles",
"(",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"getGeneratorElements",
"(",
"\"generateFiles\"",
")",
";",
"$",
"files",
"=",
"fphp",
"\\",
"Helper",
"\\",
"_Array",
"::",
"assertNoDuplicates",
"(",
"$",
"files",
... | Generates the product's files.
@return \FeaturePhp\File\File[] | [
"Generates",
"the",
"product",
"s",
"files",
"."
] | train | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/ProductLine/Product.php#L120-L125 |
ekuiter/feature-php | FeaturePhp/ProductLine/Product.php | Product.trace | public function trace() {
$tracingLinks = array_merge(
$this->getGeneratorElements("trace"),
$this->getAllGenerators()["runtime"]->traceRuntimeCalls($this->generateFiles(), $this->productLine)
);
$tracingLinks = fphp\Helper\_Array::sortByKey($tracingLinks, "getFeatureName... | php | public function trace() {
$tracingLinks = array_merge(
$this->getGeneratorElements("trace"),
$this->getAllGenerators()["runtime"]->traceRuntimeCalls($this->generateFiles(), $this->productLine)
);
$tracingLinks = fphp\Helper\_Array::sortByKey($tracingLinks, "getFeatureName... | [
"public",
"function",
"trace",
"(",
")",
"{",
"$",
"tracingLinks",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"getGeneratorElements",
"(",
"\"trace\"",
")",
",",
"$",
"this",
"->",
"getAllGenerators",
"(",
")",
"[",
"\"runtime\"",
"]",
"->",
"traceRuntimeCa... | Returns tracing links for the product.
@return \FeaturePhp\Artifact\TracingLink[] | [
"Returns",
"tracing",
"links",
"for",
"the",
"product",
"."
] | train | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/ProductLine/Product.php#L131-L138 |
ouropencode/dachi | src/Session.php | Session.start | public static function start($name, $domain = "", $forceHttps = false) {
session_name('sess_' . $name);
$domain = $domain ? $domain : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : "");
$https = $forceHttps ? true : isset($_SERVER['HTTPS']);
if($domain == "localhost" || $domain == ".localhost")
... | php | public static function start($name, $domain = "", $forceHttps = false) {
session_name('sess_' . $name);
$domain = $domain ? $domain : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : "");
$https = $forceHttps ? true : isset($_SERVER['HTTPS']);
if($domain == "localhost" || $domain == ".localhost")
... | [
"public",
"static",
"function",
"start",
"(",
"$",
"name",
",",
"$",
"domain",
"=",
"\"\"",
",",
"$",
"forceHttps",
"=",
"false",
")",
"{",
"session_name",
"(",
"'sess_'",
".",
"$",
"name",
")",
";",
"$",
"domain",
"=",
"$",
"domain",
"?",
"$",
"do... | Start a session
@param string $name The session name
@param string $domain The domain this session is attached to. (defaults to php's SERVER_NAME)
@param boolean $forceHttps Allow session only via HTTPS (defaults to 'yes if user is currently via HTTPS')
@return null | [
"Start",
"a",
"session"
] | train | https://github.com/ouropencode/dachi/blob/a0e1daf269d0345afbb859ce20ef9da6decd7efe/src/Session.php#L22-L54 |
ouropencode/dachi | src/Session.php | Session.hasSessionMoved | public static function hasSessionMoved() {
if(!isset($_SESSION['dachi_agent']))
return true;
$agents = $_SESSION['dachi_agent'];
$agentc = $_SERVER['HTTP_USER_AGENT'];
if($agents != $agentc) {
if(strpos($agentc, "Trident") !== false && strpos($agents, "Trident") !== false)
return false;
return t... | php | public static function hasSessionMoved() {
if(!isset($_SESSION['dachi_agent']))
return true;
$agents = $_SESSION['dachi_agent'];
$agentc = $_SERVER['HTTP_USER_AGENT'];
if($agents != $agentc) {
if(strpos($agentc, "Trident") !== false && strpos($agents, "Trident") !== false)
return false;
return t... | [
"public",
"static",
"function",
"hasSessionMoved",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SESSION",
"[",
"'dachi_agent'",
"]",
")",
")",
"return",
"true",
";",
"$",
"agents",
"=",
"$",
"_SESSION",
"[",
"'dachi_agent'",
"]",
";",
"$",
"agen... | Has this session moved
Moving is currently defined as "changing user agent".
@return boolean | [
"Has",
"this",
"session",
"moved"
] | train | https://github.com/ouropencode/dachi/blob/a0e1daf269d0345afbb859ce20ef9da6decd7efe/src/Session.php#L63-L78 |
ouropencode/dachi | src/Session.php | Session.isValid | public static function isValid() {
if(isset($_SESSION['dachi_closed']) && !isset($_SESSION['dachi_expires']))
return false;
if(isset($_SESSION['dachi_expires']) && $_SESSION['dachi_expires'] < time())
return false;
return true;
} | php | public static function isValid() {
if(isset($_SESSION['dachi_closed']) && !isset($_SESSION['dachi_expires']))
return false;
if(isset($_SESSION['dachi_expires']) && $_SESSION['dachi_expires'] < time())
return false;
return true;
} | [
"public",
"static",
"function",
"isValid",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SESSION",
"[",
"'dachi_closed'",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"_SESSION",
"[",
"'dachi_expires'",
"]",
")",
")",
"return",
"false",
";",
"if",
"(",
"... | Is this session still valid?
Sessions are invalidated 10 seconds after regeneration, this is to allow AJAX
requests to complete execution before terminating the session. This method will
return false if the 10 second period has expired.
@return boolean | [
"Is",
"this",
"session",
"still",
"valid?"
] | train | https://github.com/ouropencode/dachi/blob/a0e1daf269d0345afbb859ce20ef9da6decd7efe/src/Session.php#L89-L97 |
ouropencode/dachi | src/Session.php | Session.regenerate | public static function regenerate() {
if(isset($_SESSION['dachi_closed']) && $_SESSION['dachi_closed'] == true)
return false;
$_SESSION['dachi_closed'] = true;
$_SESSION['dachi_expires'] = time() + 10;
session_regenerate_id(false);
$new_session = session_id();
session_write_close();
session_id($new... | php | public static function regenerate() {
if(isset($_SESSION['dachi_closed']) && $_SESSION['dachi_closed'] == true)
return false;
$_SESSION['dachi_closed'] = true;
$_SESSION['dachi_expires'] = time() + 10;
session_regenerate_id(false);
$new_session = session_id();
session_write_close();
session_id($new... | [
"public",
"static",
"function",
"regenerate",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SESSION",
"[",
"'dachi_closed'",
"]",
")",
"&&",
"$",
"_SESSION",
"[",
"'dachi_closed'",
"]",
"==",
"true",
")",
"return",
"false",
";",
"$",
"_SESSION",
"[",
... | Regenerate the session for security
There is a 5% random chance on any page request that the session ID will be regenerated
and a new session identity served to the user. This prevents static session IDs that
can be stolen and reused.
This method sets the old session to expire in 10 seconds. This allows for any pendi... | [
"Regenerate",
"the",
"session",
"for",
"security"
] | train | https://github.com/ouropencode/dachi/blob/a0e1daf269d0345afbb859ce20ef9da6decd7efe/src/Session.php#L111-L128 |
gitiki/Gitiki | src/Git/Gitonomy/Commit.php | Commit.getDiffFile | public function getDiffFile($file)
{
$args = [
'-r', '-p', '-m', '-M', '--no-commit-id', '--full-index', $this->revision,
'--', $this->repository->getWikiDir().$file,
];
$diff = Diff::parse($this->repository->run('diff-tree', $args));
$diff->setRepository($th... | php | public function getDiffFile($file)
{
$args = [
'-r', '-p', '-m', '-M', '--no-commit-id', '--full-index', $this->revision,
'--', $this->repository->getWikiDir().$file,
];
$diff = Diff::parse($this->repository->run('diff-tree', $args));
$diff->setRepository($th... | [
"public",
"function",
"getDiffFile",
"(",
"$",
"file",
")",
"{",
"$",
"args",
"=",
"[",
"'-r'",
",",
"'-p'",
",",
"'-m'",
",",
"'-M'",
",",
"'--no-commit-id'",
",",
"'--full-index'",
",",
"$",
"this",
"->",
"revision",
",",
"'--'",
",",
"$",
"this",
... | @param string $file Path to file
@return Diff | [
"@param",
"string",
"$file",
"Path",
"to",
"file"
] | train | https://github.com/gitiki/Gitiki/blob/f017672d4f5d0ef6015fad44724f05e3b1f08463/src/Git/Gitonomy/Commit.php#L23-L34 |
ShaoZeMing/laravel-merchant | src/Console/InstallCommand.php | InstallCommand.initDatabase | public function initDatabase()
{
$this->call('migrate');
if (Administrator::count() == 0) {
$this->call('db:seed', ['--class' => \ShaoZeMing\Merchant\Auth\Database\AdminTablesSeeder::class]);
}
} | php | public function initDatabase()
{
$this->call('migrate');
if (Administrator::count() == 0) {
$this->call('db:seed', ['--class' => \ShaoZeMing\Merchant\Auth\Database\AdminTablesSeeder::class]);
}
} | [
"public",
"function",
"initDatabase",
"(",
")",
"{",
"$",
"this",
"->",
"call",
"(",
"'migrate'",
")",
";",
"if",
"(",
"Administrator",
"::",
"count",
"(",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"call",
"(",
"'db:seed'",
",",
"[",
"'--class'",
... | Create tables and seed it.
@return void | [
"Create",
"tables",
"and",
"seed",
"it",
"."
] | train | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Console/InstallCommand.php#L48-L55 |
ShaoZeMing/laravel-merchant | src/Console/InstallCommand.php | InstallCommand.createExampleController | public function createExampleController()
{
$exampleController = $this->directory.'/Controllers/ExampleController.php';
$contents = $this->getStub('ExampleController');
$this->laravel['files']->put(
$exampleController,
str_replace('DummyNamespace', config('merchant.r... | php | public function createExampleController()
{
$exampleController = $this->directory.'/Controllers/ExampleController.php';
$contents = $this->getStub('ExampleController');
$this->laravel['files']->put(
$exampleController,
str_replace('DummyNamespace', config('merchant.r... | [
"public",
"function",
"createExampleController",
"(",
")",
"{",
"$",
"exampleController",
"=",
"$",
"this",
"->",
"directory",
".",
"'/Controllers/ExampleController.php'",
";",
"$",
"contents",
"=",
"$",
"this",
"->",
"getStub",
"(",
"'ExampleController'",
")",
";... | Create HomeController.
@return void | [
"Create",
"HomeController",
"."
] | train | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Console/InstallCommand.php#L106-L116 |
netzmacht/contao-leaflet-geocode-widget | src/Widget/GeocodeWidget.php | GeocodeWidget.validator | protected function validator($value)
{
$value = parent::validator($value);
if (!$value) {
return $value;
}
if (is_array($value)) {
foreach ($value as $key => $val) {
$value[$key] = $this->validator($val);
}
return $va... | php | protected function validator($value)
{
$value = parent::validator($value);
if (!$value) {
return $value;
}
if (is_array($value)) {
foreach ($value as $key => $val) {
$value[$key] = $this->validator($val);
}
return $va... | [
"protected",
"function",
"validator",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"parent",
"::",
"validator",
"(",
"$",
"value",
")",
";",
"if",
"(",
"!",
"$",
"value",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"is_array",
"(",
... | Validate the input.
@param mixed $value Given value.
@return mixed
@SuppressWarnings(PHPMD.Superglobals) | [
"Validate",
"the",
"input",
"."
] | train | https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/08acfbc473696f385d7c6aed6148e51c91443e12/src/Widget/GeocodeWidget.php#L60-L90 |
netzmacht/contao-leaflet-geocode-widget | src/Widget/GeocodeWidget.php | GeocodeWidget.generate | public function generate()
{
$wrapperClass = 'wizard';
if (!$this->multiple || !$this->size) {
$this->size = 1;
} else {
$wrapperClass .= ' wizard_' . $this->size;
}
if (!is_array($this->value)) {
$this->value = [$this->value];
}
... | php | public function generate()
{
$wrapperClass = 'wizard';
if (!$this->multiple || !$this->size) {
$this->size = 1;
} else {
$wrapperClass .= ' wizard_' . $this->size;
}
if (!is_array($this->value)) {
$this->value = [$this->value];
}
... | [
"public",
"function",
"generate",
"(",
")",
"{",
"$",
"wrapperClass",
"=",
"'wizard'",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"multiple",
"||",
"!",
"$",
"this",
"->",
"size",
")",
"{",
"$",
"this",
"->",
"size",
"=",
"1",
";",
"}",
"else",
"{",... | Generate the widget.
@return string | [
"Generate",
"the",
"widget",
"."
] | train | https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/08acfbc473696f385d7c6aed6148e51c91443e12/src/Widget/GeocodeWidget.php#L97-L134 |
netzmacht/contao-leaflet-geocode-widget | src/Widget/GeocodeWidget.php | GeocodeWidget.buildRadiusOptions | private function buildRadiusOptions()
{
if (!$this->radius || !isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->radius])) {
return null;
}
$options = [
'element' => 'ctrl_' . $this->radius,
'min' => 0,
'max' =>... | php | private function buildRadiusOptions()
{
if (!$this->radius || !isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->radius])) {
return null;
}
$options = [
'element' => 'ctrl_' . $this->radius,
'min' => 0,
'max' =>... | [
"private",
"function",
"buildRadiusOptions",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"radius",
"||",
"!",
"isset",
"(",
"$",
"GLOBALS",
"[",
"'TL_DCA'",
"]",
"[",
"$",
"this",
"->",
"strTable",
"]",
"[",
"'fields'",
"]",
"[",
"$",
"this",
... | Build the radius options.
@return array|null
@SuppressWarnings(PHPMD.Superglobals) | [
"Build",
"the",
"radius",
"options",
"."
] | train | https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/08acfbc473696f385d7c6aed6148e51c91443e12/src/Widget/GeocodeWidget.php#L143-L166 |
ajgarlag/AjglCsv | src/Charset/IconvConverter.php | IconvConverter.convert | public function convert($value, $inputCharset, $outputCharset)
{
if ($inputCharset !== $outputCharset) {
$value = iconv($inputCharset, $outputCharset, $value);
}
return $value;
} | php | public function convert($value, $inputCharset, $outputCharset)
{
if ($inputCharset !== $outputCharset) {
$value = iconv($inputCharset, $outputCharset, $value);
}
return $value;
} | [
"public",
"function",
"convert",
"(",
"$",
"value",
",",
"$",
"inputCharset",
",",
"$",
"outputCharset",
")",
"{",
"if",
"(",
"$",
"inputCharset",
"!==",
"$",
"outputCharset",
")",
"{",
"$",
"value",
"=",
"iconv",
"(",
"$",
"inputCharset",
",",
"$",
"o... | {@inheritdoc} | [
"{"
] | train | https://github.com/ajgarlag/AjglCsv/blob/28872f58b9ef864893cac6faddfcb1229c2c2047/src/Charset/IconvConverter.php#L22-L29 |
DevGroup-ru/yii2-users-module | src/actions/BackendEditRbac.php | BackendEditRbac.run | public function run($id = null, $type)
{
$roleText = Yii::t('users', 'Role');
$permText = Yii::t('users', 'Permission');
if ($type == Item::TYPE_ROLE) {
$modelName = $roleText;
$permName = 'users-role-edit';
} else {
$modelName = $permText;
... | php | public function run($id = null, $type)
{
$roleText = Yii::t('users', 'Role');
$permText = Yii::t('users', 'Permission');
if ($type == Item::TYPE_ROLE) {
$modelName = $roleText;
$permName = 'users-role-edit';
} else {
$modelName = $permText;
... | [
"public",
"function",
"run",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"type",
")",
"{",
"$",
"roleText",
"=",
"Yii",
"::",
"t",
"(",
"'users'",
",",
"'Role'",
")",
";",
"$",
"permText",
"=",
"Yii",
"::",
"t",
"(",
"'users'",
",",
"'Permission'",
")... | Updates or creates RBAC Item
Type of item depends of given type
@param null | string $id
@param int $type
@return string|\yii\web\Response
@throws ForbiddenHttpException
@throws NotFoundHttpException | [
"Updates",
"or",
"creates",
"RBAC",
"Item",
"Type",
"of",
"item",
"depends",
"of",
"given",
"type"
] | train | https://github.com/DevGroup-ru/yii2-users-module/blob/ff0103dc55c3462627ccc704c33e70c96053f750/src/actions/BackendEditRbac.php#L36-L113 |
nabab/bbn | src/bbn/db/json.php | json.escape | public function escape($item)
{
if ( \is_string($item) && ($item = trim($item)) ){
$items = explode(".", str_replace("`", "", $item));
$r = [];
foreach ( $items as $m ){
if ( !bbn\str::check_name($m) ){
return false;
}
array_push($r, "`".$m."`");
}
re... | php | public function escape($item)
{
if ( \is_string($item) && ($item = trim($item)) ){
$items = explode(".", str_replace("`", "", $item));
$r = [];
foreach ( $items as $m ){
if ( !bbn\str::check_name($m) ){
return false;
}
array_push($r, "`".$m."`");
}
re... | [
"public",
"function",
"escape",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"item",
")",
"&&",
"(",
"$",
"item",
"=",
"trim",
"(",
"$",
"item",
")",
")",
")",
"{",
"$",
"items",
"=",
"explode",
"(",
"\".\"",
",",
"str_re... | Returns a database item expression escaped like database, table, column, key names
@param string $item The item's name (escaped or not)
@return string | false | [
"Returns",
"a",
"database",
"item",
"expression",
"escaped",
"like",
"database",
"table",
"column",
"key",
"names"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/json.php#L89-L103 |
nabab/bbn | src/bbn/db/json.php | json.table_full_name | public function table_full_name($table, $escaped=false)
{
if ( \is_string($table) && ($table = trim($table)) ){
$mtable = explode(".", str_replace("`", "", $table));
if ( \count($mtable) === 3 ){
$db = trim($mtable[0]);
$table = trim($mtable[1]);
}
else if ( \count($mtable) ... | php | public function table_full_name($table, $escaped=false)
{
if ( \is_string($table) && ($table = trim($table)) ){
$mtable = explode(".", str_replace("`", "", $table));
if ( \count($mtable) === 3 ){
$db = trim($mtable[0]);
$table = trim($mtable[1]);
}
else if ( \count($mtable) ... | [
"public",
"function",
"table_full_name",
"(",
"$",
"table",
",",
"$",
"escaped",
"=",
"false",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"table",
")",
"&&",
"(",
"$",
"table",
"=",
"trim",
"(",
"$",
"table",
")",
")",
")",
"{",
"$",
"mtab... | Returns a table's full name i.e. database.table
@param string $table The table's name (escaped or not)
@param bool $escaped If set to true the returned string will be escaped
@return string | false | [
"Returns",
"a",
"table",
"s",
"full",
"name",
"i",
".",
"e",
".",
"database",
".",
"table"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/json.php#L112-L133 |
nabab/bbn | src/bbn/db/json.php | json.table_simple_name | public function table_simple_name($table, $escaped=false)
{
if ( \is_string($table) && ($table = trim($table)) ){
$mtable = explode(".", str_replace("`", "", $table));
switch ( \count($mtable) ){
case 1:
$table = $mtable[0];
break;
case 2:
$table = $mtable... | php | public function table_simple_name($table, $escaped=false)
{
if ( \is_string($table) && ($table = trim($table)) ){
$mtable = explode(".", str_replace("`", "", $table));
switch ( \count($mtable) ){
case 1:
$table = $mtable[0];
break;
case 2:
$table = $mtable... | [
"public",
"function",
"table_simple_name",
"(",
"$",
"table",
",",
"$",
"escaped",
"=",
"false",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"table",
")",
"&&",
"(",
"$",
"table",
"=",
"trim",
"(",
"$",
"table",
")",
")",
")",
"{",
"$",
"mt... | Returns a table's simple name i.e. table
@param string $table The table's name (escaped or not)
@param bool $escaped If set to true the returned string will be escaped
@return string | false | [
"Returns",
"a",
"table",
"s",
"simple",
"name",
"i",
".",
"e",
".",
"table"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/json.php#L142-L162 |
nabab/bbn | src/bbn/db/json.php | json.col_full_name | public function col_full_name($col, $table='', $escaped=false)
{
if ( \is_string($col) && ($col = trim($col)) ){
$mcol = explode(".", str_replace("`", "", $col));
if ( \count($mcol) > 1 ){
$col = array_pop($mcol);
$table = array_pop($mcol);
$ok = 1;
}
else if ( !emp... | php | public function col_full_name($col, $table='', $escaped=false)
{
if ( \is_string($col) && ($col = trim($col)) ){
$mcol = explode(".", str_replace("`", "", $col));
if ( \count($mcol) > 1 ){
$col = array_pop($mcol);
$table = array_pop($mcol);
$ok = 1;
}
else if ( !emp... | [
"public",
"function",
"col_full_name",
"(",
"$",
"col",
",",
"$",
"table",
"=",
"''",
",",
"$",
"escaped",
"=",
"false",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"col",
")",
"&&",
"(",
"$",
"col",
"=",
"trim",
"(",
"$",
"col",
")",
")"... | Returns a column's full name i.e. table.column
@param string $col The column's name (escaped or not)
@param string $table The table's name (escaped or not)
@param bool $escaped If set to true the returned string will be escaped
@return string | false | [
"Returns",
"a",
"column",
"s",
"full",
"name",
"i",
".",
"e",
".",
"table",
".",
"column"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/json.php#L172-L191 |
nabab/bbn | src/bbn/db/json.php | json.col_simple_name | public function col_simple_name($col, $escaped=false)
{
if ( \is_string($col) && ($col = trim($col)) ){
$mcol = explode(".", str_replace("`", "", $col));
$col = end($mcol);
if ( bbn\str::check_name($col) ){
return $escaped ? "`".$col."`" : $col;
}
}
return false;
} | php | public function col_simple_name($col, $escaped=false)
{
if ( \is_string($col) && ($col = trim($col)) ){
$mcol = explode(".", str_replace("`", "", $col));
$col = end($mcol);
if ( bbn\str::check_name($col) ){
return $escaped ? "`".$col."`" : $col;
}
}
return false;
} | [
"public",
"function",
"col_simple_name",
"(",
"$",
"col",
",",
"$",
"escaped",
"=",
"false",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"col",
")",
"&&",
"(",
"$",
"col",
"=",
"trim",
"(",
"$",
"col",
")",
")",
")",
"{",
"$",
"mcol",
"="... | Returns a column's simple name i.e. column
@param string $col The column's name (escaped or not)
@param bool $escaped If set to true the returned string will be escaped
@return string | false | [
"Returns",
"a",
"column",
"s",
"simple",
"name",
"i",
".",
"e",
".",
"column"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/json.php#L200-L210 |
nabab/bbn | src/bbn/db/json.php | json.get_column_values | public function get_column_values($table, $field, array $where = [], $limit = false, $start = 0, $php = false)
{
if ( bbn\str::check_name($field) && ( $table = $this->table_full_name($table, 1) ) && ( $m = $this->db->modelize($table) ) && \count($m['fields']) > 0 )
{
$r = '';
if ( $php ){
$r .= '$db->... | php | public function get_column_values($table, $field, array $where = [], $limit = false, $start = 0, $php = false)
{
if ( bbn\str::check_name($field) && ( $table = $this->table_full_name($table, 1) ) && ( $m = $this->db->modelize($table) ) && \count($m['fields']) > 0 )
{
$r = '';
if ( $php ){
$r .= '$db->... | [
"public",
"function",
"get_column_values",
"(",
"$",
"table",
",",
"$",
"field",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"$",
"limit",
"=",
"false",
",",
"$",
"start",
"=",
"0",
",",
"$",
"php",
"=",
"false",
")",
"{",
"if",
"(",
"bbn",
... | Return an array of each values of the field $field in the table $table
@return false|array | [
"Return",
"an",
"array",
"of",
"each",
"values",
"of",
"the",
"field",
"$field",
"in",
"the",
"table",
"$table"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/json.php#L651-L674 |
nabab/bbn | src/bbn/db/json.php | json.get_values_count | public function get_values_count($table, $field, array $where = [], $limit, $start, $php = false)
{
if ( ( $table = $this->table_full_name($table, 1) ) && ( $m = $this->db->modelize($table) ) && \count($m['fields']) > 0 )
{
$r = '';
if ( $php ){
$r .= '$db->query("';
}
if ( !isset($m['fields']... | php | public function get_values_count($table, $field, array $where = [], $limit, $start, $php = false)
{
if ( ( $table = $this->table_full_name($table, 1) ) && ( $m = $this->db->modelize($table) ) && \count($m['fields']) > 0 )
{
$r = '';
if ( $php ){
$r .= '$db->query("';
}
if ( !isset($m['fields']... | [
"public",
"function",
"get_values_count",
"(",
"$",
"table",
",",
"$",
"field",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"$",
"limit",
",",
"$",
"start",
",",
"$",
"php",
"=",
"false",
")",
"{",
"if",
"(",
"(",
"$",
"table",
"=",
"$",
"t... | Return an array of double values arrays: each value of the field $field in the table $table and the number of instances
@return false|array | [
"Return",
"an",
"array",
"of",
"double",
"values",
"arrays",
":",
"each",
"value",
"of",
"the",
"field",
"$field",
"in",
"the",
"table",
"$table",
"and",
"the",
"number",
"of",
"instances"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/json.php#L681-L707 |
oroinc/OroLayoutComponent | ExpressionLanguage/Encoder/JsonExpressionEncoder.php | JsonExpressionEncoder.encodeActions | public function encodeActions($actions)
{
return json_encode(
[
'@actions' => array_map(
function (Action $action) {
return [
'name' => $action->getName(),
'args' => $action->getAr... | php | public function encodeActions($actions)
{
return json_encode(
[
'@actions' => array_map(
function (Action $action) {
return [
'name' => $action->getName(),
'args' => $action->getAr... | [
"public",
"function",
"encodeActions",
"(",
"$",
"actions",
")",
"{",
"return",
"json_encode",
"(",
"[",
"'@actions'",
"=>",
"array_map",
"(",
"function",
"(",
"Action",
"$",
"action",
")",
"{",
"return",
"[",
"'name'",
"=>",
"$",
"action",
"->",
"getName"... | {@inheritdoc} | [
"{"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/ExpressionLanguage/Encoder/JsonExpressionEncoder.php#L32-L47 |
juskiewicz/Geolocation | src/Model/AddressCollection.php | AddressCollection.offsetGet | public function offsetGet($offset)
{
return isset($this->addresses[$offset]) ? $this->addresses[$offset] : null;
} | php | public function offsetGet($offset)
{
return isset($this->addresses[$offset]) ? $this->addresses[$offset] : null;
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"addresses",
"[",
"$",
"offset",
"]",
")",
"?",
"$",
"this",
"->",
"addresses",
"[",
"$",
"offset",
"]",
":",
"null",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Model/AddressCollection.php#L56-L59 |
laraning/boost | src/Traits/CanCreateMany.php | CanCreateMany.createMany | public static function createMany(array $datasets) : array
{
$models = [];
foreach ($datasets as $dataset) {
$models[] = static::create($dataset);
}
return $models;
} | php | public static function createMany(array $datasets) : array
{
$models = [];
foreach ($datasets as $dataset) {
$models[] = static::create($dataset);
}
return $models;
} | [
"public",
"static",
"function",
"createMany",
"(",
"array",
"$",
"datasets",
")",
":",
"array",
"{",
"$",
"models",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"datasets",
"as",
"$",
"dataset",
")",
"{",
"$",
"models",
"[",
"]",
"=",
"static",
"::",
"... | Creates many Models.
@param array $datasets The data array of arrays.
@return array The created models array. | [
"Creates",
"many",
"Models",
"."
] | train | https://github.com/laraning/boost/blob/a57ac46f93eead7959c6743f5e709b1fb1429053/src/Traits/CanCreateMany.php#L17-L26 |
heidelpay/PhpDoc | src/phpDocumentor/Plugin/Core/Transformer/Behaviour/Tag/ReturnTag.php | ReturnTag.process | public function process(\DOMDocument $xml)
{
$ignoreQry = '//tag[@name=\'return\' and @type=\'self\']'
. '|//tag[@name=\'return\' and @type=\'$this\']'
. '|//tag[@name=\'return\']/type[.=\'self\']'
. '|//tag[@name=\'return\']/type[.=\'$this\']';
$xpath = new \DOM... | php | public function process(\DOMDocument $xml)
{
$ignoreQry = '//tag[@name=\'return\' and @type=\'self\']'
. '|//tag[@name=\'return\' and @type=\'$this\']'
. '|//tag[@name=\'return\']/type[.=\'self\']'
. '|//tag[@name=\'return\']/type[.=\'$this\']';
$xpath = new \DOM... | [
"public",
"function",
"process",
"(",
"\\",
"DOMDocument",
"$",
"xml",
")",
"{",
"$",
"ignoreQry",
"=",
"'//tag[@name=\\'return\\' and @type=\\'self\\']'",
".",
"'|//tag[@name=\\'return\\' and @type=\\'$this\\']'",
".",
"'|//tag[@name=\\'return\\']/type[.=\\'self\\']'",
".",
"'... | Find all return tags that contain 'self' or '$this' and replace those
terms for the name of the current class' type.
@param \DOMDocument $xml Structure source to apply behaviour onto.
@return \DOMDocument | [
"Find",
"all",
"return",
"tags",
"that",
"contain",
"self",
"or",
"$this",
"and",
"replace",
"those",
"terms",
"for",
"the",
"name",
"of",
"the",
"current",
"class",
"type",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Transformer/Behaviour/Tag/ReturnTag.php#L27-L85 |
99designs/ergo-http | src/ResponseBuilder.php | ResponseBuilder.expires | public function expires($time)
{
if (!empty($time) && is_string($time) && !$timestamp = strtotime($time)) {
throw new \Ergo\Routing\Exception("Invalid expiry time: $timestamp");
} else if (is_numeric($time)) {
$timestamp = $time;
} else if ($time == false) {
... | php | public function expires($time)
{
if (!empty($time) && is_string($time) && !$timestamp = strtotime($time)) {
throw new \Ergo\Routing\Exception("Invalid expiry time: $timestamp");
} else if (is_numeric($time)) {
$timestamp = $time;
} else if ($time == false) {
... | [
"public",
"function",
"expires",
"(",
"$",
"time",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"time",
")",
"&&",
"is_string",
"(",
"$",
"time",
")",
"&&",
"!",
"$",
"timestamp",
"=",
"strtotime",
"(",
"$",
"time",
")",
")",
"{",
"throw",
"new",... | Sets the Expires header based on a Unix timestamp.
@param int Unix timestamp
@chainable | [
"Sets",
"the",
"Expires",
"header",
"based",
"on",
"a",
"Unix",
"timestamp",
"."
] | train | https://github.com/99designs/ergo-http/blob/979b789f2e011a1cb70a00161e6b7bcd0d2e9c71/src/ResponseBuilder.php#L171-L184 |
Eresus/EresusCMS | src/core/Template/Service.php | Eresus_Template_Service.install | public function install($filename, $target)
{
if (!file_exists($filename))
{
throw new RuntimeException('Template file not found: ' . $filename);
}
$target = $this->rootDir . '/' . $target;
if (!file_exists($target))
{
try
{
... | php | public function install($filename, $target)
{
if (!file_exists($filename))
{
throw new RuntimeException('Template file not found: ' . $filename);
}
$target = $this->rootDir . '/' . $target;
if (!file_exists($target))
{
try
{
... | [
"public",
"function",
"install",
"(",
"$",
"filename",
",",
"$",
"target",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filename",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Template file not found: '",
".",
"$",
"filename",
")",
";",... | Устанавливает шаблоны в общую папку шаблонов
@param string $filename абсолютный путь к устанавливаемому шаблону
@param string $target путь относительно общей директории шаблонов
@throws RuntimeException
@since 3.01 | [
"Устанавливает",
"шаблоны",
"в",
"общую",
"папку",
"шаблонов"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Template/Service.php#L85-L119 |
Eresus/EresusCMS | src/core/Template/Service.php | Eresus_Template_Service.remove | public function remove($path)
{
$path = $this->rootDir . '/' . $path;
if (!file_exists($path))
{
throw new RuntimeException(sprintf('Template file "%s" not found', $path));
}
if (is_file($path))
{
unlink($path);
}
else
... | php | public function remove($path)
{
$path = $this->rootDir . '/' . $path;
if (!file_exists($path))
{
throw new RuntimeException(sprintf('Template file "%s" not found', $path));
}
if (is_file($path))
{
unlink($path);
}
else
... | [
"public",
"function",
"remove",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"rootDir",
".",
"'/'",
".",
"$",
"path",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
... | Удаляет шаблон или папку шаблонов
@param string $path имя файла или папки относительно общей директории шаблонов
@throws RuntimeException
@since 3.01 | [
"Удаляет",
"шаблон",
"или",
"папку",
"шаблонов"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Template/Service.php#L130-L178 |
Eresus/EresusCMS | src/core/Template/Service.php | Eresus_Template_Service.getContents | public function getContents($name, $prefix = '')
{
$path = $this->rootDir . '/' . $this->getFilename($name, $prefix);
if (!is_file($path))
{
throw new RuntimeException('Template not exists: ' . $path);
}
$contents = file_get_contents($path);
return $con... | php | public function getContents($name, $prefix = '')
{
$path = $this->rootDir . '/' . $this->getFilename($name, $prefix);
if (!is_file($path))
{
throw new RuntimeException('Template not exists: ' . $path);
}
$contents = file_get_contents($path);
return $con... | [
"public",
"function",
"getContents",
"(",
"$",
"name",
",",
"$",
"prefix",
"=",
"''",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"rootDir",
".",
"'/'",
".",
"$",
"this",
"->",
"getFilename",
"(",
"$",
"name",
",",
"$",
"prefix",
")",
";",
"if... | Возвращает содержимое шаблона
@param string $name имя файла шаблона
@param string $prefix опциональный префикс (путь относительно корня шаблонов)
@throws RuntimeException
@return string
@since 3.01 | [
"Возвращает",
"содержимое",
"шаблона"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Template/Service.php#L192-L204 |
Eresus/EresusCMS | src/core/Template/Service.php | Eresus_Template_Service.setContents | public function setContents($contents, $name, $prefix = '')
{
$path = $this->rootDir . '/' . $this->getFilename($name, $prefix);
if (!is_file($path))
{
throw new RuntimeException('Template not exists: ' . $path);
}
@file_put_contents($path, $contents);
} | php | public function setContents($contents, $name, $prefix = '')
{
$path = $this->rootDir . '/' . $this->getFilename($name, $prefix);
if (!is_file($path))
{
throw new RuntimeException('Template not exists: ' . $path);
}
@file_put_contents($path, $contents);
} | [
"public",
"function",
"setContents",
"(",
"$",
"contents",
",",
"$",
"name",
",",
"$",
"prefix",
"=",
"''",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"rootDir",
".",
"'/'",
".",
"$",
"this",
"->",
"getFilename",
"(",
"$",
"name",
",",
"$",
"... | Записывает содержимое шаблона
@param string $contents содержимое шаблона
@param string $name имя файла шаблона
@param string $prefix опциональный префикс (путь относительно корня шаблонов)
@throws RuntimeException
@return void
@since 3.01 | [
"Записывает",
"содержимое",
"шаблона"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Template/Service.php#L219-L229 |
Eresus/EresusCMS | src/core/Template/Service.php | Eresus_Template_Service.getFilename | public function getFilename($name, $prefix = '')
{
$path = $name;
if ($prefix != '')
{
$path = $prefix . '/' . $path;
}
return $path;
} | php | public function getFilename($name, $prefix = '')
{
$path = $name;
if ($prefix != '')
{
$path = $prefix . '/' . $path;
}
return $path;
} | [
"public",
"function",
"getFilename",
"(",
"$",
"name",
",",
"$",
"prefix",
"=",
"''",
")",
"{",
"$",
"path",
"=",
"$",
"name",
";",
"if",
"(",
"$",
"prefix",
"!=",
"''",
")",
"{",
"$",
"path",
"=",
"$",
"prefix",
".",
"'/'",
".",
"$",
"path",
... | Возвращает путь к файлу шаблона
@param string $name имя файла шаблона
@param string $prefix опциональный префикс (путь относительно корня шаблонов)
@return string
@since 1.00 | [
"Возвращает",
"путь",
"к",
"файлу",
"шаблона"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Template/Service.php#L241-L250 |
Eresus/EresusCMS | src/core/Template/Service.php | Eresus_Template_Service.getTemplate | public function getTemplate($name, $prefix = '')
{
$path = $this->getFilename($name, $prefix);
if (!is_file($this->rootDir . '/' . $path))
{
throw new RuntimeException('Template not exists: ' . $path);
}
$tmpl = new Eresus_Template('templates/' . $path);
... | php | public function getTemplate($name, $prefix = '')
{
$path = $this->getFilename($name, $prefix);
if (!is_file($this->rootDir . '/' . $path))
{
throw new RuntimeException('Template not exists: ' . $path);
}
$tmpl = new Eresus_Template('templates/' . $path);
... | [
"public",
"function",
"getTemplate",
"(",
"$",
"name",
",",
"$",
"prefix",
"=",
"''",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getFilename",
"(",
"$",
"name",
",",
"$",
"prefix",
")",
";",
"if",
"(",
"!",
"is_file",
"(",
"$",
"this",
"->",... | Возвращает объект шаблона
@param string $name имя файла шаблона
@param string $prefix опциональный префикс (путь относительно корня шаблонов)
@throws RuntimeException
@return Eresus_Template
@since 3.01 | [
"Возвращает",
"объект",
"шаблона"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Template/Service.php#L264-L276 |
laraning/boost | src/Commands/ViewHintsCommand.php | ViewHintsCommand.handle | public function handle()
{
// Transform array.
foreach (view()->getFinder()->getHints() as $key => $value) {
$this->hints[] = [$key, $value[0]];
}
$this->table($this->headers, $this->hints);
} | php | public function handle()
{
// Transform array.
foreach (view()->getFinder()->getHints() as $key => $value) {
$this->hints[] = [$key, $value[0]];
}
$this->table($this->headers, $this->hints);
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"// Transform array.",
"foreach",
"(",
"view",
"(",
")",
"->",
"getFinder",
"(",
")",
"->",
"getHints",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"hints",
"[",
"]",
"... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/laraning/boost/blob/a57ac46f93eead7959c6743f5e709b1fb1429053/src/Commands/ViewHintsCommand.php#L52-L60 |
scherersoftware/cake-monitor | src/Middleware/ErrorHandlerMiddleware.php | ErrorHandlerMiddleware.handleException | public function handleException($exception, $request, $response)
{
$sentryHandler = new SentryHandler();
$sentryHandler->handle($exception);
return parent::handleException($exception, $request, $response);
} | php | public function handleException($exception, $request, $response)
{
$sentryHandler = new SentryHandler();
$sentryHandler->handle($exception);
return parent::handleException($exception, $request, $response);
} | [
"public",
"function",
"handleException",
"(",
"$",
"exception",
",",
"$",
"request",
",",
"$",
"response",
")",
"{",
"$",
"sentryHandler",
"=",
"new",
"SentryHandler",
"(",
")",
";",
"$",
"sentryHandler",
"->",
"handle",
"(",
"$",
"exception",
")",
";",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/scherersoftware/cake-monitor/blob/dbe07a1aac41b3db15e631d9e59cf26214bf6938/src/Middleware/ErrorHandlerMiddleware.php#L13-L18 |
jasny/controller | src/Controller/Output.php | Output.setResponseHeader | public function setResponseHeader($header, $value, $overwrite = true)
{
$fn = $overwrite ? 'withHeader' : 'withAddedHeader';
$response = $this->getResponse()->$fn($header, $value);
$this->setResponse($response);
} | php | public function setResponseHeader($header, $value, $overwrite = true)
{
$fn = $overwrite ? 'withHeader' : 'withAddedHeader';
$response = $this->getResponse()->$fn($header, $value);
$this->setResponse($response);
} | [
"public",
"function",
"setResponseHeader",
"(",
"$",
"header",
",",
"$",
"value",
",",
"$",
"overwrite",
"=",
"true",
")",
"{",
"$",
"fn",
"=",
"$",
"overwrite",
"?",
"'withHeader'",
":",
"'withAddedHeader'",
";",
"$",
"response",
"=",
"$",
"this",
"->",... | Set a response header
@param string $header
@param string $value
@param boolean $overwrite | [
"Set",
"a",
"response",
"header"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Output.php#L47-L53 |
jasny/controller | src/Controller/Output.php | Output.respondWith | public function respondWith($status, $format = null)
{
$response = $this->getResponse();
// Shift arguments if $code is omitted
if (isset($status) && !is_int($status) && (!is_string($status) || !preg_match('/^\d{3}\b/', $status))) {
list($status, $format) = array_merge([null], f... | php | public function respondWith($status, $format = null)
{
$response = $this->getResponse();
// Shift arguments if $code is omitted
if (isset($status) && !is_int($status) && (!is_string($status) || !preg_match('/^\d{3}\b/', $status))) {
list($status, $format) = array_merge([null], f... | [
"public",
"function",
"respondWith",
"(",
"$",
"status",
",",
"$",
"format",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getResponse",
"(",
")",
";",
"// Shift arguments if $code is omitted",
"if",
"(",
"isset",
"(",
"$",
"status",
")"... | Set the headers with HTTP status code and content type.
@link http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Examples:
<code>
$this->respondWith(200, 'json');
$this->respondWith(200, 'application/json');
$this->respondWith(204);
$this->respondWith("204 Created");
$this->respondWith('json');
</code>
@param int... | [
"Set",
"the",
"headers",
"with",
"HTTP",
"status",
"code",
"and",
"content",
"type",
".",
"@link",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"List_of_HTTP_status_codes"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Output.php#L71-L91 |
jasny/controller | src/Controller/Output.php | Output.created | public function created($location = null)
{
$this->respondWith(201);
if (!empty($location)) {
$this->setResponseHeader('Location', $location);
}
} | php | public function created($location = null)
{
$this->respondWith(201);
if (!empty($location)) {
$this->setResponseHeader('Location', $location);
}
} | [
"public",
"function",
"created",
"(",
"$",
"location",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"respondWith",
"(",
"201",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"location",
")",
")",
"{",
"$",
"this",
"->",
"setResponseHeader",
"(",
"'Locatio... | Response with created 201 code, and optionally the created location
@param string $location Url of created resource | [
"Response",
"with",
"created",
"201",
"code",
"and",
"optionally",
"the",
"created",
"location"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Output.php#L109-L116 |
jasny/controller | src/Controller/Output.php | Output.partialContent | public function partialContent($rangeFrom, $rangeTo, $totalSize)
{
$this->respondWith(206);
$this->setResponseHeader('Content-Range', "bytes {$rangeFrom}-{$rangeTo}/{$totalSize}");
$this->setResponseHeader('Content-Length', $rangeTo - $rangeFrom);
} | php | public function partialContent($rangeFrom, $rangeTo, $totalSize)
{
$this->respondWith(206);
$this->setResponseHeader('Content-Range', "bytes {$rangeFrom}-{$rangeTo}/{$totalSize}");
$this->setResponseHeader('Content-Length', $rangeTo - $rangeFrom);
} | [
"public",
"function",
"partialContent",
"(",
"$",
"rangeFrom",
",",
"$",
"rangeTo",
",",
"$",
"totalSize",
")",
"{",
"$",
"this",
"->",
"respondWith",
"(",
"206",
")",
";",
"$",
"this",
"->",
"setResponseHeader",
"(",
"'Content-Range'",
",",
"\"bytes {$range... | Respond with a 206 Partial content with `Content-Range` header
@param int $rangeFrom Beginning of the range in bytes
@param int $rangeTo End of the range in bytes
@param int $totalSize Total size in bytes | [
"Respond",
"with",
"a",
"206",
"Partial",
"content",
"with",
"Content",
"-",
"Range",
"header"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Output.php#L143-L149 |
jasny/controller | src/Controller/Output.php | Output.redirect | public function redirect($url, $code = 303)
{
$this->respondWith($code);
$this->setResponseHeader('Location', $url);
$urlHtml = htmlentities($url);
$this->output('You are being redirected to <a href="' . $urlHtml . '">' . $urlHtml . '</a>', 'text/html');
} | php | public function redirect($url, $code = 303)
{
$this->respondWith($code);
$this->setResponseHeader('Location', $url);
$urlHtml = htmlentities($url);
$this->output('You are being redirected to <a href="' . $urlHtml . '">' . $urlHtml . '</a>', 'text/html');
} | [
"public",
"function",
"redirect",
"(",
"$",
"url",
",",
"$",
"code",
"=",
"303",
")",
"{",
"$",
"this",
"->",
"respondWith",
"(",
"$",
"code",
")",
";",
"$",
"this",
"->",
"setResponseHeader",
"(",
"'Location'",
",",
"$",
"url",
")",
";",
"$",
"url... | Redirect to url and output a short message with the link
@param string $url
@param int $code 301 (Moved Permanently), 302 (Found), 303 (See Other) or 307 (Temporary Redirect) | [
"Redirect",
"to",
"url",
"and",
"output",
"a",
"short",
"message",
"with",
"the",
"link"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Output.php#L158-L165 |
jasny/controller | src/Controller/Output.php | Output.getContentType | protected function getContentType($format)
{
// Check if it's already MIME
if (\Jasny\str_contains($format, '/')) {
return $format;
}
$repository = new ApacheMimeTypes();
$mime = $repository->findType($format);
if (!isset($mime)) {
th... | php | protected function getContentType($format)
{
// Check if it's already MIME
if (\Jasny\str_contains($format, '/')) {
return $format;
}
$repository = new ApacheMimeTypes();
$mime = $repository->findType($format);
if (!isset($mime)) {
th... | [
"protected",
"function",
"getContentType",
"(",
"$",
"format",
")",
"{",
"// Check if it's already MIME",
"if",
"(",
"\\",
"Jasny",
"\\",
"str_contains",
"(",
"$",
"format",
",",
"'/'",
")",
")",
"{",
"return",
"$",
"format",
";",
"}",
"$",
"repository",
"... | Get MIME type for extension
@param string $format
@return string | [
"Get",
"MIME",
"type",
"for",
"extension"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Output.php#L291-L306 |
jasny/controller | src/Controller/Output.php | Output.serializeData | protected function serializeData($data, $contentType)
{
if (is_string($data)) {
return $data;
}
$repository = new ApacheMimeTypes();
list($format) = $repository->findExtensions($contentType) + [null];
$method = 'serializeDataTo' . $format;
... | php | protected function serializeData($data, $contentType)
{
if (is_string($data)) {
return $data;
}
$repository = new ApacheMimeTypes();
list($format) = $repository->findExtensions($contentType) + [null];
$method = 'serializeDataTo' . $format;
... | [
"protected",
"function",
"serializeData",
"(",
"$",
"data",
",",
"$",
"contentType",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
"repository",
"=",
"new",
"ApacheMimeTypes",
"(",
")",
";",
... | Serialize data
@param mixed $data
@param string $contentType
@return string | [
"Serialize",
"data"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Output.php#L326-L343 |
jasny/controller | src/Controller/Output.php | Output.serializeDataToXml | private function serializeDataToXml($data)
{
if ($data instanceof \SimpleXMLElement) {
return $data->asXML();
}
if (($data instanceof \DOMNode && isset($data->ownerDocument)) || $data instanceof \DOMDocument) {
$dom = $data instanceof \DOMDocument ? $data : $... | php | private function serializeDataToXml($data)
{
if ($data instanceof \SimpleXMLElement) {
return $data->asXML();
}
if (($data instanceof \DOMNode && isset($data->ownerDocument)) || $data instanceof \DOMDocument) {
$dom = $data instanceof \DOMDocument ? $data : $... | [
"private",
"function",
"serializeDataToXml",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
"instanceof",
"\\",
"SimpleXMLElement",
")",
"{",
"return",
"$",
"data",
"->",
"asXML",
"(",
")",
";",
"}",
"if",
"(",
"(",
"$",
"data",
"instanceof",
"\\"... | Serialize data to XML.
@internal made private because this will likely move to a library
@param mixed $data
@return string | [
"Serialize",
"data",
"to",
"XML",
".",
"@internal",
"made",
"private",
"because",
"this",
"will",
"likely",
"move",
"to",
"a",
"library"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Output.php#L364-L377 |
jasny/controller | src/Controller/Output.php | Output.outputContentType | protected function outputContentType($format)
{
if (!isset($format)) {
$contentType = $this->getResponse()->getHeaderLine('Content-Type');
if (empty($contentType)) {
$format = $this->defaultFormat ?: 'text/html';
}
}
i... | php | protected function outputContentType($format)
{
if (!isset($format)) {
$contentType = $this->getResponse()->getHeaderLine('Content-Type');
if (empty($contentType)) {
$format = $this->defaultFormat ?: 'text/html';
}
}
i... | [
"protected",
"function",
"outputContentType",
"(",
"$",
"format",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"format",
")",
")",
"{",
"$",
"contentType",
"=",
"$",
"this",
"->",
"getResponse",
"(",
")",
"->",
"getHeaderLine",
"(",
"'Content-Type'",
")"... | Set the content type for the output
@param string $format
@return string | [
"Set",
"the",
"content",
"type",
"for",
"the",
"output"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Output.php#L385-L401 |
jasny/controller | src/Controller/Output.php | Output.output | public function output($data, $format = null)
{
$contentType = $this->outputContentType($format);
try {
$content = $this->serializeData($data, $contentType);
} catch (\UnexpectedValueException $e) {
if (!isset($format) && isset($this->defaultFormat) && $this->default... | php | public function output($data, $format = null)
{
$contentType = $this->outputContentType($format);
try {
$content = $this->serializeData($data, $contentType);
} catch (\UnexpectedValueException $e) {
if (!isset($format) && isset($this->defaultFormat) && $this->default... | [
"public",
"function",
"output",
"(",
"$",
"data",
",",
"$",
"format",
"=",
"null",
")",
"{",
"$",
"contentType",
"=",
"$",
"this",
"->",
"outputContentType",
"(",
"$",
"format",
")",
";",
"try",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"serialize... | Output result
@param mixed $data
@param string $format Output format as MIME or extension | [
"Output",
"result"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/Output.php#L409-L425 |
delaneymethod/sharepoint-api | src/Client.php | Client.createFolder | public function createFolder($path) : bool
{
$path = $this->normalizePath($path);
// Check if the path contains folders we dont want to create
if (str_contains($path, $this->folderPathExcludeList)) {
return true;
}
$this->folderPath = '/sites/'.$this->siteName.'/Shared%20Documents';
$requestUrl... | php | public function createFolder($path) : bool
{
$path = $this->normalizePath($path);
// Check if the path contains folders we dont want to create
if (str_contains($path, $this->folderPathExcludeList)) {
return true;
}
$this->folderPath = '/sites/'.$this->siteName.'/Shared%20Documents';
$requestUrl... | [
"public",
"function",
"createFolder",
"(",
"$",
"path",
")",
":",
"bool",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"path",
")",
";",
"// Check if the path contains folders we dont want to create",
"if",
"(",
"str_contains",
"(",
"$",
... | Create a folder at a given path. | [
"Create",
"a",
"folder",
"at",
"a",
"given",
"path",
"."
] | train | https://github.com/delaneymethod/sharepoint-api/blob/1ede2742292a13896f071427da5995abf5e9a545/src/Client.php#L71-L101 |
delaneymethod/sharepoint-api | src/Client.php | Client.delete | public function delete(string $path) : bool
{
$path = $this->normalizePath($path);
// Check if the path contains folders we dont want to delete
if (str_contains($path, $this->folderPathExcludeList)) {
return true;
}
$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFolderByServerR... | php | public function delete(string $path) : bool
{
$path = $this->normalizePath($path);
// Check if the path contains folders we dont want to delete
if (str_contains($path, $this->folderPathExcludeList)) {
return true;
}
$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFolderByServerR... | [
"public",
"function",
"delete",
"(",
"string",
"$",
"path",
")",
":",
"bool",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"path",
")",
";",
"// Check if the path contains folders we dont want to delete",
"if",
"(",
"str_contains",
"(",
... | Delete the file or folder at a given path.
If the path is a folder, all its contents will be deleted too.
A successful response indicates that the file or folder was deleted. | [
"Delete",
"the",
"file",
"or",
"folder",
"at",
"a",
"given",
"path",
"."
] | train | https://github.com/delaneymethod/sharepoint-api/blob/1ede2742292a13896f071427da5995abf5e9a545/src/Client.php#L109-L131 |
delaneymethod/sharepoint-api | src/Client.php | Client.getMetadata | public function getMetadata(string $path, array $mimeType) : array
{
$path = $this->normalizePath($path);
// If plain/text, its a folder
if (substr($mimeType['mimetype'], 0, 4) === 'text') {
$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFolderByServerRelativeUrl(\''.$this->folderPath... | php | public function getMetadata(string $path, array $mimeType) : array
{
$path = $this->normalizePath($path);
// If plain/text, its a folder
if (substr($mimeType['mimetype'], 0, 4) === 'text') {
$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFolderByServerRelativeUrl(\''.$this->folderPath... | [
"public",
"function",
"getMetadata",
"(",
"string",
"$",
"path",
",",
"array",
"$",
"mimeType",
")",
":",
"array",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"path",
")",
";",
"// If plain/text, its a folder",
"if",
"(",
"substr",... | Returns the metadata for a file or folder.
Note: Metadata for the root folder is unsupported. | [
"Returns",
"the",
"metadata",
"for",
"a",
"file",
"or",
"folder",
"."
] | train | https://github.com/delaneymethod/sharepoint-api/blob/1ede2742292a13896f071427da5995abf5e9a545/src/Client.php#L138-L163 |
delaneymethod/sharepoint-api | src/Client.php | Client.listFolder | public function listFolder(string $path, bool $recursive = false) : array
{
$path = $this->normalizePath($path);
$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFolderByServerRelativeUrl(\''.$this->folderPath.$path.'\')/Folders';
$options = [
'headers' => $this->requestHeaders,
]... | php | public function listFolder(string $path, bool $recursive = false) : array
{
$path = $this->normalizePath($path);
$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFolderByServerRelativeUrl(\''.$this->folderPath.$path.'\')/Folders';
$options = [
'headers' => $this->requestHeaders,
]... | [
"public",
"function",
"listFolder",
"(",
"string",
"$",
"path",
",",
"bool",
"$",
"recursive",
"=",
"false",
")",
":",
"array",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"path",
")",
";",
"$",
"requestUrl",
"=",
"$",
"this"... | Returns the contents of a folder. | [
"Returns",
"the",
"contents",
"of",
"a",
"folder",
"."
] | train | https://github.com/delaneymethod/sharepoint-api/blob/1ede2742292a13896f071427da5995abf5e9a545/src/Client.php#L168-L188 |
delaneymethod/sharepoint-api | src/Client.php | Client.copy | public function copy(string $fromPath, string $toPath, array $mimeType) : bool
{
$fromPath = $this->normalizePath($fromPath);
$toPath = $this->normalizePath($toPath);
// If plain/text, its a folder
if (substr($mimeType['mimetype'], 0, 4) === 'text') {
$requestUrl = $this->siteUrl.'/sites/'.$this->site... | php | public function copy(string $fromPath, string $toPath, array $mimeType) : bool
{
$fromPath = $this->normalizePath($fromPath);
$toPath = $this->normalizePath($toPath);
// If plain/text, its a folder
if (substr($mimeType['mimetype'], 0, 4) === 'text') {
$requestUrl = $this->siteUrl.'/sites/'.$this->site... | [
"public",
"function",
"copy",
"(",
"string",
"$",
"fromPath",
",",
"string",
"$",
"toPath",
",",
"array",
"$",
"mimeType",
")",
":",
"bool",
"{",
"$",
"fromPath",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"fromPath",
")",
";",
"$",
"toPath",
... | Copy a file or folder to a different location.
https://msdn.microsoft.com/en-us/library/office/jj247198%28v=office.15%29.aspx | [
"Copy",
"a",
"file",
"or",
"folder",
"to",
"a",
"different",
"location",
"."
] | train | https://github.com/delaneymethod/sharepoint-api/blob/1ede2742292a13896f071427da5995abf5e9a545/src/Client.php#L195-L215 |
delaneymethod/sharepoint-api | src/Client.php | Client.upload | public function upload(string $path, $contents) : array
{
$path = trim($path, '/');
// Split the path so we can grab the filename and folder path
$segments = explode('/', $path);
// Filename will be last item
$path = last($segments);
// Remove filename from segments so we're left with the folder p... | php | public function upload(string $path, $contents) : array
{
$path = trim($path, '/');
// Split the path so we can grab the filename and folder path
$segments = explode('/', $path);
// Filename will be last item
$path = last($segments);
// Remove filename from segments so we're left with the folder p... | [
"public",
"function",
"upload",
"(",
"string",
"$",
"path",
",",
"$",
"contents",
")",
":",
"array",
"{",
"$",
"path",
"=",
"trim",
"(",
"$",
"path",
",",
"'/'",
")",
";",
"// Split the path so we can grab the filename and folder path",
"$",
"segments",
"=",
... | Create a new file with the contents provided in the request.
@param string $path
@param string|resource $contents
@return bool | [
"Create",
"a",
"new",
"file",
"with",
"the",
"contents",
"provided",
"in",
"the",
"request",
"."
] | train | https://github.com/delaneymethod/sharepoint-api/blob/1ede2742292a13896f071427da5995abf5e9a545/src/Client.php#L252-L287 |
delaneymethod/sharepoint-api | src/Client.php | Client.download | public function download(string $path)
{
// To get specific file data pass in the value you want e.g. /Name
$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFileByServerRelativeUrl(\''.$this->folderPath.$path.'\')';
$options = [
'headers' => $this->requestHeaders,
];
$response =... | php | public function download(string $path)
{
// To get specific file data pass in the value you want e.g. /Name
$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFileByServerRelativeUrl(\''.$this->folderPath.$path.'\')';
$options = [
'headers' => $this->requestHeaders,
];
$response =... | [
"public",
"function",
"download",
"(",
"string",
"$",
"path",
")",
"{",
"// To get specific file data pass in the value you want e.g. /Name ",
"$",
"requestUrl",
"=",
"$",
"this",
"->",
"siteUrl",
".",
"'/sites/'",
".",
"$",
"this",
"->",
"siteName",
".",
"'/_api/We... | Download a file.
@param string $path
@return resource | [
"Download",
"a",
"file",
"."
] | train | https://github.com/delaneymethod/sharepoint-api/blob/1ede2742292a13896f071427da5995abf5e9a545/src/Client.php#L296-L308 |
mothership-ec/composer | src/Composer/Repository/ArrayRepository.php | ArrayRepository.findPackage | public function findPackage($name, $version)
{
// normalize version & name
$versionParser = new VersionParser();
$version = $versionParser->normalize($version);
$name = strtolower($name);
foreach ($this->getPackages() as $package) {
if ($name === $package->getNam... | php | public function findPackage($name, $version)
{
// normalize version & name
$versionParser = new VersionParser();
$version = $versionParser->normalize($version);
$name = strtolower($name);
foreach ($this->getPackages() as $package) {
if ($name === $package->getNam... | [
"public",
"function",
"findPackage",
"(",
"$",
"name",
",",
"$",
"version",
")",
"{",
"// normalize version & name",
"$",
"versionParser",
"=",
"new",
"VersionParser",
"(",
")",
";",
"$",
"version",
"=",
"$",
"versionParser",
"->",
"normalize",
"(",
"$",
"ve... | {@inheritDoc} | [
"{"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Repository/ArrayRepository.php#L39-L51 |
mothership-ec/composer | src/Composer/Repository/ArrayRepository.php | ArrayRepository.findPackages | public function findPackages($name, $version = null)
{
// normalize name
$name = strtolower($name);
// normalize version
if (null !== $version) {
$versionParser = new VersionParser();
$version = $versionParser->normalize($version);
}
$package... | php | public function findPackages($name, $version = null)
{
// normalize name
$name = strtolower($name);
// normalize version
if (null !== $version) {
$versionParser = new VersionParser();
$version = $versionParser->normalize($version);
}
$package... | [
"public",
"function",
"findPackages",
"(",
"$",
"name",
",",
"$",
"version",
"=",
"null",
")",
"{",
"// normalize name",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"// normalize version",
"if",
"(",
"null",
"!==",
"$",
"version",
")",
"{... | {@inheritDoc} | [
"{"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Repository/ArrayRepository.php#L56-L76 |
alevilar/ristorantino-vendor | Printers/Lib/PrinterOutput/FilePrinterOutput.php | FilePrinterOutput.send | public function send( $printaitorViewObj ) {
$texto = $printaitorViewObj->viewTextRender;
$nombreImpresoraFiscal = $printaitorViewObj->printer['Printer']['alias'];
$hostname = $printaitorViewObj->hostName;
$nombreImpresoraFiscal = Inflector::slug($nombreImpresoraFiscal);... | php | public function send( $printaitorViewObj ) {
$texto = $printaitorViewObj->viewTextRender;
$nombreImpresoraFiscal = $printaitorViewObj->printer['Printer']['alias'];
$hostname = $printaitorViewObj->hostName;
$nombreImpresoraFiscal = Inflector::slug($nombreImpresoraFiscal);... | [
"public",
"function",
"send",
"(",
"$",
"printaitorViewObj",
")",
"{",
"$",
"texto",
"=",
"$",
"printaitorViewObj",
"->",
"viewTextRender",
";",
"$",
"nombreImpresoraFiscal",
"=",
"$",
"printaitorViewObj",
"->",
"printer",
"[",
"'Printer'",
"]",
"[",
"'alias'",
... | Crea un archivo y lo coloca en la carpeta /tmp
@param string $texto es el texto a imprimir
@param string $nombreImpresoraFiscal nombre de la impresora
@param string $hostname nombre o IP del host
@return type boolean true si salio todo bien false caso contrario | [
"Crea",
"un",
"archivo",
"y",
"lo",
"coloca",
"en",
"la",
"carpeta",
"/",
"tmp"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Printers/Lib/PrinterOutput/FilePrinterOutput.php#L41-L59 |
php-lug/lug | app/AppKernel.php | AppKernel.registerBundles | public function registerBundles()
{
$bundles = [
new FrameworkBundle(),
new SecurityBundle(),
new TwigBundle(),
new MonologBundle(),
new FOSRestBundle(),
new JMSSerializerBundle(),
new BazingaHateoasBundle(),
new... | php | public function registerBundles()
{
$bundles = [
new FrameworkBundle(),
new SecurityBundle(),
new TwigBundle(),
new MonologBundle(),
new FOSRestBundle(),
new JMSSerializerBundle(),
new BazingaHateoasBundle(),
new... | [
"public",
"function",
"registerBundles",
"(",
")",
"{",
"$",
"bundles",
"=",
"[",
"new",
"FrameworkBundle",
"(",
")",
",",
"new",
"SecurityBundle",
"(",
")",
",",
"new",
"TwigBundle",
"(",
")",
",",
"new",
"MonologBundle",
"(",
")",
",",
"new",
"FOSRestB... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/app/AppKernel.php#L69-L120 |
php-lug/lug | app/AppKernel.php | AppKernel.registerContainerConfiguration | public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
$this->registerDriverConfiguration($loader);
} | php | public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
$this->registerDriverConfiguration($loader);
} | [
"public",
"function",
"registerContainerConfiguration",
"(",
"LoaderInterface",
"$",
"loader",
")",
"{",
"$",
"loader",
"->",
"load",
"(",
"$",
"this",
"->",
"getRootDir",
"(",
")",
".",
"'/config/config_'",
".",
"$",
"this",
"->",
"getEnvironment",
"(",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/app/AppKernel.php#L149-L154 |
discodian/core | src/Foundation/Application.php | Application.registerConfiguredProviders | public function registerConfiguredProviders()
{
foreach ([
CacheProvider::class,
PartProvider::class,
SchedulingProvider::class,
ViewProvider::class,
EventProvider::class,
DatabasePr... | php | public function registerConfiguredProviders()
{
foreach ([
CacheProvider::class,
PartProvider::class,
SchedulingProvider::class,
ViewProvider::class,
EventProvider::class,
DatabasePr... | [
"public",
"function",
"registerConfiguredProviders",
"(",
")",
"{",
"foreach",
"(",
"[",
"CacheProvider",
"::",
"class",
",",
"PartProvider",
"::",
"class",
",",
"SchedulingProvider",
"::",
"class",
",",
"ViewProvider",
"::",
"class",
",",
"EventProvider",
"::",
... | Register all of the configured providers.
@return void | [
"Register",
"all",
"of",
"the",
"configured",
"providers",
"."
] | train | https://github.com/discodian/core/blob/e007855f7c161e12391469eb39eaaf39cbb59897/src/Foundation/Application.php#L208-L225 |
discodian/core | src/Foundation/Application.php | Application.register | public function register($provider, $options = [], $force = false)
{
$instance = new $provider($this);
if (method_exists($instance, 'register')) {
$this->call([$instance, 'register']);
}
$this->providers[$provider] = $instance;
} | php | public function register($provider, $options = [], $force = false)
{
$instance = new $provider($this);
if (method_exists($instance, 'register')) {
$this->call([$instance, 'register']);
}
$this->providers[$provider] = $instance;
} | [
"public",
"function",
"register",
"(",
"$",
"provider",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"instance",
"=",
"new",
"$",
"provider",
"(",
"$",
"this",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
... | Register a service provider with the application.
@param \Illuminate\Support\ServiceProvider|string $provider
@param array $options
@param bool $force
@return \Illuminate\Support\ServiceProvider | [
"Register",
"a",
"service",
"provider",
"with",
"the",
"application",
"."
] | train | https://github.com/discodian/core/blob/e007855f7c161e12391469eb39eaaf39cbb59897/src/Foundation/Application.php#L235-L242 |
discodian/core | src/Foundation/Application.php | Application.boot | public function boot()
{
if ($this->booted) {
return;
}
$this->fireAppCallback($this->bootingCallbacks);
/** @var ExtensionManager $manager */
$manager = $this->make(Manager::class);
$manager->boot();
foreach ($this->providers as $provider) {
... | php | public function boot()
{
if ($this->booted) {
return;
}
$this->fireAppCallback($this->bootingCallbacks);
/** @var ExtensionManager $manager */
$manager = $this->make(Manager::class);
$manager->boot();
foreach ($this->providers as $provider) {
... | [
"public",
"function",
"boot",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"booted",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"fireAppCallback",
"(",
"$",
"this",
"->",
"bootingCallbacks",
")",
";",
"/** @var ExtensionManager $manager */",
"$",
"ma... | Boot the application's service providers.
@return void | [
"Boot",
"the",
"application",
"s",
"service",
"providers",
"."
] | train | https://github.com/discodian/core/blob/e007855f7c161e12391469eb39eaaf39cbb59897/src/Foundation/Application.php#L261-L281 |
kecik-framework/kecik | Kecik/Assets.php | Assets.images | public function images( $file, $version = '' ) {
if ( empty( $version ) ) {
$version = '?ver=' . Kecik::$version;
}
return $this->BaseUrl . Config::get( 'path.assets' ) . '/images/' . $file . $version;
} | php | public function images( $file, $version = '' ) {
if ( empty( $version ) ) {
$version = '?ver=' . Kecik::$version;
}
return $this->BaseUrl . Config::get( 'path.assets' ) . '/images/' . $file . $version;
} | [
"public",
"function",
"images",
"(",
"$",
"file",
",",
"$",
"version",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"version",
")",
")",
"{",
"$",
"version",
"=",
"'?ver='",
".",
"Kecik",
"::",
"$",
"version",
";",
"}",
"return",
"$",
"this... | Create of images Url from Assets
@param $file
@param string $version
@return string | [
"Create",
"of",
"images",
"Url",
"from",
"Assets"
] | train | https://github.com/kecik-framework/kecik/blob/fa87e593affe1c9c51a2acd264b85ec06df31d7c/Kecik/Assets.php#L49-L56 |
kecik-framework/kecik | Kecik/Assets.php | Assets.url | public function url( $file = '', $version = '' ) {
if ( empty( $version ) ) {
$version = '?ver=' . Kecik::$version;
}
if ( ! empty( $file ) ) {
return $this->BaseUrl . Config::get( 'path.assets' ) . '/' . $file . $version;
} else {
return $this->BaseUrl . Config::get( 'path.assets' ) . '/';
}
} | php | public function url( $file = '', $version = '' ) {
if ( empty( $version ) ) {
$version = '?ver=' . Kecik::$version;
}
if ( ! empty( $file ) ) {
return $this->BaseUrl . Config::get( 'path.assets' ) . '/' . $file . $version;
} else {
return $this->BaseUrl . Config::get( 'path.assets' ) . '/';
}
} | [
"public",
"function",
"url",
"(",
"$",
"file",
"=",
"''",
",",
"$",
"version",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"version",
")",
")",
"{",
"$",
"version",
"=",
"'?ver='",
".",
"Kecik",
"::",
"$",
"version",
";",
"}",
"if",
"(",... | Create url from assets
@param string $file
@param string $version
@return string | [
"Create",
"url",
"from",
"assets"
] | train | https://github.com/kecik-framework/kecik/blob/fa87e593affe1c9c51a2acd264b85ec06df31d7c/Kecik/Assets.php#L66-L78 |
kecik-framework/kecik | Kecik/Assets.php | AssetsBase.add | public function add( $file, $version = "", $attr = array() ) {
if ( count( $attr ) <= 0 && is_array( $version ) ) {
$attr = $version;
$version = "";
}
if ( empty( $version ) ) {
$version = '?ver=' . Kecik::$version;
} else {
$version = '?ver=' . $version;
}
if ( ! in_array( $file, $this->a... | php | public function add( $file, $version = "", $attr = array() ) {
if ( count( $attr ) <= 0 && is_array( $version ) ) {
$attr = $version;
$version = "";
}
if ( empty( $version ) ) {
$version = '?ver=' . Kecik::$version;
} else {
$version = '?ver=' . $version;
}
if ( ! in_array( $file, $this->a... | [
"public",
"function",
"add",
"(",
"$",
"file",
",",
"$",
"version",
"=",
"\"\"",
",",
"$",
"attr",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"attr",
")",
"<=",
"0",
"&&",
"is_array",
"(",
"$",
"version",
")",
")",
"{",
"... | Add/register Assets for render to template
@param $file
@param string $version
@param array $attr | [
"Add",
"/",
"register",
"Assets",
"for",
"render",
"to",
"template"
] | train | https://github.com/kecik-framework/kecik/blob/fa87e593affe1c9c51a2acd264b85ec06df31d7c/Kecik/Assets.php#L120-L139 |
kecik-framework/kecik | Kecik/Assets.php | AssetsBase.delete | public function delete( $file ) {
$key = array_search( $file, $this->assets[ $this->type ] );
unset( $this->assets[ $this->type ][ $key ] );
unset( $this->attr[ $this->type ][ $key ] );
} | php | public function delete( $file ) {
$key = array_search( $file, $this->assets[ $this->type ] );
unset( $this->assets[ $this->type ][ $key ] );
unset( $this->attr[ $this->type ][ $key ] );
} | [
"public",
"function",
"delete",
"(",
"$",
"file",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"file",
",",
"$",
"this",
"->",
"assets",
"[",
"$",
"this",
"->",
"type",
"]",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"assets",
"[",
"$",
... | Delete Assets from register
delete
@param $file | [
"Delete",
"Assets",
"from",
"register",
"delete"
] | train | https://github.com/kecik-framework/kecik/blob/fa87e593affe1c9c51a2acd264b85ec06df31d7c/Kecik/Assets.php#L147-L151 |
kecik-framework/kecik | Kecik/Assets.php | AssetsBase.render | public function render( $file = '' ) {
reset( $this->assets[ $this->type ] );
//reset($this->attr[$this->type]);
$attr = '';
if ( $this->type == 'js' ) {
if ( $file != '' ) {
$key = array_search( $file, $this->assets[ $this->type ] );
$version = $this->versions[ $this->type ][ $key ];
$asse... | php | public function render( $file = '' ) {
reset( $this->assets[ $this->type ] );
//reset($this->attr[$this->type]);
$attr = '';
if ( $this->type == 'js' ) {
if ( $file != '' ) {
$key = array_search( $file, $this->assets[ $this->type ] );
$version = $this->versions[ $this->type ][ $key ];
$asse... | [
"public",
"function",
"render",
"(",
"$",
"file",
"=",
"''",
")",
"{",
"reset",
"(",
"$",
"this",
"->",
"assets",
"[",
"$",
"this",
"->",
"type",
"]",
")",
";",
"//reset($this->attr[$this->type]);",
"$",
"attr",
"=",
"''",
";",
"if",
"(",
"$",
"this"... | Render Assets which already registered
@param string $file
@return string | [
"Render",
"Assets",
"which",
"already",
"registered"
] | train | https://github.com/kecik-framework/kecik/blob/fa87e593affe1c9c51a2acd264b85ec06df31d7c/Kecik/Assets.php#L160-L261 |
hametuha/wpametu | src/WPametu/UI/Field/Input.php | Input.get_field | protected function get_field( \WP_Post $post ){
$fields = [];
foreach( $this->get_field_arguments() as $key => $val ){
$fields[] = sprintf('%s="%s"', $key, esc_attr($val));
}
return $this->build_input($this->get_data($post), $fields);
} | php | protected function get_field( \WP_Post $post ){
$fields = [];
foreach( $this->get_field_arguments() as $key => $val ){
$fields[] = sprintf('%s="%s"', $key, esc_attr($val));
}
return $this->build_input($this->get_data($post), $fields);
} | [
"protected",
"function",
"get_field",
"(",
"\\",
"WP_Post",
"$",
"post",
")",
"{",
"$",
"fields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"get_field_arguments",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"$",
"fields",
"... | Get field
@param \WP_Post $post
@return string | [
"Get",
"field"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Field/Input.php#L29-L35 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.