repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
alexlcdee/colorcli | src/Logger.php | Logger.resetBGColor | public function resetBGColor()
{
static::$backgroundColorMap = [
LogLevel::EMERGENCY => BackgroundColors::RED(),
LogLevel::ALERT => BackgroundColors::RED(),
LogLevel::CRITICAL => BackgroundColors::YELLOW(),
LogLevel::ERROR => null,
LogLevel::WARNIN... | php | public function resetBGColor()
{
static::$backgroundColorMap = [
LogLevel::EMERGENCY => BackgroundColors::RED(),
LogLevel::ALERT => BackgroundColors::RED(),
LogLevel::CRITICAL => BackgroundColors::YELLOW(),
LogLevel::ERROR => null,
LogLevel::WARNIN... | [
"public",
"function",
"resetBGColor",
"(",
")",
"{",
"static",
"::",
"$",
"backgroundColorMap",
"=",
"[",
"LogLevel",
"::",
"EMERGENCY",
"=>",
"BackgroundColors",
"::",
"RED",
"(",
")",
",",
"LogLevel",
"::",
"ALERT",
"=>",
"BackgroundColors",
"::",
"RED",
"... | Set background colors map to default ones | [
"Set",
"background",
"colors",
"map",
"to",
"default",
"ones"
] | 2107917987f6c300ac5ce4a26102c9bf8e6b3d95 | https://github.com/alexlcdee/colorcli/blob/2107917987f6c300ac5ce4a26102c9bf8e6b3d95/src/Logger.php#L121-L133 | train |
alexlcdee/colorcli | src/Logger.php | Logger.resetOutputStreams | public function resetOutputStreams()
{
defined('STDOUT') || define('STDOUT', fopen('php://stdout', 'w'));
defined('STDERR') || define('STDERR', fopen('php://stderr', 'w'));
static::$streamsMap = [
LogLevel::EMERGENCY => STDERR,
LogLevel::ALERT => STDERR,
L... | php | public function resetOutputStreams()
{
defined('STDOUT') || define('STDOUT', fopen('php://stdout', 'w'));
defined('STDERR') || define('STDERR', fopen('php://stderr', 'w'));
static::$streamsMap = [
LogLevel::EMERGENCY => STDERR,
LogLevel::ALERT => STDERR,
L... | [
"public",
"function",
"resetOutputStreams",
"(",
")",
"{",
"defined",
"(",
"'STDOUT'",
")",
"||",
"define",
"(",
"'STDOUT'",
",",
"fopen",
"(",
"'php://stdout'",
",",
"'w'",
")",
")",
";",
"defined",
"(",
"'STDERR'",
")",
"||",
"define",
"(",
"'STDERR'",
... | Set output streams map to default map | [
"Set",
"output",
"streams",
"map",
"to",
"default",
"map"
] | 2107917987f6c300ac5ce4a26102c9bf8e6b3d95 | https://github.com/alexlcdee/colorcli/blob/2107917987f6c300ac5ce4a26102c9bf8e6b3d95/src/Logger.php#L209-L223 | train |
alexlcdee/colorcli | src/Logger.php | Logger.setFGColor | public function setFGColor($level, ForegroundColors $color)
{
if (static::$foregroundColorMap === null) {
$this->resetFGColors();
}
$this->checkLevel($level);
static::$foregroundColorMap[$level] = $color;
return $this;
} | php | public function setFGColor($level, ForegroundColors $color)
{
if (static::$foregroundColorMap === null) {
$this->resetFGColors();
}
$this->checkLevel($level);
static::$foregroundColorMap[$level] = $color;
return $this;
} | [
"public",
"function",
"setFGColor",
"(",
"$",
"level",
",",
"ForegroundColors",
"$",
"color",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"foregroundColorMap",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"resetFGColors",
"(",
")",
";",
"}",
"$",
"this",
... | Set foreground color for specified level
@param mixed $level
@param ForegroundColors $color
@return $this | [
"Set",
"foreground",
"color",
"for",
"specified",
"level"
] | 2107917987f6c300ac5ce4a26102c9bf8e6b3d95 | https://github.com/alexlcdee/colorcli/blob/2107917987f6c300ac5ce4a26102c9bf8e6b3d95/src/Logger.php#L231-L239 | train |
alexlcdee/colorcli | src/Logger.php | Logger.setBGColor | public function setBGColor($level, ForegroundColors $color)
{
if (static::$foregroundColorMap === null) {
$this->resetBGColor();
}
$this->checkLevel($level);
static::$foregroundColorMap[$level] = $color;
return $this;
} | php | public function setBGColor($level, ForegroundColors $color)
{
if (static::$foregroundColorMap === null) {
$this->resetBGColor();
}
$this->checkLevel($level);
static::$foregroundColorMap[$level] = $color;
return $this;
} | [
"public",
"function",
"setBGColor",
"(",
"$",
"level",
",",
"ForegroundColors",
"$",
"color",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"foregroundColorMap",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"resetBGColor",
"(",
")",
";",
"}",
"$",
"this",
"... | Set background color for specified level
@param mixed $level
@param ForegroundColors $color
@return $this | [
"Set",
"background",
"color",
"for",
"specified",
"level"
] | 2107917987f6c300ac5ce4a26102c9bf8e6b3d95 | https://github.com/alexlcdee/colorcli/blob/2107917987f6c300ac5ce4a26102c9bf8e6b3d95/src/Logger.php#L247-L255 | train |
alexlcdee/colorcli | src/Logger.php | Logger.setOutputStream | public function setOutputStream($level, $stream)
{
if (static::$streamsMap === null) {
$this->resetOutputStreams();
}
$this->checkLevel($level);
if (!is_resource($stream)) {
throw new \UnexpectedValueException("Argument '\$stream' must be a writable stream res... | php | public function setOutputStream($level, $stream)
{
if (static::$streamsMap === null) {
$this->resetOutputStreams();
}
$this->checkLevel($level);
if (!is_resource($stream)) {
throw new \UnexpectedValueException("Argument '\$stream' must be a writable stream res... | [
"public",
"function",
"setOutputStream",
"(",
"$",
"level",
",",
"$",
"stream",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"streamsMap",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"resetOutputStreams",
"(",
")",
";",
"}",
"$",
"this",
"->",
"checkLevel... | Set output stream for specified level
@param mixed $level
@param resource $stream
@return $this | [
"Set",
"output",
"stream",
"for",
"specified",
"level"
] | 2107917987f6c300ac5ce4a26102c9bf8e6b3d95 | https://github.com/alexlcdee/colorcli/blob/2107917987f6c300ac5ce4a26102c9bf8e6b3d95/src/Logger.php#L263-L274 | train |
ekyna/SettingBundle | Controller/Admin/ParameterController.php | ParameterController.showAction | public function showAction()
{
$this->isGranted('VIEW');
$this->container->get('ekyna_admin.menu.builder')
->breadcrumbAppend('settings', 'ekyna_setting.parameter.label.plural');
$manager = $this->getSettingsManager();
$schemas = $this->getSettingsRegistry()->ge... | php | public function showAction()
{
$this->isGranted('VIEW');
$this->container->get('ekyna_admin.menu.builder')
->breadcrumbAppend('settings', 'ekyna_setting.parameter.label.plural');
$manager = $this->getSettingsManager();
$schemas = $this->getSettingsRegistry()->ge... | [
"public",
"function",
"showAction",
"(",
")",
"{",
"$",
"this",
"->",
"isGranted",
"(",
"'VIEW'",
")",
";",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'ekyna_admin.menu.builder'",
")",
"->",
"breadcrumbAppend",
"(",
"'settings'",
",",
"'ekyna_setting.p... | Show the parameters.
@return \Symfony\Component\HttpFoundation\Response | [
"Show",
"the",
"parameters",
"."
] | df58f83eb3a01ef56cd76ea73639322c581e75c1 | https://github.com/ekyna/SettingBundle/blob/df58f83eb3a01ef56cd76ea73639322c581e75c1/Controller/Admin/ParameterController.php#L22-L42 | train |
ekyna/SettingBundle | Controller/Admin/ParameterController.php | ParameterController.editAction | public function editAction(Request $request)
{
$this->isGranted('EDIT');
$this->container->get('ekyna_admin.menu.builder')
->breadcrumbAppend('settings', 'ekyna_setting.parameter.label.plural');
$manager = $this->getSettingsManager();
$schemas = $this->getSettingsRegist... | php | public function editAction(Request $request)
{
$this->isGranted('EDIT');
$this->container->get('ekyna_admin.menu.builder')
->breadcrumbAppend('settings', 'ekyna_setting.parameter.label.plural');
$manager = $this->getSettingsManager();
$schemas = $this->getSettingsRegist... | [
"public",
"function",
"editAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"isGranted",
"(",
"'EDIT'",
")",
";",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'ekyna_admin.menu.builder'",
")",
"->",
"breadcrumbAppend",
"(",
"'setti... | Edit the parameters.
@param Request $request
@return \Symfony\Component\HttpFoundation\Response | [
"Edit",
"the",
"parameters",
"."
] | df58f83eb3a01ef56cd76ea73639322c581e75c1 | https://github.com/ekyna/SettingBundle/blob/df58f83eb3a01ef56cd76ea73639322c581e75c1/Controller/Admin/ParameterController.php#L50-L124 | train |
ziopod/Tanuki-core | classes/View/Tanuki.php | View_Tanuki.title | public function title()
{
// Try to load title from model
$model_name = $this->model_name;
if (isset($this->$model_name->title))
{
return $this->$model_name->title;
}
// Instead use global config
return Arr::path($this->tanuki(), 'title');
} | php | public function title()
{
// Try to load title from model
$model_name = $this->model_name;
if (isset($this->$model_name->title))
{
return $this->$model_name->title;
}
// Instead use global config
return Arr::path($this->tanuki(), 'title');
} | [
"public",
"function",
"title",
"(",
")",
"{",
"// Try to load title from model",
"$",
"model_name",
"=",
"$",
"this",
"->",
"model_name",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"$",
"model_name",
"->",
"title",
")",
")",
"{",
"return",
"$",
"th... | Set HTML title tag
@return string | [
"Set",
"HTML",
"title",
"tag"
] | 8dbe2dd45c6cafd0029aa747cd1ffebea4a936ab | https://github.com/ziopod/Tanuki-core/blob/8dbe2dd45c6cafd0029aa747cd1ffebea4a936ab/classes/View/Tanuki.php#L133-L145 | train |
mtils/cmsable | src/Cmsable/Mail/MessageBuilder.php | MessageBuilder.setupMessage | public function setupMessage(Message $message){
$this->addRecipients($message);
$this->setSubject($message);
$this->callCustomBuilder($message);
} | php | public function setupMessage(Message $message){
$this->addRecipients($message);
$this->setSubject($message);
$this->callCustomBuilder($message);
} | [
"public",
"function",
"setupMessage",
"(",
"Message",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"addRecipients",
"(",
"$",
"message",
")",
";",
"$",
"this",
"->",
"setSubject",
"(",
"$",
"message",
")",
";",
"$",
"this",
"->",
"callCustomBuilder",
"("... | This method will be called by the returned closure
@param \Illuminate\Mail\Message $message
@return void | [
"This",
"method",
"will",
"be",
"called",
"by",
"the",
"returned",
"closure"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Mail/MessageBuilder.php#L57-L65 | train |
mtils/cmsable | src/Cmsable/Mail/MessageBuilder.php | MessageBuilder.addRecipients | protected function addRecipients(Message $message){
if($overwriteTo = $this->getOverwriteTo()){
$message->to($overwriteTo);
return;
}
$first = true;
foreach($this->recipients as $recipient){
if($first){
$message->to($recipient);
... | php | protected function addRecipients(Message $message){
if($overwriteTo = $this->getOverwriteTo()){
$message->to($overwriteTo);
return;
}
$first = true;
foreach($this->recipients as $recipient){
if($first){
$message->to($recipient);
... | [
"protected",
"function",
"addRecipients",
"(",
"Message",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"overwriteTo",
"=",
"$",
"this",
"->",
"getOverwriteTo",
"(",
")",
")",
"{",
"$",
"message",
"->",
"to",
"(",
"$",
"overwriteTo",
")",
";",
"return",
";... | Adds the recipients to the message
@param \Illuminate\Mail\Message $message
@return void | [
"Adds",
"the",
"recipients",
"to",
"the",
"message"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Mail/MessageBuilder.php#L105-L127 | train |
mtils/cmsable | src/Cmsable/Mail/MessageBuilder.php | MessageBuilder.setSubject | protected function setSubject(Message $message){
if(!isset($this->data['subject'])){
throw new OutOfBoundsException("You have to pass a subject key and value in your view data");
}
$message->subject($this->data['subject']);
} | php | protected function setSubject(Message $message){
if(!isset($this->data['subject'])){
throw new OutOfBoundsException("You have to pass a subject key and value in your view data");
}
$message->subject($this->data['subject']);
} | [
"protected",
"function",
"setSubject",
"(",
"Message",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'subject'",
"]",
")",
")",
"{",
"throw",
"new",
"OutOfBoundsException",
"(",
"\"You have to pass a subject key and v... | Sets tzhe subject of the message
@param \Illuminate\Mail\Message $message
@return void | [
"Sets",
"tzhe",
"subject",
"of",
"the",
"message"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Mail/MessageBuilder.php#L135-L143 | train |
bytic/orm | src/Relations/Traits/HasPivotTable.php | HasPivotTable.generatePivotTable | public function generatePivotTable()
{
$tables = [
$this->getManager()->getTable(),
$this->getWith()->getTable()
];
sort($tables);
return implode("_", $tables);
} | php | public function generatePivotTable()
{
$tables = [
$this->getManager()->getTable(),
$this->getWith()->getTable()
];
sort($tables);
return implode("_", $tables);
} | [
"public",
"function",
"generatePivotTable",
"(",
")",
"{",
"$",
"tables",
"=",
"[",
"$",
"this",
"->",
"getManager",
"(",
")",
"->",
"getTable",
"(",
")",
",",
"$",
"this",
"->",
"getWith",
"(",
")",
"->",
"getTable",
"(",
")",
"]",
";",
"sort",
"(... | Builds the name of a has-and-belongs-to-many association table
@return string | [
"Builds",
"the",
"name",
"of",
"a",
"has",
"-",
"and",
"-",
"belongs",
"-",
"to",
"-",
"many",
"association",
"table"
] | 8d9a79b47761af0bfd9b8d1d28c83221dcac0de0 | https://github.com/bytic/orm/blob/8d9a79b47761af0bfd9b8d1d28c83221dcac0de0/src/Relations/Traits/HasPivotTable.php#L46-L55 | train |
kherge-abandoned/php-service-process | src/lib/Herrera/Service/Process/Process.php | Process.glob | public function glob($pattern)
{
foreach (glob($pattern) as $result) {
$this->builder->add($result);
}
} | php | public function glob($pattern)
{
foreach (glob($pattern) as $result) {
$this->builder->add($result);
}
} | [
"public",
"function",
"glob",
"(",
"$",
"pattern",
")",
"{",
"foreach",
"(",
"glob",
"(",
"$",
"pattern",
")",
"as",
"$",
"result",
")",
"{",
"$",
"this",
"->",
"builder",
"->",
"add",
"(",
"$",
"result",
")",
";",
"}",
"}"
] | Expands the glob pattern and add the results as arguments.
@param string $pattern The glob pattern.
@return Process For method chaining. | [
"Expands",
"the",
"glob",
"pattern",
"and",
"add",
"the",
"results",
"as",
"arguments",
"."
] | 33b6e17c027d99dcb38bfe66f250b56800a525fa | https://github.com/kherge-abandoned/php-service-process/blob/33b6e17c027d99dcb38bfe66f250b56800a525fa/src/lib/Herrera/Service/Process/Process.php#L90-L95 | train |
SevenEcks/string-utils | src/StringUtils.php | StringUtils.tostr | public function tostr(...$strings)
{
$new_string = '';
foreach ($strings as $temp) {
switch (gettype($temp)) {
case "array":
$it = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($temp));
foreach($it as $v) {
... | php | public function tostr(...$strings)
{
$new_string = '';
foreach ($strings as $temp) {
switch (gettype($temp)) {
case "array":
$it = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($temp));
foreach($it as $v) {
... | [
"public",
"function",
"tostr",
"(",
"...",
"$",
"strings",
")",
"{",
"$",
"new_string",
"=",
"''",
";",
"foreach",
"(",
"$",
"strings",
"as",
"$",
"temp",
")",
"{",
"switch",
"(",
"gettype",
"(",
"$",
"temp",
")",
")",
"{",
"case",
"\"array\"",
":"... | Take n arguments and combine them into a single
string and return that string
@param string $strings
@param ... $strings
@return string | [
"Take",
"n",
"arguments",
"and",
"combine",
"them",
"into",
"a",
"single",
"string",
"and",
"return",
"that",
"string"
] | 3d1fc3cbac2a77d1fbd52c4eca1868f6136ae3a0 | https://github.com/SevenEcks/string-utils/blob/3d1fc3cbac2a77d1fbd52c4eca1868f6136ae3a0/src/StringUtils.php#L136-L154 | train |
SevenEcks/string-utils | src/StringUtils.php | StringUtils.wordWrap | public function wordWrap($string)
{
return wordwrap($string, $this->line_length, $this->break_string, $this->split_mid_word);
} | php | public function wordWrap($string)
{
return wordwrap($string, $this->line_length, $this->break_string, $this->split_mid_word);
} | [
"public",
"function",
"wordWrap",
"(",
"$",
"string",
")",
"{",
"return",
"wordwrap",
"(",
"$",
"string",
",",
"$",
"this",
"->",
"line_length",
",",
"$",
"this",
"->",
"break_string",
",",
"$",
"this",
"->",
"split_mid_word",
")",
";",
"}"
] | Return a string wrapped either at a word, or close to the words completion
using the break_string defined on the object
@param string $string
@return none | [
"Return",
"a",
"string",
"wrapped",
"either",
"at",
"a",
"word",
"or",
"close",
"to",
"the",
"words",
"completion",
"using",
"the",
"break_string",
"defined",
"on",
"the",
"object"
] | 3d1fc3cbac2a77d1fbd52c4eca1868f6136ae3a0 | https://github.com/SevenEcks/string-utils/blob/3d1fc3cbac2a77d1fbd52c4eca1868f6136ae3a0/src/StringUtils.php#L176-L179 | train |
SevenEcks/string-utils | src/StringUtils.php | StringUtils.massColor | public function massColor(array $strings, string $color)
{
$len_array = count($strings);
for ($i = 0; $i < $len_array; $i++) {
$strings[$i] = $this->colorize->{$color}($strings[$i]);
}
return $strings;
} | php | public function massColor(array $strings, string $color)
{
$len_array = count($strings);
for ($i = 0; $i < $len_array; $i++) {
$strings[$i] = $this->colorize->{$color}($strings[$i]);
}
return $strings;
} | [
"public",
"function",
"massColor",
"(",
"array",
"$",
"strings",
",",
"string",
"$",
"color",
")",
"{",
"$",
"len_array",
"=",
"count",
"(",
"$",
"strings",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"len_array",
";",
"$",... | Mass colorize an array of strings
@param array $strings
@param string $color
@return array | [
"Mass",
"colorize",
"an",
"array",
"of",
"strings"
] | 3d1fc3cbac2a77d1fbd52c4eca1868f6136ae3a0 | https://github.com/SevenEcks/string-utils/blob/3d1fc3cbac2a77d1fbd52c4eca1868f6136ae3a0/src/StringUtils.php#L308-L315 | train |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Color.php | Color.setRGB | public function setRGB( $rgbValue ) : Color
{
if ( \is_string( $rgbValue ) )
{
$this->setRGBString( $rgbValue );
}
else if ( \is_array( $rgbValue ) && \count( $rgbValue ) > 2 )
{
$this->setRGBArray( $rgbValue );
}
else
{
throw new ArgumentEr... | php | public function setRGB( $rgbValue ) : Color
{
if ( \is_string( $rgbValue ) )
{
$this->setRGBString( $rgbValue );
}
else if ( \is_array( $rgbValue ) && \count( $rgbValue ) > 2 )
{
$this->setRGBArray( $rgbValue );
}
else
{
throw new ArgumentEr... | [
"public",
"function",
"setRGB",
"(",
"$",
"rgbValue",
")",
":",
"Color",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"rgbValue",
")",
")",
"{",
"$",
"this",
"->",
"setRGBString",
"(",
"$",
"rgbValue",
")",
";",
"}",
"else",
"if",
"(",
"\\",
"is_ar... | Sets a new color, defined by a valid RGB value.
If a string is used the following formats are valid: 'rgb(r,g,b)' or 'r,g,b'
Or a array (0=r,1=g,2=b) or associative with keys 'r'|'red', 'g'|'green', 'b'|'blue'
@param string|array $rgbValue
@return \Beluga\Drawing\Color
@throws \Beluga\ArgumentError | [
"Sets",
"a",
"new",
"color",
"defined",
"by",
"a",
"valid",
"RGB",
"value",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Color.php#L287-L310 | train |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Color.php | Color.FromString | public static function FromString( $objectString )
{
if ( false !== ( $rgb = ColorTool::Color2Rgb( $objectString ) ) )
{
return new Color(
ColorTool::Rgb2Hex(
$rgb[ 0 ],
$rgb[ 1 ],
$rgb[ 2 ]
)
);
}
if ( f... | php | public static function FromString( $objectString )
{
if ( false !== ( $rgb = ColorTool::Color2Rgb( $objectString ) ) )
{
return new Color(
ColorTool::Rgb2Hex(
$rgb[ 0 ],
$rgb[ 1 ],
$rgb[ 2 ]
)
);
}
if ( f... | [
"public",
"static",
"function",
"FromString",
"(",
"$",
"objectString",
")",
"{",
"if",
"(",
"false",
"!==",
"(",
"$",
"rgb",
"=",
"ColorTool",
"::",
"Color2Rgb",
"(",
"$",
"objectString",
")",
")",
")",
"{",
"return",
"new",
"Color",
"(",
"ColorTool",
... | Init a new instance from defined string.
@param string $objectString
@return \Beluga\Drawing\Color | [
"Init",
"a",
"new",
"instance",
"from",
"defined",
"string",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Color.php#L701-L722 | train |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Color.php | Color.FromArray | public static function FromArray( array $objectData )
{
if ( \count( $objectData ) == 3 )
{
if ( false !== ( $hex = ColorTool::Color2Hex( $objectData ) ) )
{
return new Color( $hex );
}
}
$rgb = array();
if ( isset( $objectData[ 'r' ] ) )
... | php | public static function FromArray( array $objectData )
{
if ( \count( $objectData ) == 3 )
{
if ( false !== ( $hex = ColorTool::Color2Hex( $objectData ) ) )
{
return new Color( $hex );
}
}
$rgb = array();
if ( isset( $objectData[ 'r' ] ) )
... | [
"public",
"static",
"function",
"FromArray",
"(",
"array",
"$",
"objectData",
")",
"{",
"if",
"(",
"\\",
"count",
"(",
"$",
"objectData",
")",
"==",
"3",
")",
"{",
"if",
"(",
"false",
"!==",
"(",
"$",
"hex",
"=",
"ColorTool",
"::",
"Color2Hex",
"(",
... | Init a new instance from defined array.
@param array $objectData
@return \Beluga\Drawing\Color Or boolean FALSE | [
"Init",
"a",
"new",
"instance",
"from",
"defined",
"array",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Color.php#L730-L801 | train |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Color.php | Color.FromGdValueWithAlpha | public static function FromGdValueWithAlpha( $gdValueWithAlpha )
{
$a = ( $gdValueWithAlpha >> 24 ) & 0xFF;
$r = ( $gdValueWithAlpha >> 16 ) & 0xFF;
$g = ( $gdValueWithAlpha >> 8 ) & 0xFF;
$b = $gdValueWithAlpha & 0xFF;
if ( $a == 0 )
{
$o = 0;
}
else if ( ... | php | public static function FromGdValueWithAlpha( $gdValueWithAlpha )
{
$a = ( $gdValueWithAlpha >> 24 ) & 0xFF;
$r = ( $gdValueWithAlpha >> 16 ) & 0xFF;
$g = ( $gdValueWithAlpha >> 8 ) & 0xFF;
$b = $gdValueWithAlpha & 0xFF;
if ( $a == 0 )
{
$o = 0;
}
else if ( ... | [
"public",
"static",
"function",
"FromGdValueWithAlpha",
"(",
"$",
"gdValueWithAlpha",
")",
"{",
"$",
"a",
"=",
"(",
"$",
"gdValueWithAlpha",
">>",
"24",
")",
"&",
"0xFF",
";",
"$",
"r",
"=",
"(",
"$",
"gdValueWithAlpha",
">>",
"16",
")",
"&",
"0xFF",
"... | Converts a GD integer value as color with alpha channel to an \Beluga\Drawing\Color instance.
@param int $gdValueWithAlpha
@return \Beluga\Drawing\Color | [
"Converts",
"a",
"GD",
"integer",
"value",
"as",
"color",
"with",
"alpha",
"channel",
"to",
"an",
"\\",
"Beluga",
"\\",
"Drawing",
"\\",
"Color",
"instance",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Color.php#L809-L832 | train |
Dhii/config | src/GetDataCapableByPathTrait.php | GetDataCapableByPathTrait._getData | protected function _getData($key)
{
$separator = $this->_getPathSegmentSeparator();
$path = $this->_normalizePath($key, $separator);
$store = $this->_getDataStore();
return $this->_containerGetPath($store, $path);
} | php | protected function _getData($key)
{
$separator = $this->_getPathSegmentSeparator();
$path = $this->_normalizePath($key, $separator);
$store = $this->_getDataStore();
return $this->_containerGetPath($store, $path);
} | [
"protected",
"function",
"_getData",
"(",
"$",
"key",
")",
"{",
"$",
"separator",
"=",
"$",
"this",
"->",
"_getPathSegmentSeparator",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"_normalizePath",
"(",
"$",
"key",
",",
"$",
"separator",
")",
";"... | Retrieves the data associated with the specified key or path.
Will traverse the hierarchy of containers identified by the path segments.
@since [*next-version*]
@param string|Stringable $key The key or list of keys in the path to get the data for.
@return mixed The data corresponding to the path. | [
"Retrieves",
"the",
"data",
"associated",
"with",
"the",
"specified",
"key",
"or",
"path",
"."
] | 1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf | https://github.com/Dhii/config/blob/1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf/src/GetDataCapableByPathTrait.php#L32-L39 | train |
SlabPHP/bundle-stack | src/Stack.php | Stack.findClassName | public function findClassName($className)
{
if (!empty($this->lookupCache->classes[$className])) {
return $this->lookupCache->classes[$className];
}
if (class_exists($className)) return $className;
$startsWithSlash = ($className[0] == '\\');
foreach ($this->sear... | php | public function findClassName($className)
{
if (!empty($this->lookupCache->classes[$className])) {
return $this->lookupCache->classes[$className];
}
if (class_exists($className)) return $className;
$startsWithSlash = ($className[0] == '\\');
foreach ($this->sear... | [
"public",
"function",
"findClassName",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"lookupCache",
"->",
"classes",
"[",
"$",
"className",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"lookupCache",
"->",
"class... | Find class name
@param $className
@return null|string | [
"Find",
"class",
"name"
] | d96c4de469e58040968044d2d6525cb60d9dd8c6 | https://github.com/SlabPHP/bundle-stack/blob/d96c4de469e58040968044d2d6525cb60d9dd8c6/src/Stack.php#L79-L104 | train |
jenskooij/cloudcontrol | src/util/StringUtil.php | StringUtil.slugify | public static function slugify($str, $replace = array(), $delimiter = '-')
{
if (!empty($replace)) {
$str = str_replace((array)$replace, ' ', $str);
}
$clean = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
... | php | public static function slugify($str, $replace = array(), $delimiter = '-')
{
if (!empty($replace)) {
$str = str_replace((array)$replace, ' ', $str);
}
$clean = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
... | [
"public",
"static",
"function",
"slugify",
"(",
"$",
"str",
",",
"$",
"replace",
"=",
"array",
"(",
")",
",",
"$",
"delimiter",
"=",
"'-'",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"replace",
")",
")",
"{",
"$",
"str",
"=",
"str_replace",
"("... | Convert a string to url friendly slug
@param string $str
@param array $replace
@param string $delimiter
@return mixed|string | [
"Convert",
"a",
"string",
"to",
"url",
"friendly",
"slug"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/util/StringUtil.php#L38-L50 | train |
jenskooij/cloudcontrol | src/util/StringUtil.php | StringUtil.iconByFileType | public static function iconByFileType($fileType)
{
foreach (self::$fileTypeIcons as $needle => $icon) {
if (strpos($fileType, $needle) !== false) {
return $icon;
}
}
return 'file-o';
} | php | public static function iconByFileType($fileType)
{
foreach (self::$fileTypeIcons as $needle => $icon) {
if (strpos($fileType, $needle) !== false) {
return $icon;
}
}
return 'file-o';
} | [
"public",
"static",
"function",
"iconByFileType",
"(",
"$",
"fileType",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"fileTypeIcons",
"as",
"$",
"needle",
"=>",
"$",
"icon",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"fileType",
",",
"$",
"needle",
")",
... | Selects the right font-awesome icon for each filetype
@param $fileType
@return string | [
"Selects",
"the",
"right",
"font",
"-",
"awesome",
"icon",
"for",
"each",
"filetype"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/util/StringUtil.php#L59-L70 | train |
jenskooij/cloudcontrol | src/util/StringUtil.php | StringUtil.humanFileSize | public static function humanFileSize($size, $unit = '')
{
if (self::isHumanFilesizeUnitGb($size, $unit)) {
return number_format($size / (1 << 30), 2) . 'GB';
}
if (self::isHumanFilesizeUnitMb($size, $unit)) {
return number_format($size / (1 << 20), 2) . 'MB';
... | php | public static function humanFileSize($size, $unit = '')
{
if (self::isHumanFilesizeUnitGb($size, $unit)) {
return number_format($size / (1 << 30), 2) . 'GB';
}
if (self::isHumanFilesizeUnitMb($size, $unit)) {
return number_format($size / (1 << 20), 2) . 'MB';
... | [
"public",
"static",
"function",
"humanFileSize",
"(",
"$",
"size",
",",
"$",
"unit",
"=",
"''",
")",
"{",
"if",
"(",
"self",
"::",
"isHumanFilesizeUnitGb",
"(",
"$",
"size",
",",
"$",
"unit",
")",
")",
"{",
"return",
"number_format",
"(",
"$",
"size",
... | Converts an amount of bytes to a human readable
format
@param $size
@param string $unit
@return string | [
"Converts",
"an",
"amount",
"of",
"bytes",
"to",
"a",
"human",
"readable",
"format"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/util/StringUtil.php#L81-L94 | train |
native5/native5-sdk-client-php | src/Native5/UI/TemplatingEngine.php | TemplatingEngine.render | protected function render($tmpl, $in_data=array()) {
try {
$data = array();
$app = array();
$app['content'] = $in_data;
$app['settings'] = $this->_viewData['settings'];
$data['app'] = $app;
$data['global'] = a... | php | protected function render($tmpl, $in_data=array()) {
try {
$data = array();
$app = array();
$app['content'] = $in_data;
$app['settings'] = $this->_viewData['settings'];
$data['app'] = $app;
$data['global'] = a... | [
"protected",
"function",
"render",
"(",
"$",
"tmpl",
",",
"$",
"in_data",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"app",
"=",
"array",
"(",
")",
";",
"$",
"app",
"[",
"'content'",
"]",
"=",
... | Renders a given template along with input data.
@param mixed $tmpl The template to render.
@param mixed $in_data The data to render with.
@access protected
@return void | [
"Renders",
"a",
"given",
"template",
"along",
"with",
"input",
"data",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/UI/TemplatingEngine.php#L148-L164 | train |
ARCANESOFT/Media | src/MediaServiceProvider.php | MediaServiceProvider.syncFilesystemConfig | private function syncFilesystemConfig()
{
foreach ($this->config()->get('arcanesoft.media.filesystem.disks', []) as $disk => $config) {
$this->config()->set("filesystems.disks.$disk", $config);
}
} | php | private function syncFilesystemConfig()
{
foreach ($this->config()->get('arcanesoft.media.filesystem.disks', []) as $disk => $config) {
$this->config()->set("filesystems.disks.$disk", $config);
}
} | [
"private",
"function",
"syncFilesystemConfig",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'arcanesoft.media.filesystem.disks'",
",",
"[",
"]",
")",
"as",
"$",
"disk",
"=>",
"$",
"config",
")",
"{",
"$",
"this... | Sync the filesystem config. | [
"Sync",
"the",
"filesystem",
"config",
"."
] | e98aad52f94e6587fcbf79c56f7bf7072929bfc9 | https://github.com/ARCANESOFT/Media/blob/e98aad52f94e6587fcbf79c56f7bf7072929bfc9/src/MediaServiceProvider.php#L84-L89 | train |
theopera/framework | src/Component/Template/PhpEngine.php | PhpEngine.loadFile | public function loadFile(string $file)
{
$path = $this->basePath . '/' . $file . '.phtml';
if (!is_readable($path)) {
throw new TemplateException(sprintf('Template engine could not read the file "%s"', $path));
};
if (($this->contents = file_get_contents($path)) === fals... | php | public function loadFile(string $file)
{
$path = $this->basePath . '/' . $file . '.phtml';
if (!is_readable($path)) {
throw new TemplateException(sprintf('Template engine could not read the file "%s"', $path));
};
if (($this->contents = file_get_contents($path)) === fals... | [
"public",
"function",
"loadFile",
"(",
"string",
"$",
"file",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"basePath",
".",
"'/'",
".",
"$",
"file",
".",
"'.phtml'",
";",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"path",
")",
")",
"{",
"throw",
... | Loads a template file into memory
@param string $file
@return mixed | [
"Loads",
"a",
"template",
"file",
"into",
"memory"
] | fa6165d3891a310faa580c81dee49a63c150c711 | https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/Template/PhpEngine.php#L55-L66 | train |
chalasr/RCHCapistranoBundle | Generator/CapfileGenerator.php | CapfileGenerator.write | public function write()
{
$capfile = '';
foreach ($this->parameters as $namespace) {
$line = str_replace('<requirement>', $namespace, self::$template);
$capfile = sprintf('%s%s%s', $capfile, PHP_EOL, $line);
}
$capfile .= self::$importTemplate;
fwri... | php | public function write()
{
$capfile = '';
foreach ($this->parameters as $namespace) {
$line = str_replace('<requirement>', $namespace, self::$template);
$capfile = sprintf('%s%s%s', $capfile, PHP_EOL, $line);
}
$capfile .= self::$importTemplate;
fwri... | [
"public",
"function",
"write",
"(",
")",
"{",
"$",
"capfile",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"as",
"$",
"namespace",
")",
"{",
"$",
"line",
"=",
"str_replace",
"(",
"'<requirement>'",
",",
"$",
"namespace",
",",
"self"... | Writes Capfile. | [
"Writes",
"Capfile",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Generator/CapfileGenerator.php#L49-L61 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Cookie/SetCookie.php | SetCookie.fromString | public static function fromString($cookie)
{
// Create the default return array
$data = self::$defaults;
// Explode the cookie string using a series of semicolons
$pieces = array_filter(array_map('trim', explode(';', $cookie)));
// The name of the cookie (first kvp) must incl... | php | public static function fromString($cookie)
{
// Create the default return array
$data = self::$defaults;
// Explode the cookie string using a series of semicolons
$pieces = array_filter(array_map('trim', explode(';', $cookie)));
// The name of the cookie (first kvp) must incl... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"cookie",
")",
"{",
"// Create the default return array",
"$",
"data",
"=",
"self",
"::",
"$",
"defaults",
";",
"// Explode the cookie string using a series of semicolons",
"$",
"pieces",
"=",
"array_filter",
"(",
... | Create a new SetCookie object from a string
@param string $cookie Set-Cookie header string
@return self | [
"Create",
"a",
"new",
"SetCookie",
"object",
"from",
"a",
"string"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Cookie/SetCookie.php#L35-L71 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Cookie/SetCookie.php | SetCookie.setExpires | public function setExpires($timestamp)
{
$this->data['Expires'] = is_numeric($timestamp)
? (int) $timestamp
: strtotime($timestamp);
return $this;
} | php | public function setExpires($timestamp)
{
$this->data['Expires'] = is_numeric($timestamp)
? (int) $timestamp
: strtotime($timestamp);
return $this;
} | [
"public",
"function",
"setExpires",
"(",
"$",
"timestamp",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'Expires'",
"]",
"=",
"is_numeric",
"(",
"$",
"timestamp",
")",
"?",
"(",
"int",
")",
"$",
"timestamp",
":",
"strtotime",
"(",
"$",
"timestamp",
")",
... | Set the unix timestamp for which the cookie will expire
@param int $timestamp Unix timestamp
@return self | [
"Set",
"the",
"unix",
"timestamp",
"for",
"which",
"the",
"cookie",
"will",
"expire"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Cookie/SetCookie.php#L246-L253 | train |
Kris-Kuiper/sFire-Framework | src/Image/Image.php | Image.setImage | public function setImage($file) {
if(false === is_string($file)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($file)), E_USER_ERROR);
}
if(false === is_file($file)) {
return trigger_error(sprintf('File "%s" passed to %s() doe... | php | public function setImage($file) {
if(false === is_string($file)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($file)), E_USER_ERROR);
}
if(false === is_file($file)) {
return trigger_error(sprintf('File "%s" passed to %s() doe... | [
"public",
"function",
"setImage",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"file",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"__M... | Set a new image
@param string $image
@return sFire\Image\Image | [
"Set",
"a",
"new",
"image"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Image/Image.php#L94-L118 | train |
Kris-Kuiper/sFire-Framework | src/Image/Image.php | Image.flip | public function flip($mode = self :: FLIP_HORIZONTAL) {
if(false === in_array($mode, [self :: FLIP_HORIZONTAL, self :: FLIP_VERTICAL, self :: FLIP_BOTH])) {
return trigger_error(sprintf('Unknown mode passed %s(), "%s" given', __METHOD__, gettype($mode)), E_USER_ERROR);
}
$this -> add(__FUNCTION__, fu... | php | public function flip($mode = self :: FLIP_HORIZONTAL) {
if(false === in_array($mode, [self :: FLIP_HORIZONTAL, self :: FLIP_VERTICAL, self :: FLIP_BOTH])) {
return trigger_error(sprintf('Unknown mode passed %s(), "%s" given', __METHOD__, gettype($mode)), E_USER_ERROR);
}
$this -> add(__FUNCTION__, fu... | [
"public",
"function",
"flip",
"(",
"$",
"mode",
"=",
"self",
"::",
"FLIP_HORIZONTAL",
")",
"{",
"if",
"(",
"false",
"===",
"in_array",
"(",
"$",
"mode",
",",
"[",
"self",
"::",
"FLIP_HORIZONTAL",
",",
"self",
"::",
"FLIP_VERTICAL",
",",
"self",
"::",
"... | Flip the current image horizontal, vertical or both
@param int $mode
@return sFire\Image\Image | [
"Flip",
"the",
"current",
"image",
"horizontal",
"vertical",
"or",
"both"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Image/Image.php#L340-L348 | train |
Kris-Kuiper/sFire-Framework | src/Image/Image.php | Image.call | private function call() {
if(null === $this -> driver) {
return trigger_error('Driver is not set. Set the driver with the setDriver() method', E_USER_ERROR);
}
if(null === $this -> image) {
return trigger_error('Image has not been set. Set the image with the setImag... | php | private function call() {
if(null === $this -> driver) {
return trigger_error('Driver is not set. Set the driver with the setDriver() method', E_USER_ERROR);
}
if(null === $this -> image) {
return trigger_error('Image has not been set. Set the image with the setImag... | [
"private",
"function",
"call",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"driver",
")",
"{",
"return",
"trigger_error",
"(",
"'Driver is not set. Set the driver with the setDriver() method'",
",",
"E_USER_ERROR",
")",
";",
"}",
"if",
"(",
"null... | Check if image and driver is set and returns the driver
@return mixed | [
"Check",
"if",
"image",
"and",
"driver",
"is",
"set",
"and",
"returns",
"the",
"driver"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Image/Image.php#L458-L473 | train |
Kris-Kuiper/sFire-Framework | src/Image/Image.php | Image.getQuality | private function getQuality($quality, $extension) {
if(false === ('-' . intval($quality) == '-' . $quality)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($quality)), E_USER_ERROR);
}
if(false === is_string($extension)) {
ret... | php | private function getQuality($quality, $extension) {
if(false === ('-' . intval($quality) == '-' . $quality)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($quality)), E_USER_ERROR);
}
if(false === is_string($extension)) {
ret... | [
"private",
"function",
"getQuality",
"(",
"$",
"quality",
",",
"$",
"extension",
")",
"{",
"if",
"(",
"false",
"===",
"(",
"'-'",
".",
"intval",
"(",
"$",
"quality",
")",
"==",
"'-'",
".",
"$",
"quality",
")",
")",
"{",
"return",
"trigger_error",
"("... | Validates and returns quality based on image extension
@param int $quality
@param string $extension
@return int | [
"Validates",
"and",
"returns",
"quality",
"based",
"on",
"image",
"extension"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Image/Image.php#L482-L497 | train |
ndavison/groundwork-framework | src/Groundwork/Classes/Resource.php | Resource.output | public function output()
{
// Check that the method for this HTTP request method exists.
$methodName = 'http_' . $this->request->httpMethod();
if (method_exists($this, $methodName)) {
// Execute the requested Resource instance's method that
// corresponds with the re... | php | public function output()
{
// Check that the method for this HTTP request method exists.
$methodName = 'http_' . $this->request->httpMethod();
if (method_exists($this, $methodName)) {
// Execute the requested Resource instance's method that
// corresponds with the re... | [
"public",
"function",
"output",
"(",
")",
"{",
"// Check that the method for this HTTP request method exists.",
"$",
"methodName",
"=",
"'http_'",
".",
"$",
"this",
"->",
"request",
"->",
"httpMethod",
"(",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
... | Generate the output of the requested Resource instance.
@return mixed | [
"Generate",
"the",
"output",
"of",
"the",
"requested",
"Resource",
"instance",
"."
] | c3d22a1410c8d8a07b4ca1f99a35a1181516cd6c | https://github.com/ndavison/groundwork-framework/blob/c3d22a1410c8d8a07b4ca1f99a35a1181516cd6c/src/Groundwork/Classes/Resource.php#L53-L70 | train |
brightnucleus/options-store | src/Exception/InvalidOption.php | InvalidOption.fromOption | public static function fromOption($option)
{
$message = sprintf(
'Could not add invalid Option of type "%1$s" to option repository.',
is_object($option)
? get_class($option)
: gettype($option)
);
return new static($message);
} | php | public static function fromOption($option)
{
$message = sprintf(
'Could not add invalid Option of type "%1$s" to option repository.',
is_object($option)
? get_class($option)
: gettype($option)
);
return new static($message);
} | [
"public",
"static",
"function",
"fromOption",
"(",
"$",
"option",
")",
"{",
"$",
"message",
"=",
"sprintf",
"(",
"'Could not add invalid Option of type \"%1$s\" to option repository.'",
",",
"is_object",
"(",
"$",
"option",
")",
"?",
"get_class",
"(",
"$",
"option",... | Get a new exception based on the type of an invalid option.
@since 0.1.0
@param mixed $option Option that was tried to be added.
@return static | [
"Get",
"a",
"new",
"exception",
"based",
"on",
"the",
"type",
"of",
"an",
"invalid",
"option",
"."
] | 9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1 | https://github.com/brightnucleus/options-store/blob/9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1/src/Exception/InvalidOption.php#L40-L50 | train |
EdwinDayot/shorty-framework | src/Framework/Routing/Controller.php | Controller.middleware | public function middleware($name)
{
if (is_string($name)) {
app()->addRouteMiddleware($name);
} else if (is_array($name)) {
foreach ($name as $middlewareName) {
app()->addRouteMiddleware($middlewareName);
}
}
} | php | public function middleware($name)
{
if (is_string($name)) {
app()->addRouteMiddleware($name);
} else if (is_array($name)) {
foreach ($name as $middlewareName) {
app()->addRouteMiddleware($middlewareName);
}
}
} | [
"public",
"function",
"middleware",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"app",
"(",
")",
"->",
"addRouteMiddleware",
"(",
"$",
"name",
")",
";",
"}",
"else",
"if",
"(",
"is_array",
"(",
"$",
"name",
... | Middlewares to add.
@param string|string[] $name | [
"Middlewares",
"to",
"add",
"."
] | e03c991ea86aedbd87674d1ee2f9041b55b5e578 | https://github.com/EdwinDayot/shorty-framework/blob/e03c991ea86aedbd87674d1ee2f9041b55b5e578/src/Framework/Routing/Controller.php#L20-L29 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Normalizer/MajoraNormalizer.php | MajoraNormalizer.createNormalizer | public static function createNormalizer($key = 'default')
{
return isset(self::$instancePool[$key]) ?
self::$instancePool[$key] :
self::$instancePool[$key] = new static(
PropertyAccess::createPropertyAccessor()
);
} | php | public static function createNormalizer($key = 'default')
{
return isset(self::$instancePool[$key]) ?
self::$instancePool[$key] :
self::$instancePool[$key] = new static(
PropertyAccess::createPropertyAccessor()
);
} | [
"public",
"static",
"function",
"createNormalizer",
"(",
"$",
"key",
"=",
"'default'",
")",
"{",
"return",
"isset",
"(",
"self",
"::",
"$",
"instancePool",
"[",
"$",
"key",
"]",
")",
"?",
"self",
"::",
"$",
"instancePool",
"[",
"$",
"key",
"]",
":",
... | Create and return an instantiated normalizer, returns always the same throught this call.
@param string $key optionnal normalizer key
@return MajoraNormalizer | [
"Create",
"and",
"return",
"an",
"instantiated",
"normalizer",
"returns",
"always",
"the",
"same",
"throught",
"this",
"call",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Normalizer/MajoraNormalizer.php#L69-L76 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Normalizer/MajoraNormalizer.php | MajoraNormalizer.createReadingDelegate | private function createReadingDelegate()
{
return $this->readDelegate ?: $this->readDelegate = function ($property, PropertyAccessor $propertyAccessor) {
switch (true) {
// Public property / accessor case
case $propertyAccessor->isReadable($this, $property) :
... | php | private function createReadingDelegate()
{
return $this->readDelegate ?: $this->readDelegate = function ($property, PropertyAccessor $propertyAccessor) {
switch (true) {
// Public property / accessor case
case $propertyAccessor->isReadable($this, $property) :
... | [
"private",
"function",
"createReadingDelegate",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"readDelegate",
"?",
":",
"$",
"this",
"->",
"readDelegate",
"=",
"function",
"(",
"$",
"property",
",",
"PropertyAccessor",
"$",
"propertyAccessor",
")",
"{",
"switch"... | Create and return a Closure available to read an object property through a property path or a private property.
@return \Closure | [
"Create",
"and",
"return",
"a",
"Closure",
"available",
"to",
"read",
"an",
"object",
"property",
"through",
"a",
"property",
"path",
"or",
"a",
"private",
"property",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Normalizer/MajoraNormalizer.php#L107-L127 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Normalizer/MajoraNormalizer.php | MajoraNormalizer.normalize | public function normalize($object, $scope = 'default')
{
switch (true) {
// Cannot normalized anything which already are
case !is_object($object) :
return $object;
// StdClass can be cast as array
case $object instanceof StdClass :
... | php | public function normalize($object, $scope = 'default')
{
switch (true) {
// Cannot normalized anything which already are
case !is_object($object) :
return $object;
// StdClass can be cast as array
case $object instanceof StdClass :
... | [
"public",
"function",
"normalize",
"(",
"$",
"object",
",",
"$",
"scope",
"=",
"'default'",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"// Cannot normalized anything which already are",
"case",
"!",
"is_object",
"(",
"$",
"object",
")",
":",
"return",
"$",
"... | Normalize given object using given scope.
@param mixed $object
@param string $scope
@return array|string
@throws ScopeNotFoundException If given scope not defined into given normalizable
@throws InvalidScopeException If given scope requires an unaccessible field | [
"Normalize",
"given",
"object",
"using",
"given",
"scope",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Normalizer/MajoraNormalizer.php#L140-L166 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Normalizer/MajoraNormalizer.php | MajoraNormalizer.scopify | public function scopify(NormalizableInterface $object, $scope)
{
$scopes = $object->getScopes();
if (!isset($scopes[$scope])) {
throw new ScopeNotFoundException(sprintf(
'Invalid scope for %s object, only ["%s"] supported, "%s" given.',
get_class($object),... | php | public function scopify(NormalizableInterface $object, $scope)
{
$scopes = $object->getScopes();
if (!isset($scopes[$scope])) {
throw new ScopeNotFoundException(sprintf(
'Invalid scope for %s object, only ["%s"] supported, "%s" given.',
get_class($object),... | [
"public",
"function",
"scopify",
"(",
"NormalizableInterface",
"$",
"object",
",",
"$",
"scope",
")",
"{",
"$",
"scopes",
"=",
"$",
"object",
"->",
"getScopes",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"scopes",
"[",
"$",
"scope",
"]",
")",
... | Normalize given normalizable following given scope.
@param NormalizableInterface $object
@param string $scope
@return array | [
"Normalize",
"given",
"normalizable",
"following",
"given",
"scope",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Normalizer/MajoraNormalizer.php#L176-L261 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Normalizer/MajoraNormalizer.php | MajoraNormalizer.createWrittingDelegate | private function createWrittingDelegate()
{
return $this->writeDelegate ?: $this->writeDelegate = function (PropertyPathInterface $property, $value, PropertyAccessor $propertyAccessor) {
switch (true) {
// Public property / accessor case
case $propertyAccessor->i... | php | private function createWrittingDelegate()
{
return $this->writeDelegate ?: $this->writeDelegate = function (PropertyPathInterface $property, $value, PropertyAccessor $propertyAccessor) {
switch (true) {
// Public property / accessor case
case $propertyAccessor->i... | [
"private",
"function",
"createWrittingDelegate",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"writeDelegate",
"?",
":",
"$",
"this",
"->",
"writeDelegate",
"=",
"function",
"(",
"PropertyPathInterface",
"$",
"property",
",",
"$",
"value",
",",
"PropertyAccessor"... | Create and return a Closure available to write an object property through a property path or a private property.
@return \Closure | [
"Create",
"and",
"return",
"a",
"Closure",
"available",
"to",
"write",
"an",
"object",
"property",
"through",
"a",
"property",
"path",
"or",
"a",
"private",
"property",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Normalizer/MajoraNormalizer.php#L268-L288 | train |
kambalabs/KmbPmProxy | src/KmbPmProxy/Service/PuppetModule.php | PuppetModule.getModuleHydrator | public function getModuleHydrator()
{
if ($this->moduleHydrator == null) {
$moduleHydratorClass = $this->getOptions()->getPuppetModuleHydratorClass();
$this->moduleHydrator = new $moduleHydratorClass;
}
return $this->moduleHydrator;
} | php | public function getModuleHydrator()
{
if ($this->moduleHydrator == null) {
$moduleHydratorClass = $this->getOptions()->getPuppetModuleHydratorClass();
$this->moduleHydrator = new $moduleHydratorClass;
}
return $this->moduleHydrator;
} | [
"public",
"function",
"getModuleHydrator",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"moduleHydrator",
"==",
"null",
")",
"{",
"$",
"moduleHydratorClass",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
"->",
"getPuppetModuleHydratorClass",
"(",
")",
";",... | Get ModuleHydrator.
@return \Zend\Stdlib\Hydrator\HydratorInterface | [
"Get",
"ModuleHydrator",
"."
] | b4c664ae8b6f29e4e8768461ed99e1b0b80bde18 | https://github.com/kambalabs/KmbPmProxy/blob/b4c664ae8b6f29e4e8768461ed99e1b0b80bde18/src/KmbPmProxy/Service/PuppetModule.php#L224-L231 | train |
kambalabs/KmbPmProxy | src/KmbPmProxy/Service/PuppetModule.php | PuppetModule.getClassHydrator | public function getClassHydrator()
{
if ($this->classHydrator == null) {
$classHydratorClass = $this->getOptions()->getPuppetClassHydratorClass();
$this->classHydrator = new $classHydratorClass;
}
return $this->classHydrator;
} | php | public function getClassHydrator()
{
if ($this->classHydrator == null) {
$classHydratorClass = $this->getOptions()->getPuppetClassHydratorClass();
$this->classHydrator = new $classHydratorClass;
}
return $this->classHydrator;
} | [
"public",
"function",
"getClassHydrator",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"classHydrator",
"==",
"null",
")",
"{",
"$",
"classHydratorClass",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
"->",
"getPuppetClassHydratorClass",
"(",
")",
";",
"... | Get ClassHydrator.
@return \Zend\Stdlib\Hydrator\HydratorInterface | [
"Get",
"ClassHydrator",
"."
] | b4c664ae8b6f29e4e8768461ed99e1b0b80bde18 | https://github.com/kambalabs/KmbPmProxy/blob/b4c664ae8b6f29e4e8768461ed99e1b0b80bde18/src/KmbPmProxy/Service/PuppetModule.php#L250-L257 | train |
zarathustra323/modlr-data | src/Zarathustra/ModlrData/Metadata/RelationshipMetadata.php | RelationshipMetadata.validateType | protected function validateType($relType)
{
$valid = ['one', 'many'];
if (!in_array($relType, $valid)) {
throw MetadataException::invalidRelType($relType, $valid);
}
return true;
} | php | protected function validateType($relType)
{
$valid = ['one', 'many'];
if (!in_array($relType, $valid)) {
throw MetadataException::invalidRelType($relType, $valid);
}
return true;
} | [
"protected",
"function",
"validateType",
"(",
"$",
"relType",
")",
"{",
"$",
"valid",
"=",
"[",
"'one'",
",",
"'many'",
"]",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"relType",
",",
"$",
"valid",
")",
")",
"{",
"throw",
"MetadataException",
"::",
"... | Validates the relationship type.
@param string $type
@return bool
@throws MetadataException | [
"Validates",
"the",
"relationship",
"type",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/RelationshipMetadata.php#L108-L115 | train |
SlabPHP/configuration-manager | src/Parameter.php | Parameter.getConfigurationParameterName | public function getConfigurationParameterName($value = null)
{
$output = '';
if (!empty($this->_parent) && $this->_parent instanceof Parameter) {
$output .= $this->_parent->getConfigurationParameterName();
}
if (!empty($this->_name)) {
if (!empty($output)) $... | php | public function getConfigurationParameterName($value = null)
{
$output = '';
if (!empty($this->_parent) && $this->_parent instanceof Parameter) {
$output .= $this->_parent->getConfigurationParameterName();
}
if (!empty($this->_name)) {
if (!empty($output)) $... | [
"public",
"function",
"getConfigurationParameterName",
"(",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_parent",
")",
"&&",
"$",
"this",
"->",
"_parent",
"instanceof",
"Parameter"... | Get name of configuration value
@param string $value
return $string; | [
"Get",
"name",
"of",
"configuration",
"value"
] | 3f36b528b8d7b0ffbb43ec933e82efd7312a3397 | https://github.com/SlabPHP/configuration-manager/blob/3f36b528b8d7b0ffbb43ec933e82efd7312a3397/src/Parameter.php#L50-L75 | train |
SlabPHP/configuration-manager | src/Parameter.php | Parameter.flattenResult | public function flattenResult()
{
$output = [];
$vars = (array)$this;
foreach ($vars as $field => $value) {
//Trim off the protected items that come in as \0*\0_name
if (ord($field[0]) == 0) continue;
if ($value instanceof Parameter) {
$... | php | public function flattenResult()
{
$output = [];
$vars = (array)$this;
foreach ($vars as $field => $value) {
//Trim off the protected items that come in as \0*\0_name
if (ord($field[0]) == 0) continue;
if ($value instanceof Parameter) {
$... | [
"public",
"function",
"flattenResult",
"(",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"$",
"vars",
"=",
"(",
"array",
")",
"$",
"this",
";",
"foreach",
"(",
"$",
"vars",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"//Trim off the protected i... | Get flattened scalars from a configuration parameter, recursively
@return array | [
"Get",
"flattened",
"scalars",
"from",
"a",
"configuration",
"parameter",
"recursively"
] | 3f36b528b8d7b0ffbb43ec933e82efd7312a3397 | https://github.com/SlabPHP/configuration-manager/blob/3f36b528b8d7b0ffbb43ec933e82efd7312a3397/src/Parameter.php#L119-L137 | train |
moaction/jsonrpc-common | src/Moaction/Jsonrpc/Common/Request.php | Request.toArray | public function toArray()
{
if (!$this->getMethod()) {
throw new \InvalidArgumentException('Method must be provided for request');
}
$data = array(
'jsonrpc' => self::VERSION,
'method' => $this->getMethod(),
);
if ($this->getParams()) {
$data['params'] = $this->getParams();
}
if ($this->g... | php | public function toArray()
{
if (!$this->getMethod()) {
throw new \InvalidArgumentException('Method must be provided for request');
}
$data = array(
'jsonrpc' => self::VERSION,
'method' => $this->getMethod(),
);
if ($this->getParams()) {
$data['params'] = $this->getParams();
}
if ($this->g... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getMethod",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Method must be provided for request'",
")",
";",
"}",
"$",
"data",
"=",
"array",
"(... | Serialize into array
@throws \InvalidArgumentException
@return array | [
"Serialize",
"into",
"array"
] | 05692a2c58d647f20f11b6f7b9568c8fff2d5f8c | https://github.com/moaction/jsonrpc-common/blob/05692a2c58d647f20f11b6f7b9568c8fff2d5f8c/src/Moaction/Jsonrpc/Common/Request.php#L87-L107 | train |
Rundiz/serializer | Rundiz/Serializer/Serializer.php | Serializer.isSerialized | public function isSerialized($string)
{
if (!is_string($string)) {
return false;
}
$string = trim($string);
if ($string === 'N;') {
// if serialized string is NULL.
return true;
}
$string_encoding = mb_detect_encoding($string);
... | php | public function isSerialized($string)
{
if (!is_string($string)) {
return false;
}
$string = trim($string);
if ($string === 'N;') {
// if serialized string is NULL.
return true;
}
$string_encoding = mb_detect_encoding($string);
... | [
"public",
"function",
"isSerialized",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"string",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"string",
"=",
"trim",
"(",
"$",
"string",
")",
";",
"if",
"(",
"$",
"string",
"... | Is serialized string.
@link https://core.trac.wordpress.org/browser/tags/4.7.3/src/wp-includes/functions.php#L341 Reference from WordPress.
@link https://gist.github.com/cs278/217091 Reference from Github cs278/is_serialized.php
@param string $string The string to check.
@return boolean Return true if serialized, fals... | [
"Is",
"serialized",
"string",
"."
] | e50185a835949a7f0c7a5d73ae48daa7f3f4a2d9 | https://github.com/Rundiz/serializer/blob/e50185a835949a7f0c7a5d73ae48daa7f3f4a2d9/Rundiz/Serializer/Serializer.php#L33-L111 | train |
AnnotateFramework/backend | src/Content/Providers/MainPanelContentProvider.php | MainPanelContentProvider.addLink | public function addLink($url, $title, $icon = NULL, $priority = 0)
{
$link = [
"moduleUrl" => str_replace("#", NULL, substr($url, 0, strpos($url, ":"))),
"url" => $url,
"title" => $title,
"icon" => $icon,
"priority" => $priority
];
$this->links[] = $link;
} | php | public function addLink($url, $title, $icon = NULL, $priority = 0)
{
$link = [
"moduleUrl" => str_replace("#", NULL, substr($url, 0, strpos($url, ":"))),
"url" => $url,
"title" => $title,
"icon" => $icon,
"priority" => $priority
];
$this->links[] = $link;
} | [
"public",
"function",
"addLink",
"(",
"$",
"url",
",",
"$",
"title",
",",
"$",
"icon",
"=",
"NULL",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"$",
"link",
"=",
"[",
"\"moduleUrl\"",
"=>",
"str_replace",
"(",
"\"#\"",
",",
"NULL",
",",
"substr",
"("... | Adds link to mainPanel
@param string
@param string
@param string|NULL
@param int|NULL goes from min to max | [
"Adds",
"link",
"to",
"mainPanel"
] | dbc524ceb9d2af5f5f76a72ea0f6100399bc2f17 | https://github.com/AnnotateFramework/backend/blob/dbc524ceb9d2af5f5f76a72ea0f6100399bc2f17/src/Content/Providers/MainPanelContentProvider.php#L45-L55 | train |
ScaraMVC/Framework | src/Scara/Debug/ExceptionRenderer.php | ExceptionRenderer.render | public function render(Exception $e, $debug)
{
$e = FlattenException::create($e);
$handler = new SymfonyExceptionHandler($debug);
$status = $e->getStatusCode();
$response = SymfonyResponse::create($handler->getHtml($e), $status, $e->getHeaders());
$rex = explode("\n", $resp... | php | public function render(Exception $e, $debug)
{
$e = FlattenException::create($e);
$handler = new SymfonyExceptionHandler($debug);
$status = $e->getStatusCode();
$response = SymfonyResponse::create($handler->getHtml($e), $status, $e->getHeaders());
$rex = explode("\n", $resp... | [
"public",
"function",
"render",
"(",
"Exception",
"$",
"e",
",",
"$",
"debug",
")",
"{",
"$",
"e",
"=",
"FlattenException",
"::",
"create",
"(",
"$",
"e",
")",
";",
"$",
"handler",
"=",
"new",
"SymfonyExceptionHandler",
"(",
"$",
"debug",
")",
";",
"... | Renders the error.
@param \Exception $e
@param bool $debug
@return void | [
"Renders",
"the",
"error",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Debug/ExceptionRenderer.php#L30-L51 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/interfaces/AbstractCache.php | AbstractCache.multiGet | public function multiGet(array $keys, $localOnly = false)
{
$keys = array_unique($keys);
$results = array();
$others = array();
foreach ($keys as $key) {
$cacheKey = $this->cacheKey($key);
if ($this->keepLocalCache && array_key_exists($cacheKey, $this->localCa... | php | public function multiGet(array $keys, $localOnly = false)
{
$keys = array_unique($keys);
$results = array();
$others = array();
foreach ($keys as $key) {
$cacheKey = $this->cacheKey($key);
if ($this->keepLocalCache && array_key_exists($cacheKey, $this->localCa... | [
"public",
"function",
"multiGet",
"(",
"array",
"$",
"keys",
",",
"$",
"localOnly",
"=",
"false",
")",
"{",
"$",
"keys",
"=",
"array_unique",
"(",
"$",
"keys",
")",
";",
"$",
"results",
"=",
"array",
"(",
")",
";",
"$",
"others",
"=",
"array",
"(",... | Returns an array of nodes from cache specified by key
@param array $keys An array of keys to fetch
@param bool $localOnly
@return array | [
"Returns",
"an",
"array",
"of",
"nodes",
"from",
"cache",
"specified",
"by",
"key"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/interfaces/AbstractCache.php#L54-L80 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/interfaces/AbstractCache.php | AbstractCache.put | public function put($key, $value, $duration, $localOnly = false)
{
$cacheKey = $this->cacheKey($key);
if($this->keepLocalCache)
$this->localCache[$cacheKey] = $value;
if(!$localOnly)
$this->cacheStore->put($cacheKey, $value, $duration);
} | php | public function put($key, $value, $duration, $localOnly = false)
{
$cacheKey = $this->cacheKey($key);
if($this->keepLocalCache)
$this->localCache[$cacheKey] = $value;
if(!$localOnly)
$this->cacheStore->put($cacheKey, $value, $duration);
} | [
"public",
"function",
"put",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"duration",
",",
"$",
"localOnly",
"=",
"false",
")",
"{",
"$",
"cacheKey",
"=",
"$",
"this",
"->",
"cacheKey",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"this",
"->",
... | Stores the value specified with the cacheKey given.
@param string $cacheKey The cache key
@param mixed $value The value to store
@access public
@return void | [
"Stores",
"the",
"value",
"specified",
"with",
"the",
"cacheKey",
"given",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/interfaces/AbstractCache.php#L91-L98 | train |
ZFrapid/zfrapid-core | src/Console/Application.php | Application.translateRoutes | protected function translateRoutes(array $routes = [])
{
foreach ($routes as $routeKey => $routeParams) {
if (isset($routeParams['description'])) {
$routes[$routeKey]['description']
= $this->translator->translate(
$routeParams['description'... | php | protected function translateRoutes(array $routes = [])
{
foreach ($routes as $routeKey => $routeParams) {
if (isset($routeParams['description'])) {
$routes[$routeKey]['description']
= $this->translator->translate(
$routeParams['description'... | [
"protected",
"function",
"translateRoutes",
"(",
"array",
"$",
"routes",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"routeKey",
"=>",
"$",
"routeParams",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"routeParams",
"[",
"'description'",... | Translate the route texts
@param array $routes
@return array | [
"Translate",
"the",
"route",
"texts"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Application.php#L132-L161 | train |
ZFrapid/zfrapid-core | src/Console/Application.php | Application.writeApplicationBanner | public function writeApplicationBanner(AdapterInterface $console)
{
$console->writeLine();
$console->writeLine(
str_pad('', $console->getWidth() - 1, '=', STR_PAD_RIGHT),
Color::GREEN
);
$console->write('=', Color::GREEN);
$console->write(
... | php | public function writeApplicationBanner(AdapterInterface $console)
{
$console->writeLine();
$console->writeLine(
str_pad('', $console->getWidth() - 1, '=', STR_PAD_RIGHT),
Color::GREEN
);
$console->write('=', Color::GREEN);
$console->write(
... | [
"public",
"function",
"writeApplicationBanner",
"(",
"AdapterInterface",
"$",
"console",
")",
"{",
"$",
"console",
"->",
"writeLine",
"(",
")",
";",
"$",
"console",
"->",
"writeLine",
"(",
"str_pad",
"(",
"''",
",",
"$",
"console",
"->",
"getWidth",
"(",
"... | Write application banner
@param AdapterInterface $console | [
"Write",
"application",
"banner"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Application.php#L168-L195 | train |
ZFrapid/zfrapid-core | src/Console/Application.php | Application.writeApplicationFooter | public function writeApplicationFooter(AdapterInterface $console)
{
$console->writeLine(
str_pad('', $console->getWidth() - 1, '=', STR_PAD_RIGHT),
Color::GREEN
);
$console->writeLine();
} | php | public function writeApplicationFooter(AdapterInterface $console)
{
$console->writeLine(
str_pad('', $console->getWidth() - 1, '=', STR_PAD_RIGHT),
Color::GREEN
);
$console->writeLine();
} | [
"public",
"function",
"writeApplicationFooter",
"(",
"AdapterInterface",
"$",
"console",
")",
"{",
"$",
"console",
"->",
"writeLine",
"(",
"str_pad",
"(",
"''",
",",
"$",
"console",
"->",
"getWidth",
"(",
")",
"-",
"1",
",",
"'='",
",",
"STR_PAD_RIGHT",
")... | Write application footer
@param AdapterInterface $console | [
"Write",
"application",
"footer"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Application.php#L202-L210 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/inputclean/InputClean.php | InputClean.clean | public function clean($string, $allowedTags = null)
{
if (is_array($string)) {
$new_array = array();
foreach ($string as $key => $val) {
$new_array[$key] = $this->clean($val, $allowedTags);
}
return $new_array;
}
$string = $thi... | php | public function clean($string, $allowedTags = null)
{
if (is_array($string)) {
$new_array = array();
foreach ($string as $key => $val) {
$new_array[$key] = $this->clean($val, $allowedTags);
}
return $new_array;
}
$string = $thi... | [
"public",
"function",
"clean",
"(",
"$",
"string",
",",
"$",
"allowedTags",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"string",
")",
")",
"{",
"$",
"new_array",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"string",
"as",
"$",
... | Cleans XSS by removing all tags
@param string $string to clean
@return string cleaned | [
"Cleans",
"XSS",
"by",
"removing",
"all",
"tags"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/inputclean/InputClean.php#L94-L107 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/inputclean/InputClean.php | InputClean.cleanHTMLPurify | protected function cleanHTMLPurify($string, $allowedTags = null)
{
if(strlen($string)==0)
return '';
if($allowedTags === null)
$allowedTags = $this->defaultAllowedTags;
if($allowedTags == '*')
return $string;
if(is_null($this->purifier))
... | php | protected function cleanHTMLPurify($string, $allowedTags = null)
{
if(strlen($string)==0)
return '';
if($allowedTags === null)
$allowedTags = $this->defaultAllowedTags;
if($allowedTags == '*')
return $string;
if(is_null($this->purifier))
... | [
"protected",
"function",
"cleanHTMLPurify",
"(",
"$",
"string",
",",
"$",
"allowedTags",
"=",
"null",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"string",
")",
"==",
"0",
")",
"return",
"''",
";",
"if",
"(",
"$",
"allowedTags",
"===",
"null",
")",
"$",... | Produces a nicely-formatted HTML string with all non-matching tags stripped.
@param string $string The HTML string to format
@param string $allowedTags A comma separated list of tags to allow in the result
@return string A nicely-formatted version of the input text, containing only the tags specified. | [
"Produces",
"a",
"nicely",
"-",
"formatted",
"HTML",
"string",
"with",
"all",
"non",
"-",
"matching",
"tags",
"stripped",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/inputclean/InputClean.php#L157-L190 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/inputclean/InputClean.php | InputClean.autoParagraph | public function autoParagraph($string, $allowedTags = null, $linkUrls = true)
{
if(is_null($allowedTags))
$allowedTags = $this->defaultAllowedTags;
if(is_null($this->purifier))
{
require_once PATH_SYSTEM . '/vendors/HTMLPurifier.php';
$this->purifier = H... | php | public function autoParagraph($string, $allowedTags = null, $linkUrls = true)
{
if(is_null($allowedTags))
$allowedTags = $this->defaultAllowedTags;
if(is_null($this->purifier))
{
require_once PATH_SYSTEM . '/vendors/HTMLPurifier.php';
$this->purifier = H... | [
"public",
"function",
"autoParagraph",
"(",
"$",
"string",
",",
"$",
"allowedTags",
"=",
"null",
",",
"$",
"linkUrls",
"=",
"true",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"allowedTags",
")",
")",
"$",
"allowedTags",
"=",
"$",
"this",
"->",
"defaultA... | Marks up a string with paragraphs and automatically links any urls.
This function marks up the output with paragraph tags and auto-links any URLs that are found.
The resulting output is suitable for display in any web-browser, but must have
paragraph and extra html tags removed before it's ready for editing.
Content ... | [
"Marks",
"up",
"a",
"string",
"with",
"paragraphs",
"and",
"automatically",
"links",
"any",
"urls",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/inputclean/InputClean.php#L209-L258 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/inputclean/InputClean.php | InputClean.unAutoParagraph | public function unAutoParagraph($string)
{
$string = str_replace(array("<p>","</p>","<br/>", "<br />"), array("", "\n\n", "\n", "\n"), $string);
$string = preg_replace("/\<a href\=\"(".URLUtils::URL_MATCH.")\"\>\\1\<\/a\>/i", '$1', $string);
$string = preg_replace_callback("/\<a href\=\"(".... | php | public function unAutoParagraph($string)
{
$string = str_replace(array("<p>","</p>","<br/>", "<br />"), array("", "\n\n", "\n", "\n"), $string);
$string = preg_replace("/\<a href\=\"(".URLUtils::URL_MATCH.")\"\>\\1\<\/a\>/i", '$1', $string);
$string = preg_replace_callback("/\<a href\=\"(".... | [
"public",
"function",
"unAutoParagraph",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"str_replace",
"(",
"array",
"(",
"\"<p>\"",
",",
"\"</p>\"",
",",
"\"<br/>\"",
",",
"\"<br />\"",
")",
",",
"array",
"(",
"\"\"",
",",
"\"\\n\\n\"",
",",
"\"\\n\"",... | Removes the markup added by autoParagraph.
This will restore the string to a version that's safe to display in a simple <textarea> editor.
All autolinked urls are unlinked and paragraph tags are removed.
@param string $string The string that will be deconverted
@return string A version of $string suitable for editin... | [
"Removes",
"the",
"markup",
"added",
"by",
"autoParagraph",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/inputclean/InputClean.php#L291-L300 | train |
codeblanche/Entity | src/Entity/Utils.php | Utils.makeSetterGetterDoc | public static function makeSetterGetterDoc(Entity $entity)
{
$properties = $entity->toArray(false);
$entityName = $entity->calledClassName();
echo "<pre>\n";
foreach ($properties as $name => $value) {
$methodName = ucfirst($name);
$type = $entity->type... | php | public static function makeSetterGetterDoc(Entity $entity)
{
$properties = $entity->toArray(false);
$entityName = $entity->calledClassName();
echo "<pre>\n";
foreach ($properties as $name => $value) {
$methodName = ucfirst($name);
$type = $entity->type... | [
"public",
"static",
"function",
"makeSetterGetterDoc",
"(",
"Entity",
"$",
"entity",
")",
"{",
"$",
"properties",
"=",
"$",
"entity",
"->",
"toArray",
"(",
"false",
")",
";",
"$",
"entityName",
"=",
"$",
"entity",
"->",
"calledClassName",
"(",
")",
";",
... | Generate the setter and getter method PHPDoc declaration to paste into your entity class.
@param Entity $entity | [
"Generate",
"the",
"setter",
"and",
"getter",
"method",
"PHPDoc",
"declaration",
"to",
"paste",
"into",
"your",
"entity",
"class",
"."
] | 1d3839c09d7639ae8bbfc9d2721223202f3a5cdd | https://github.com/codeblanche/Entity/blob/1d3839c09d7639ae8bbfc9d2721223202f3a5cdd/src/Entity/Utils.php#L20-L35 | train |
codeblanche/Entity | src/Entity/Utils.php | Utils.makePublicProperties | public static function makePublicProperties(array $properties)
{
echo '<pre>'."\n";
foreach ($properties as $key => $value)
{
$type = gettype($value);
if ($type === 'object') {
$type = get_class($value);
}
echo <<<EODOC
/... | php | public static function makePublicProperties(array $properties)
{
echo '<pre>'."\n";
foreach ($properties as $key => $value)
{
$type = gettype($value);
if ($type === 'object') {
$type = get_class($value);
}
echo <<<EODOC
/... | [
"public",
"static",
"function",
"makePublicProperties",
"(",
"array",
"$",
"properties",
")",
"{",
"echo",
"'<pre>'",
".",
"\"\\n\"",
";",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"type",
"=",
"gettype",
"("... | Generate the public properties PHPDoc declarations to paste into your entity class.
@param array $properties | [
"Generate",
"the",
"public",
"properties",
"PHPDoc",
"declarations",
"to",
"paste",
"into",
"your",
"entity",
"class",
"."
] | 1d3839c09d7639ae8bbfc9d2721223202f3a5cdd | https://github.com/codeblanche/Entity/blob/1d3839c09d7639ae8bbfc9d2721223202f3a5cdd/src/Entity/Utils.php#L41-L63 | train |
covex-nn/JooS | src/JooS/Event/Event.php | Event.getInstance | final public static function getInstance()
{
$className = get_called_class();
if (!isset(self::$_instances[$className])) {
self::$_instances[$className] = new static();
}
self::$_instances[$className]->initialize();
return self::$_instances[$className];
} | php | final public static function getInstance()
{
$className = get_called_class();
if (!isset(self::$_instances[$className])) {
self::$_instances[$className] = new static();
}
self::$_instances[$className]->initialize();
return self::$_instances[$className];
} | [
"final",
"public",
"static",
"function",
"getInstance",
"(",
")",
"{",
"$",
"className",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"_instances",
"[",
"$",
"className",
"]",
")",
")",
"{",
"self",
"::",
"... | Return event instance
@return Event | [
"Return",
"event",
"instance"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Event/Event.php#L63-L73 | train |
covex-nn/JooS | src/JooS/Event/Event.php | Event.clearInstance | final public static function clearInstance($className)
{
if (isset(self::$_instances[$className])) {
$name = self::_configName($className);
Config::clearInstance($name);
self::$_instances[$className]->_loadObservers();
}
} | php | final public static function clearInstance($className)
{
if (isset(self::$_instances[$className])) {
$name = self::_configName($className);
Config::clearInstance($name);
self::$_instances[$className]->_loadObservers();
}
} | [
"final",
"public",
"static",
"function",
"clearInstance",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"_instances",
"[",
"$",
"className",
"]",
")",
")",
"{",
"$",
"name",
"=",
"self",
"::",
"_configName",
"(",
"$",
"... | Unloads event instance.
@param string $className Event name
@return null | [
"Unloads",
"event",
"instance",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Event/Event.php#L82-L90 | train |
covex-nn/JooS | src/JooS/Event/Event.php | Event.notify | final public function notify()
{
$observers = array_values($this->_observers);
foreach ($observers as $observer) {
switch (false) {
case is_array($observer):
case isset($observer[0]):
case isset($observer[1]):
case is_string($observer[0]):
break;
default... | php | final public function notify()
{
$observers = array_values($this->_observers);
foreach ($observers as $observer) {
switch (false) {
case is_array($observer):
case isset($observer[0]):
case isset($observer[1]):
case is_string($observer[0]):
break;
default... | [
"final",
"public",
"function",
"notify",
"(",
")",
"{",
"$",
"observers",
"=",
"array_values",
"(",
"$",
"this",
"->",
"_observers",
")",
";",
"foreach",
"(",
"$",
"observers",
"as",
"$",
"observer",
")",
"{",
"switch",
"(",
"false",
")",
"{",
"case",
... | Notify observers.
@return Event | [
"Notify",
"observers",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Event/Event.php#L111-L134 | train |
covex-nn/JooS | src/JooS/Event/Event.php | Event.attach | final public function attach($observer)
{
if (!in_array($observer, $this->_observers)) {
array_push($this->_observers, $observer);
}
return $this;
} | php | final public function attach($observer)
{
if (!in_array($observer, $this->_observers)) {
array_push($this->_observers, $observer);
}
return $this;
} | [
"final",
"public",
"function",
"attach",
"(",
"$",
"observer",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"observer",
",",
"$",
"this",
"->",
"_observers",
")",
")",
"{",
"array_push",
"(",
"$",
"this",
"->",
"_observers",
",",
"$",
"observer",
... | Attach new observer.
@param callback $observer Observer
@return Event | [
"Attach",
"new",
"observer",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Event/Event.php#L143-L149 | train |
covex-nn/JooS | src/JooS/Event/Event.php | Event.detach | final public function detach($observer)
{
$key = array_search($observer, $this->_observers);
if ($key !== false) {
unset($this->_observers[$key]);
}
return $this;
} | php | final public function detach($observer)
{
$key = array_search($observer, $this->_observers);
if ($key !== false) {
unset($this->_observers[$key]);
}
return $this;
} | [
"final",
"public",
"function",
"detach",
"(",
"$",
"observer",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"observer",
",",
"$",
"this",
"->",
"_observers",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
"thi... | Detach observer.
@param callback $observer Observer
@return Event | [
"Detach",
"observer",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Event/Event.php#L158-L165 | train |
covex-nn/JooS | src/JooS/Event/Event.php | Event._loadObservers | private function _loadObservers()
{
$class = $this->name();
$name = self::_configName($class);
$config = Config::getInstance($name);
$this->_observers = $config->valueOf();
} | php | private function _loadObservers()
{
$class = $this->name();
$name = self::_configName($class);
$config = Config::getInstance($name);
$this->_observers = $config->valueOf();
} | [
"private",
"function",
"_loadObservers",
"(",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"name",
"(",
")",
";",
"$",
"name",
"=",
"self",
"::",
"_configName",
"(",
"$",
"class",
")",
";",
"$",
"config",
"=",
"Config",
"::",
"getInstance",
"(",
... | Load observers.
@return null | [
"Load",
"observers",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Event/Event.php#L208-L215 | train |
jamset/commands-executor | src/CommandsManager.php | CommandsManager.getSystemLoadInfo | public function getSystemLoadInfo()
{
$cpuMemDto = new CpuMemDto();
$cpuMemDto = $this->getMemFree($cpuMemDto);
$cpuMemDto = $this->getCpuIdle($cpuMemDto);
return $cpuMemDto;
} | php | public function getSystemLoadInfo()
{
$cpuMemDto = new CpuMemDto();
$cpuMemDto = $this->getMemFree($cpuMemDto);
$cpuMemDto = $this->getCpuIdle($cpuMemDto);
return $cpuMemDto;
} | [
"public",
"function",
"getSystemLoadInfo",
"(",
")",
"{",
"$",
"cpuMemDto",
"=",
"new",
"CpuMemDto",
"(",
")",
";",
"$",
"cpuMemDto",
"=",
"$",
"this",
"->",
"getMemFree",
"(",
"$",
"cpuMemDto",
")",
";",
"$",
"cpuMemDto",
"=",
"$",
"this",
"->",
"getC... | Get current cpu idle and memory free
@return CpuMemDto | [
"Get",
"current",
"cpu",
"idle",
"and",
"memory",
"free"
] | 5cca74fdd36d30e83dfae7c8c2457a00c8855d4f | https://github.com/jamset/commands-executor/blob/5cca74fdd36d30e83dfae7c8c2457a00c8855d4f/src/CommandsManager.php#L52-L60 | train |
jamset/commands-executor | src/CommandsManager.php | CommandsManager.getPidByPpid | public function getPidByPpid($ppid)
{
$commandsDto = new CommandsExecutionDto();
$commandsDto->setCommandName(CommandsConstants::GET_PID_BY_PPID);
$commandsDto->setPid($ppid);
return $this->getCommandExecutionResult($commandsDto);
} | php | public function getPidByPpid($ppid)
{
$commandsDto = new CommandsExecutionDto();
$commandsDto->setCommandName(CommandsConstants::GET_PID_BY_PPID);
$commandsDto->setPid($ppid);
return $this->getCommandExecutionResult($commandsDto);
} | [
"public",
"function",
"getPidByPpid",
"(",
"$",
"ppid",
")",
"{",
"$",
"commandsDto",
"=",
"new",
"CommandsExecutionDto",
"(",
")",
";",
"$",
"commandsDto",
"->",
"setCommandName",
"(",
"CommandsConstants",
"::",
"GET_PID_BY_PPID",
")",
";",
"$",
"commandsDto",
... | Return PID of the child's process by parent PID
@param $pid | [
"Return",
"PID",
"of",
"the",
"child",
"s",
"process",
"by",
"parent",
"PID"
] | 5cca74fdd36d30e83dfae7c8c2457a00c8855d4f | https://github.com/jamset/commands-executor/blob/5cca74fdd36d30e83dfae7c8c2457a00c8855d4f/src/CommandsManager.php#L93-L100 | train |
php-api-clients/installer | src/Filesystem.php | Filesystem.write | public function write(string $filename, string $contents): int
{
return (int)file_put_contents($filename, $contents);
} | php | public function write(string $filename, string $contents): int
{
return (int)file_put_contents($filename, $contents);
} | [
"public",
"function",
"write",
"(",
"string",
"$",
"filename",
",",
"string",
"$",
"contents",
")",
":",
"int",
"{",
"return",
"(",
"int",
")",
"file_put_contents",
"(",
"$",
"filename",
",",
"$",
"contents",
")",
";",
"}"
] | Write the given contents to the given file.
@param string $filename
@param string $contents
@return int | [
"Write",
"the",
"given",
"contents",
"to",
"the",
"given",
"file",
"."
] | 5d5a936520ff2261cf94882b335c2d1d7ea4dda2 | https://github.com/php-api-clients/installer/blob/5d5a936520ff2261cf94882b335c2d1d7ea4dda2/src/Filesystem.php#L25-L28 | train |
php-api-clients/installer | src/Filesystem.php | Filesystem.ls | public function ls(string $path): array
{
$files = [];
$d = dir($path);
while (false !== ($entry = $d->read())) {
if (in_array($entry, ['.', '..'], true)) {
continue;
}
$entryPath = $path . $entry;
if (is_dir($entryPath)) {
... | php | public function ls(string $path): array
{
$files = [];
$d = dir($path);
while (false !== ($entry = $d->read())) {
if (in_array($entry, ['.', '..'], true)) {
continue;
}
$entryPath = $path . $entry;
if (is_dir($entryPath)) {
... | [
"public",
"function",
"ls",
"(",
"string",
"$",
"path",
")",
":",
"array",
"{",
"$",
"files",
"=",
"[",
"]",
";",
"$",
"d",
"=",
"dir",
"(",
"$",
"path",
")",
";",
"while",
"(",
"false",
"!==",
"(",
"$",
"entry",
"=",
"$",
"d",
"->",
"read",
... | List all files in a directory and it's subdirectories.
@param string $path
@return array | [
"List",
"all",
"files",
"in",
"a",
"directory",
"and",
"it",
"s",
"subdirectories",
"."
] | 5d5a936520ff2261cf94882b335c2d1d7ea4dda2 | https://github.com/php-api-clients/installer/blob/5d5a936520ff2261cf94882b335c2d1d7ea4dda2/src/Filesystem.php#L36-L59 | train |
geoffadams/bedrest-core | library/BedRest/Content/Negotiation/QualityFactorList.php | QualityFactorList.qualityFactorComparator | public function qualityFactorComparator($mediaType1, $mediaType2)
{
$diff = $mediaType2['q'] - $mediaType1['q'];
// doesn't cope too well with values 1 > v > -1, so make sure we return simple integers
if ($diff > 0) {
$diff = 1;
} elseif ($diff < 0) {
$diff =... | php | public function qualityFactorComparator($mediaType1, $mediaType2)
{
$diff = $mediaType2['q'] - $mediaType1['q'];
// doesn't cope too well with values 1 > v > -1, so make sure we return simple integers
if ($diff > 0) {
$diff = 1;
} elseif ($diff < 0) {
$diff =... | [
"public",
"function",
"qualityFactorComparator",
"(",
"$",
"mediaType1",
",",
"$",
"mediaType2",
")",
"{",
"$",
"diff",
"=",
"$",
"mediaType2",
"[",
"'q'",
"]",
"-",
"$",
"mediaType1",
"[",
"'q'",
"]",
";",
"// doesn't cope too well with values 1 > v > -1, so make... | Comparator function for sorting a list of arrays by their 'q' factor.
@param array $mediaType1
@param array $mediaType2
@return integer | [
"Comparator",
"function",
"for",
"sorting",
"a",
"list",
"of",
"arrays",
"by",
"their",
"q",
"factor",
"."
] | a77bf8b7492dfbfb720b201f7ec91a4f03417b5c | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Content/Negotiation/QualityFactorList.php#L80-L92 | train |
pixelpolishers/makedocs | src/MakeDocs/Generator/AssetManager.php | AssetManager.addAsset | public function addAsset($name, $path)
{
if (!is_file($path)) {
throw new \RuntimeException('The asset file "' . $path . '" does not exist.');
}
$this->assets[$name] = $path;
} | php | public function addAsset($name, $path)
{
if (!is_file($path)) {
throw new \RuntimeException('The asset file "' . $path . '" does not exist.');
}
$this->assets[$name] = $path;
} | [
"public",
"function",
"addAsset",
"(",
"$",
"name",
",",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'The asset file \"'",
".",
"$",
"path",
".",
"'\" does not exist.'... | Adds an asset.
@param string $name The name of the asset.
@param string $path The path to the asset.
@throws \RuntimeException | [
"Adds",
"an",
"asset",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/AssetManager.php#L35-L41 | train |
pixelpolishers/makedocs | src/MakeDocs/Generator/AssetManager.php | AssetManager.copyTo | public function copyTo($path)
{
foreach ($this->assets as $assetName => $assetPath) {
$outputPath = $path . '/' . $assetName;
$this->copyFromTo($assetPath, $outputPath);
}
} | php | public function copyTo($path)
{
foreach ($this->assets as $assetName => $assetPath) {
$outputPath = $path . '/' . $assetName;
$this->copyFromTo($assetPath, $outputPath);
}
} | [
"public",
"function",
"copyTo",
"(",
"$",
"path",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"assets",
"as",
"$",
"assetName",
"=>",
"$",
"assetPath",
")",
"{",
"$",
"outputPath",
"=",
"$",
"path",
".",
"'/'",
".",
"$",
"assetName",
";",
"$",
"th... | Copies all assets to the given path.
@param string $path The path to copy to. | [
"Copies",
"all",
"assets",
"to",
"the",
"given",
"path",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/AssetManager.php#L48-L55 | train |
pixelpolishers/makedocs | src/MakeDocs/Generator/AssetManager.php | AssetManager.copyFromTo | private function copyFromTo($from, $to)
{
$directory = dirname($to);
if (!is_dir($directory)) {
mkdir($directory, 0777, true);
}
copy($from, $to);
} | php | private function copyFromTo($from, $to)
{
$directory = dirname($to);
if (!is_dir($directory)) {
mkdir($directory, 0777, true);
}
copy($from, $to);
} | [
"private",
"function",
"copyFromTo",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"$",
"directory",
"=",
"dirname",
"(",
"$",
"to",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"directory",
")",
")",
"{",
"mkdir",
"(",
"$",
"directory",
",",
"077... | Copies a single asset from a path to a path.
@param string $from The location to copy from.
@param string $to The location to copy to. | [
"Copies",
"a",
"single",
"asset",
"from",
"a",
"path",
"to",
"a",
"path",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/AssetManager.php#L63-L71 | train |
vukbgit/PHPCraft.Subject | src/Traits/Upload/Field.php | Field.setInput | private function setInput()
{
$this->inputFile = $_FILES[$this->field]['name'];
$this->inputHash = hash_file('md5', $_FILES[$this->field]['tmp_name']);
} | php | private function setInput()
{
$this->inputFile = $_FILES[$this->field]['name'];
$this->inputHash = hash_file('md5', $_FILES[$this->field]['tmp_name']);
} | [
"private",
"function",
"setInput",
"(",
")",
"{",
"$",
"this",
"->",
"inputFile",
"=",
"$",
"_FILES",
"[",
"$",
"this",
"->",
"field",
"]",
"[",
"'name'",
"]",
";",
"$",
"this",
"->",
"inputHash",
"=",
"hash_file",
"(",
"'md5'",
",",
"$",
"_FILES",
... | Stores input informations | [
"Stores",
"input",
"informations"
] | a43ad7868098ff1e7bda6819547ea64f9a853732 | https://github.com/vukbgit/PHPCraft.Subject/blob/a43ad7868098ff1e7bda6819547ea64f9a853732/src/Traits/Upload/Field.php#L60-L64 | train |
vukbgit/PHPCraft.Subject | src/Traits/Upload/Field.php | Field.handleUpload | public function handleUpload(&$uploader)
{
// store uploader
$this->uploader =& $uploader;
//store input
$this->setInput();
// tell uploader which field is uploaded
$this->uploader->setField($this->field);
// make temporary file
$this->uploader->setDes... | php | public function handleUpload(&$uploader)
{
// store uploader
$this->uploader =& $uploader;
//store input
$this->setInput();
// tell uploader which field is uploaded
$this->uploader->setField($this->field);
// make temporary file
$this->uploader->setDes... | [
"public",
"function",
"handleUpload",
"(",
"&",
"$",
"uploader",
")",
"{",
"// store uploader",
"$",
"this",
"->",
"uploader",
"=",
"&",
"$",
"uploader",
";",
"//store input",
"$",
"this",
"->",
"setInput",
"(",
")",
";",
"// tell uploader which field is uploade... | Handles an upload
@param $uploader adapter following PHPCraft\Upload\UploadInterface | [
"Handles",
"an",
"upload"
] | a43ad7868098ff1e7bda6819547ea64f9a853732 | https://github.com/vukbgit/PHPCraft.Subject/blob/a43ad7868098ff1e7bda6819547ea64f9a853732/src/Traits/Upload/Field.php#L80-L120 | train |
Kris-Kuiper/sFire-Framework | src/Form/Types/Button.php | Button.text | public function text($text) {
if(false === is_string($text)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($text)), E_USER_ERROR);
}
$this -> text = $text;
return $this;
} | php | public function text($text) {
if(false === is_string($text)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($text)), E_USER_ERROR);
}
$this -> text = $text;
return $this;
} | [
"public",
"function",
"text",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"text",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"__METHO... | Set the text of the button
@param string $text
@return sFire\Form\Types\Button | [
"Set",
"the",
"text",
"of",
"the",
"button"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Form/Types/Button.php#L32-L41 | train |
t3v/t3v_core | Classes/Service/LanguageService.php | LanguageService.getLanguage | public function getLanguage(string $default = null): string {
$language = $default ?: 'en';
if (TYPO3_MODE === 'FE') {
if (isset($GLOBALS['TSFE']->lang)) {
$language = $GLOBALS['TSFE']->lang;
}
} elseif (is_object($GLOBALS['LANG'])) {
if (isset($GLOBALS['LANG']->lang)) {
$... | php | public function getLanguage(string $default = null): string {
$language = $default ?: 'en';
if (TYPO3_MODE === 'FE') {
if (isset($GLOBALS['TSFE']->lang)) {
$language = $GLOBALS['TSFE']->lang;
}
} elseif (is_object($GLOBALS['LANG'])) {
if (isset($GLOBALS['LANG']->lang)) {
$... | [
"public",
"function",
"getLanguage",
"(",
"string",
"$",
"default",
"=",
"null",
")",
":",
"string",
"{",
"$",
"language",
"=",
"$",
"default",
"?",
":",
"'en'",
";",
"if",
"(",
"TYPO3_MODE",
"===",
"'FE'",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"... | Gets the current language.
@param string $default The default language, defaults to `en`
@return string The current language if available, otherwise the default one | [
"Gets",
"the",
"current",
"language",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Service/LanguageService.php#L18-L40 | train |
t3v/t3v_core | Classes/Service/LanguageService.php | LanguageService.getLanguageUid | public function getLanguageUid(int $default = null): int {
$languageUid = $default ?: 0;
if (TYPO3_MODE === 'FE') {
if (isset($GLOBALS['TSFE']->sys_language_uid)) {
$languageUid = $GLOBALS['TSFE']->sys_language_uid;
}
} elseif (is_object($GLOBALS['LANG'])) {
if (isset($GLOBALS['LA... | php | public function getLanguageUid(int $default = null): int {
$languageUid = $default ?: 0;
if (TYPO3_MODE === 'FE') {
if (isset($GLOBALS['TSFE']->sys_language_uid)) {
$languageUid = $GLOBALS['TSFE']->sys_language_uid;
}
} elseif (is_object($GLOBALS['LANG'])) {
if (isset($GLOBALS['LA... | [
"public",
"function",
"getLanguageUid",
"(",
"int",
"$",
"default",
"=",
"null",
")",
":",
"int",
"{",
"$",
"languageUid",
"=",
"$",
"default",
"?",
":",
"0",
";",
"if",
"(",
"TYPO3_MODE",
"===",
"'FE'",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"GLO... | Gets the current language UID.
@param int $default The default language UID, defaults to `0`
@return int The current language UID if available, otherwise the default one | [
"Gets",
"the",
"current",
"language",
"UID",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Service/LanguageService.php#L48-L62 | train |
brain-diminished/schema-version-control | src/SchemaVersionControlService.php | SchemaVersionControlService.loadSchemaFile | public function loadSchemaFile(): Schema
{
if (!file_exists($this->schemaFile)) {
return new Schema();
}
$content = file_get_contents($this->schemaFile);
$desc = Yaml::parse($content);
if (empty($desc)) {
return new Schema();
}
$build... | php | public function loadSchemaFile(): Schema
{
if (!file_exists($this->schemaFile)) {
return new Schema();
}
$content = file_get_contents($this->schemaFile);
$desc = Yaml::parse($content);
if (empty($desc)) {
return new Schema();
}
$build... | [
"public",
"function",
"loadSchemaFile",
"(",
")",
":",
"Schema",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"schemaFile",
")",
")",
"{",
"return",
"new",
"Schema",
"(",
")",
";",
"}",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",... | Load schema from config file.
@return Schema | [
"Load",
"schema",
"from",
"config",
"file",
"."
] | 215dd96394072720b61a682e10a55a6520470c46 | https://github.com/brain-diminished/schema-version-control/blob/215dd96394072720b61a682e10a55a6520470c46/src/SchemaVersionControlService.php#L52-L66 | train |
brain-diminished/schema-version-control | src/SchemaVersionControlService.php | SchemaVersionControlService.applySchema | public function applySchema(bool $strict = false): array
{
$sqlStatements = $this->getMigrationSql();
foreach ($sqlStatements as $sqlStatement) {
$this->connection->exec($sqlStatement);
}
if ($strict) {
$reorderSql = $this->reorderSql();
$sqlStatem... | php | public function applySchema(bool $strict = false): array
{
$sqlStatements = $this->getMigrationSql();
foreach ($sqlStatements as $sqlStatement) {
$this->connection->exec($sqlStatement);
}
if ($strict) {
$reorderSql = $this->reorderSql();
$sqlStatem... | [
"public",
"function",
"applySchema",
"(",
"bool",
"$",
"strict",
"=",
"false",
")",
":",
"array",
"{",
"$",
"sqlStatements",
"=",
"$",
"this",
"->",
"getMigrationSql",
"(",
")",
";",
"foreach",
"(",
"$",
"sqlStatements",
"as",
"$",
"sqlStatement",
")",
"... | Alter schema in database, according to config file.
@return int | [
"Alter",
"schema",
"in",
"database",
"according",
"to",
"config",
"file",
"."
] | 215dd96394072720b61a682e10a55a6520470c46 | https://github.com/brain-diminished/schema-version-control/blob/215dd96394072720b61a682e10a55a6520470c46/src/SchemaVersionControlService.php#L72-L86 | train |
brain-diminished/schema-version-control | src/SchemaVersionControlService.php | SchemaVersionControlService.getSchemaDiff | public function getSchemaDiff(bool $reverseDiff = false): SchemaDiff
{
$currentSchema = $this->getCurrentSchema();
$newSchema = $this->loadSchemaFile();
$comparator = new Comparator();
if ($reverseDiff) {
return $comparator->compare($newSchema, $currentSchema);
} ... | php | public function getSchemaDiff(bool $reverseDiff = false): SchemaDiff
{
$currentSchema = $this->getCurrentSchema();
$newSchema = $this->loadSchemaFile();
$comparator = new Comparator();
if ($reverseDiff) {
return $comparator->compare($newSchema, $currentSchema);
} ... | [
"public",
"function",
"getSchemaDiff",
"(",
"bool",
"$",
"reverseDiff",
"=",
"false",
")",
":",
"SchemaDiff",
"{",
"$",
"currentSchema",
"=",
"$",
"this",
"->",
"getCurrentSchema",
"(",
")",
";",
"$",
"newSchema",
"=",
"$",
"this",
"->",
"loadSchemaFile",
... | Get diff between current schema and config file
@return SchemaDiff | [
"Get",
"diff",
"between",
"current",
"schema",
"and",
"config",
"file"
] | 215dd96394072720b61a682e10a55a6520470c46 | https://github.com/brain-diminished/schema-version-control/blob/215dd96394072720b61a682e10a55a6520470c46/src/SchemaVersionControlService.php#L102-L112 | train |
brain-diminished/schema-version-control | src/SchemaVersionControlService.php | SchemaVersionControlService.dumpSchema | public function dumpSchema()
{
$schema = $this->getCurrentSchema();
$normalizer = new SchemaNormalizer();
$desc = $normalizer->normalize($schema);
$yamlSchema = Yaml::dump(['schema' =>$desc], 10, 2);
$directory = dirname($this->schemaFile);
if (!file_exists($directory... | php | public function dumpSchema()
{
$schema = $this->getCurrentSchema();
$normalizer = new SchemaNormalizer();
$desc = $normalizer->normalize($schema);
$yamlSchema = Yaml::dump(['schema' =>$desc], 10, 2);
$directory = dirname($this->schemaFile);
if (!file_exists($directory... | [
"public",
"function",
"dumpSchema",
"(",
")",
"{",
"$",
"schema",
"=",
"$",
"this",
"->",
"getCurrentSchema",
"(",
")",
";",
"$",
"normalizer",
"=",
"new",
"SchemaNormalizer",
"(",
")",
";",
"$",
"desc",
"=",
"$",
"normalizer",
"->",
"normalize",
"(",
... | Write current database schema in config file | [
"Write",
"current",
"database",
"schema",
"in",
"config",
"file"
] | 215dd96394072720b61a682e10a55a6520470c46 | https://github.com/brain-diminished/schema-version-control/blob/215dd96394072720b61a682e10a55a6520470c46/src/SchemaVersionControlService.php#L117-L128 | train |
jenskooij/cloudcontrol | src/storage/storage/DocumentTypesStorage.php | DocumentTypesStorage.addDocumentType | public function addDocumentType($postValues)
{
$documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues);
$documentTypes = $this->repository->documentTypes;
$documentTypes[] = $documentTypeObject;
$this->repository->documentTypes = $documentTypes;
... | php | public function addDocumentType($postValues)
{
$documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues);
$documentTypes = $this->repository->documentTypes;
$documentTypes[] = $documentTypeObject;
$this->repository->documentTypes = $documentTypes;
... | [
"public",
"function",
"addDocumentType",
"(",
"$",
"postValues",
")",
"{",
"$",
"documentTypeObject",
"=",
"DocumentTypeFactory",
"::",
"createDocumentTypeFromPostValues",
"(",
"$",
"postValues",
")",
";",
"$",
"documentTypes",
"=",
"$",
"this",
"->",
"repository",
... | Add a document type from post values
@param $postValues
@throws \Exception | [
"Add",
"a",
"document",
"type",
"from",
"post",
"values"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentTypesStorage.php#L33-L42 | train |
jenskooij/cloudcontrol | src/storage/storage/DocumentTypesStorage.php | DocumentTypesStorage.deleteDocumentTypeBySlug | public function deleteDocumentTypeBySlug($slug)
{
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $key => $documentTypeObject) {
if ($documentTypeObject->slug == $slug) {
unset($documentTypes[$key]);
}
}
$documentT... | php | public function deleteDocumentTypeBySlug($slug)
{
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $key => $documentTypeObject) {
if ($documentTypeObject->slug == $slug) {
unset($documentTypes[$key]);
}
}
$documentT... | [
"public",
"function",
"deleteDocumentTypeBySlug",
"(",
"$",
"slug",
")",
"{",
"$",
"documentTypes",
"=",
"$",
"this",
"->",
"repository",
"->",
"documentTypes",
";",
"foreach",
"(",
"$",
"documentTypes",
"as",
"$",
"key",
"=>",
"$",
"documentTypeObject",
")",
... | Delete document type
@param $slug
@throws \Exception | [
"Delete",
"document",
"type"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentTypesStorage.php#L51-L62 | train |
jenskooij/cloudcontrol | src/storage/storage/DocumentTypesStorage.php | DocumentTypesStorage.getDocumentTypeBySlug | public function getDocumentTypeBySlug($slug, $getBricks = false)
{
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $documentType) {
if ($documentType->slug == $slug) {
if ($getBricks === true) {
foreach ($documentType->bri... | php | public function getDocumentTypeBySlug($slug, $getBricks = false)
{
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $documentType) {
if ($documentType->slug == $slug) {
if ($getBricks === true) {
foreach ($documentType->bri... | [
"public",
"function",
"getDocumentTypeBySlug",
"(",
"$",
"slug",
",",
"$",
"getBricks",
"=",
"false",
")",
"{",
"$",
"documentTypes",
"=",
"$",
"this",
"->",
"repository",
"->",
"documentTypes",
";",
"foreach",
"(",
"$",
"documentTypes",
"as",
"$",
"document... | Get document type by its slug
@param $slug
@param bool $getBricks
@return mixed | [
"Get",
"document",
"type",
"by",
"its",
"slug"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentTypesStorage.php#L72-L93 | train |
jenskooij/cloudcontrol | src/storage/storage/DocumentTypesStorage.php | DocumentTypesStorage.saveDocumentType | public function saveDocumentType($slug, $postValues)
{
$documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues);
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $key => $documentType) {
if ($documentType->slug == $slu... | php | public function saveDocumentType($slug, $postValues)
{
$documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues);
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $key => $documentType) {
if ($documentType->slug == $slu... | [
"public",
"function",
"saveDocumentType",
"(",
"$",
"slug",
",",
"$",
"postValues",
")",
"{",
"$",
"documentTypeObject",
"=",
"DocumentTypeFactory",
"::",
"createDocumentTypeFromPostValues",
"(",
"$",
"postValues",
")",
";",
"$",
"documentTypes",
"=",
"$",
"this",... | Save changes to a document type
@param $slug
@param $postValues
@throws \Exception | [
"Save",
"changes",
"to",
"a",
"document",
"type"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentTypesStorage.php#L103-L115 | train |
Eden-PHP/Block | Component/Tree.php | Tree.addItem | public function addItem($path, $object = array(), $class = null)
{
$path = explode('/', $path);
$object['class'] = $class;
$args = array();
foreach($path as $key) {
$args[] = $key;
$args[] = 'children';
}
//soft inject
$tree = eden('registry', $this->tree);
$last = count($args);
fore... | php | public function addItem($path, $object = array(), $class = null)
{
$path = explode('/', $path);
$object['class'] = $class;
$args = array();
foreach($path as $key) {
$args[] = $key;
$args[] = 'children';
}
//soft inject
$tree = eden('registry', $this->tree);
$last = count($args);
fore... | [
"public",
"function",
"addItem",
"(",
"$",
"path",
",",
"$",
"object",
"=",
"array",
"(",
")",
",",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"explode",
"(",
"'/'",
",",
"$",
"path",
")",
";",
"$",
"object",
"[",
"'class'",
"]",
"=... | Adds item to the tree
@param string
@param mixed
@return array | [
"Adds",
"item",
"to",
"the",
"tree"
] | 681b9f01dd118612d0fced84d2f702167b52109b | https://github.com/Eden-PHP/Block/blob/681b9f01dd118612d0fced84d2f702167b52109b/Component/Tree.php#L50-L73 | train |
PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Nested/SetMapper.php | SetMapper.map | public function map( $modelList )
{
$self = $this;
return $this->wrapInTransaction( function () use ( $self, $modelList )
{
forward_static_call( [get_class( $self->model ), 'unguard'] );
$result = $self->mapTree( $modelList );
forward_static_call( [get_class( $self->model ), 'reguard'] );
return ... | php | public function map( $modelList )
{
$self = $this;
return $this->wrapInTransaction( function () use ( $self, $modelList )
{
forward_static_call( [get_class( $self->model ), 'unguard'] );
$result = $self->mapTree( $modelList );
forward_static_call( [get_class( $self->model ), 'reguard'] );
return ... | [
"public",
"function",
"map",
"(",
"$",
"modelList",
")",
"{",
"$",
"self",
"=",
"$",
"this",
";",
"return",
"$",
"this",
"->",
"wrapInTransaction",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"self",
",",
"$",
"modelList",
")",
"{",
"forward_static_cal... | Maps a tree structure into the database. Unguards & wraps in transaction.
@param array|Arrayable
@return boolean | [
"Maps",
"a",
"tree",
"structure",
"into",
"the",
"database",
".",
"Unguards",
"&",
"wraps",
"in",
"transaction",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/SetMapper.php#L41-L55 | train |
PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Nested/SetMapper.php | SetMapper.mapTree | public function mapTree( $modelList )
{
$tree = $modelList instanceof Arrayable ? $modelList->toArray() : $modelList;
$affectedKeys = [];
$result = $this->mapTreeRecursive( $tree, $this->model->getKey(), $affectedKeys );
if ( $result && count( $affectedKeys ) > 0 )
$this->deleteUnaffected( $affectedKeys ... | php | public function mapTree( $modelList )
{
$tree = $modelList instanceof Arrayable ? $modelList->toArray() : $modelList;
$affectedKeys = [];
$result = $this->mapTreeRecursive( $tree, $this->model->getKey(), $affectedKeys );
if ( $result && count( $affectedKeys ) > 0 )
$this->deleteUnaffected( $affectedKeys ... | [
"public",
"function",
"mapTree",
"(",
"$",
"modelList",
")",
"{",
"$",
"tree",
"=",
"$",
"modelList",
"instanceof",
"Arrayable",
"?",
"$",
"modelList",
"->",
"toArray",
"(",
")",
":",
"$",
"modelList",
";",
"$",
"affectedKeys",
"=",
"[",
"]",
";",
"$",... | Maps a tree structure into the database without unguarding nor wrapping
inside a transaction.
@param array|Arrayable
@return boolean | [
"Maps",
"a",
"tree",
"structure",
"into",
"the",
"database",
"without",
"unguarding",
"nor",
"wrapping",
"inside",
"a",
"transaction",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/SetMapper.php#L64-L76 | train |
agentmedia/phine-builtin | src/BuiltIn/Modules/Backend/LoginForm.php | LoginForm.SaveElement | protected function SaveElement()
{
$this->login->SetNextUrl($this->selectorNext->Save($this->login->GetNextUrl()));
$this->login->SetPasswordUrl($this->selectorPassword->Save($this->login->GetPasswordUrl()));
return $this->login;
} | php | protected function SaveElement()
{
$this->login->SetNextUrl($this->selectorNext->Save($this->login->GetNextUrl()));
$this->login->SetPasswordUrl($this->selectorPassword->Save($this->login->GetPasswordUrl()));
return $this->login;
} | [
"protected",
"function",
"SaveElement",
"(",
")",
"{",
"$",
"this",
"->",
"login",
"->",
"SetNextUrl",
"(",
"$",
"this",
"->",
"selectorNext",
"->",
"Save",
"(",
"$",
"this",
"->",
"login",
"->",
"GetNextUrl",
"(",
")",
")",
")",
";",
"$",
"this",
"-... | Saves the login element and returns it
@return ContentLogin Returns the login element with form values applied | [
"Saves",
"the",
"login",
"element",
"and",
"returns",
"it"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Backend/LoginForm.php#L81-L86 | train |
ivopetkov/form-bearframework-addon | classes/Form/Constraints.php | Constraints.setMinLength | public function setMinLength(string $elementName, int $minLength, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = sprintf(__('ivopetkov.form.The length of this field must be atleast %s characters.'), $minLength);
... | php | public function setMinLength(string $elementName, int $minLength, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = sprintf(__('ivopetkov.form.The length of this field must be atleast %s characters.'), $minLength);
... | [
"public",
"function",
"setMinLength",
"(",
"string",
"$",
"elementName",
",",
"int",
"$",
"minLength",
",",
"string",
"$",
"errorMessage",
"=",
"null",
")",
":",
"\\",
"IvoPetkov",
"\\",
"BearFrameworkAddons",
"\\",
"Form",
"\\",
"Constraints",
"{",
"if",
"(... | Sets a minimum length requirement for an element
@param string $elementName The element name
@param int $minLength
@param string $errorMessage Error message
@return \IvoPetkov\BearFrameworkAddons\Form\Constraints Returns a reference to itself. | [
"Sets",
"a",
"minimum",
"length",
"requirement",
"for",
"an",
"element"
] | 78ab860c430166805b4e81942eb5a8c32777df01 | https://github.com/ivopetkov/form-bearframework-addon/blob/78ab860c430166805b4e81942eb5a8c32777df01/classes/Form/Constraints.php#L48-L55 | train |
ivopetkov/form-bearframework-addon | classes/Form/Constraints.php | Constraints.setMaxLength | public function setMaxLength(string $elementName, int $maxLength, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = sprintf(__('ivopetkov.form.The length of this field must be atmost %s characters.'), $maxLength);
... | php | public function setMaxLength(string $elementName, int $maxLength, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = sprintf(__('ivopetkov.form.The length of this field must be atmost %s characters.'), $maxLength);
... | [
"public",
"function",
"setMaxLength",
"(",
"string",
"$",
"elementName",
",",
"int",
"$",
"maxLength",
",",
"string",
"$",
"errorMessage",
"=",
"null",
")",
":",
"\\",
"IvoPetkov",
"\\",
"BearFrameworkAddons",
"\\",
"Form",
"\\",
"Constraints",
"{",
"if",
"(... | Sets a maximum length requirement for an element
@param string $elementName The element name
@param int $maxLength
@param string $errorMessage Error message
@return \IvoPetkov\BearFrameworkAddons\Form\Constraints Returns a reference to itself. | [
"Sets",
"a",
"maximum",
"length",
"requirement",
"for",
"an",
"element"
] | 78ab860c430166805b4e81942eb5a8c32777df01 | https://github.com/ivopetkov/form-bearframework-addon/blob/78ab860c430166805b4e81942eb5a8c32777df01/classes/Form/Constraints.php#L65-L72 | train |
ivopetkov/form-bearframework-addon | classes/Form/Constraints.php | Constraints.setEmail | public function setEmail(string $elementName, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = __('ivopetkov.form.This is not a valid email address.');
}
$this->data[] = ['email', $errorMessage, $element... | php | public function setEmail(string $elementName, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = __('ivopetkov.form.This is not a valid email address.');
}
$this->data[] = ['email', $errorMessage, $element... | [
"public",
"function",
"setEmail",
"(",
"string",
"$",
"elementName",
",",
"string",
"$",
"errorMessage",
"=",
"null",
")",
":",
"\\",
"IvoPetkov",
"\\",
"BearFrameworkAddons",
"\\",
"Form",
"\\",
"Constraints",
"{",
"if",
"(",
"$",
"errorMessage",
"===",
"nu... | Requires the element value to be a valid email address
@param string $elementName The element name
@param string $errorMessage Error message
@return \IvoPetkov\BearFrameworkAddons\Form\Constraints Returns a reference to itself. | [
"Requires",
"the",
"element",
"value",
"to",
"be",
"a",
"valid",
"email",
"address"
] | 78ab860c430166805b4e81942eb5a8c32777df01 | https://github.com/ivopetkov/form-bearframework-addon/blob/78ab860c430166805b4e81942eb5a8c32777df01/classes/Form/Constraints.php#L81-L88 | train |
ivopetkov/form-bearframework-addon | classes/Form/Constraints.php | Constraints.setRegularExpression | public function setRegularExpression(string $elementName, string $regularExpression, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = __('ivopetkov.form.This is not a valid value.');
}
$this->data[] = ['... | php | public function setRegularExpression(string $elementName, string $regularExpression, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = __('ivopetkov.form.This is not a valid value.');
}
$this->data[] = ['... | [
"public",
"function",
"setRegularExpression",
"(",
"string",
"$",
"elementName",
",",
"string",
"$",
"regularExpression",
",",
"string",
"$",
"errorMessage",
"=",
"null",
")",
":",
"\\",
"IvoPetkov",
"\\",
"BearFrameworkAddons",
"\\",
"Form",
"\\",
"Constraints",
... | Performs a regular expression validation
@param string $elementName The element name
@param string $regularExpression
@param string $errorMessage Error message
@return \IvoPetkov\BearFrameworkAddons\Form\Constraints Returns a reference to itself. | [
"Performs",
"a",
"regular",
"expression",
"validation"
] | 78ab860c430166805b4e81942eb5a8c32777df01 | https://github.com/ivopetkov/form-bearframework-addon/blob/78ab860c430166805b4e81942eb5a8c32777df01/classes/Form/Constraints.php#L98-L105 | train |
ivopetkov/form-bearframework-addon | classes/Form/Constraints.php | Constraints.validate | public function validate(array $values, array &$errorsList): bool
{
$hasErrors = false;
foreach ($this->data as $item) {
$type = $item[0];
$errorMessage = $item[1];
$elementName = $item[2];
$value = isset($values[$elementName]) ? (string) $values[$elem... | php | public function validate(array $values, array &$errorsList): bool
{
$hasErrors = false;
foreach ($this->data as $item) {
$type = $item[0];
$errorMessage = $item[1];
$elementName = $item[2];
$value = isset($values[$elementName]) ? (string) $values[$elem... | [
"public",
"function",
"validate",
"(",
"array",
"$",
"values",
",",
"array",
"&",
"$",
"errorsList",
")",
":",
"bool",
"{",
"$",
"hasErrors",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"item",
")",
"{",
"$",
"type",
"=... | Validates the values passed
@param array $values The values to checks
@param array $errorsList List of validation errors
@return bool TRUE if no validation errors found. FALSE otherwise. | [
"Validates",
"the",
"values",
"passed"
] | 78ab860c430166805b4e81942eb5a8c32777df01 | https://github.com/ivopetkov/form-bearframework-addon/blob/78ab860c430166805b4e81942eb5a8c32777df01/classes/Form/Constraints.php#L114-L153 | train |
DoSomething/mb-toolbox | src/MB_Toolbox.php | MB_Toolbox.isDSAffiliate | public function isDSAffiliate($targetCountyCode)
{
$foundAffiliate = false;
$affiliates = [
'GB', // United Kingdom
'UK', // United Kingdom
'CA', // Canada
'ID', // Indonesia
'BW', // Botswana
'KE', // Kenya
'GH', // Ghana
'NG', // Nigeria
'CD', // Congo, The Democratic R... | php | public function isDSAffiliate($targetCountyCode)
{
$foundAffiliate = false;
$affiliates = [
'GB', // United Kingdom
'UK', // United Kingdom
'CA', // Canada
'ID', // Indonesia
'BW', // Botswana
'KE', // Kenya
'GH', // Ghana
'NG', // Nigeria
'CD', // Congo, The Democratic R... | [
"public",
"function",
"isDSAffiliate",
"(",
"$",
"targetCountyCode",
")",
"{",
"$",
"foundAffiliate",
"=",
"false",
";",
"$",
"affiliates",
"=",
"[",
"'GB'",
",",
"// United Kingdom",
"'UK'",
",",
"// United Kingdom",
"'CA'",
",",
"// Canada",
"'ID'",
",",
"//... | Test if country code has a DoSomething affiliate.
Follow country code convention defined in:
http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
@param string $targetCountyCode
Country code to check.
@return boolean/array $foundAffiliate
Test if supplied country code is a DoSomething a... | [
"Test",
"if",
"country",
"code",
"has",
"a",
"DoSomething",
"affiliate",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Toolbox.php#L83-L123 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.