id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,500 | silverorange/swat | Swat/SwatMessageDisplay.php | SwatMessageDisplay.display | public function display()
{
if (!$this->visible) {
return;
}
if ($this->getMessageCount() === 0) {
return;
}
parent::display();
$wrapper_div = new SwatHtmlTag('div');
$wrapper_div->id = $this->id;
$wrapper_div->class = $this->getCSSClassString();
$wrapper_div->open();
$has_dismiss_link = false;
$message_count = count($this->display_messages);
$count = 1;
foreach ($this->display_messages as $key => $message) {
if (in_array($key, $this->dismissable_messages)) {
$has_dismiss_link = true;
}
$first = $count === 1;
$last = $count === $message_count;
$this->displayMessage($key, $message, $first, $last);
$count++;
}
$wrapper_div->close();
if ($has_dismiss_link) {
Swat::displayInlineJavaScript($this->getInlineJavaScript());
}
} | php | public function display()
{
if (!$this->visible) {
return;
}
if ($this->getMessageCount() === 0) {
return;
}
parent::display();
$wrapper_div = new SwatHtmlTag('div');
$wrapper_div->id = $this->id;
$wrapper_div->class = $this->getCSSClassString();
$wrapper_div->open();
$has_dismiss_link = false;
$message_count = count($this->display_messages);
$count = 1;
foreach ($this->display_messages as $key => $message) {
if (in_array($key, $this->dismissable_messages)) {
$has_dismiss_link = true;
}
$first = $count === 1;
$last = $count === $message_count;
$this->displayMessage($key, $message, $first, $last);
$count++;
}
$wrapper_div->close();
if ($has_dismiss_link) {
Swat::displayInlineJavaScript($this->getInlineJavaScript());
}
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getMessageCount",
"(",
")",
"===",
"0",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"wrapper_div",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"wrapper_div",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"wrapper_div",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"wrapper_div",
"->",
"open",
"(",
")",
";",
"$",
"has_dismiss_link",
"=",
"false",
";",
"$",
"message_count",
"=",
"count",
"(",
"$",
"this",
"->",
"display_messages",
")",
";",
"$",
"count",
"=",
"1",
";",
"foreach",
"(",
"$",
"this",
"->",
"display_messages",
"as",
"$",
"key",
"=>",
"$",
"message",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"dismissable_messages",
")",
")",
"{",
"$",
"has_dismiss_link",
"=",
"true",
";",
"}",
"$",
"first",
"=",
"$",
"count",
"===",
"1",
";",
"$",
"last",
"=",
"$",
"count",
"===",
"$",
"message_count",
";",
"$",
"this",
"->",
"displayMessage",
"(",
"$",
"key",
",",
"$",
"message",
",",
"$",
"first",
",",
"$",
"last",
")",
";",
"$",
"count",
"++",
";",
"}",
"$",
"wrapper_div",
"->",
"close",
"(",
")",
";",
"if",
"(",
"$",
"has_dismiss_link",
")",
"{",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavaScript",
"(",
")",
")",
";",
"}",
"}"
] | Displays messages in this message display
The CSS class of each message is determined by the message being
displayed. | [
"Displays",
"messages",
"in",
"this",
"message",
"display"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatMessageDisplay.php#L153-L193 |
33,501 | silverorange/swat | Swat/SwatMessageDisplay.php | SwatMessageDisplay.displayMessage | protected function displayMessage(
$message_id,
SwatMessage $message,
$first = false,
$last = false
) {
$message_div = new SwatHtmlTag('div');
$container_div = new SwatHtmlTag('div');
$message_div->id = $this->id . '_' . $message_id;
$message_div->class = $message->getCSSClassString();
if ($first) {
$message_div->class .= ' swat-message-first';
}
if ($last) {
$message_div->class .= ' swat-message-last';
}
$message_div->open();
$container_div->class = 'swat-message-container';
$container_div->open();
$primary_content = new SwatHtmlTag('h3');
$primary_content->class = 'swat-message-primary-content';
$primary_content->setContent(
$message->primary_content,
$message->content_type
);
$primary_content->display();
if ($message->secondary_content !== null) {
$secondary_div = new SwatHtmlTag('div');
$secondary_div->class = 'swat-message-secondary-content';
$secondary_div->setContent(
$message->secondary_content,
$message->content_type
);
$secondary_div->display();
}
$container_div->close();
$message_div->close();
} | php | protected function displayMessage(
$message_id,
SwatMessage $message,
$first = false,
$last = false
) {
$message_div = new SwatHtmlTag('div');
$container_div = new SwatHtmlTag('div');
$message_div->id = $this->id . '_' . $message_id;
$message_div->class = $message->getCSSClassString();
if ($first) {
$message_div->class .= ' swat-message-first';
}
if ($last) {
$message_div->class .= ' swat-message-last';
}
$message_div->open();
$container_div->class = 'swat-message-container';
$container_div->open();
$primary_content = new SwatHtmlTag('h3');
$primary_content->class = 'swat-message-primary-content';
$primary_content->setContent(
$message->primary_content,
$message->content_type
);
$primary_content->display();
if ($message->secondary_content !== null) {
$secondary_div = new SwatHtmlTag('div');
$secondary_div->class = 'swat-message-secondary-content';
$secondary_div->setContent(
$message->secondary_content,
$message->content_type
);
$secondary_div->display();
}
$container_div->close();
$message_div->close();
} | [
"protected",
"function",
"displayMessage",
"(",
"$",
"message_id",
",",
"SwatMessage",
"$",
"message",
",",
"$",
"first",
"=",
"false",
",",
"$",
"last",
"=",
"false",
")",
"{",
"$",
"message_div",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"container_div",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"message_div",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_'",
".",
"$",
"message_id",
";",
"$",
"message_div",
"->",
"class",
"=",
"$",
"message",
"->",
"getCSSClassString",
"(",
")",
";",
"if",
"(",
"$",
"first",
")",
"{",
"$",
"message_div",
"->",
"class",
".=",
"' swat-message-first'",
";",
"}",
"if",
"(",
"$",
"last",
")",
"{",
"$",
"message_div",
"->",
"class",
".=",
"' swat-message-last'",
";",
"}",
"$",
"message_div",
"->",
"open",
"(",
")",
";",
"$",
"container_div",
"->",
"class",
"=",
"'swat-message-container'",
";",
"$",
"container_div",
"->",
"open",
"(",
")",
";",
"$",
"primary_content",
"=",
"new",
"SwatHtmlTag",
"(",
"'h3'",
")",
";",
"$",
"primary_content",
"->",
"class",
"=",
"'swat-message-primary-content'",
";",
"$",
"primary_content",
"->",
"setContent",
"(",
"$",
"message",
"->",
"primary_content",
",",
"$",
"message",
"->",
"content_type",
")",
";",
"$",
"primary_content",
"->",
"display",
"(",
")",
";",
"if",
"(",
"$",
"message",
"->",
"secondary_content",
"!==",
"null",
")",
"{",
"$",
"secondary_div",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"secondary_div",
"->",
"class",
"=",
"'swat-message-secondary-content'",
";",
"$",
"secondary_div",
"->",
"setContent",
"(",
"$",
"message",
"->",
"secondary_content",
",",
"$",
"message",
"->",
"content_type",
")",
";",
"$",
"secondary_div",
"->",
"display",
"(",
")",
";",
"}",
"$",
"container_div",
"->",
"close",
"(",
")",
";",
"$",
"message_div",
"->",
"close",
"(",
")",
";",
"}"
] | Display a single message of this message display
@param integer $message_id a unique identifier for the message within
this message display.
@param SwatMessage $message the message to display.
@param boolean $first optional. Whether or not the message is the first
message in this message display.
@param boolean $last optional. Whether or not the message is the last
message in this message display. | [
"Display",
"a",
"single",
"message",
"of",
"this",
"message",
"display"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatMessageDisplay.php#L242-L289 |
33,502 | silverorange/swat | Swat/SwatMessageDisplay.php | SwatMessageDisplay.getInlineJavaScript | protected function getInlineJavaScript()
{
static $shown = false;
if (!$shown) {
$javascript = $this->getInlineJavaScriptTranslations();
$shown = true;
} else {
$javascript = '';
}
$dismissable_messages =
'[' . implode(', ', $this->dismissable_messages) . ']';
$javascript .= sprintf(
"var %s_obj = new %s('%s', %s);",
$this->id,
$this->getJavaScriptClass(),
$this->id,
$dismissable_messages
);
return $javascript;
} | php | protected function getInlineJavaScript()
{
static $shown = false;
if (!$shown) {
$javascript = $this->getInlineJavaScriptTranslations();
$shown = true;
} else {
$javascript = '';
}
$dismissable_messages =
'[' . implode(', ', $this->dismissable_messages) . ']';
$javascript .= sprintf(
"var %s_obj = new %s('%s', %s);",
$this->id,
$this->getJavaScriptClass(),
$this->id,
$dismissable_messages
);
return $javascript;
} | [
"protected",
"function",
"getInlineJavaScript",
"(",
")",
"{",
"static",
"$",
"shown",
"=",
"false",
";",
"if",
"(",
"!",
"$",
"shown",
")",
"{",
"$",
"javascript",
"=",
"$",
"this",
"->",
"getInlineJavaScriptTranslations",
"(",
")",
";",
"$",
"shown",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"javascript",
"=",
"''",
";",
"}",
"$",
"dismissable_messages",
"=",
"'['",
".",
"implode",
"(",
"', '",
",",
"$",
"this",
"->",
"dismissable_messages",
")",
".",
"']'",
";",
"$",
"javascript",
".=",
"sprintf",
"(",
"\"var %s_obj = new %s('%s', %s);\"",
",",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"getJavaScriptClass",
"(",
")",
",",
"$",
"this",
"->",
"id",
",",
"$",
"dismissable_messages",
")",
";",
"return",
"$",
"javascript",
";",
"}"
] | Gets the inline JavaScript for hiding messages | [
"Gets",
"the",
"inline",
"JavaScript",
"for",
"hiding",
"messages"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatMessageDisplay.php#L326-L349 |
33,503 | silverorange/swat | Swat/SwatReplicableFrame.php | SwatReplicableFrame.init | public function init()
{
$children = array();
foreach ($this->children as $child_widget) {
$children[] = $this->remove($child_widget);
}
$frame = new SwatFrame();
$frame->id = $frame->getUniqueId();
$prototype_id = $frame->id;
foreach ($children as $child_widget) {
$frame->add($child_widget);
}
$this->add($frame);
parent::init();
if ($this->replication_ids === null && is_array($this->replicators)) {
foreach ($this->replicators as $id => $title) {
$frame = $this->getWidget($prototype_id, $id);
$frame->title = $title;
}
}
} | php | public function init()
{
$children = array();
foreach ($this->children as $child_widget) {
$children[] = $this->remove($child_widget);
}
$frame = new SwatFrame();
$frame->id = $frame->getUniqueId();
$prototype_id = $frame->id;
foreach ($children as $child_widget) {
$frame->add($child_widget);
}
$this->add($frame);
parent::init();
if ($this->replication_ids === null && is_array($this->replicators)) {
foreach ($this->replicators as $id => $title) {
$frame = $this->getWidget($prototype_id, $id);
$frame->title = $title;
}
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"children",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child_widget",
")",
"{",
"$",
"children",
"[",
"]",
"=",
"$",
"this",
"->",
"remove",
"(",
"$",
"child_widget",
")",
";",
"}",
"$",
"frame",
"=",
"new",
"SwatFrame",
"(",
")",
";",
"$",
"frame",
"->",
"id",
"=",
"$",
"frame",
"->",
"getUniqueId",
"(",
")",
";",
"$",
"prototype_id",
"=",
"$",
"frame",
"->",
"id",
";",
"foreach",
"(",
"$",
"children",
"as",
"$",
"child_widget",
")",
"{",
"$",
"frame",
"->",
"add",
"(",
"$",
"child_widget",
")",
";",
"}",
"$",
"this",
"->",
"add",
"(",
"$",
"frame",
")",
";",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"replication_ids",
"===",
"null",
"&&",
"is_array",
"(",
"$",
"this",
"->",
"replicators",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"replicators",
"as",
"$",
"id",
"=>",
"$",
"title",
")",
"{",
"$",
"frame",
"=",
"$",
"this",
"->",
"getWidget",
"(",
"$",
"prototype_id",
",",
"$",
"id",
")",
";",
"$",
"frame",
"->",
"title",
"=",
"$",
"title",
";",
"}",
"}",
"}"
] | Initilizes this replicable frame | [
"Initilizes",
"this",
"replicable",
"frame"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatReplicableFrame.php#L23-L48 |
33,504 | silverorange/swat | SwatDB/SwatDBClassMap.php | SwatDBClassMap.add | public static function add($from_class_name, $to_class_name)
{
// check for circular dependency
if (array_key_exists($to_class_name, self::$map)) {
$class_name = $to_class_name;
$child_class_names = array($class_name);
while (array_key_exists($class_name, self::$map)) {
$class_name = self::$map[$class_name];
$child_class_names[] = $class_name;
}
if (in_array($from_class_name, $child_class_names)) {
throw new SwatException(
sprintf(
'Circular class dependency detected: %s => %s',
$from_class_name,
implode(' => ', $child_class_names)
)
);
}
}
self::$map[$from_class_name] = $to_class_name;
} | php | public static function add($from_class_name, $to_class_name)
{
// check for circular dependency
if (array_key_exists($to_class_name, self::$map)) {
$class_name = $to_class_name;
$child_class_names = array($class_name);
while (array_key_exists($class_name, self::$map)) {
$class_name = self::$map[$class_name];
$child_class_names[] = $class_name;
}
if (in_array($from_class_name, $child_class_names)) {
throw new SwatException(
sprintf(
'Circular class dependency detected: %s => %s',
$from_class_name,
implode(' => ', $child_class_names)
)
);
}
}
self::$map[$from_class_name] = $to_class_name;
} | [
"public",
"static",
"function",
"add",
"(",
"$",
"from_class_name",
",",
"$",
"to_class_name",
")",
"{",
"// check for circular dependency",
"if",
"(",
"array_key_exists",
"(",
"$",
"to_class_name",
",",
"self",
"::",
"$",
"map",
")",
")",
"{",
"$",
"class_name",
"=",
"$",
"to_class_name",
";",
"$",
"child_class_names",
"=",
"array",
"(",
"$",
"class_name",
")",
";",
"while",
"(",
"array_key_exists",
"(",
"$",
"class_name",
",",
"self",
"::",
"$",
"map",
")",
")",
"{",
"$",
"class_name",
"=",
"self",
"::",
"$",
"map",
"[",
"$",
"class_name",
"]",
";",
"$",
"child_class_names",
"[",
"]",
"=",
"$",
"class_name",
";",
"}",
"if",
"(",
"in_array",
"(",
"$",
"from_class_name",
",",
"$",
"child_class_names",
")",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"sprintf",
"(",
"'Circular class dependency detected: %s => %s'",
",",
"$",
"from_class_name",
",",
"implode",
"(",
"' => '",
",",
"$",
"child_class_names",
")",
")",
")",
";",
"}",
"}",
"self",
"::",
"$",
"map",
"[",
"$",
"from_class_name",
"]",
"=",
"$",
"to_class_name",
";",
"}"
] | Maps a class name to another class name
Subsequent calls to {@link SwatDBClassMap::get()} using the
<i>$from_class_name</i> will return the <i>$to_class_name</i>. Class
names may be mapped to already mapped class names. For example:
<code>
SwatDBClassMap::add('Object', 'MyObject');
SwatDBClassMap::add('MyObject', 'MyOtherObject');
echo SwatDBClassMap::get('Object'); // MyOtherObject
</code>
If a circular dependency is created, an exception is thrown. If the
<i>$from_class_name</i> is already mapped to another class the old
mapping is overwritten.
@param string $from_class_name the class name to map from.
@param string $to_class_name the class name to map to. The mapped class
must be a subclass of the
<i>$from_class_name</i> otherwise class
resolution using
{@link SwatDBClassMap::get()} will throw
an exception.
@throws SwatException if the added mapping creates a circular dependency. | [
"Maps",
"a",
"class",
"name",
"to",
"another",
"class",
"name"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBClassMap.php#L68-L91 |
33,505 | silverorange/swat | SwatDB/SwatDBClassMap.php | SwatDBClassMap.get | public static function get($from_class_name)
{
$to_class_name = $from_class_name;
while (array_key_exists($from_class_name, self::$map)) {
$to_class_name = self::$map[$from_class_name];
if (!is_subclass_of($to_class_name, $from_class_name)) {
throw new SwatInvalidClassException(
sprintf(
'Invalid ' .
'class-mapping detected. %s is not a subclass of %s.',
$to_class_name,
$from_class_name
)
);
}
$from_class_name = $to_class_name;
}
return $to_class_name;
} | php | public static function get($from_class_name)
{
$to_class_name = $from_class_name;
while (array_key_exists($from_class_name, self::$map)) {
$to_class_name = self::$map[$from_class_name];
if (!is_subclass_of($to_class_name, $from_class_name)) {
throw new SwatInvalidClassException(
sprintf(
'Invalid ' .
'class-mapping detected. %s is not a subclass of %s.',
$to_class_name,
$from_class_name
)
);
}
$from_class_name = $to_class_name;
}
return $to_class_name;
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"from_class_name",
")",
"{",
"$",
"to_class_name",
"=",
"$",
"from_class_name",
";",
"while",
"(",
"array_key_exists",
"(",
"$",
"from_class_name",
",",
"self",
"::",
"$",
"map",
")",
")",
"{",
"$",
"to_class_name",
"=",
"self",
"::",
"$",
"map",
"[",
"$",
"from_class_name",
"]",
";",
"if",
"(",
"!",
"is_subclass_of",
"(",
"$",
"to_class_name",
",",
"$",
"from_class_name",
")",
")",
"{",
"throw",
"new",
"SwatInvalidClassException",
"(",
"sprintf",
"(",
"'Invalid '",
".",
"'class-mapping detected. %s is not a subclass of %s.'",
",",
"$",
"to_class_name",
",",
"$",
"from_class_name",
")",
")",
";",
"}",
"$",
"from_class_name",
"=",
"$",
"to_class_name",
";",
"}",
"return",
"$",
"to_class_name",
";",
"}"
] | Resolves a class name from the class map
@param string $from_class_name the name of the class to resolve.
@return string the resolved class name. If no class mapping exists for
for the given class name, the same class name is
returned.
@throws SwatInvalidClassException if a mapped class is not a subclass of
its original class. | [
"Resolves",
"a",
"class",
"name",
"from",
"the",
"class",
"map"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBClassMap.php#L108-L130 |
33,506 | silverorange/swat | SwatDB/SwatDBClassMap.php | SwatDBClassMap.addPath | public static function addPath($search_path)
{
if (!in_array($search_path, self::$search_paths, true)) {
// add path to front of array since it is more likely we will find
// class-definitions in manually added search paths
array_unshift(self::$search_paths, $search_path);
}
} | php | public static function addPath($search_path)
{
if (!in_array($search_path, self::$search_paths, true)) {
// add path to front of array since it is more likely we will find
// class-definitions in manually added search paths
array_unshift(self::$search_paths, $search_path);
}
} | [
"public",
"static",
"function",
"addPath",
"(",
"$",
"search_path",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"search_path",
",",
"self",
"::",
"$",
"search_paths",
",",
"true",
")",
")",
"{",
"// add path to front of array since it is more likely we will find",
"// class-definitions in manually added search paths",
"array_unshift",
"(",
"self",
"::",
"$",
"search_paths",
",",
"$",
"search_path",
")",
";",
"}",
"}"
] | Adds a search path for class-definition files
When an undefined class is resolved, the class map attempts to find
and require a class-definition file for the class.
All search paths are relative to the PHP include path. The empty search
path ('.') is included by default.
@param string $search_path the path to search for class-definition files.
@see SwatDBClassMap::removePath() | [
"Adds",
"a",
"search",
"path",
"for",
"class",
"-",
"definition",
"files"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBClassMap.php#L148-L155 |
33,507 | silverorange/swat | SwatDB/SwatDBClassMap.php | SwatDBClassMap.removePath | public static function removePath($search_path)
{
$index = array_search($search_path, self::$search_paths);
if ($index !== false) {
array_splice(self::$search_paths, $index, 1);
}
} | php | public static function removePath($search_path)
{
$index = array_search($search_path, self::$search_paths);
if ($index !== false) {
array_splice(self::$search_paths, $index, 1);
}
} | [
"public",
"static",
"function",
"removePath",
"(",
"$",
"search_path",
")",
"{",
"$",
"index",
"=",
"array_search",
"(",
"$",
"search_path",
",",
"self",
"::",
"$",
"search_paths",
")",
";",
"if",
"(",
"$",
"index",
"!==",
"false",
")",
"{",
"array_splice",
"(",
"self",
"::",
"$",
"search_paths",
",",
"$",
"index",
",",
"1",
")",
";",
"}",
"}"
] | Removes a search path for class-definition files
@param string $search_path the path to remove.
@see SwatDBClassMap::addPath() | [
"Removes",
"a",
"search",
"path",
"for",
"class",
"-",
"definition",
"files"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBClassMap.php#L167-L173 |
33,508 | silverorange/swat | SwatDB/SwatDBClassMap.php | SwatDBClassMap.addMapping | public function addMapping($package_class_name, $class_name)
{
$this->mappings[$package_class_name] = $class_name;
self::add($package_class_name, $class_name);
} | php | public function addMapping($package_class_name, $class_name)
{
$this->mappings[$package_class_name] = $class_name;
self::add($package_class_name, $class_name);
} | [
"public",
"function",
"addMapping",
"(",
"$",
"package_class_name",
",",
"$",
"class_name",
")",
"{",
"$",
"this",
"->",
"mappings",
"[",
"$",
"package_class_name",
"]",
"=",
"$",
"class_name",
";",
"self",
"::",
"add",
"(",
"$",
"package_class_name",
",",
"$",
"class_name",
")",
";",
"}"
] | Adds a class-mapping to the class-mapping object
@param string $package_class_name the name of the package class to
override.
@param string $class_name the name of the site-specific class.
@deprecated Use the static method {@link SwatDBClassMap::add()}. | [
"Adds",
"a",
"class",
"-",
"mapping",
"to",
"the",
"class",
"-",
"mapping",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBClassMap.php#L251-L255 |
33,509 | TeknooSoftware/states | src/State/StateTrait.php | StateTrait.getReflectionClass | private function getReflectionClass(): \ReflectionClass
{
if (null === $this->reflectionClass) {
$this->reflectionClass = new \ReflectionClass(\get_class($this));
}
return $this->reflectionClass;
} | php | private function getReflectionClass(): \ReflectionClass
{
if (null === $this->reflectionClass) {
$this->reflectionClass = new \ReflectionClass(\get_class($this));
}
return $this->reflectionClass;
} | [
"private",
"function",
"getReflectionClass",
"(",
")",
":",
"\\",
"ReflectionClass",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"reflectionClass",
")",
"{",
"$",
"this",
"->",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"\\",
"get_class",
"(",
"$",
"this",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"reflectionClass",
";",
"}"
] | To build the ReflectionClass for the current object.
@api
@return \ReflectionClass
@throws \ReflectionException | [
"To",
"build",
"the",
"ReflectionClass",
"for",
"the",
"current",
"object",
"."
] | 0c675b768781ee3a3a15c2663cffec5d50c1d5fd | https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/src/State/StateTrait.php#L139-L146 |
33,510 | TeknooSoftware/states | src/State/StateTrait.php | StateTrait.checkVisibilityProtected | private function checkVisibilityProtected(string &$methodName, string &$statedClassOrigin): bool
{
if (false === $this->reflectionsMethods[$methodName]->isPrivate()
&& !empty($statedClassOrigin)
&& ($statedClassOrigin === $this->statedClassName
|| \is_subclass_of($statedClassOrigin, $this->statedClassName))) {
//It's a public or protected method, do like if there is no method
return true;
}
return false;
} | php | private function checkVisibilityProtected(string &$methodName, string &$statedClassOrigin): bool
{
if (false === $this->reflectionsMethods[$methodName]->isPrivate()
&& !empty($statedClassOrigin)
&& ($statedClassOrigin === $this->statedClassName
|| \is_subclass_of($statedClassOrigin, $this->statedClassName))) {
//It's a public or protected method, do like if there is no method
return true;
}
return false;
} | [
"private",
"function",
"checkVisibilityProtected",
"(",
"string",
"&",
"$",
"methodName",
",",
"string",
"&",
"$",
"statedClassOrigin",
")",
":",
"bool",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"reflectionsMethods",
"[",
"$",
"methodName",
"]",
"->",
"isPrivate",
"(",
")",
"&&",
"!",
"empty",
"(",
"$",
"statedClassOrigin",
")",
"&&",
"(",
"$",
"statedClassOrigin",
"===",
"$",
"this",
"->",
"statedClassName",
"||",
"\\",
"is_subclass_of",
"(",
"$",
"statedClassOrigin",
",",
"$",
"this",
"->",
"statedClassName",
")",
")",
")",
"{",
"//It's a public or protected method, do like if there is no method",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Can not access to private methods, only public and protected.
@param string $methodName
@param string $statedClassOrigin
@return bool | [
"Can",
"not",
"access",
"to",
"private",
"methods",
"only",
"public",
"and",
"protected",
"."
] | 0c675b768781ee3a3a15c2663cffec5d50c1d5fd | https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/src/State/StateTrait.php#L178-L189 |
33,511 | TeknooSoftware/states | src/State/StateTrait.php | StateTrait.checkVisibilityPublic | private function checkVisibilityPublic(string &$methodName): bool
{
if (true === $this->reflectionsMethods[$methodName]->isPublic()) {
//It's a public method, do like if there is no method
return true;
}
return false;
} | php | private function checkVisibilityPublic(string &$methodName): bool
{
if (true === $this->reflectionsMethods[$methodName]->isPublic()) {
//It's a public method, do like if there is no method
return true;
}
return false;
} | [
"private",
"function",
"checkVisibilityPublic",
"(",
"string",
"&",
"$",
"methodName",
")",
":",
"bool",
"{",
"if",
"(",
"true",
"===",
"$",
"this",
"->",
"reflectionsMethods",
"[",
"$",
"methodName",
"]",
"->",
"isPublic",
"(",
")",
")",
"{",
"//It's a public method, do like if there is no method",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Can not access to protect and private method.
@param string $methodName
@return bool | [
"Can",
"not",
"access",
"to",
"protect",
"and",
"private",
"method",
"."
] | 0c675b768781ee3a3a15c2663cffec5d50c1d5fd | https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/src/State/StateTrait.php#L198-L206 |
33,512 | brainworxx/kreXX | src/Analyse/Routing/Process/ProcessString.php | ProcessString.process | public function process(Model $model)
{
$data = $model->getData();
// Check if this is a possible callback.
// We are not going to analyse this further, because modern systems
// do not use these anymore.
if (function_exists($data) === true) {
$model->setIsCallback(true);
}
// Checking the encoding.
$encoding = $this->pool->encodingService->mbDetectEncoding($data);
if ($encoding === false) {
// Looks like we have a mixed encoded string.
// We need to tell the dev!
$length = $this->pool->encodingService->mbStrLen($data);
$strlen = 'broken encoding ' . $length;
$model->addToJson(static::META_ENCODING, 'broken');
} else {
// Normal encoding, nothing special here.
$length = $strlen = $this->pool->encodingService->mbStrLen($data, $encoding);
}
if ($length > 20) {
// Getting mime type from the string.
// With larger strings, there is a good chance that there is
// something interesting in there.
$model->addToJson(static::META_MIME_TYPE, $this->bufferInfo->buffer($data));
}
// Check, if we are handling large string, and if we need to use a
// preview (which we call "extra").
// We also need to check for linebreaks, because the preview can not
// display those.
if ($length > 50 || strstr($data, PHP_EOL) !== false) {
$cut = $this->pool->encodingService->encodeString(
$this->pool->encodingService->mbSubStr($data, 0, 50)
) . static::UNKNOWN_VALUE;
$data = $this->pool->encodingService->encodeString($data);
$model->setHasExtra(true)
->setNormal($cut)
->setData($data);
} else {
$model->setNormal($this->pool->encodingService->encodeString($data));
}
return $this->pool->render->renderSingleChild(
$model->setType(static::TYPE_STRING . $strlen)
->addToJson(static::META_LENGTH, $length)
);
} | php | public function process(Model $model)
{
$data = $model->getData();
// Check if this is a possible callback.
// We are not going to analyse this further, because modern systems
// do not use these anymore.
if (function_exists($data) === true) {
$model->setIsCallback(true);
}
// Checking the encoding.
$encoding = $this->pool->encodingService->mbDetectEncoding($data);
if ($encoding === false) {
// Looks like we have a mixed encoded string.
// We need to tell the dev!
$length = $this->pool->encodingService->mbStrLen($data);
$strlen = 'broken encoding ' . $length;
$model->addToJson(static::META_ENCODING, 'broken');
} else {
// Normal encoding, nothing special here.
$length = $strlen = $this->pool->encodingService->mbStrLen($data, $encoding);
}
if ($length > 20) {
// Getting mime type from the string.
// With larger strings, there is a good chance that there is
// something interesting in there.
$model->addToJson(static::META_MIME_TYPE, $this->bufferInfo->buffer($data));
}
// Check, if we are handling large string, and if we need to use a
// preview (which we call "extra").
// We also need to check for linebreaks, because the preview can not
// display those.
if ($length > 50 || strstr($data, PHP_EOL) !== false) {
$cut = $this->pool->encodingService->encodeString(
$this->pool->encodingService->mbSubStr($data, 0, 50)
) . static::UNKNOWN_VALUE;
$data = $this->pool->encodingService->encodeString($data);
$model->setHasExtra(true)
->setNormal($cut)
->setData($data);
} else {
$model->setNormal($this->pool->encodingService->encodeString($data));
}
return $this->pool->render->renderSingleChild(
$model->setType(static::TYPE_STRING . $strlen)
->addToJson(static::META_LENGTH, $length)
);
} | [
"public",
"function",
"process",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"data",
"=",
"$",
"model",
"->",
"getData",
"(",
")",
";",
"// Check if this is a possible callback.",
"// We are not going to analyse this further, because modern systems",
"// do not use these anymore.",
"if",
"(",
"function_exists",
"(",
"$",
"data",
")",
"===",
"true",
")",
"{",
"$",
"model",
"->",
"setIsCallback",
"(",
"true",
")",
";",
"}",
"// Checking the encoding.",
"$",
"encoding",
"=",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"mbDetectEncoding",
"(",
"$",
"data",
")",
";",
"if",
"(",
"$",
"encoding",
"===",
"false",
")",
"{",
"// Looks like we have a mixed encoded string.",
"// We need to tell the dev!",
"$",
"length",
"=",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"mbStrLen",
"(",
"$",
"data",
")",
";",
"$",
"strlen",
"=",
"'broken encoding '",
".",
"$",
"length",
";",
"$",
"model",
"->",
"addToJson",
"(",
"static",
"::",
"META_ENCODING",
",",
"'broken'",
")",
";",
"}",
"else",
"{",
"// Normal encoding, nothing special here.",
"$",
"length",
"=",
"$",
"strlen",
"=",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"mbStrLen",
"(",
"$",
"data",
",",
"$",
"encoding",
")",
";",
"}",
"if",
"(",
"$",
"length",
">",
"20",
")",
"{",
"// Getting mime type from the string.",
"// With larger strings, there is a good chance that there is",
"// something interesting in there.",
"$",
"model",
"->",
"addToJson",
"(",
"static",
"::",
"META_MIME_TYPE",
",",
"$",
"this",
"->",
"bufferInfo",
"->",
"buffer",
"(",
"$",
"data",
")",
")",
";",
"}",
"// Check, if we are handling large string, and if we need to use a",
"// preview (which we call \"extra\").",
"// We also need to check for linebreaks, because the preview can not",
"// display those.",
"if",
"(",
"$",
"length",
">",
"50",
"||",
"strstr",
"(",
"$",
"data",
",",
"PHP_EOL",
")",
"!==",
"false",
")",
"{",
"$",
"cut",
"=",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"encodeString",
"(",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"mbSubStr",
"(",
"$",
"data",
",",
"0",
",",
"50",
")",
")",
".",
"static",
"::",
"UNKNOWN_VALUE",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"encodeString",
"(",
"$",
"data",
")",
";",
"$",
"model",
"->",
"setHasExtra",
"(",
"true",
")",
"->",
"setNormal",
"(",
"$",
"cut",
")",
"->",
"setData",
"(",
"$",
"data",
")",
";",
"}",
"else",
"{",
"$",
"model",
"->",
"setNormal",
"(",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"encodeString",
"(",
"$",
"data",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleChild",
"(",
"$",
"model",
"->",
"setType",
"(",
"static",
"::",
"TYPE_STRING",
".",
"$",
"strlen",
")",
"->",
"addToJson",
"(",
"static",
"::",
"META_LENGTH",
",",
"$",
"length",
")",
")",
";",
"}"
] | Render a dump for a string value.
@param Model $model
The data we are analysing.
@return string
The rendered markup. | [
"Render",
"a",
"dump",
"for",
"a",
"string",
"value",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessString.php#L79-L132 |
33,513 | silverorange/swat | Swat/SwatRemoveInputCell.php | SwatRemoveInputCell.init | public function init()
{
$row = $this->getInputRow();
if ($row === null) {
throw new SwatException(
'Remove input-cells can only be used ' .
'inside table-views with an input-row.'
);
}
$content = new SwatContentBlock();
ob_start();
$view = $this->getFirstAncestor('SwatTableView');
$view_id = $view === null ? null : $view->id;
$id = $view_id === null ? $row->id : $view_id . '_' . $row->id;
$anchor_tag = new SwatHtmlTag('a');
$anchor_tag->title = Swat::_('Remove this row');
$anchor_tag->class = 'swat-remove-input-cell-remove';
$anchor_tag->href = sprintf("javascript:%s_obj.removeRow('%%s');", $id);
$anchor_tag->setContent(Swat::_('Remove this row'));
$anchor_tag->display();
$content->content = ob_get_clean();
$content->content_type = 'text/xml';
// manually set the widget since setWidget() is over-ridden to throw
// an exception.
$this->widget = $content;
$content->parent = $this;
} | php | public function init()
{
$row = $this->getInputRow();
if ($row === null) {
throw new SwatException(
'Remove input-cells can only be used ' .
'inside table-views with an input-row.'
);
}
$content = new SwatContentBlock();
ob_start();
$view = $this->getFirstAncestor('SwatTableView');
$view_id = $view === null ? null : $view->id;
$id = $view_id === null ? $row->id : $view_id . '_' . $row->id;
$anchor_tag = new SwatHtmlTag('a');
$anchor_tag->title = Swat::_('Remove this row');
$anchor_tag->class = 'swat-remove-input-cell-remove';
$anchor_tag->href = sprintf("javascript:%s_obj.removeRow('%%s');", $id);
$anchor_tag->setContent(Swat::_('Remove this row'));
$anchor_tag->display();
$content->content = ob_get_clean();
$content->content_type = 'text/xml';
// manually set the widget since setWidget() is over-ridden to throw
// an exception.
$this->widget = $content;
$content->parent = $this;
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"row",
"=",
"$",
"this",
"->",
"getInputRow",
"(",
")",
";",
"if",
"(",
"$",
"row",
"===",
"null",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"'Remove input-cells can only be used '",
".",
"'inside table-views with an input-row.'",
")",
";",
"}",
"$",
"content",
"=",
"new",
"SwatContentBlock",
"(",
")",
";",
"ob_start",
"(",
")",
";",
"$",
"view",
"=",
"$",
"this",
"->",
"getFirstAncestor",
"(",
"'SwatTableView'",
")",
";",
"$",
"view_id",
"=",
"$",
"view",
"===",
"null",
"?",
"null",
":",
"$",
"view",
"->",
"id",
";",
"$",
"id",
"=",
"$",
"view_id",
"===",
"null",
"?",
"$",
"row",
"->",
"id",
":",
"$",
"view_id",
".",
"'_'",
".",
"$",
"row",
"->",
"id",
";",
"$",
"anchor_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'a'",
")",
";",
"$",
"anchor_tag",
"->",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Remove this row'",
")",
";",
"$",
"anchor_tag",
"->",
"class",
"=",
"'swat-remove-input-cell-remove'",
";",
"$",
"anchor_tag",
"->",
"href",
"=",
"sprintf",
"(",
"\"javascript:%s_obj.removeRow('%%s');\"",
",",
"$",
"id",
")",
";",
"$",
"anchor_tag",
"->",
"setContent",
"(",
"Swat",
"::",
"_",
"(",
"'Remove this row'",
")",
")",
";",
"$",
"anchor_tag",
"->",
"display",
"(",
")",
";",
"$",
"content",
"->",
"content",
"=",
"ob_get_clean",
"(",
")",
";",
"$",
"content",
"->",
"content_type",
"=",
"'text/xml'",
";",
"// manually set the widget since setWidget() is over-ridden to throw",
"// an exception.",
"$",
"this",
"->",
"widget",
"=",
"$",
"content",
";",
"$",
"content",
"->",
"parent",
"=",
"$",
"this",
";",
"}"
] | Sets the remove widget for this input cell
In SwatRemoveInputCell objects the remove widget is automatically set to
a SwatContentBlock with predefined content for the remove link.
@throws SwatException | [
"Sets",
"the",
"remove",
"widget",
"for",
"this",
"input",
"cell"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRemoveInputCell.php#L32-L65 |
33,514 | silverorange/swat | Swat/SwatRemoveInputCell.php | SwatRemoveInputCell.display | public function display($replicator_id)
{
$widget = $this->getClonedWidget($replicator_id);
// substitute the replicator_id into the content block's contents
$widget->content = str_replace('%s', $replicator_id, $widget->content);
$widget->display();
} | php | public function display($replicator_id)
{
$widget = $this->getClonedWidget($replicator_id);
// substitute the replicator_id into the content block's contents
$widget->content = str_replace('%s', $replicator_id, $widget->content);
$widget->display();
} | [
"public",
"function",
"display",
"(",
"$",
"replicator_id",
")",
"{",
"$",
"widget",
"=",
"$",
"this",
"->",
"getClonedWidget",
"(",
"$",
"replicator_id",
")",
";",
"// substitute the replicator_id into the content block's contents",
"$",
"widget",
"->",
"content",
"=",
"str_replace",
"(",
"'%s'",
",",
"$",
"replicator_id",
",",
"$",
"widget",
"->",
"content",
")",
";",
"$",
"widget",
"->",
"display",
"(",
")",
";",
"}"
] | Displays this remove input cell given a numeric row identifier
@param integer $replicator_id the numeric identifier of the input row
that is being displayed.
@see SwatInputCell::display() | [
"Displays",
"this",
"remove",
"input",
"cell",
"given",
"a",
"numeric",
"row",
"identifier"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRemoveInputCell.php#L78-L84 |
33,515 | brainworxx/kreXX | src/Errorhandler/AbstractError.php | AbstractError.translateErrorType | protected function translateErrorType($errorint)
{
if (isset($this->errorTranslation[$errorint]) === true) {
return $this->errorTranslation[$errorint];
}
// Fallback to 'unknown'.
return array('Unknown error', 'unknown');
} | php | protected function translateErrorType($errorint)
{
if (isset($this->errorTranslation[$errorint]) === true) {
return $this->errorTranslation[$errorint];
}
// Fallback to 'unknown'.
return array('Unknown error', 'unknown');
} | [
"protected",
"function",
"translateErrorType",
"(",
"$",
"errorint",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"errorTranslation",
"[",
"$",
"errorint",
"]",
")",
"===",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"errorTranslation",
"[",
"$",
"errorint",
"]",
";",
"}",
"// Fallback to 'unknown'.",
"return",
"array",
"(",
"'Unknown error'",
",",
"'unknown'",
")",
";",
"}"
] | Translates the error number into human readable text.
It also includes the corresponding config
setting, so we can decide if we want to output
anything.
@param int $errorint
The error number.
@return array
The translated type and the setting. | [
"Translates",
"the",
"error",
"number",
"into",
"human",
"readable",
"text",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Errorhandler/AbstractError.php#L133-L141 |
33,516 | silverorange/swat | Swat/SwatCheckAll.php | SwatCheckAll.display | public function display()
{
if (!$this->visible) {
return;
}
$div_tag = new SwatHtmlTag('div');
$div_tag->id = $this->id;
$div_tag->class = $this->getCSSClassString();
$div_tag->open();
$label_tag = new SwatHtmlTag('label');
$label_tag->for = $this->id . '_value';
$label_tag->open();
$old_id = $this->id;
$this->id .= '_value';
parent::display();
$this->id = $old_id;
$span_tag = new SwatHtmlTag('span');
$span_tag->class = 'swat-check-all-title';
$span_tag->setContent($this->title, $this->content_type);
$span_tag->display();
$label_tag->close();
if ($this->extended_count > $this->visible_count) {
$div_tag = new SwatHtmlTag('div');
$div_tag->id = $this->id . '_extended';
$div_tag->class = 'swat-hidden swat-extended-check-all';
$div_tag->open();
echo $this->getExtendedTitle();
$div_tag->close();
}
$div_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | php | public function display()
{
if (!$this->visible) {
return;
}
$div_tag = new SwatHtmlTag('div');
$div_tag->id = $this->id;
$div_tag->class = $this->getCSSClassString();
$div_tag->open();
$label_tag = new SwatHtmlTag('label');
$label_tag->for = $this->id . '_value';
$label_tag->open();
$old_id = $this->id;
$this->id .= '_value';
parent::display();
$this->id = $old_id;
$span_tag = new SwatHtmlTag('span');
$span_tag->class = 'swat-check-all-title';
$span_tag->setContent($this->title, $this->content_type);
$span_tag->display();
$label_tag->close();
if ($this->extended_count > $this->visible_count) {
$div_tag = new SwatHtmlTag('div');
$div_tag->id = $this->id . '_extended';
$div_tag->class = 'swat-hidden swat-extended-check-all';
$div_tag->open();
echo $this->getExtendedTitle();
$div_tag->close();
}
$div_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"$",
"div_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"div_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"div_tag",
"->",
"open",
"(",
")",
";",
"$",
"label_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'label'",
")",
";",
"$",
"label_tag",
"->",
"for",
"=",
"$",
"this",
"->",
"id",
".",
"'_value'",
";",
"$",
"label_tag",
"->",
"open",
"(",
")",
";",
"$",
"old_id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"this",
"->",
"id",
".=",
"'_value'",
";",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"this",
"->",
"id",
"=",
"$",
"old_id",
";",
"$",
"span_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'span'",
")",
";",
"$",
"span_tag",
"->",
"class",
"=",
"'swat-check-all-title'",
";",
"$",
"span_tag",
"->",
"setContent",
"(",
"$",
"this",
"->",
"title",
",",
"$",
"this",
"->",
"content_type",
")",
";",
"$",
"span_tag",
"->",
"display",
"(",
")",
";",
"$",
"label_tag",
"->",
"close",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"extended_count",
">",
"$",
"this",
"->",
"visible_count",
")",
"{",
"$",
"div_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_extended'",
";",
"$",
"div_tag",
"->",
"class",
"=",
"'swat-hidden swat-extended-check-all'",
";",
"$",
"div_tag",
"->",
"open",
"(",
")",
";",
"echo",
"$",
"this",
"->",
"getExtendedTitle",
"(",
")",
";",
"$",
"div_tag",
"->",
"close",
"(",
")",
";",
"}",
"$",
"div_tag",
"->",
"close",
"(",
")",
";",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavaScript",
"(",
")",
")",
";",
"}"
] | Displays this check-all widget | [
"Displays",
"this",
"check",
"-",
"all",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCheckAll.php#L100-L139 |
33,517 | zeroem/ZeroemCurlBundle | Curl/CurlOptions.php | CurlOptions.loadOptions | static private function loadOptions() {
if (static::$option_value_types) {
return;
}
$options = array(
'CURLOPT_AUTOREFERER' => "bool",
'CURLOPT_BINARYTRANSFER' => "bool",
'CURLOPT_COOKIESESSION' => "bool",
'CURLOPT_CERTINFO' => "bool",
'CURLOPT_CRLF' => "bool",
'CURLOPT_DNS_USE_GLOBAL_CACHE' => "bool",
'CURLOPT_FAILONERROR' => "bool",
'CURLOPT_FILETIME' => "bool",
'CURLOPT_FOLLOWLOCATION' => "bool",
'CURLOPT_FORBID_REUSE' => "bool",
'CURLOPT_FRESH_CONNECT' => "bool",
'CURLOPT_FTP_USE_EPRT' => "bool",
'CURLOPT_FTP_USE_EPSV' => "bool",
'CURLOPT_FTP_CREATE_MISSING_DIRS' => "bool",
'CURLOPT_FTPAPPEND' => "bool",
'CURLOPT_FTPASCII' => "bool",
'CURLOPT_FTPLISTONLY' => "bool",
'CURLOPT_HEADER' => "bool",
'CURLINFO_HEADER_OUT' => "bool",
'CURLOPT_HTTPGET' => "bool",
'CURLOPT_HTTPPROXYTUNNEL' => "bool",
'CURLOPT_MUTE' => "bool",
'CURLOPT_NETRC' => "bool",
'CURLOPT_NOBODY' => "bool",
'CURLOPT_NOPROGRESS' => "bool",
'CURLOPT_NOSIGNAL' => "bool",
'CURLOPT_POST' => "bool",
'CURLOPT_PUT' => "bool",
'CURLOPT_RETURNTRANSFER' => "bool",
'CURLOPT_SSL_VERIFYPEER' => "bool",
'CURLOPT_TRANSFERTEXT' => "bool",
'CURLOPT_UNRESTRICTED_AUTH' => "bool",
'CURLOPT_UPLOAD' => "bool",
'CURLOPT_VERBOSE' => "bool",
'CURLOPT_BUFFERSIZE' => "int",
'CURLOPT_CLOSEPOLICY' => "int",
'CURLOPT_CONNECTTIMEOUT' => "int",
'CURLOPT_CONNECTTIMEOUT_MS' => "int",
'CURLOPT_DNS_CACHE_TIMEOUT' => "int",
'CURLOPT_FTPSSLAUTH' => "int",
'CURLOPT_HTTP_VERSION' => "int",
'CURLOPT_HTTPAUTH' => "int",
'CURLOPT_INFILESIZE' => "int",
'CURLOPT_LOW_SPEED_LIMIT' => "int",
'CURLOPT_LOW_SPEED_TIME' => "int",
'CURLOPT_MAXCONNECTS' => "int",
'CURLOPT_MAXREDIRS' => "int",
'CURLOPT_PORT' => "int",
'CURLOPT_PROTOCOLS' => "int",
'CURLOPT_PROXYAUTH' => "int",
'CURLOPT_PROXYPORT' => "int",
'CURLOPT_PROXYTYPE' => "int",
'CURLOPT_REDIR_PROTOCOLS' => "int",
'CURLOPT_RESUME_FROM' => "int",
'CURLOPT_SSL_VERIFYHOST' => "int",
'CURLOPT_SSLVERSION' => "int",
'CURLOPT_TIMECONDITION' => "int",
'CURLOPT_TIMEOUT' => "int",
'CURLOPT_TIMEOUT_MS' => "int",
'CURLOPT_TIMEVALUE' => "int",
'CURLOPT_MAX_RECV_SPEED_LARGE' => "int",
'CURLOPT_MAX_SEND_SPEED_LARGE' => "int",
'CURLOPT_SSH_AUTH_TYPES' => "int",
'CURLOPT_CAINFO' => "string",
'CURLOPT_CAPATH' => "string",
'CURLOPT_COOKIE' => "string",
'CURLOPT_COOKIEFILE' => "string",
'CURLOPT_COOKIEJAR' => "string",
'CURLOPT_CUSTOMREQUEST' => "string",
'CURLOPT_EGDSOCKET' => "string",
'CURLOPT_ENCODING' => "string",
'CURLOPT_FTPPORT' => "string",
'CURLOPT_INTERFACE' => "string",
'CURLOPT_KEYPASSWD' => "string",
'CURLOPT_KRB4LEVEL' => "string",
'CURLOPT_POSTFIELDS' => array("string","array"),
'CURLOPT_PROXY' => "string",
'CURLOPT_PROXYUSERPWD' => "string",
'CURLOPT_RANDOM_FILE' => "string",
'CURLOPT_RANGE' => "string",
'CURLOPT_REFERER' => "string",
'CURLOPT_SSH_HOST_PUBLIC_KEY_MD5' => "string",
'CURLOPT_SSH_PUBLIC_KEYFILE' => "string",
'CURLOPT_SSH_PRIVATE_KEYFILE' => "string",
'CURLOPT_SSL_CIPHER_LIST' => "string",
'CURLOPT_SSLCERT' => "string",
'CURLOPT_SSLCERTPASSWD' => "string",
'CURLOPT_SSLCERTTYPE' => "string",
'CURLOPT_SSLENGINE' => "string",
'CURLOPT_SSLENGINE_DEFAULT' => "string",
'CURLOPT_SSLKEY' => "string",
'CURLOPT_SSLKEYPASSWD' => "string",
'CURLOPT_SSLKEYTYPE' => "string",
'CURLOPT_URL' => "string",
'CURLOPT_USERAGENT' => "string",
'CURLOPT_USERPWD' => "string",
'CURLOPT_HTTP200ALIASES' => "array",
'CURLOPT_HTTPHEADER' => "array",
'CURLOPT_POSTQUOTE' => "array",
'CURLOPT_QUOTE' => "array",
'CURLOPT_FILE' => "resource",
'CURLOPT_INFILE' => "resource",
'CURLOPT_STDERR' => "resource",
'CURLOPT_WRITEHEADER' => "resource",
'CURLOPT_HEADERFUNCTION' => "callable",
'CURLOPT_PASSWDFUNCTION' => "callable",
'CURLOPT_PROGRESSFUNCTION' => "callable",
'CURLOPT_READFUNCTION' => "callable",
'CURLOPT_WRITEFUNCTION' => "callable",
);
foreach ($options as $option => $type) {
if (defined($option)) {
static::$option_value_types[constant($option)] = $type;
}
}
} | php | static private function loadOptions() {
if (static::$option_value_types) {
return;
}
$options = array(
'CURLOPT_AUTOREFERER' => "bool",
'CURLOPT_BINARYTRANSFER' => "bool",
'CURLOPT_COOKIESESSION' => "bool",
'CURLOPT_CERTINFO' => "bool",
'CURLOPT_CRLF' => "bool",
'CURLOPT_DNS_USE_GLOBAL_CACHE' => "bool",
'CURLOPT_FAILONERROR' => "bool",
'CURLOPT_FILETIME' => "bool",
'CURLOPT_FOLLOWLOCATION' => "bool",
'CURLOPT_FORBID_REUSE' => "bool",
'CURLOPT_FRESH_CONNECT' => "bool",
'CURLOPT_FTP_USE_EPRT' => "bool",
'CURLOPT_FTP_USE_EPSV' => "bool",
'CURLOPT_FTP_CREATE_MISSING_DIRS' => "bool",
'CURLOPT_FTPAPPEND' => "bool",
'CURLOPT_FTPASCII' => "bool",
'CURLOPT_FTPLISTONLY' => "bool",
'CURLOPT_HEADER' => "bool",
'CURLINFO_HEADER_OUT' => "bool",
'CURLOPT_HTTPGET' => "bool",
'CURLOPT_HTTPPROXYTUNNEL' => "bool",
'CURLOPT_MUTE' => "bool",
'CURLOPT_NETRC' => "bool",
'CURLOPT_NOBODY' => "bool",
'CURLOPT_NOPROGRESS' => "bool",
'CURLOPT_NOSIGNAL' => "bool",
'CURLOPT_POST' => "bool",
'CURLOPT_PUT' => "bool",
'CURLOPT_RETURNTRANSFER' => "bool",
'CURLOPT_SSL_VERIFYPEER' => "bool",
'CURLOPT_TRANSFERTEXT' => "bool",
'CURLOPT_UNRESTRICTED_AUTH' => "bool",
'CURLOPT_UPLOAD' => "bool",
'CURLOPT_VERBOSE' => "bool",
'CURLOPT_BUFFERSIZE' => "int",
'CURLOPT_CLOSEPOLICY' => "int",
'CURLOPT_CONNECTTIMEOUT' => "int",
'CURLOPT_CONNECTTIMEOUT_MS' => "int",
'CURLOPT_DNS_CACHE_TIMEOUT' => "int",
'CURLOPT_FTPSSLAUTH' => "int",
'CURLOPT_HTTP_VERSION' => "int",
'CURLOPT_HTTPAUTH' => "int",
'CURLOPT_INFILESIZE' => "int",
'CURLOPT_LOW_SPEED_LIMIT' => "int",
'CURLOPT_LOW_SPEED_TIME' => "int",
'CURLOPT_MAXCONNECTS' => "int",
'CURLOPT_MAXREDIRS' => "int",
'CURLOPT_PORT' => "int",
'CURLOPT_PROTOCOLS' => "int",
'CURLOPT_PROXYAUTH' => "int",
'CURLOPT_PROXYPORT' => "int",
'CURLOPT_PROXYTYPE' => "int",
'CURLOPT_REDIR_PROTOCOLS' => "int",
'CURLOPT_RESUME_FROM' => "int",
'CURLOPT_SSL_VERIFYHOST' => "int",
'CURLOPT_SSLVERSION' => "int",
'CURLOPT_TIMECONDITION' => "int",
'CURLOPT_TIMEOUT' => "int",
'CURLOPT_TIMEOUT_MS' => "int",
'CURLOPT_TIMEVALUE' => "int",
'CURLOPT_MAX_RECV_SPEED_LARGE' => "int",
'CURLOPT_MAX_SEND_SPEED_LARGE' => "int",
'CURLOPT_SSH_AUTH_TYPES' => "int",
'CURLOPT_CAINFO' => "string",
'CURLOPT_CAPATH' => "string",
'CURLOPT_COOKIE' => "string",
'CURLOPT_COOKIEFILE' => "string",
'CURLOPT_COOKIEJAR' => "string",
'CURLOPT_CUSTOMREQUEST' => "string",
'CURLOPT_EGDSOCKET' => "string",
'CURLOPT_ENCODING' => "string",
'CURLOPT_FTPPORT' => "string",
'CURLOPT_INTERFACE' => "string",
'CURLOPT_KEYPASSWD' => "string",
'CURLOPT_KRB4LEVEL' => "string",
'CURLOPT_POSTFIELDS' => array("string","array"),
'CURLOPT_PROXY' => "string",
'CURLOPT_PROXYUSERPWD' => "string",
'CURLOPT_RANDOM_FILE' => "string",
'CURLOPT_RANGE' => "string",
'CURLOPT_REFERER' => "string",
'CURLOPT_SSH_HOST_PUBLIC_KEY_MD5' => "string",
'CURLOPT_SSH_PUBLIC_KEYFILE' => "string",
'CURLOPT_SSH_PRIVATE_KEYFILE' => "string",
'CURLOPT_SSL_CIPHER_LIST' => "string",
'CURLOPT_SSLCERT' => "string",
'CURLOPT_SSLCERTPASSWD' => "string",
'CURLOPT_SSLCERTTYPE' => "string",
'CURLOPT_SSLENGINE' => "string",
'CURLOPT_SSLENGINE_DEFAULT' => "string",
'CURLOPT_SSLKEY' => "string",
'CURLOPT_SSLKEYPASSWD' => "string",
'CURLOPT_SSLKEYTYPE' => "string",
'CURLOPT_URL' => "string",
'CURLOPT_USERAGENT' => "string",
'CURLOPT_USERPWD' => "string",
'CURLOPT_HTTP200ALIASES' => "array",
'CURLOPT_HTTPHEADER' => "array",
'CURLOPT_POSTQUOTE' => "array",
'CURLOPT_QUOTE' => "array",
'CURLOPT_FILE' => "resource",
'CURLOPT_INFILE' => "resource",
'CURLOPT_STDERR' => "resource",
'CURLOPT_WRITEHEADER' => "resource",
'CURLOPT_HEADERFUNCTION' => "callable",
'CURLOPT_PASSWDFUNCTION' => "callable",
'CURLOPT_PROGRESSFUNCTION' => "callable",
'CURLOPT_READFUNCTION' => "callable",
'CURLOPT_WRITEFUNCTION' => "callable",
);
foreach ($options as $option => $type) {
if (defined($option)) {
static::$option_value_types[constant($option)] = $type;
}
}
} | [
"static",
"private",
"function",
"loadOptions",
"(",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"option_value_types",
")",
"{",
"return",
";",
"}",
"$",
"options",
"=",
"array",
"(",
"'CURLOPT_AUTOREFERER'",
"=>",
"\"bool\"",
",",
"'CURLOPT_BINARYTRANSFER'",
"=>",
"\"bool\"",
",",
"'CURLOPT_COOKIESESSION'",
"=>",
"\"bool\"",
",",
"'CURLOPT_CERTINFO'",
"=>",
"\"bool\"",
",",
"'CURLOPT_CRLF'",
"=>",
"\"bool\"",
",",
"'CURLOPT_DNS_USE_GLOBAL_CACHE'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FAILONERROR'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FILETIME'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FOLLOWLOCATION'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FORBID_REUSE'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FRESH_CONNECT'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FTP_USE_EPRT'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FTP_USE_EPSV'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FTP_CREATE_MISSING_DIRS'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FTPAPPEND'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FTPASCII'",
"=>",
"\"bool\"",
",",
"'CURLOPT_FTPLISTONLY'",
"=>",
"\"bool\"",
",",
"'CURLOPT_HEADER'",
"=>",
"\"bool\"",
",",
"'CURLINFO_HEADER_OUT'",
"=>",
"\"bool\"",
",",
"'CURLOPT_HTTPGET'",
"=>",
"\"bool\"",
",",
"'CURLOPT_HTTPPROXYTUNNEL'",
"=>",
"\"bool\"",
",",
"'CURLOPT_MUTE'",
"=>",
"\"bool\"",
",",
"'CURLOPT_NETRC'",
"=>",
"\"bool\"",
",",
"'CURLOPT_NOBODY'",
"=>",
"\"bool\"",
",",
"'CURLOPT_NOPROGRESS'",
"=>",
"\"bool\"",
",",
"'CURLOPT_NOSIGNAL'",
"=>",
"\"bool\"",
",",
"'CURLOPT_POST'",
"=>",
"\"bool\"",
",",
"'CURLOPT_PUT'",
"=>",
"\"bool\"",
",",
"'CURLOPT_RETURNTRANSFER'",
"=>",
"\"bool\"",
",",
"'CURLOPT_SSL_VERIFYPEER'",
"=>",
"\"bool\"",
",",
"'CURLOPT_TRANSFERTEXT'",
"=>",
"\"bool\"",
",",
"'CURLOPT_UNRESTRICTED_AUTH'",
"=>",
"\"bool\"",
",",
"'CURLOPT_UPLOAD'",
"=>",
"\"bool\"",
",",
"'CURLOPT_VERBOSE'",
"=>",
"\"bool\"",
",",
"'CURLOPT_BUFFERSIZE'",
"=>",
"\"int\"",
",",
"'CURLOPT_CLOSEPOLICY'",
"=>",
"\"int\"",
",",
"'CURLOPT_CONNECTTIMEOUT'",
"=>",
"\"int\"",
",",
"'CURLOPT_CONNECTTIMEOUT_MS'",
"=>",
"\"int\"",
",",
"'CURLOPT_DNS_CACHE_TIMEOUT'",
"=>",
"\"int\"",
",",
"'CURLOPT_FTPSSLAUTH'",
"=>",
"\"int\"",
",",
"'CURLOPT_HTTP_VERSION'",
"=>",
"\"int\"",
",",
"'CURLOPT_HTTPAUTH'",
"=>",
"\"int\"",
",",
"'CURLOPT_INFILESIZE'",
"=>",
"\"int\"",
",",
"'CURLOPT_LOW_SPEED_LIMIT'",
"=>",
"\"int\"",
",",
"'CURLOPT_LOW_SPEED_TIME'",
"=>",
"\"int\"",
",",
"'CURLOPT_MAXCONNECTS'",
"=>",
"\"int\"",
",",
"'CURLOPT_MAXREDIRS'",
"=>",
"\"int\"",
",",
"'CURLOPT_PORT'",
"=>",
"\"int\"",
",",
"'CURLOPT_PROTOCOLS'",
"=>",
"\"int\"",
",",
"'CURLOPT_PROXYAUTH'",
"=>",
"\"int\"",
",",
"'CURLOPT_PROXYPORT'",
"=>",
"\"int\"",
",",
"'CURLOPT_PROXYTYPE'",
"=>",
"\"int\"",
",",
"'CURLOPT_REDIR_PROTOCOLS'",
"=>",
"\"int\"",
",",
"'CURLOPT_RESUME_FROM'",
"=>",
"\"int\"",
",",
"'CURLOPT_SSL_VERIFYHOST'",
"=>",
"\"int\"",
",",
"'CURLOPT_SSLVERSION'",
"=>",
"\"int\"",
",",
"'CURLOPT_TIMECONDITION'",
"=>",
"\"int\"",
",",
"'CURLOPT_TIMEOUT'",
"=>",
"\"int\"",
",",
"'CURLOPT_TIMEOUT_MS'",
"=>",
"\"int\"",
",",
"'CURLOPT_TIMEVALUE'",
"=>",
"\"int\"",
",",
"'CURLOPT_MAX_RECV_SPEED_LARGE'",
"=>",
"\"int\"",
",",
"'CURLOPT_MAX_SEND_SPEED_LARGE'",
"=>",
"\"int\"",
",",
"'CURLOPT_SSH_AUTH_TYPES'",
"=>",
"\"int\"",
",",
"'CURLOPT_CAINFO'",
"=>",
"\"string\"",
",",
"'CURLOPT_CAPATH'",
"=>",
"\"string\"",
",",
"'CURLOPT_COOKIE'",
"=>",
"\"string\"",
",",
"'CURLOPT_COOKIEFILE'",
"=>",
"\"string\"",
",",
"'CURLOPT_COOKIEJAR'",
"=>",
"\"string\"",
",",
"'CURLOPT_CUSTOMREQUEST'",
"=>",
"\"string\"",
",",
"'CURLOPT_EGDSOCKET'",
"=>",
"\"string\"",
",",
"'CURLOPT_ENCODING'",
"=>",
"\"string\"",
",",
"'CURLOPT_FTPPORT'",
"=>",
"\"string\"",
",",
"'CURLOPT_INTERFACE'",
"=>",
"\"string\"",
",",
"'CURLOPT_KEYPASSWD'",
"=>",
"\"string\"",
",",
"'CURLOPT_KRB4LEVEL'",
"=>",
"\"string\"",
",",
"'CURLOPT_POSTFIELDS'",
"=>",
"array",
"(",
"\"string\"",
",",
"\"array\"",
")",
",",
"'CURLOPT_PROXY'",
"=>",
"\"string\"",
",",
"'CURLOPT_PROXYUSERPWD'",
"=>",
"\"string\"",
",",
"'CURLOPT_RANDOM_FILE'",
"=>",
"\"string\"",
",",
"'CURLOPT_RANGE'",
"=>",
"\"string\"",
",",
"'CURLOPT_REFERER'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSH_HOST_PUBLIC_KEY_MD5'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSH_PUBLIC_KEYFILE'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSH_PRIVATE_KEYFILE'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSL_CIPHER_LIST'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSLCERT'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSLCERTPASSWD'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSLCERTTYPE'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSLENGINE'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSLENGINE_DEFAULT'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSLKEY'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSLKEYPASSWD'",
"=>",
"\"string\"",
",",
"'CURLOPT_SSLKEYTYPE'",
"=>",
"\"string\"",
",",
"'CURLOPT_URL'",
"=>",
"\"string\"",
",",
"'CURLOPT_USERAGENT'",
"=>",
"\"string\"",
",",
"'CURLOPT_USERPWD'",
"=>",
"\"string\"",
",",
"'CURLOPT_HTTP200ALIASES'",
"=>",
"\"array\"",
",",
"'CURLOPT_HTTPHEADER'",
"=>",
"\"array\"",
",",
"'CURLOPT_POSTQUOTE'",
"=>",
"\"array\"",
",",
"'CURLOPT_QUOTE'",
"=>",
"\"array\"",
",",
"'CURLOPT_FILE'",
"=>",
"\"resource\"",
",",
"'CURLOPT_INFILE'",
"=>",
"\"resource\"",
",",
"'CURLOPT_STDERR'",
"=>",
"\"resource\"",
",",
"'CURLOPT_WRITEHEADER'",
"=>",
"\"resource\"",
",",
"'CURLOPT_HEADERFUNCTION'",
"=>",
"\"callable\"",
",",
"'CURLOPT_PASSWDFUNCTION'",
"=>",
"\"callable\"",
",",
"'CURLOPT_PROGRESSFUNCTION'",
"=>",
"\"callable\"",
",",
"'CURLOPT_READFUNCTION'",
"=>",
"\"callable\"",
",",
"'CURLOPT_WRITEFUNCTION'",
"=>",
"\"callable\"",
",",
")",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"option",
"=>",
"$",
"type",
")",
"{",
"if",
"(",
"defined",
"(",
"$",
"option",
")",
")",
"{",
"static",
"::",
"$",
"option_value_types",
"[",
"constant",
"(",
"$",
"option",
")",
"]",
"=",
"$",
"type",
";",
"}",
"}",
"}"
] | Checks which cURL constants is defined and loads them as valid options | [
"Checks",
"which",
"cURL",
"constants",
"is",
"defined",
"and",
"loads",
"them",
"as",
"valid",
"options"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/CurlOptions.php#L23-L146 |
33,518 | zeroem/ZeroemCurlBundle | Curl/CurlOptions.php | CurlOptions.checkOptionValue | static public function checkOptionValue($option, $value, $throw = true) {
if (!static::$option_value_types) {
static::loadOptions();
}
if(static::isValidOption($option)) {
$result = static::checkType($value, static::$option_value_types[$option]);
if(!$result && $throw) {
throw new \InvalidArgumentException("Invalid value for the given cURL option");
}
return $result;
} else {
throw new \InvalidArgumentException("Not a valid cURL option");
}
} | php | static public function checkOptionValue($option, $value, $throw = true) {
if (!static::$option_value_types) {
static::loadOptions();
}
if(static::isValidOption($option)) {
$result = static::checkType($value, static::$option_value_types[$option]);
if(!$result && $throw) {
throw new \InvalidArgumentException("Invalid value for the given cURL option");
}
return $result;
} else {
throw new \InvalidArgumentException("Not a valid cURL option");
}
} | [
"static",
"public",
"function",
"checkOptionValue",
"(",
"$",
"option",
",",
"$",
"value",
",",
"$",
"throw",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"$",
"option_value_types",
")",
"{",
"static",
"::",
"loadOptions",
"(",
")",
";",
"}",
"if",
"(",
"static",
"::",
"isValidOption",
"(",
"$",
"option",
")",
")",
"{",
"$",
"result",
"=",
"static",
"::",
"checkType",
"(",
"$",
"value",
",",
"static",
"::",
"$",
"option_value_types",
"[",
"$",
"option",
"]",
")",
";",
"if",
"(",
"!",
"$",
"result",
"&&",
"$",
"throw",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Invalid value for the given cURL option\"",
")",
";",
"}",
"return",
"$",
"result",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Not a valid cURL option\"",
")",
";",
"}",
"}"
] | Check whether or not the value is a valid type for the given option
@param int $option An integer flag
@param mixed $value the value to be set to the integer flag
@return boolean Whether or not the value is of the correct type
@throws \InvalidArgumentException if the $option _is_not_ a valid cURL option | [
"Check",
"whether",
"or",
"not",
"the",
"value",
"is",
"a",
"valid",
"type",
"for",
"the",
"given",
"option"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/CurlOptions.php#L172-L189 |
33,519 | silverorange/swat | Swat/SwatAbstractOverlay.php | SwatAbstractOverlay.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$container_div_tag = new SwatHtmlTag('div');
$container_div_tag->id = $this->id;
$container_div_tag->class = $this->getCSSClassString();
$container_div_tag->open();
$input_tag = new SwatHtmlTag('input');
$input_tag->type = 'hidden';
$input_tag->id = $this->id . '_value';
$input_tag->name = $this->id;
$input_tag->value = $this->value;
$input_tag->accesskey = $this->access_key;
$input_tag->display();
$container_div_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$container_div_tag = new SwatHtmlTag('div');
$container_div_tag->id = $this->id;
$container_div_tag->class = $this->getCSSClassString();
$container_div_tag->open();
$input_tag = new SwatHtmlTag('input');
$input_tag->type = 'hidden';
$input_tag->id = $this->id . '_value';
$input_tag->name = $this->id;
$input_tag->value = $this->value;
$input_tag->accesskey = $this->access_key;
$input_tag->display();
$container_div_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"container_div_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"container_div_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"container_div_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"container_div_tag",
"->",
"open",
"(",
")",
";",
"$",
"input_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'input'",
")",
";",
"$",
"input_tag",
"->",
"type",
"=",
"'hidden'",
";",
"$",
"input_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_value'",
";",
"$",
"input_tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"input_tag",
"->",
"value",
"=",
"$",
"this",
"->",
"value",
";",
"$",
"input_tag",
"->",
"accesskey",
"=",
"$",
"this",
"->",
"access_key",
";",
"$",
"input_tag",
"->",
"display",
"(",
")",
";",
"$",
"container_div_tag",
"->",
"close",
"(",
")",
";",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavaScript",
"(",
")",
")",
";",
"}"
] | Displays this overlay widget | [
"Displays",
"this",
"overlay",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatAbstractOverlay.php#L73-L98 |
33,520 | rollun-com/rollun-datastore | src/Uploader/src/Iterator/DataStorePack.php | DataStorePack.getQuery | protected function getQuery()
{
$query = new Query();
if ($this->valid()) {
$query->setQuery(new GtNode($this->dataStore->getIdentifier(), $this->key()));
}
$query->setLimit(new LimitNode($this->limit));
$query->setSort(new SortNode([$this->dataStore->getIdentifier() => SortNode::SORT_ASC]));
return $query;
} | php | protected function getQuery()
{
$query = new Query();
if ($this->valid()) {
$query->setQuery(new GtNode($this->dataStore->getIdentifier(), $this->key()));
}
$query->setLimit(new LimitNode($this->limit));
$query->setSort(new SortNode([$this->dataStore->getIdentifier() => SortNode::SORT_ASC]));
return $query;
} | [
"protected",
"function",
"getQuery",
"(",
")",
"{",
"$",
"query",
"=",
"new",
"Query",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"valid",
"(",
")",
")",
"{",
"$",
"query",
"->",
"setQuery",
"(",
"new",
"GtNode",
"(",
"$",
"this",
"->",
"dataStore",
"->",
"getIdentifier",
"(",
")",
",",
"$",
"this",
"->",
"key",
"(",
")",
")",
")",
";",
"}",
"$",
"query",
"->",
"setLimit",
"(",
"new",
"LimitNode",
"(",
"$",
"this",
"->",
"limit",
")",
")",
";",
"$",
"query",
"->",
"setSort",
"(",
"new",
"SortNode",
"(",
"[",
"$",
"this",
"->",
"dataStore",
"->",
"getIdentifier",
"(",
")",
"=>",
"SortNode",
"::",
"SORT_ASC",
"]",
")",
")",
";",
"return",
"$",
"query",
";",
"}"
] | Return query with limit and offset | [
"Return",
"query",
"with",
"limit",
"and",
"offset"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/Uploader/src/Iterator/DataStorePack.php#L64-L76 |
33,521 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/HttpClient.php | HttpClient.initHttpClient | protected function initHttpClient(string $method, string $uri, $ifMatch = false)
{
$httpClient = clone $this->client;
$httpClient->setUri($uri);
$httpClient->setOptions($this->options);
$headers['Content-Type'] = 'application/json';
$headers['Accept'] = 'application/json';
if ($ifMatch) {
$headers['If-Match'] = '*';
}
$httpClient->setHeaders($headers);
if (isset($this->login) && isset($this->password)) {
$httpClient->setAuth($this->login, $this->password);
}
$httpClient->setMethod($method);
return $httpClient;
} | php | protected function initHttpClient(string $method, string $uri, $ifMatch = false)
{
$httpClient = clone $this->client;
$httpClient->setUri($uri);
$httpClient->setOptions($this->options);
$headers['Content-Type'] = 'application/json';
$headers['Accept'] = 'application/json';
if ($ifMatch) {
$headers['If-Match'] = '*';
}
$httpClient->setHeaders($headers);
if (isset($this->login) && isset($this->password)) {
$httpClient->setAuth($this->login, $this->password);
}
$httpClient->setMethod($method);
return $httpClient;
} | [
"protected",
"function",
"initHttpClient",
"(",
"string",
"$",
"method",
",",
"string",
"$",
"uri",
",",
"$",
"ifMatch",
"=",
"false",
")",
"{",
"$",
"httpClient",
"=",
"clone",
"$",
"this",
"->",
"client",
";",
"$",
"httpClient",
"->",
"setUri",
"(",
"$",
"uri",
")",
";",
"$",
"httpClient",
"->",
"setOptions",
"(",
"$",
"this",
"->",
"options",
")",
";",
"$",
"headers",
"[",
"'Content-Type'",
"]",
"=",
"'application/json'",
";",
"$",
"headers",
"[",
"'Accept'",
"]",
"=",
"'application/json'",
";",
"if",
"(",
"$",
"ifMatch",
")",
"{",
"$",
"headers",
"[",
"'If-Match'",
"]",
"=",
"'*'",
";",
"}",
"$",
"httpClient",
"->",
"setHeaders",
"(",
"$",
"headers",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"login",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"password",
")",
")",
"{",
"$",
"httpClient",
"->",
"setAuth",
"(",
"$",
"this",
"->",
"login",
",",
"$",
"this",
"->",
"password",
")",
";",
"}",
"$",
"httpClient",
"->",
"setMethod",
"(",
"$",
"method",
")",
";",
"return",
"$",
"httpClient",
";",
"}"
] | Create http client
@param string $method ('GET', 'HEAD', 'POST', 'PUT', 'DELETE')
@param string $uri
@param bool $ifMatch
@return Client | [
"Create",
"http",
"client"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/HttpClient.php#L110-L132 |
33,522 | silverorange/swat | Swat/SwatReplicableNoteBookPage.php | SwatReplicableNoteBookPage.init | public function init()
{
$children = array();
foreach ($this->children as $child_widget) {
$children[] = $this->remove($child_widget);
}
$page = new SwatNoteBookPage();
$page->id = $page->getUniqueId();
$page_prototype_id = $page->id;
foreach ($children as $child_widget) {
$page->add($child_widget);
}
$this->add($page);
parent::init();
foreach ($this->replicators as $id => $title) {
$page = $this->getWidget($page_prototype_id, $id);
$page->title = $title;
}
$note_book = new SwatNoteBook($this->id . '_notebook');
foreach ($this->children as $child_widget) {
$page = $this->remove($child_widget);
$note_book->addPage($page);
}
$this->add($note_book);
} | php | public function init()
{
$children = array();
foreach ($this->children as $child_widget) {
$children[] = $this->remove($child_widget);
}
$page = new SwatNoteBookPage();
$page->id = $page->getUniqueId();
$page_prototype_id = $page->id;
foreach ($children as $child_widget) {
$page->add($child_widget);
}
$this->add($page);
parent::init();
foreach ($this->replicators as $id => $title) {
$page = $this->getWidget($page_prototype_id, $id);
$page->title = $title;
}
$note_book = new SwatNoteBook($this->id . '_notebook');
foreach ($this->children as $child_widget) {
$page = $this->remove($child_widget);
$note_book->addPage($page);
}
$this->add($note_book);
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"children",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child_widget",
")",
"{",
"$",
"children",
"[",
"]",
"=",
"$",
"this",
"->",
"remove",
"(",
"$",
"child_widget",
")",
";",
"}",
"$",
"page",
"=",
"new",
"SwatNoteBookPage",
"(",
")",
";",
"$",
"page",
"->",
"id",
"=",
"$",
"page",
"->",
"getUniqueId",
"(",
")",
";",
"$",
"page_prototype_id",
"=",
"$",
"page",
"->",
"id",
";",
"foreach",
"(",
"$",
"children",
"as",
"$",
"child_widget",
")",
"{",
"$",
"page",
"->",
"add",
"(",
"$",
"child_widget",
")",
";",
"}",
"$",
"this",
"->",
"add",
"(",
"$",
"page",
")",
";",
"parent",
"::",
"init",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"replicators",
"as",
"$",
"id",
"=>",
"$",
"title",
")",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"getWidget",
"(",
"$",
"page_prototype_id",
",",
"$",
"id",
")",
";",
"$",
"page",
"->",
"title",
"=",
"$",
"title",
";",
"}",
"$",
"note_book",
"=",
"new",
"SwatNoteBook",
"(",
"$",
"this",
"->",
"id",
".",
"'_notebook'",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child_widget",
")",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"remove",
"(",
"$",
"child_widget",
")",
";",
"$",
"note_book",
"->",
"addPage",
"(",
"$",
"page",
")",
";",
"}",
"$",
"this",
"->",
"add",
"(",
"$",
"note_book",
")",
";",
"}"
] | Initilizes this replicable notebook page | [
"Initilizes",
"this",
"replicable",
"notebook",
"page"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatReplicableNoteBookPage.php#L24-L56 |
33,523 | silverorange/swat | Swat/SwatGroupedFlydown.php | SwatGroupedFlydown.display | public function display()
{
if (!$this->visible) {
return;
}
SwatWidget::display();
// tree is copied for display so we can add a blank node if show_blank
// is true
$display_tree = $this->getDisplayTree();
$count = count($display_tree) - 1;
// only show a select if there is more than one option
if ($count > 1) {
$select_tag = new SwatHtmlTag('select');
$select_tag->name = $this->id;
$select_tag->id = $this->id;
$select_tag->class = $this->getCSSClassString();
if (!$this->isSensitive()) {
$select_tag->disabled = 'disabled';
}
$select_tag->open();
foreach ($display_tree->getChildren() as $child) {
$this->displayNode($child, 1);
}
$select_tag->close();
} elseif ($count === 1) {
// get first and only element
$children = $display_tree->getChildren();
$option = reset($children)->getOption();
$this->displaySingle($option);
}
} | php | public function display()
{
if (!$this->visible) {
return;
}
SwatWidget::display();
// tree is copied for display so we can add a blank node if show_blank
// is true
$display_tree = $this->getDisplayTree();
$count = count($display_tree) - 1;
// only show a select if there is more than one option
if ($count > 1) {
$select_tag = new SwatHtmlTag('select');
$select_tag->name = $this->id;
$select_tag->id = $this->id;
$select_tag->class = $this->getCSSClassString();
if (!$this->isSensitive()) {
$select_tag->disabled = 'disabled';
}
$select_tag->open();
foreach ($display_tree->getChildren() as $child) {
$this->displayNode($child, 1);
}
$select_tag->close();
} elseif ($count === 1) {
// get first and only element
$children = $display_tree->getChildren();
$option = reset($children)->getOption();
$this->displaySingle($option);
}
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"SwatWidget",
"::",
"display",
"(",
")",
";",
"// tree is copied for display so we can add a blank node if show_blank",
"// is true",
"$",
"display_tree",
"=",
"$",
"this",
"->",
"getDisplayTree",
"(",
")",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"display_tree",
")",
"-",
"1",
";",
"// only show a select if there is more than one option",
"if",
"(",
"$",
"count",
">",
"1",
")",
"{",
"$",
"select_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'select'",
")",
";",
"$",
"select_tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"select_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"select_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isSensitive",
"(",
")",
")",
"{",
"$",
"select_tag",
"->",
"disabled",
"=",
"'disabled'",
";",
"}",
"$",
"select_tag",
"->",
"open",
"(",
")",
";",
"foreach",
"(",
"$",
"display_tree",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child",
")",
"{",
"$",
"this",
"->",
"displayNode",
"(",
"$",
"child",
",",
"1",
")",
";",
"}",
"$",
"select_tag",
"->",
"close",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"count",
"===",
"1",
")",
"{",
"// get first and only element",
"$",
"children",
"=",
"$",
"display_tree",
"->",
"getChildren",
"(",
")",
";",
"$",
"option",
"=",
"reset",
"(",
"$",
"children",
")",
"->",
"getOption",
"(",
")",
";",
"$",
"this",
"->",
"displaySingle",
"(",
"$",
"option",
")",
";",
"}",
"}"
] | Displays this grouped flydown
Displays this flydown as a XHTML select. Level 1 tree nodes are
displayed as optgroups if their value is null, they have children and
they are not dividers. | [
"Displays",
"this",
"grouped",
"flydown"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatGroupedFlydown.php#L43-L80 |
33,524 | silverorange/swat | Swat/SwatGroupedFlydown.php | SwatGroupedFlydown.checkTree | protected function checkTree(SwatTreeFlydownNode $tree, $level = 0)
{
if ($level > 2) {
throw new SwatException(
'SwatGroupedFlydown tree must not be ' .
'more than 3 levels including the root node.'
);
}
foreach ($tree->getChildren() as $child) {
$this->checkTree($child, $level + 1);
}
} | php | protected function checkTree(SwatTreeFlydownNode $tree, $level = 0)
{
if ($level > 2) {
throw new SwatException(
'SwatGroupedFlydown tree must not be ' .
'more than 3 levels including the root node.'
);
}
foreach ($tree->getChildren() as $child) {
$this->checkTree($child, $level + 1);
}
} | [
"protected",
"function",
"checkTree",
"(",
"SwatTreeFlydownNode",
"$",
"tree",
",",
"$",
"level",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"level",
">",
"2",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"'SwatGroupedFlydown tree must not be '",
".",
"'more than 3 levels including the root node.'",
")",
";",
"}",
"foreach",
"(",
"$",
"tree",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child",
")",
"{",
"$",
"this",
"->",
"checkTree",
"(",
"$",
"child",
",",
"$",
"level",
"+",
"1",
")",
";",
"}",
"}"
] | Checks a tree to ensure it is valid for a grouped flydown
@param SwatTreeFlydownNode the tree to check.
@throws SwatException if the tree is not valid for a grouped flydown. | [
"Checks",
"a",
"tree",
"to",
"ensure",
"it",
"is",
"valid",
"for",
"a",
"grouped",
"flydown"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatGroupedFlydown.php#L92-L104 |
33,525 | silverorange/swat | Swat/SwatGroupedFlydown.php | SwatGroupedFlydown.displayNode | protected function displayNode(
SwatTreeFlydownNode $node,
$level = 0,
$selected = false
) {
$children = $node->getChildren();
$flydown_option = $node->getOption();
if (
$level == 1 &&
count($children) > 0 &&
end($flydown_option->value) === null &&
!($flydown_option instanceof SwatFlydownDivider)
) {
$optgroup_tag = new SwatHtmlTag('optgroup');
$optgroup_tag->label = $flydown_option->title;
$optgroup_tag->open();
foreach ($node->getChildren() as $child_node) {
$this->displayNode($child_node, $level + 1, $selected);
}
$optgroup_tag->close();
} else {
$option_tag = new SwatHtmlTag('option');
if ($this->serialize_values) {
$salt = $this->getForm()->getSalt();
$option_tag->value = SwatString::signedSerialize(
$flydown_option->value,
$salt
);
} else {
$option_tag->value = (string) $flydown_option->values;
}
if ($flydown_option instanceof SwatFlydownDivider) {
$option_tag->disabled = 'disabled';
$option_tag->class = 'swat-flydown-option-divider';
} else {
$option_tag->removeAttribute('disabled');
$option_tag->removeAttribute('class');
}
if (
$this->path === $flydown_option->value &&
$selected === false &&
!($flydown_option instanceof SwatFlydownDivider)
) {
$option_tag->selected = 'selected';
$selected = true;
} else {
$option_tag->removeAttribute('selected');
}
$option_tag->setContent($flydown_option->title);
$option_tag->display();
foreach ($children as $child_node) {
$this->displayNode($child_node, $level + 1, $selected);
}
}
} | php | protected function displayNode(
SwatTreeFlydownNode $node,
$level = 0,
$selected = false
) {
$children = $node->getChildren();
$flydown_option = $node->getOption();
if (
$level == 1 &&
count($children) > 0 &&
end($flydown_option->value) === null &&
!($flydown_option instanceof SwatFlydownDivider)
) {
$optgroup_tag = new SwatHtmlTag('optgroup');
$optgroup_tag->label = $flydown_option->title;
$optgroup_tag->open();
foreach ($node->getChildren() as $child_node) {
$this->displayNode($child_node, $level + 1, $selected);
}
$optgroup_tag->close();
} else {
$option_tag = new SwatHtmlTag('option');
if ($this->serialize_values) {
$salt = $this->getForm()->getSalt();
$option_tag->value = SwatString::signedSerialize(
$flydown_option->value,
$salt
);
} else {
$option_tag->value = (string) $flydown_option->values;
}
if ($flydown_option instanceof SwatFlydownDivider) {
$option_tag->disabled = 'disabled';
$option_tag->class = 'swat-flydown-option-divider';
} else {
$option_tag->removeAttribute('disabled');
$option_tag->removeAttribute('class');
}
if (
$this->path === $flydown_option->value &&
$selected === false &&
!($flydown_option instanceof SwatFlydownDivider)
) {
$option_tag->selected = 'selected';
$selected = true;
} else {
$option_tag->removeAttribute('selected');
}
$option_tag->setContent($flydown_option->title);
$option_tag->display();
foreach ($children as $child_node) {
$this->displayNode($child_node, $level + 1, $selected);
}
}
} | [
"protected",
"function",
"displayNode",
"(",
"SwatTreeFlydownNode",
"$",
"node",
",",
"$",
"level",
"=",
"0",
",",
"$",
"selected",
"=",
"false",
")",
"{",
"$",
"children",
"=",
"$",
"node",
"->",
"getChildren",
"(",
")",
";",
"$",
"flydown_option",
"=",
"$",
"node",
"->",
"getOption",
"(",
")",
";",
"if",
"(",
"$",
"level",
"==",
"1",
"&&",
"count",
"(",
"$",
"children",
")",
">",
"0",
"&&",
"end",
"(",
"$",
"flydown_option",
"->",
"value",
")",
"===",
"null",
"&&",
"!",
"(",
"$",
"flydown_option",
"instanceof",
"SwatFlydownDivider",
")",
")",
"{",
"$",
"optgroup_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'optgroup'",
")",
";",
"$",
"optgroup_tag",
"->",
"label",
"=",
"$",
"flydown_option",
"->",
"title",
";",
"$",
"optgroup_tag",
"->",
"open",
"(",
")",
";",
"foreach",
"(",
"$",
"node",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child_node",
")",
"{",
"$",
"this",
"->",
"displayNode",
"(",
"$",
"child_node",
",",
"$",
"level",
"+",
"1",
",",
"$",
"selected",
")",
";",
"}",
"$",
"optgroup_tag",
"->",
"close",
"(",
")",
";",
"}",
"else",
"{",
"$",
"option_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'option'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"serialize_values",
")",
"{",
"$",
"salt",
"=",
"$",
"this",
"->",
"getForm",
"(",
")",
"->",
"getSalt",
"(",
")",
";",
"$",
"option_tag",
"->",
"value",
"=",
"SwatString",
"::",
"signedSerialize",
"(",
"$",
"flydown_option",
"->",
"value",
",",
"$",
"salt",
")",
";",
"}",
"else",
"{",
"$",
"option_tag",
"->",
"value",
"=",
"(",
"string",
")",
"$",
"flydown_option",
"->",
"values",
";",
"}",
"if",
"(",
"$",
"flydown_option",
"instanceof",
"SwatFlydownDivider",
")",
"{",
"$",
"option_tag",
"->",
"disabled",
"=",
"'disabled'",
";",
"$",
"option_tag",
"->",
"class",
"=",
"'swat-flydown-option-divider'",
";",
"}",
"else",
"{",
"$",
"option_tag",
"->",
"removeAttribute",
"(",
"'disabled'",
")",
";",
"$",
"option_tag",
"->",
"removeAttribute",
"(",
"'class'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"path",
"===",
"$",
"flydown_option",
"->",
"value",
"&&",
"$",
"selected",
"===",
"false",
"&&",
"!",
"(",
"$",
"flydown_option",
"instanceof",
"SwatFlydownDivider",
")",
")",
"{",
"$",
"option_tag",
"->",
"selected",
"=",
"'selected'",
";",
"$",
"selected",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"option_tag",
"->",
"removeAttribute",
"(",
"'selected'",
")",
";",
"}",
"$",
"option_tag",
"->",
"setContent",
"(",
"$",
"flydown_option",
"->",
"title",
")",
";",
"$",
"option_tag",
"->",
"display",
"(",
")",
";",
"foreach",
"(",
"$",
"children",
"as",
"$",
"child_node",
")",
"{",
"$",
"this",
"->",
"displayNode",
"(",
"$",
"child_node",
",",
"$",
"level",
"+",
"1",
",",
"$",
"selected",
")",
";",
"}",
"}",
"}"
] | Displays a grouped tree flydown node and its child nodes
Level 1 tree nodes are displayed as optgroups if their value is null,
they have children and they are not dividers.
@param SwatTreeFlydownNode $node the node to display.
@param integer $level the current level of the tree node.
@param array $path an array of values representing the tree path to
this node.
@param boolean $selected whether or not an element has been selected
yet. | [
"Displays",
"a",
"grouped",
"tree",
"flydown",
"node",
"and",
"its",
"child",
"nodes"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatGroupedFlydown.php#L122-L183 |
33,526 | silverorange/swat | Swat/SwatGroupedFlydown.php | SwatGroupedFlydown.buildDisplayTree | protected function buildDisplayTree(
SwatTreeFlydownNode $tree,
SwatTreeFlydownNode $parent,
$path = array()
) {
$flydown_option = $tree->getOption();
$path[] = $flydown_option->value;
$new_node = new SwatTreeFlydownNode($path, $flydown_option->title);
$parent->addChild($new_node);
foreach ($tree->getChildren() as $child) {
$this->buildDisplayTree($child, $new_node, $path);
}
} | php | protected function buildDisplayTree(
SwatTreeFlydownNode $tree,
SwatTreeFlydownNode $parent,
$path = array()
) {
$flydown_option = $tree->getOption();
$path[] = $flydown_option->value;
$new_node = new SwatTreeFlydownNode($path, $flydown_option->title);
$parent->addChild($new_node);
foreach ($tree->getChildren() as $child) {
$this->buildDisplayTree($child, $new_node, $path);
}
} | [
"protected",
"function",
"buildDisplayTree",
"(",
"SwatTreeFlydownNode",
"$",
"tree",
",",
"SwatTreeFlydownNode",
"$",
"parent",
",",
"$",
"path",
"=",
"array",
"(",
")",
")",
"{",
"$",
"flydown_option",
"=",
"$",
"tree",
"->",
"getOption",
"(",
")",
";",
"$",
"path",
"[",
"]",
"=",
"$",
"flydown_option",
"->",
"value",
";",
"$",
"new_node",
"=",
"new",
"SwatTreeFlydownNode",
"(",
"$",
"path",
",",
"$",
"flydown_option",
"->",
"title",
")",
";",
"$",
"parent",
"->",
"addChild",
"(",
"$",
"new_node",
")",
";",
"foreach",
"(",
"$",
"tree",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child",
")",
"{",
"$",
"this",
"->",
"buildDisplayTree",
"(",
"$",
"child",
",",
"$",
"new_node",
",",
"$",
"path",
")",
";",
"}",
"}"
] | Builds this grouped flydown's display tree by copying nodes from this
grouped flydown's tree
@param SwatTreeFlydownNode $tree the source tree node to build from.
@param SwatTreeFlydownNode $parent the destination parent node to add
display tree nodes to.
@param array $path the current path of the display tree. | [
"Builds",
"this",
"grouped",
"flydown",
"s",
"display",
"tree",
"by",
"copying",
"nodes",
"from",
"this",
"grouped",
"flydown",
"s",
"tree"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatGroupedFlydown.php#L197-L210 |
33,527 | silverorange/swat | Swat/SwatGroupedFlydown.php | SwatGroupedFlydown.getDisplayTree | protected function getDisplayTree()
{
$display_tree = new SwatTreeFlydownNode(null, 'root');
if ($this->show_blank) {
$display_tree->addChild(
new SwatTreeFlydownNode(null, $this->blank_title)
);
}
foreach ($this->tree->getChildren() as $child) {
$this->buildDisplayTree($child, $display_tree);
}
return $display_tree;
} | php | protected function getDisplayTree()
{
$display_tree = new SwatTreeFlydownNode(null, 'root');
if ($this->show_blank) {
$display_tree->addChild(
new SwatTreeFlydownNode(null, $this->blank_title)
);
}
foreach ($this->tree->getChildren() as $child) {
$this->buildDisplayTree($child, $display_tree);
}
return $display_tree;
} | [
"protected",
"function",
"getDisplayTree",
"(",
")",
"{",
"$",
"display_tree",
"=",
"new",
"SwatTreeFlydownNode",
"(",
"null",
",",
"'root'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"show_blank",
")",
"{",
"$",
"display_tree",
"->",
"addChild",
"(",
"new",
"SwatTreeFlydownNode",
"(",
"null",
",",
"$",
"this",
"->",
"blank_title",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"tree",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child",
")",
"{",
"$",
"this",
"->",
"buildDisplayTree",
"(",
"$",
"child",
",",
"$",
"display_tree",
")",
";",
"}",
"return",
"$",
"display_tree",
";",
"}"
] | Gets the display tree of this grouped flydown
The display tree is copied from this grouped flydown's tree. If
{@link SwatGroupedFlydown::$show_blank} is true, a blank node is
inserted as the first child of the root node of the display tree.
The value of a display tree node is set to an array representing the
path to the node in the display tree.
@see setTree() | [
"Gets",
"the",
"display",
"tree",
"of",
"this",
"grouped",
"flydown"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatGroupedFlydown.php#L227-L241 |
33,528 | silverorange/swat | Swat/SwatCellRendererContainer.php | SwatCellRendererContainer.addMappingToRenderer | public function addMappingToRenderer(
$renderer,
$data_field,
$property,
$object = null
) {
if ($object !== null) {
$property = $renderer->getPropertyNameToMap($object, $property);
}
$mapping = new SwatCellRendererMapping($property, $data_field);
$this->renderers->addMappingToRenderer($renderer, $mapping);
if ($object !== null) {
$object->$property = $mapping;
}
return $mapping;
} | php | public function addMappingToRenderer(
$renderer,
$data_field,
$property,
$object = null
) {
if ($object !== null) {
$property = $renderer->getPropertyNameToMap($object, $property);
}
$mapping = new SwatCellRendererMapping($property, $data_field);
$this->renderers->addMappingToRenderer($renderer, $mapping);
if ($object !== null) {
$object->$property = $mapping;
}
return $mapping;
} | [
"public",
"function",
"addMappingToRenderer",
"(",
"$",
"renderer",
",",
"$",
"data_field",
",",
"$",
"property",
",",
"$",
"object",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"object",
"!==",
"null",
")",
"{",
"$",
"property",
"=",
"$",
"renderer",
"->",
"getPropertyNameToMap",
"(",
"$",
"object",
",",
"$",
"property",
")",
";",
"}",
"$",
"mapping",
"=",
"new",
"SwatCellRendererMapping",
"(",
"$",
"property",
",",
"$",
"data_field",
")",
";",
"$",
"this",
"->",
"renderers",
"->",
"addMappingToRenderer",
"(",
"$",
"renderer",
",",
"$",
"mapping",
")",
";",
"if",
"(",
"$",
"object",
"!==",
"null",
")",
"{",
"$",
"object",
"->",
"$",
"property",
"=",
"$",
"mapping",
";",
"}",
"return",
"$",
"mapping",
";",
"}"
] | Links a data-field to a cell renderer property of a cell renderer
within this container
@param SwatCellRenderer $renderer the cell renderer in this container
onto which the data-field is to be
mapped.
@param string $data_field the field of the data model to map to the cell
renderer property.
@param string $property the property of the cell renderer to which the
<i>$data_field</i> is mapped.
@param SwatUIObject $object optional. The object containing the property
to map when the property does not belong to
the cell renderer itself. If unspecified,
the <i>$property</i> must be a property of
the given cell renderer.
@return SwatCellRendererMapping a new mapping object that has been
added to the renderer. | [
"Links",
"a",
"data",
"-",
"field",
"to",
"a",
"cell",
"renderer",
"property",
"of",
"a",
"cell",
"renderer",
"within",
"this",
"container"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererContainer.php#L57-L75 |
33,529 | silverorange/swat | Swat/SwatCellRendererContainer.php | SwatCellRendererContainer.addRenderer | public function addRenderer(SwatCellRenderer $renderer)
{
$this->renderers->addRenderer($renderer);
$renderer->parent = $this;
} | php | public function addRenderer(SwatCellRenderer $renderer)
{
$this->renderers->addRenderer($renderer);
$renderer->parent = $this;
} | [
"public",
"function",
"addRenderer",
"(",
"SwatCellRenderer",
"$",
"renderer",
")",
"{",
"$",
"this",
"->",
"renderers",
"->",
"addRenderer",
"(",
"$",
"renderer",
")",
";",
"$",
"renderer",
"->",
"parent",
"=",
"$",
"this",
";",
"}"
] | Adds a cell renderer to this container's set of renderers
@param SwatCellRenderer $renderer the renderer to add. | [
"Adds",
"a",
"cell",
"renderer",
"to",
"this",
"container",
"s",
"set",
"of",
"renderers"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererContainer.php#L85-L89 |
33,530 | silverorange/swat | Swat/SwatCellRendererContainer.php | SwatCellRendererContainer.getRenderers | public function getRenderers()
{
$out = array();
$renderers = clone $this->renderers;
foreach ($renderers as $renderer) {
$out[] = $renderer;
}
return $out;
} | php | public function getRenderers()
{
$out = array();
$renderers = clone $this->renderers;
foreach ($renderers as $renderer) {
$out[] = $renderer;
}
return $out;
} | [
"public",
"function",
"getRenderers",
"(",
")",
"{",
"$",
"out",
"=",
"array",
"(",
")",
";",
"$",
"renderers",
"=",
"clone",
"$",
"this",
"->",
"renderers",
";",
"foreach",
"(",
"$",
"renderers",
"as",
"$",
"renderer",
")",
"{",
"$",
"out",
"[",
"]",
"=",
"$",
"renderer",
";",
"}",
"return",
"$",
"out",
";",
"}"
] | Gets the cell renderers of this container
@return array an array containing the cell renderers in this container. | [
"Gets",
"the",
"cell",
"renderers",
"of",
"this",
"container"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererContainer.php#L99-L108 |
33,531 | silverorange/swat | Swat/SwatCellRendererContainer.php | SwatCellRendererContainer.getHtmlHeadEntrySet | public function getHtmlHeadEntrySet()
{
$set = parent::getHtmlHeadEntrySet();
$renderers = $this->getRenderers();
foreach ($renderers as $renderer) {
$set->addEntrySet($renderer->getHtmlHeadEntrySet());
}
return $set;
} | php | public function getHtmlHeadEntrySet()
{
$set = parent::getHtmlHeadEntrySet();
$renderers = $this->getRenderers();
foreach ($renderers as $renderer) {
$set->addEntrySet($renderer->getHtmlHeadEntrySet());
}
return $set;
} | [
"public",
"function",
"getHtmlHeadEntrySet",
"(",
")",
"{",
"$",
"set",
"=",
"parent",
"::",
"getHtmlHeadEntrySet",
"(",
")",
";",
"$",
"renderers",
"=",
"$",
"this",
"->",
"getRenderers",
"(",
")",
";",
"foreach",
"(",
"$",
"renderers",
"as",
"$",
"renderer",
")",
"{",
"$",
"set",
"->",
"addEntrySet",
"(",
"$",
"renderer",
"->",
"getHtmlHeadEntrySet",
"(",
")",
")",
";",
"}",
"return",
"$",
"set",
";",
"}"
] | Gets the SwatHtmlHeadEntry objects needed by this cell renderer
container
@return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by
this cell renderer container.
@see SwatUIObject::getHtmlHeadEntrySet() | [
"Gets",
"the",
"SwatHtmlHeadEntry",
"objects",
"needed",
"by",
"this",
"cell",
"renderer",
"container"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererContainer.php#L337-L347 |
33,532 | silverorange/swat | Swat/SwatCellRendererContainer.php | SwatCellRendererContainer.getAvailableHtmlHeadEntrySet | public function getAvailableHtmlHeadEntrySet()
{
$set = parent::getAvailableHtmlHeadEntrySet();
$renderers = $this->getRenderers();
foreach ($renderers as $renderer) {
$set->addEntrySet($renderer->getAvailableHtmlHeadEntrySet());
}
return $set;
} | php | public function getAvailableHtmlHeadEntrySet()
{
$set = parent::getAvailableHtmlHeadEntrySet();
$renderers = $this->getRenderers();
foreach ($renderers as $renderer) {
$set->addEntrySet($renderer->getAvailableHtmlHeadEntrySet());
}
return $set;
} | [
"public",
"function",
"getAvailableHtmlHeadEntrySet",
"(",
")",
"{",
"$",
"set",
"=",
"parent",
"::",
"getAvailableHtmlHeadEntrySet",
"(",
")",
";",
"$",
"renderers",
"=",
"$",
"this",
"->",
"getRenderers",
"(",
")",
";",
"foreach",
"(",
"$",
"renderers",
"as",
"$",
"renderer",
")",
"{",
"$",
"set",
"->",
"addEntrySet",
"(",
"$",
"renderer",
"->",
"getAvailableHtmlHeadEntrySet",
"(",
")",
")",
";",
"}",
"return",
"$",
"set",
";",
"}"
] | Gets the SwatHtmlHeadEntry objects that may be needed by this cell
renderer container
@return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects that may be
needed by this cell renderer container.
@see SwatUIObject::getAvailableHtmlHeadEntrySet() | [
"Gets",
"the",
"SwatHtmlHeadEntry",
"objects",
"that",
"may",
"be",
"needed",
"by",
"this",
"cell",
"renderer",
"container"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererContainer.php#L361-L370 |
33,533 | silverorange/swat | Swat/SwatCellRendererContainer.php | SwatCellRendererContainer.getRendererInlineJavaScript | public function getRendererInlineJavaScript()
{
$javascript = '';
foreach ($this->getRenderers() as $renderer) {
$renderer_javascript = $renderer->getInlineJavaScript();
if ($renderer_javascript != '') {
$javascript = "\n" . $renderer_javascript;
}
}
return $javascript;
} | php | public function getRendererInlineJavaScript()
{
$javascript = '';
foreach ($this->getRenderers() as $renderer) {
$renderer_javascript = $renderer->getInlineJavaScript();
if ($renderer_javascript != '') {
$javascript = "\n" . $renderer_javascript;
}
}
return $javascript;
} | [
"public",
"function",
"getRendererInlineJavaScript",
"(",
")",
"{",
"$",
"javascript",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"getRenderers",
"(",
")",
"as",
"$",
"renderer",
")",
"{",
"$",
"renderer_javascript",
"=",
"$",
"renderer",
"->",
"getInlineJavaScript",
"(",
")",
";",
"if",
"(",
"$",
"renderer_javascript",
"!=",
"''",
")",
"{",
"$",
"javascript",
"=",
"\"\\n\"",
".",
"$",
"renderer_javascript",
";",
"}",
"}",
"return",
"$",
"javascript",
";",
"}"
] | Gets inline JavaScript used by all cell renderers within this cell
renderer container
@return string the inline JavaScript used by all cell renderers within
this cell renderer container. | [
"Gets",
"inline",
"JavaScript",
"used",
"by",
"all",
"cell",
"renderers",
"within",
"this",
"cell",
"renderer",
"container"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererContainer.php#L382-L394 |
33,534 | silverorange/swat | Swat/SwatNumber.php | SwatNumber.roundUp | public static function roundUp($value, $fractional_digits)
{
$power = pow(10, $fractional_digits);
$value = ceil($value * $power) / $power;
return $value;
} | php | public static function roundUp($value, $fractional_digits)
{
$power = pow(10, $fractional_digits);
$value = ceil($value * $power) / $power;
return $value;
} | [
"public",
"static",
"function",
"roundUp",
"(",
"$",
"value",
",",
"$",
"fractional_digits",
")",
"{",
"$",
"power",
"=",
"pow",
"(",
"10",
",",
"$",
"fractional_digits",
")",
";",
"$",
"value",
"=",
"ceil",
"(",
"$",
"value",
"*",
"$",
"power",
")",
"/",
"$",
"power",
";",
"return",
"$",
"value",
";",
"}"
] | Rounds a number to the specified number of fractional digits using the
round-half-up rounding method
See {@link http://en.wikipedia.org/wiki/Rounding#Round_half_up}.
@param float $value the value to round.
@param integer $fractional_digits the number of fractional digits in the
rounded result.
@return float the rounded value. | [
"Rounds",
"a",
"number",
"to",
"the",
"specified",
"number",
"of",
"fractional",
"digits",
"using",
"the",
"round",
"-",
"half",
"-",
"up",
"rounding",
"method"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNumber.php#L26-L32 |
33,535 | rhoone/yii2-rhoone | base/Rhoone.php | Rhoone.search | public function search($keyword = "")
{
Yii::trace("Begin searching...", __METHOD__);
$matches = $this->match($keyword);
$results = [];
foreach ($matches as $extension) {
$results[$extension->extension->id()] = $extension->extension->search($keyword);
}
return $results;
} | php | public function search($keyword = "")
{
Yii::trace("Begin searching...", __METHOD__);
$matches = $this->match($keyword);
$results = [];
foreach ($matches as $extension) {
$results[$extension->extension->id()] = $extension->extension->search($keyword);
}
return $results;
} | [
"public",
"function",
"search",
"(",
"$",
"keyword",
"=",
"\"\"",
")",
"{",
"Yii",
"::",
"trace",
"(",
"\"Begin searching...\"",
",",
"__METHOD__",
")",
";",
"$",
"matches",
"=",
"$",
"this",
"->",
"match",
"(",
"$",
"keyword",
")",
";",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"matches",
"as",
"$",
"extension",
")",
"{",
"$",
"results",
"[",
"$",
"extension",
"->",
"extension",
"->",
"id",
"(",
")",
"]",
"=",
"$",
"extension",
"->",
"extension",
"->",
"search",
"(",
"$",
"keyword",
")",
";",
"}",
"return",
"$",
"results",
";",
"}"
] | Search for result to the keywords.
@param string $keyword | [
"Search",
"for",
"result",
"to",
"the",
"keywords",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/base/Rhoone.php#L141-L150 |
33,536 | silverorange/swat | Swat/SwatRadioButtonCellRenderer.php | SwatRadioButtonCellRenderer.process | public function process()
{
$form = $this->getForm();
if ($form !== null && $form->isSubmitted()) {
$data = $form->getFormData();
if (isset($data[$this->id])) {
$this->selected_value = $data[$this->id];
$view = $this->getFirstAncestor('SwatView');
if ($view !== null) {
$selection = new SwatViewSelection(array(
$this->selected_value
));
$view->setSelection($selection, $this);
}
}
}
} | php | public function process()
{
$form = $this->getForm();
if ($form !== null && $form->isSubmitted()) {
$data = $form->getFormData();
if (isset($data[$this->id])) {
$this->selected_value = $data[$this->id];
$view = $this->getFirstAncestor('SwatView');
if ($view !== null) {
$selection = new SwatViewSelection(array(
$this->selected_value
));
$view->setSelection($selection, $this);
}
}
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"getForm",
"(",
")",
";",
"if",
"(",
"$",
"form",
"!==",
"null",
"&&",
"$",
"form",
"->",
"isSubmitted",
"(",
")",
")",
"{",
"$",
"data",
"=",
"$",
"form",
"->",
"getFormData",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"$",
"this",
"->",
"id",
"]",
")",
")",
"{",
"$",
"this",
"->",
"selected_value",
"=",
"$",
"data",
"[",
"$",
"this",
"->",
"id",
"]",
";",
"$",
"view",
"=",
"$",
"this",
"->",
"getFirstAncestor",
"(",
"'SwatView'",
")",
";",
"if",
"(",
"$",
"view",
"!==",
"null",
")",
"{",
"$",
"selection",
"=",
"new",
"SwatViewSelection",
"(",
"array",
"(",
"$",
"this",
"->",
"selected_value",
")",
")",
";",
"$",
"view",
"->",
"setSelection",
"(",
"$",
"selection",
",",
"$",
"this",
")",
";",
"}",
"}",
"}",
"}"
] | Processes this radio button cell renderer | [
"Processes",
"this",
"radio",
"button",
"cell",
"renderer"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioButtonCellRenderer.php#L101-L119 |
33,537 | silverorange/swat | Swat/SwatRadioButtonCellRenderer.php | SwatRadioButtonCellRenderer.render | public function render()
{
if (!$this->visible) {
return;
}
parent::render();
if ($this->title !== null) {
$label_tag = new SwatHtmlTag('label');
$label_tag->for = $this->id . '_radio_button_' . $this->value;
$label_tag->setContent($this->title, $this->content_type);
$label_tag->open();
}
$radio_button_tag = new SwatHtmlTag('input');
$radio_button_tag->type = 'radio';
$radio_button_tag->name = $this->id;
$radio_button_tag->id = $this->id . '_radio_button_' . $this->value;
$radio_button_tag->value = $this->value;
if (!$this->sensitive) {
$radio_button_tag->disabled = 'disabled';
}
$view = $this->getFirstAncestor('SwatView');
if ($view !== null) {
$selection = $view->getSelection($this);
if ($selection->contains($this->value)) {
$radio_button_tag->checked = 'checked';
}
}
echo '<span class="swat-radio-wrapper">';
$radio_button_tag->display();
echo '<span class="swat-radio-shim"></span>';
echo '</span>';
if ($this->title !== null) {
$label_tag->displayContent();
$label_tag->close();
}
} | php | public function render()
{
if (!$this->visible) {
return;
}
parent::render();
if ($this->title !== null) {
$label_tag = new SwatHtmlTag('label');
$label_tag->for = $this->id . '_radio_button_' . $this->value;
$label_tag->setContent($this->title, $this->content_type);
$label_tag->open();
}
$radio_button_tag = new SwatHtmlTag('input');
$radio_button_tag->type = 'radio';
$radio_button_tag->name = $this->id;
$radio_button_tag->id = $this->id . '_radio_button_' . $this->value;
$radio_button_tag->value = $this->value;
if (!$this->sensitive) {
$radio_button_tag->disabled = 'disabled';
}
$view = $this->getFirstAncestor('SwatView');
if ($view !== null) {
$selection = $view->getSelection($this);
if ($selection->contains($this->value)) {
$radio_button_tag->checked = 'checked';
}
}
echo '<span class="swat-radio-wrapper">';
$radio_button_tag->display();
echo '<span class="swat-radio-shim"></span>';
echo '</span>';
if ($this->title !== null) {
$label_tag->displayContent();
$label_tag->close();
}
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"render",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"title",
"!==",
"null",
")",
"{",
"$",
"label_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'label'",
")",
";",
"$",
"label_tag",
"->",
"for",
"=",
"$",
"this",
"->",
"id",
".",
"'_radio_button_'",
".",
"$",
"this",
"->",
"value",
";",
"$",
"label_tag",
"->",
"setContent",
"(",
"$",
"this",
"->",
"title",
",",
"$",
"this",
"->",
"content_type",
")",
";",
"$",
"label_tag",
"->",
"open",
"(",
")",
";",
"}",
"$",
"radio_button_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'input'",
")",
";",
"$",
"radio_button_tag",
"->",
"type",
"=",
"'radio'",
";",
"$",
"radio_button_tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"radio_button_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_radio_button_'",
".",
"$",
"this",
"->",
"value",
";",
"$",
"radio_button_tag",
"->",
"value",
"=",
"$",
"this",
"->",
"value",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"sensitive",
")",
"{",
"$",
"radio_button_tag",
"->",
"disabled",
"=",
"'disabled'",
";",
"}",
"$",
"view",
"=",
"$",
"this",
"->",
"getFirstAncestor",
"(",
"'SwatView'",
")",
";",
"if",
"(",
"$",
"view",
"!==",
"null",
")",
"{",
"$",
"selection",
"=",
"$",
"view",
"->",
"getSelection",
"(",
"$",
"this",
")",
";",
"if",
"(",
"$",
"selection",
"->",
"contains",
"(",
"$",
"this",
"->",
"value",
")",
")",
"{",
"$",
"radio_button_tag",
"->",
"checked",
"=",
"'checked'",
";",
"}",
"}",
"echo",
"'<span class=\"swat-radio-wrapper\">'",
";",
"$",
"radio_button_tag",
"->",
"display",
"(",
")",
";",
"echo",
"'<span class=\"swat-radio-shim\"></span>'",
";",
"echo",
"'</span>'",
";",
"if",
"(",
"$",
"this",
"->",
"title",
"!==",
"null",
")",
"{",
"$",
"label_tag",
"->",
"displayContent",
"(",
")",
";",
"$",
"label_tag",
"->",
"close",
"(",
")",
";",
"}",
"}"
] | Renders this radio button cell renderer | [
"Renders",
"this",
"radio",
"button",
"cell",
"renderer"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioButtonCellRenderer.php#L127-L168 |
33,538 | silverorange/swat | Swat/SwatRadioButtonCellRenderer.php | SwatRadioButtonCellRenderer.getInlineJavaScript | public function getInlineJavaScript()
{
$view = $this->getFirstAncestor('SwatView');
if ($view !== null) {
$javascript = sprintf(
"var %s = new SwatRadioButtonCellRenderer('%s', %s);",
$this->id,
$this->id,
$view->id
);
} else {
$javascript = '';
}
return $javascript;
} | php | public function getInlineJavaScript()
{
$view = $this->getFirstAncestor('SwatView');
if ($view !== null) {
$javascript = sprintf(
"var %s = new SwatRadioButtonCellRenderer('%s', %s);",
$this->id,
$this->id,
$view->id
);
} else {
$javascript = '';
}
return $javascript;
} | [
"public",
"function",
"getInlineJavaScript",
"(",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getFirstAncestor",
"(",
"'SwatView'",
")",
";",
"if",
"(",
"$",
"view",
"!==",
"null",
")",
"{",
"$",
"javascript",
"=",
"sprintf",
"(",
"\"var %s = new SwatRadioButtonCellRenderer('%s', %s);\"",
",",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"id",
",",
"$",
"view",
"->",
"id",
")",
";",
"}",
"else",
"{",
"$",
"javascript",
"=",
"''",
";",
"}",
"return",
"$",
"javascript",
";",
"}"
] | Gets the inline JavaScript required by this radio button cell renderer
@return string the inline JavaScript required by this radio button cell
renderer. | [
"Gets",
"the",
"inline",
"JavaScript",
"required",
"by",
"this",
"radio",
"button",
"cell",
"renderer"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioButtonCellRenderer.php#L194-L209 |
33,539 | silverorange/swat | Swat/SwatGroupingFormField.php | SwatGroupingFormField.getTitleTag | protected function getTitleTag()
{
$legend_tag = new SwatHtmlTag('legend');
$legend_tag->setContent($this->title, $this->title_content_type);
return $legend_tag;
} | php | protected function getTitleTag()
{
$legend_tag = new SwatHtmlTag('legend');
$legend_tag->setContent($this->title, $this->title_content_type);
return $legend_tag;
} | [
"protected",
"function",
"getTitleTag",
"(",
")",
"{",
"$",
"legend_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'legend'",
")",
";",
"$",
"legend_tag",
"->",
"setContent",
"(",
"$",
"this",
"->",
"title",
",",
"$",
"this",
"->",
"title_content_type",
")",
";",
"return",
"$",
"legend_tag",
";",
"}"
] | Get a SwatHtmlTag to display the title.
Subclasses can change this to change their appearance.
@return SwatHtmlTag a tag object containing the title. | [
"Get",
"a",
"SwatHtmlTag",
"to",
"display",
"the",
"title",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatGroupingFormField.php#L24-L30 |
33,540 | brainworxx/kreXX | src/Analyse/Callback/Analyse/Objects/ProtectedProperties.php | ProtectedProperties.callMe | public function callMe()
{
$output = $this->dispatchStartEvent();
/** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
$refProps = $ref->getProperties(\ReflectionProperty::IS_PROTECTED);
if (empty($refProps) === true) {
return $output;
}
usort($refProps, array($this, 'reflectionSorting'));
return $output .
$this->getReflectionPropertiesData(
$refProps,
$ref,
'Protected properties'
);
} | php | public function callMe()
{
$output = $this->dispatchStartEvent();
/** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
$refProps = $ref->getProperties(\ReflectionProperty::IS_PROTECTED);
if (empty($refProps) === true) {
return $output;
}
usort($refProps, array($this, 'reflectionSorting'));
return $output .
$this->getReflectionPropertiesData(
$refProps,
$ref,
'Protected properties'
);
} | [
"public",
"function",
"callMe",
"(",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
";",
"/** @var \\Brainworxx\\Krexx\\Service\\Reflection\\ReflectionClass $ref */",
"$",
"ref",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_REF",
"]",
";",
"$",
"refProps",
"=",
"$",
"ref",
"->",
"getProperties",
"(",
"\\",
"ReflectionProperty",
"::",
"IS_PROTECTED",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"refProps",
")",
"===",
"true",
")",
"{",
"return",
"$",
"output",
";",
"}",
"usort",
"(",
"$",
"refProps",
",",
"array",
"(",
"$",
"this",
",",
"'reflectionSorting'",
")",
")",
";",
"return",
"$",
"output",
".",
"$",
"this",
"->",
"getReflectionPropertiesData",
"(",
"$",
"refProps",
",",
"$",
"ref",
",",
"'Protected properties'",
")",
";",
"}"
] | Dump all protected properties.
@return string
The generated HTML markup | [
"Dump",
"all",
"protected",
"properties",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/ProtectedProperties.php#L60-L79 |
33,541 | silverorange/swat | Swat/SwatDate.php | SwatDate.format | public function format($format, $tz_format = null)
{
if (is_int($format)) {
$format = self::getFormatById($format);
}
$out = parent::format($format);
if ($tz_format !== null) {
$out .= ' ' . $this->formatTZ($tz_format);
}
return $out;
} | php | public function format($format, $tz_format = null)
{
if (is_int($format)) {
$format = self::getFormatById($format);
}
$out = parent::format($format);
if ($tz_format !== null) {
$out .= ' ' . $this->formatTZ($tz_format);
}
return $out;
} | [
"public",
"function",
"format",
"(",
"$",
"format",
",",
"$",
"tz_format",
"=",
"null",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"format",
")",
")",
"{",
"$",
"format",
"=",
"self",
"::",
"getFormatById",
"(",
"$",
"format",
")",
";",
"}",
"$",
"out",
"=",
"parent",
"::",
"format",
"(",
"$",
"format",
")",
";",
"if",
"(",
"$",
"tz_format",
"!==",
"null",
")",
"{",
"$",
"out",
".=",
"' '",
".",
"$",
"this",
"->",
"formatTZ",
"(",
"$",
"tz_format",
")",
";",
"}",
"return",
"$",
"out",
";",
"}"
] | Formats this date given either a format string or a format id
Note: The results of this method are not localized. For a localized
formatted date, use {@link SwatDate::formatLikeIntl()} or
{@link SwatDate::formatLikeStrftime()}.
@param mixed $format either a format string or an integer format id.
@param integer $tz_format optional time zone format id.
@return string the formatted date. | [
"Formats",
"this",
"date",
"given",
"either",
"a",
"format",
"string",
"or",
"a",
"format",
"id"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L351-L364 |
33,542 | silverorange/swat | Swat/SwatDate.php | SwatDate.formatLikeIntl | public function formatLikeIntl($format, $tz_format = null, $locale = null)
{
if (is_int($format)) {
$format = self::getFormatLikeIntlById($format);
}
if ($locale == '') {
$locale = setlocale(LC_TIME, 0);
}
static $formatters = array();
if (!isset($formatters[$locale])) {
$formatters[$locale] = new IntlDateFormatter(
$locale,
IntlDateFormatter::FULL,
IntlDateFormatter::FULL
);
}
$formatter = $formatters[$locale];
$formatter->setTimeZone($this->getTimezone()->getName());
$formatter->setPattern($format);
$timestamp = $this->getTimestamp();
$out = $formatter->format($timestamp);
if ($tz_format !== null) {
$out .= ' ' . $this->formatTZ($tz_format);
}
return $out;
} | php | public function formatLikeIntl($format, $tz_format = null, $locale = null)
{
if (is_int($format)) {
$format = self::getFormatLikeIntlById($format);
}
if ($locale == '') {
$locale = setlocale(LC_TIME, 0);
}
static $formatters = array();
if (!isset($formatters[$locale])) {
$formatters[$locale] = new IntlDateFormatter(
$locale,
IntlDateFormatter::FULL,
IntlDateFormatter::FULL
);
}
$formatter = $formatters[$locale];
$formatter->setTimeZone($this->getTimezone()->getName());
$formatter->setPattern($format);
$timestamp = $this->getTimestamp();
$out = $formatter->format($timestamp);
if ($tz_format !== null) {
$out .= ' ' . $this->formatTZ($tz_format);
}
return $out;
} | [
"public",
"function",
"formatLikeIntl",
"(",
"$",
"format",
",",
"$",
"tz_format",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"format",
")",
")",
"{",
"$",
"format",
"=",
"self",
"::",
"getFormatLikeIntlById",
"(",
"$",
"format",
")",
";",
"}",
"if",
"(",
"$",
"locale",
"==",
"''",
")",
"{",
"$",
"locale",
"=",
"setlocale",
"(",
"LC_TIME",
",",
"0",
")",
";",
"}",
"static",
"$",
"formatters",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"formatters",
"[",
"$",
"locale",
"]",
")",
")",
"{",
"$",
"formatters",
"[",
"$",
"locale",
"]",
"=",
"new",
"IntlDateFormatter",
"(",
"$",
"locale",
",",
"IntlDateFormatter",
"::",
"FULL",
",",
"IntlDateFormatter",
"::",
"FULL",
")",
";",
"}",
"$",
"formatter",
"=",
"$",
"formatters",
"[",
"$",
"locale",
"]",
";",
"$",
"formatter",
"->",
"setTimeZone",
"(",
"$",
"this",
"->",
"getTimezone",
"(",
")",
"->",
"getName",
"(",
")",
")",
";",
"$",
"formatter",
"->",
"setPattern",
"(",
"$",
"format",
")",
";",
"$",
"timestamp",
"=",
"$",
"this",
"->",
"getTimestamp",
"(",
")",
";",
"$",
"out",
"=",
"$",
"formatter",
"->",
"format",
"(",
"$",
"timestamp",
")",
";",
"if",
"(",
"$",
"tz_format",
"!==",
"null",
")",
"{",
"$",
"out",
".=",
"' '",
".",
"$",
"this",
"->",
"formatTZ",
"(",
"$",
"tz_format",
")",
";",
"}",
"return",
"$",
"out",
";",
"}"
] | Formats this date using the ICU IntlDateFormater given either a format
string or a format id
This method returns localized results.
@param mixed $format either a format string or an integer format id.
@param integer $tz_format optional. A time zone format id.
@param string $locale optional. The locale to use to format the date.
If not specified, the current locale is used.
@return string the formatted date according to the current locale. | [
"Formats",
"this",
"date",
"using",
"the",
"ICU",
"IntlDateFormater",
"given",
"either",
"a",
"format",
"string",
"or",
"a",
"format",
"id"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L426-L458 |
33,543 | silverorange/swat | Swat/SwatDate.php | SwatDate.formatTZ | public function formatTZ($format)
{
$out = '';
switch ($format) {
case self::TZ_ID:
$out = $this->format('e');
break;
case self::TZ_SHORT:
case self::TZ_LONG:
$id = $this->format('e');
$abbreviations = self::getTimeZoneAbbreviations();
if (
isset($abbreviations[$id]) &&
isset($abbreviations[$id]['st'])
) {
$out = $abbreviations[$id]['st'];
}
break;
case self::TZ_DST_SHORT:
case self::TZ_DST_LONG:
$id = $this->format('e');
$abbreviations = self::getTimeZoneAbbreviations();
if (isset($abbreviations[$id])) {
if (isset($abbreviations[$id]['dt'])) {
$out = $abbreviations[$id]['dt'];
} else {
$out = $abbreviations[$id]['st'];
}
}
break;
case self::TZ_CURRENT_SHORT:
case self::TZ_CURRENT_LONG:
$out = $this->format('T');
break;
case self::TZ_COMBINED:
$out = array();
$id = $this->format('e');
$abbreviations = self::getTimeZoneAbbreviations();
if (isset($abbreviations[$id])) {
if (isset($abbreviations[$id]['st'])) {
$out[] = $abbreviations[$id]['st'];
}
if (isset($abbreviations[$id]['dt'])) {
$out[] = $abbreviations[$id]['dt'];
}
}
$out = implode('/', $out);
break;
}
return $out;
} | php | public function formatTZ($format)
{
$out = '';
switch ($format) {
case self::TZ_ID:
$out = $this->format('e');
break;
case self::TZ_SHORT:
case self::TZ_LONG:
$id = $this->format('e');
$abbreviations = self::getTimeZoneAbbreviations();
if (
isset($abbreviations[$id]) &&
isset($abbreviations[$id]['st'])
) {
$out = $abbreviations[$id]['st'];
}
break;
case self::TZ_DST_SHORT:
case self::TZ_DST_LONG:
$id = $this->format('e');
$abbreviations = self::getTimeZoneAbbreviations();
if (isset($abbreviations[$id])) {
if (isset($abbreviations[$id]['dt'])) {
$out = $abbreviations[$id]['dt'];
} else {
$out = $abbreviations[$id]['st'];
}
}
break;
case self::TZ_CURRENT_SHORT:
case self::TZ_CURRENT_LONG:
$out = $this->format('T');
break;
case self::TZ_COMBINED:
$out = array();
$id = $this->format('e');
$abbreviations = self::getTimeZoneAbbreviations();
if (isset($abbreviations[$id])) {
if (isset($abbreviations[$id]['st'])) {
$out[] = $abbreviations[$id]['st'];
}
if (isset($abbreviations[$id]['dt'])) {
$out[] = $abbreviations[$id]['dt'];
}
}
$out = implode('/', $out);
break;
}
return $out;
} | [
"public",
"function",
"formatTZ",
"(",
"$",
"format",
")",
"{",
"$",
"out",
"=",
"''",
";",
"switch",
"(",
"$",
"format",
")",
"{",
"case",
"self",
"::",
"TZ_ID",
":",
"$",
"out",
"=",
"$",
"this",
"->",
"format",
"(",
"'e'",
")",
";",
"break",
";",
"case",
"self",
"::",
"TZ_SHORT",
":",
"case",
"self",
"::",
"TZ_LONG",
":",
"$",
"id",
"=",
"$",
"this",
"->",
"format",
"(",
"'e'",
")",
";",
"$",
"abbreviations",
"=",
"self",
"::",
"getTimeZoneAbbreviations",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
")",
"&&",
"isset",
"(",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
"[",
"'st'",
"]",
")",
")",
"{",
"$",
"out",
"=",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
"[",
"'st'",
"]",
";",
"}",
"break",
";",
"case",
"self",
"::",
"TZ_DST_SHORT",
":",
"case",
"self",
"::",
"TZ_DST_LONG",
":",
"$",
"id",
"=",
"$",
"this",
"->",
"format",
"(",
"'e'",
")",
";",
"$",
"abbreviations",
"=",
"self",
"::",
"getTimeZoneAbbreviations",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
"[",
"'dt'",
"]",
")",
")",
"{",
"$",
"out",
"=",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
"[",
"'dt'",
"]",
";",
"}",
"else",
"{",
"$",
"out",
"=",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
"[",
"'st'",
"]",
";",
"}",
"}",
"break",
";",
"case",
"self",
"::",
"TZ_CURRENT_SHORT",
":",
"case",
"self",
"::",
"TZ_CURRENT_LONG",
":",
"$",
"out",
"=",
"$",
"this",
"->",
"format",
"(",
"'T'",
")",
";",
"break",
";",
"case",
"self",
"::",
"TZ_COMBINED",
":",
"$",
"out",
"=",
"array",
"(",
")",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"format",
"(",
"'e'",
")",
";",
"$",
"abbreviations",
"=",
"self",
"::",
"getTimeZoneAbbreviations",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
"[",
"'st'",
"]",
")",
")",
"{",
"$",
"out",
"[",
"]",
"=",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
"[",
"'st'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
"[",
"'dt'",
"]",
")",
")",
"{",
"$",
"out",
"[",
"]",
"=",
"$",
"abbreviations",
"[",
"$",
"id",
"]",
"[",
"'dt'",
"]",
";",
"}",
"}",
"$",
"out",
"=",
"implode",
"(",
"'/'",
",",
"$",
"out",
")",
";",
"break",
";",
"}",
"return",
"$",
"out",
";",
"}"
] | Formats the time zone part of this date
@param integer $format an integer time zone format id.
@return string the formatted time zone. | [
"Formats",
"the",
"time",
"zone",
"part",
"of",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L470-L526 |
33,544 | silverorange/swat | Swat/SwatDate.php | SwatDate.getFormatById | public static function getFormatById($id)
{
// Note: The format() method does not localize results, so these
// format codes are _not_ wrapped in gettext calls.
switch ($id) {
case self::DF_MDY:
return 'm/d/y';
case self::DF_MDY_SHORT:
return 'mdy';
case self::DF_DATE:
return 'F j, Y';
case self::DF_DATE_LONG:
return 'l, F j, Y';
case self::DF_DATE_TIME:
return 'F j, Y g:i a';
case self::DF_DATE_TIME_LONG:
return 'l, F j, Y g:i a';
case self::DF_TIME:
return 'g:i a';
case self::DF_DATE_SHORT:
return 'M j, Y';
case self::DF_DATE_SHORT_NOYEAR:
return 'M j';
case self::DF_DATE_TIME_SHORT:
return 'M j, Y g:i a';
case self::DF_DATE_TIME_SHORT_NOYEAR:
return 'M j, g:i a';
case self::DF_MY:
return 'F Y';
case self::DF_CC_MY:
return 'm / Y';
case self::DF_Y:
return 'Y';
case self::DF_ISO_8601_BASIC:
return 'Ymd\THis';
case self::DF_ISO_8601_EXTENDED:
return 'Y-m-d\TH:i:s';
case self::DF_RFC_2822:
return 'r';
default:
throw new Exception("Unknown date format id '$id'.");
}
} | php | public static function getFormatById($id)
{
// Note: The format() method does not localize results, so these
// format codes are _not_ wrapped in gettext calls.
switch ($id) {
case self::DF_MDY:
return 'm/d/y';
case self::DF_MDY_SHORT:
return 'mdy';
case self::DF_DATE:
return 'F j, Y';
case self::DF_DATE_LONG:
return 'l, F j, Y';
case self::DF_DATE_TIME:
return 'F j, Y g:i a';
case self::DF_DATE_TIME_LONG:
return 'l, F j, Y g:i a';
case self::DF_TIME:
return 'g:i a';
case self::DF_DATE_SHORT:
return 'M j, Y';
case self::DF_DATE_SHORT_NOYEAR:
return 'M j';
case self::DF_DATE_TIME_SHORT:
return 'M j, Y g:i a';
case self::DF_DATE_TIME_SHORT_NOYEAR:
return 'M j, g:i a';
case self::DF_MY:
return 'F Y';
case self::DF_CC_MY:
return 'm / Y';
case self::DF_Y:
return 'Y';
case self::DF_ISO_8601_BASIC:
return 'Ymd\THis';
case self::DF_ISO_8601_EXTENDED:
return 'Y-m-d\TH:i:s';
case self::DF_RFC_2822:
return 'r';
default:
throw new Exception("Unknown date format id '$id'.");
}
} | [
"public",
"static",
"function",
"getFormatById",
"(",
"$",
"id",
")",
"{",
"// Note: The format() method does not localize results, so these",
"// format codes are _not_ wrapped in gettext calls.",
"switch",
"(",
"$",
"id",
")",
"{",
"case",
"self",
"::",
"DF_MDY",
":",
"return",
"'m/d/y'",
";",
"case",
"self",
"::",
"DF_MDY_SHORT",
":",
"return",
"'mdy'",
";",
"case",
"self",
"::",
"DF_DATE",
":",
"return",
"'F j, Y'",
";",
"case",
"self",
"::",
"DF_DATE_LONG",
":",
"return",
"'l, F j, Y'",
";",
"case",
"self",
"::",
"DF_DATE_TIME",
":",
"return",
"'F j, Y g:i a'",
";",
"case",
"self",
"::",
"DF_DATE_TIME_LONG",
":",
"return",
"'l, F j, Y g:i a'",
";",
"case",
"self",
"::",
"DF_TIME",
":",
"return",
"'g:i a'",
";",
"case",
"self",
"::",
"DF_DATE_SHORT",
":",
"return",
"'M j, Y'",
";",
"case",
"self",
"::",
"DF_DATE_SHORT_NOYEAR",
":",
"return",
"'M j'",
";",
"case",
"self",
"::",
"DF_DATE_TIME_SHORT",
":",
"return",
"'M j, Y g:i a'",
";",
"case",
"self",
"::",
"DF_DATE_TIME_SHORT_NOYEAR",
":",
"return",
"'M j, g:i a'",
";",
"case",
"self",
"::",
"DF_MY",
":",
"return",
"'F Y'",
";",
"case",
"self",
"::",
"DF_CC_MY",
":",
"return",
"'m / Y'",
";",
"case",
"self",
"::",
"DF_Y",
":",
"return",
"'Y'",
";",
"case",
"self",
"::",
"DF_ISO_8601_BASIC",
":",
"return",
"'Ymd\\THis'",
";",
"case",
"self",
"::",
"DF_ISO_8601_EXTENDED",
":",
"return",
"'Y-m-d\\TH:i:s'",
";",
"case",
"self",
"::",
"DF_RFC_2822",
":",
"return",
"'r'",
";",
"default",
":",
"throw",
"new",
"Exception",
"(",
"\"Unknown date format id '$id'.\"",
")",
";",
"}",
"}"
] | Gets a date format string by id
@param integer $id the id of the format string to retrieve.
@return string the formatting string that was requested.
@throws SwatException | [
"Gets",
"a",
"date",
"format",
"string",
"by",
"id"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L647-L690 |
33,545 | silverorange/swat | Swat/SwatDate.php | SwatDate.getTimeZoneAbbreviations | public static function getTimeZoneAbbreviations()
{
static $shortnames = null;
if (self::$tz_abbreviations === null) {
self::$tz_abbreviations = array();
$abbreviations = DateTimeZone::listAbbreviations();
foreach ($abbreviations as $abbreviation => $time_zones) {
if (isset(self::$valid_tz_abbreviations[$abbreviation])) {
foreach ($time_zones as $tz) {
$tz_id = $tz['timezone_id'];
if (!isset(self::$tz_abbreviations[$tz_id])) {
self::$tz_abbreviations[$tz_id] = array();
}
// daylight-time or standard-time
$key = $tz['dst'] ? 'dt' : 'st';
if (!isset(self::$tz_abbreviations[$tz_id][$key])) {
self::$tz_abbreviations[$tz_id][
$key
] = mb_strtoupper($abbreviation);
}
}
}
}
}
return self::$tz_abbreviations;
} | php | public static function getTimeZoneAbbreviations()
{
static $shortnames = null;
if (self::$tz_abbreviations === null) {
self::$tz_abbreviations = array();
$abbreviations = DateTimeZone::listAbbreviations();
foreach ($abbreviations as $abbreviation => $time_zones) {
if (isset(self::$valid_tz_abbreviations[$abbreviation])) {
foreach ($time_zones as $tz) {
$tz_id = $tz['timezone_id'];
if (!isset(self::$tz_abbreviations[$tz_id])) {
self::$tz_abbreviations[$tz_id] = array();
}
// daylight-time or standard-time
$key = $tz['dst'] ? 'dt' : 'st';
if (!isset(self::$tz_abbreviations[$tz_id][$key])) {
self::$tz_abbreviations[$tz_id][
$key
] = mb_strtoupper($abbreviation);
}
}
}
}
}
return self::$tz_abbreviations;
} | [
"public",
"static",
"function",
"getTimeZoneAbbreviations",
"(",
")",
"{",
"static",
"$",
"shortnames",
"=",
"null",
";",
"if",
"(",
"self",
"::",
"$",
"tz_abbreviations",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"tz_abbreviations",
"=",
"array",
"(",
")",
";",
"$",
"abbreviations",
"=",
"DateTimeZone",
"::",
"listAbbreviations",
"(",
")",
";",
"foreach",
"(",
"$",
"abbreviations",
"as",
"$",
"abbreviation",
"=>",
"$",
"time_zones",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"valid_tz_abbreviations",
"[",
"$",
"abbreviation",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"time_zones",
"as",
"$",
"tz",
")",
"{",
"$",
"tz_id",
"=",
"$",
"tz",
"[",
"'timezone_id'",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"tz_abbreviations",
"[",
"$",
"tz_id",
"]",
")",
")",
"{",
"self",
"::",
"$",
"tz_abbreviations",
"[",
"$",
"tz_id",
"]",
"=",
"array",
"(",
")",
";",
"}",
"// daylight-time or standard-time",
"$",
"key",
"=",
"$",
"tz",
"[",
"'dst'",
"]",
"?",
"'dt'",
":",
"'st'",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"tz_abbreviations",
"[",
"$",
"tz_id",
"]",
"[",
"$",
"key",
"]",
")",
")",
"{",
"self",
"::",
"$",
"tz_abbreviations",
"[",
"$",
"tz_id",
"]",
"[",
"$",
"key",
"]",
"=",
"mb_strtoupper",
"(",
"$",
"abbreviation",
")",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"self",
"::",
"$",
"tz_abbreviations",
";",
"}"
] | Gets a mapping of time zone names to time zone abbreviations
Note: the data generated by this method is cached in a static array. The
first call will be relatively expensive but subsequent calls won't do
additional calculation.
@return array an array where the array key is a time zone name and the
array value is an array containing one or both of
- 'st' for the standard time abbreviation, and
- 'dt' for the daylight time abbreviation. | [
"Gets",
"a",
"mapping",
"of",
"time",
"zone",
"names",
"to",
"time",
"zone",
"abbreviations"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L815-L844 |
33,546 | silverorange/swat | Swat/SwatDate.php | SwatDate.getTimeZoneAbbreviation | public static function getTimeZoneAbbreviation(DateTimeZone $time_zone)
{
$abbreviations = self::getTimeZoneAbbreviations();
$key = $time_zone->getName();
if (array_key_exists($key, $abbreviations)) {
$abbreviation = $abbreviations[$key];
}
return $abbreviation;
} | php | public static function getTimeZoneAbbreviation(DateTimeZone $time_zone)
{
$abbreviations = self::getTimeZoneAbbreviations();
$key = $time_zone->getName();
if (array_key_exists($key, $abbreviations)) {
$abbreviation = $abbreviations[$key];
}
return $abbreviation;
} | [
"public",
"static",
"function",
"getTimeZoneAbbreviation",
"(",
"DateTimeZone",
"$",
"time_zone",
")",
"{",
"$",
"abbreviations",
"=",
"self",
"::",
"getTimeZoneAbbreviations",
"(",
")",
";",
"$",
"key",
"=",
"$",
"time_zone",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"abbreviations",
")",
")",
"{",
"$",
"abbreviation",
"=",
"$",
"abbreviations",
"[",
"$",
"key",
"]",
";",
"}",
"return",
"$",
"abbreviation",
";",
"}"
] | Gets an array of time zone abbreviations for a specific time zone
@param DateTimeZone $time_zone the new time zone.
@return array an array containing one or both of
- 'st' for the standard time abbreviation, and
- 'dt' for the daylight time abbreviation. | [
"Gets",
"an",
"array",
"of",
"time",
"zone",
"abbreviations",
"for",
"a",
"specific",
"time",
"zone"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L858-L868 |
33,547 | silverorange/swat | Swat/SwatDate.php | SwatDate.compare | public static function compare(DateTime $date1, DateTime $date2)
{
// Not using getTimestamp() here because it is clamped to the 32-bit
// signed integer range. Float compaison should be safe here as the
// number are within the double-precision offered by floats and can
// be represented exactly.
$seconds1 = (float) $date1->format('U');
$seconds2 = (float) $date2->format('U');
if ($seconds1 > $seconds2) {
return 1;
}
if ($seconds1 < $seconds2) {
return -1;
}
return 0;
} | php | public static function compare(DateTime $date1, DateTime $date2)
{
// Not using getTimestamp() here because it is clamped to the 32-bit
// signed integer range. Float compaison should be safe here as the
// number are within the double-precision offered by floats and can
// be represented exactly.
$seconds1 = (float) $date1->format('U');
$seconds2 = (float) $date2->format('U');
if ($seconds1 > $seconds2) {
return 1;
}
if ($seconds1 < $seconds2) {
return -1;
}
return 0;
} | [
"public",
"static",
"function",
"compare",
"(",
"DateTime",
"$",
"date1",
",",
"DateTime",
"$",
"date2",
")",
"{",
"// Not using getTimestamp() here because it is clamped to the 32-bit",
"// signed integer range. Float compaison should be safe here as the",
"// number are within the double-precision offered by floats and can",
"// be represented exactly.",
"$",
"seconds1",
"=",
"(",
"float",
")",
"$",
"date1",
"->",
"format",
"(",
"'U'",
")",
";",
"$",
"seconds2",
"=",
"(",
"float",
")",
"$",
"date2",
"->",
"format",
"(",
"'U'",
")",
";",
"if",
"(",
"$",
"seconds1",
">",
"$",
"seconds2",
")",
"{",
"return",
"1",
";",
"}",
"if",
"(",
"$",
"seconds1",
"<",
"$",
"seconds2",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"0",
";",
"}"
] | Compares two SwatDates
This method is provided for backwards compatibility with PEAR::Date.
@param DateTime $date1 the first date to compare.
@param DateTime $date2 the second date to compare.
@return integer a tri-value where -1 indicates $date1 is before $date2,
0 indicates $date1 is equivalent to $date2 and 1
indicates $date1 is after $date2. | [
"Compares",
"two",
"SwatDates"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L885-L903 |
33,548 | silverorange/swat | Swat/SwatDate.php | SwatDate.getIntervalFromSeconds | public static function getIntervalFromSeconds($seconds)
{
// don't care about micro-seconds.
$seconds = floor(abs($seconds));
$minute = 60;
$hour = $minute * 60;
$day = $hour * 24;
$month = $day * 30;
$year = $day * 365;
$interval_spec = 'P';
if ($seconds > $year) {
$years = floor($seconds / $year);
$seconds -= $year * $years;
$interval_spec .= $years . 'Y';
}
if ($seconds > $month) {
$months = floor($seconds / $month);
$seconds -= $month * $months;
$interval_spec .= $months . 'M';
}
if ($seconds > $day) {
$days = floor($seconds / $day);
$seconds -= $day * $days;
$interval_spec .= $days . 'D';
}
if ($seconds > 0 || $interval_spec === 'P') {
$interval_spec .= 'T';
if ($seconds > $hour) {
$hours = floor($seconds / $hour);
$seconds -= $hour * $hours;
$interval_spec .= $hours . 'H';
}
if ($seconds > $minute) {
$minutes = floor($seconds / $minute);
$seconds -= $minute * $minutes;
$interval_spec .= $minutes . 'M';
}
$interval_spec .= $seconds . 'S';
}
return new DateInterval($interval_spec);
} | php | public static function getIntervalFromSeconds($seconds)
{
// don't care about micro-seconds.
$seconds = floor(abs($seconds));
$minute = 60;
$hour = $minute * 60;
$day = $hour * 24;
$month = $day * 30;
$year = $day * 365;
$interval_spec = 'P';
if ($seconds > $year) {
$years = floor($seconds / $year);
$seconds -= $year * $years;
$interval_spec .= $years . 'Y';
}
if ($seconds > $month) {
$months = floor($seconds / $month);
$seconds -= $month * $months;
$interval_spec .= $months . 'M';
}
if ($seconds > $day) {
$days = floor($seconds / $day);
$seconds -= $day * $days;
$interval_spec .= $days . 'D';
}
if ($seconds > 0 || $interval_spec === 'P') {
$interval_spec .= 'T';
if ($seconds > $hour) {
$hours = floor($seconds / $hour);
$seconds -= $hour * $hours;
$interval_spec .= $hours . 'H';
}
if ($seconds > $minute) {
$minutes = floor($seconds / $minute);
$seconds -= $minute * $minutes;
$interval_spec .= $minutes . 'M';
}
$interval_spec .= $seconds . 'S';
}
return new DateInterval($interval_spec);
} | [
"public",
"static",
"function",
"getIntervalFromSeconds",
"(",
"$",
"seconds",
")",
"{",
"// don't care about micro-seconds.",
"$",
"seconds",
"=",
"floor",
"(",
"abs",
"(",
"$",
"seconds",
")",
")",
";",
"$",
"minute",
"=",
"60",
";",
"$",
"hour",
"=",
"$",
"minute",
"*",
"60",
";",
"$",
"day",
"=",
"$",
"hour",
"*",
"24",
";",
"$",
"month",
"=",
"$",
"day",
"*",
"30",
";",
"$",
"year",
"=",
"$",
"day",
"*",
"365",
";",
"$",
"interval_spec",
"=",
"'P'",
";",
"if",
"(",
"$",
"seconds",
">",
"$",
"year",
")",
"{",
"$",
"years",
"=",
"floor",
"(",
"$",
"seconds",
"/",
"$",
"year",
")",
";",
"$",
"seconds",
"-=",
"$",
"year",
"*",
"$",
"years",
";",
"$",
"interval_spec",
".=",
"$",
"years",
".",
"'Y'",
";",
"}",
"if",
"(",
"$",
"seconds",
">",
"$",
"month",
")",
"{",
"$",
"months",
"=",
"floor",
"(",
"$",
"seconds",
"/",
"$",
"month",
")",
";",
"$",
"seconds",
"-=",
"$",
"month",
"*",
"$",
"months",
";",
"$",
"interval_spec",
".=",
"$",
"months",
".",
"'M'",
";",
"}",
"if",
"(",
"$",
"seconds",
">",
"$",
"day",
")",
"{",
"$",
"days",
"=",
"floor",
"(",
"$",
"seconds",
"/",
"$",
"day",
")",
";",
"$",
"seconds",
"-=",
"$",
"day",
"*",
"$",
"days",
";",
"$",
"interval_spec",
".=",
"$",
"days",
".",
"'D'",
";",
"}",
"if",
"(",
"$",
"seconds",
">",
"0",
"||",
"$",
"interval_spec",
"===",
"'P'",
")",
"{",
"$",
"interval_spec",
".=",
"'T'",
";",
"if",
"(",
"$",
"seconds",
">",
"$",
"hour",
")",
"{",
"$",
"hours",
"=",
"floor",
"(",
"$",
"seconds",
"/",
"$",
"hour",
")",
";",
"$",
"seconds",
"-=",
"$",
"hour",
"*",
"$",
"hours",
";",
"$",
"interval_spec",
".=",
"$",
"hours",
".",
"'H'",
";",
"}",
"if",
"(",
"$",
"seconds",
">",
"$",
"minute",
")",
"{",
"$",
"minutes",
"=",
"floor",
"(",
"$",
"seconds",
"/",
"$",
"minute",
")",
";",
"$",
"seconds",
"-=",
"$",
"minute",
"*",
"$",
"minutes",
";",
"$",
"interval_spec",
".=",
"$",
"minutes",
".",
"'M'",
";",
"}",
"$",
"interval_spec",
".=",
"$",
"seconds",
".",
"'S'",
";",
"}",
"return",
"new",
"DateInterval",
"(",
"$",
"interval_spec",
")",
";",
"}"
] | Gets a date interval with appropriate values for the specified
number of seconds
As this method applies on seconds, no time zone considerations
are made. Years are assumed to be 365 days. Months are assumed
to be 30 days.
@param integer $seconds seconds for which to get interval.
@return DateInterval a date interval with the relevant parts
set. | [
"Gets",
"a",
"date",
"interval",
"with",
"appropriate",
"values",
"for",
"the",
"specified",
"number",
"of",
"seconds"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L921-L971 |
33,549 | silverorange/swat | Swat/SwatDate.php | SwatDate.getISO8601 | public function getISO8601($options = 5)
{
if (($options & self::ISO_EXTENDED) === self::ISO_EXTENDED) {
$format = self::DF_ISO_8601_EXTENDED;
} else {
$format = self::DF_ISO_8601_BASIC;
}
if (($options & self::ISO_MICROTIME) === self::ISO_MICROTIME) {
$format .= '.SSSS';
}
$date = $this->format($format);
if (($options & self::ISO_TIME_ZONE) === self::ISO_TIME_ZONE) {
$date .= $this->getFormattedOffsetById($format);
}
return $date;
} | php | public function getISO8601($options = 5)
{
if (($options & self::ISO_EXTENDED) === self::ISO_EXTENDED) {
$format = self::DF_ISO_8601_EXTENDED;
} else {
$format = self::DF_ISO_8601_BASIC;
}
if (($options & self::ISO_MICROTIME) === self::ISO_MICROTIME) {
$format .= '.SSSS';
}
$date = $this->format($format);
if (($options & self::ISO_TIME_ZONE) === self::ISO_TIME_ZONE) {
$date .= $this->getFormattedOffsetById($format);
}
return $date;
} | [
"public",
"function",
"getISO8601",
"(",
"$",
"options",
"=",
"5",
")",
"{",
"if",
"(",
"(",
"$",
"options",
"&",
"self",
"::",
"ISO_EXTENDED",
")",
"===",
"self",
"::",
"ISO_EXTENDED",
")",
"{",
"$",
"format",
"=",
"self",
"::",
"DF_ISO_8601_EXTENDED",
";",
"}",
"else",
"{",
"$",
"format",
"=",
"self",
"::",
"DF_ISO_8601_BASIC",
";",
"}",
"if",
"(",
"(",
"$",
"options",
"&",
"self",
"::",
"ISO_MICROTIME",
")",
"===",
"self",
"::",
"ISO_MICROTIME",
")",
"{",
"$",
"format",
".=",
"'.SSSS'",
";",
"}",
"$",
"date",
"=",
"$",
"this",
"->",
"format",
"(",
"$",
"format",
")",
";",
"if",
"(",
"(",
"$",
"options",
"&",
"self",
"::",
"ISO_TIME_ZONE",
")",
"===",
"self",
"::",
"ISO_TIME_ZONE",
")",
"{",
"$",
"date",
".=",
"$",
"this",
"->",
"getFormattedOffsetById",
"(",
"$",
"format",
")",
";",
"}",
"return",
"$",
"date",
";",
"}"
] | Gets this date formatted as an ISO 8601 timestamp
Options are:
- <kbd>{@link SwatDate::ISO_EXTENDED}</kbd> - include '-' and ':'
separators.
- <kbd>{@link SwatDate::ISO_MICROTIME}</kbd> - include microseconds.
- <kbd>{@link SwatDate::ISO_TIME_ZONE}</kbd> - include time zone.
@param integer $options optional. A bitwise combination of options.
Options include the SwatDate::ISO_* constants.
Default options are to use extended formatting
and to include time zone offset.
@return string this date formatted as an ISO 8601 timestamp. | [
"Gets",
"this",
"date",
"formatted",
"as",
"an",
"ISO",
"8601",
"timestamp"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1083-L1102 |
33,550 | silverorange/swat | Swat/SwatDate.php | SwatDate.getFormattedOffsetById | public function getFormattedOffsetById($id)
{
switch ($id) {
case self::DF_ISO_8601_BASIC:
case self::DF_ISO_8601_EXTENDED:
case self::DF_RFC_2822:
$offset = $this->getOffset();
$offset = intval(floor($offset / 60)); // minutes
if ($offset === 0) {
$offset = 'Z';
} else {
$offset_hours = floor($offset / 60);
$offset_minutes = abs($offset % 60);
$offset = sprintf(
'%+03.0d:%02.0d',
$offset_hours,
$offset_minutes
);
}
return $offset;
default:
throw new Exception("Unknown offset format for id '$id'.");
}
} | php | public function getFormattedOffsetById($id)
{
switch ($id) {
case self::DF_ISO_8601_BASIC:
case self::DF_ISO_8601_EXTENDED:
case self::DF_RFC_2822:
$offset = $this->getOffset();
$offset = intval(floor($offset / 60)); // minutes
if ($offset === 0) {
$offset = 'Z';
} else {
$offset_hours = floor($offset / 60);
$offset_minutes = abs($offset % 60);
$offset = sprintf(
'%+03.0d:%02.0d',
$offset_hours,
$offset_minutes
);
}
return $offset;
default:
throw new Exception("Unknown offset format for id '$id'.");
}
} | [
"public",
"function",
"getFormattedOffsetById",
"(",
"$",
"id",
")",
"{",
"switch",
"(",
"$",
"id",
")",
"{",
"case",
"self",
"::",
"DF_ISO_8601_BASIC",
":",
"case",
"self",
"::",
"DF_ISO_8601_EXTENDED",
":",
"case",
"self",
"::",
"DF_RFC_2822",
":",
"$",
"offset",
"=",
"$",
"this",
"->",
"getOffset",
"(",
")",
";",
"$",
"offset",
"=",
"intval",
"(",
"floor",
"(",
"$",
"offset",
"/",
"60",
")",
")",
";",
"// minutes",
"if",
"(",
"$",
"offset",
"===",
"0",
")",
"{",
"$",
"offset",
"=",
"'Z'",
";",
"}",
"else",
"{",
"$",
"offset_hours",
"=",
"floor",
"(",
"$",
"offset",
"/",
"60",
")",
";",
"$",
"offset_minutes",
"=",
"abs",
"(",
"$",
"offset",
"%",
"60",
")",
";",
"$",
"offset",
"=",
"sprintf",
"(",
"'%+03.0d:%02.0d'",
",",
"$",
"offset_hours",
",",
"$",
"offset_minutes",
")",
";",
"}",
"return",
"$",
"offset",
";",
"default",
":",
"throw",
"new",
"Exception",
"(",
"\"Unknown offset format for id '$id'.\"",
")",
";",
"}",
"}"
] | Returns this date's timezone offset from GMT using a format id.
@param integer $format an integer date format id.
@return string the formatted timezone offset. | [
"Returns",
"this",
"date",
"s",
"timezone",
"offset",
"from",
"GMT",
"using",
"a",
"format",
"id",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1129-L1155 |
33,551 | silverorange/swat | Swat/SwatDate.php | SwatDate.setTZ | public function setTZ(DateTimeZone $time_zone)
{
$this->addSeconds($this->format('Z'));
$result = $this->setTimezone($time_zone);
$this->subtractSeconds($this->format('Z'));
return $result;
} | php | public function setTZ(DateTimeZone $time_zone)
{
$this->addSeconds($this->format('Z'));
$result = $this->setTimezone($time_zone);
$this->subtractSeconds($this->format('Z'));
return $result;
} | [
"public",
"function",
"setTZ",
"(",
"DateTimeZone",
"$",
"time_zone",
")",
"{",
"$",
"this",
"->",
"addSeconds",
"(",
"$",
"this",
"->",
"format",
"(",
"'Z'",
")",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"setTimezone",
"(",
"$",
"time_zone",
")",
";",
"$",
"this",
"->",
"subtractSeconds",
"(",
"$",
"this",
"->",
"format",
"(",
"'Z'",
")",
")",
";",
"return",
"$",
"result",
";",
"}"
] | Sets the time zone for this date and updates this date's time so the
hours are the same as with the old time zone
@param DateTimeZone $time_zone the new time zone.
@return mixed this object on success, or false if the time zone name is
invalid. | [
"Sets",
"the",
"time",
"zone",
"for",
"this",
"date",
"and",
"updates",
"this",
"date",
"s",
"time",
"so",
"the",
"hours",
"are",
"the",
"same",
"as",
"with",
"the",
"old",
"time",
"zone"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1329-L1335 |
33,552 | silverorange/swat | Swat/SwatDate.php | SwatDate.addYears | public function addYears($years)
{
$years = (int) $years;
$interval = new DateInterval('P' . abs($years) . 'Y');
if ($years < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | php | public function addYears($years)
{
$years = (int) $years;
$interval = new DateInterval('P' . abs($years) . 'Y');
if ($years < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | [
"public",
"function",
"addYears",
"(",
"$",
"years",
")",
"{",
"$",
"years",
"=",
"(",
"int",
")",
"$",
"years",
";",
"$",
"interval",
"=",
"new",
"DateInterval",
"(",
"'P'",
".",
"abs",
"(",
"$",
"years",
")",
".",
"'Y'",
")",
";",
"if",
"(",
"$",
"years",
"<",
"0",
")",
"{",
"$",
"interval",
"->",
"invert",
"=",
"1",
";",
"}",
"return",
"$",
"this",
"->",
"add",
"(",
"$",
"interval",
")",
";",
"}"
] | Adds the specified number of years to this date
@param integer $years the number of years to add.
@return this object on success or false on failure. | [
"Adds",
"the",
"specified",
"number",
"of",
"years",
"to",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1394-L1404 |
33,553 | silverorange/swat | Swat/SwatDate.php | SwatDate.subtractYears | public function subtractYears($years)
{
$years = (int) $years;
$years = -$years;
return $this->addYears($years);
} | php | public function subtractYears($years)
{
$years = (int) $years;
$years = -$years;
return $this->addYears($years);
} | [
"public",
"function",
"subtractYears",
"(",
"$",
"years",
")",
"{",
"$",
"years",
"=",
"(",
"int",
")",
"$",
"years",
";",
"$",
"years",
"=",
"-",
"$",
"years",
";",
"return",
"$",
"this",
"->",
"addYears",
"(",
"$",
"years",
")",
";",
"}"
] | Subtracts the specified number of years from this date
@param integer $years the number of years to subtract.
@return this object on success or false on failure. | [
"Subtracts",
"the",
"specified",
"number",
"of",
"years",
"from",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1416-L1421 |
33,554 | silverorange/swat | Swat/SwatDate.php | SwatDate.addMonths | public function addMonths($months)
{
$months = (int) $months;
$interval = new DateInterval('P' . abs($months) . 'M');
if ($months < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | php | public function addMonths($months)
{
$months = (int) $months;
$interval = new DateInterval('P' . abs($months) . 'M');
if ($months < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | [
"public",
"function",
"addMonths",
"(",
"$",
"months",
")",
"{",
"$",
"months",
"=",
"(",
"int",
")",
"$",
"months",
";",
"$",
"interval",
"=",
"new",
"DateInterval",
"(",
"'P'",
".",
"abs",
"(",
"$",
"months",
")",
".",
"'M'",
")",
";",
"if",
"(",
"$",
"months",
"<",
"0",
")",
"{",
"$",
"interval",
"->",
"invert",
"=",
"1",
";",
"}",
"return",
"$",
"this",
"->",
"add",
"(",
"$",
"interval",
")",
";",
"}"
] | Adds the specified number of months to this date
@param integer $months the number of months to add.
@return this object on success or false on failure. | [
"Adds",
"the",
"specified",
"number",
"of",
"months",
"to",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1433-L1443 |
33,555 | silverorange/swat | Swat/SwatDate.php | SwatDate.subtractMonths | public function subtractMonths($months)
{
$months = (int) $months;
$months = -$months;
return $this->addMonths($months);
} | php | public function subtractMonths($months)
{
$months = (int) $months;
$months = -$months;
return $this->addMonths($months);
} | [
"public",
"function",
"subtractMonths",
"(",
"$",
"months",
")",
"{",
"$",
"months",
"=",
"(",
"int",
")",
"$",
"months",
";",
"$",
"months",
"=",
"-",
"$",
"months",
";",
"return",
"$",
"this",
"->",
"addMonths",
"(",
"$",
"months",
")",
";",
"}"
] | Subtracts the specified number of months from this date
@param integer $months the number of months to subtract.
@return this object on success or false on failure. | [
"Subtracts",
"the",
"specified",
"number",
"of",
"months",
"from",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1455-L1460 |
33,556 | silverorange/swat | Swat/SwatDate.php | SwatDate.addDays | public function addDays($days)
{
$days = (int) $days;
$interval = new DateInterval('P' . abs($days) . 'D');
if ($days < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | php | public function addDays($days)
{
$days = (int) $days;
$interval = new DateInterval('P' . abs($days) . 'D');
if ($days < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | [
"public",
"function",
"addDays",
"(",
"$",
"days",
")",
"{",
"$",
"days",
"=",
"(",
"int",
")",
"$",
"days",
";",
"$",
"interval",
"=",
"new",
"DateInterval",
"(",
"'P'",
".",
"abs",
"(",
"$",
"days",
")",
".",
"'D'",
")",
";",
"if",
"(",
"$",
"days",
"<",
"0",
")",
"{",
"$",
"interval",
"->",
"invert",
"=",
"1",
";",
"}",
"return",
"$",
"this",
"->",
"add",
"(",
"$",
"interval",
")",
";",
"}"
] | Adds the specified number of days to this date
@param integer $days the number of days to add.
@return this object on success or false on failure. | [
"Adds",
"the",
"specified",
"number",
"of",
"days",
"to",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1472-L1482 |
33,557 | silverorange/swat | Swat/SwatDate.php | SwatDate.subtractDays | public function subtractDays($days)
{
$days = (int) $days;
$days = -$days;
return $this->addDays($days);
} | php | public function subtractDays($days)
{
$days = (int) $days;
$days = -$days;
return $this->addDays($days);
} | [
"public",
"function",
"subtractDays",
"(",
"$",
"days",
")",
"{",
"$",
"days",
"=",
"(",
"int",
")",
"$",
"days",
";",
"$",
"days",
"=",
"-",
"$",
"days",
";",
"return",
"$",
"this",
"->",
"addDays",
"(",
"$",
"days",
")",
";",
"}"
] | Subtracts the specified number of days from this date
@param integer $days the number of days to subtract.
@return this object on success or false on failure. | [
"Subtracts",
"the",
"specified",
"number",
"of",
"days",
"from",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1494-L1499 |
33,558 | silverorange/swat | Swat/SwatDate.php | SwatDate.addHours | public function addHours($hours)
{
$hours = (int) $hours;
$interval = new DateInterval('PT' . abs($hours) . 'H');
if ($hours < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | php | public function addHours($hours)
{
$hours = (int) $hours;
$interval = new DateInterval('PT' . abs($hours) . 'H');
if ($hours < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | [
"public",
"function",
"addHours",
"(",
"$",
"hours",
")",
"{",
"$",
"hours",
"=",
"(",
"int",
")",
"$",
"hours",
";",
"$",
"interval",
"=",
"new",
"DateInterval",
"(",
"'PT'",
".",
"abs",
"(",
"$",
"hours",
")",
".",
"'H'",
")",
";",
"if",
"(",
"$",
"hours",
"<",
"0",
")",
"{",
"$",
"interval",
"->",
"invert",
"=",
"1",
";",
"}",
"return",
"$",
"this",
"->",
"add",
"(",
"$",
"interval",
")",
";",
"}"
] | Adds the specified number of hours to this date
@param integer $hours the number of hours to add.
@return this object on success or false on failure. | [
"Adds",
"the",
"specified",
"number",
"of",
"hours",
"to",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1511-L1521 |
33,559 | silverorange/swat | Swat/SwatDate.php | SwatDate.subtractHours | public function subtractHours($hours)
{
$hours = (int) $hours;
$hours = -$hours;
return $this->addHours($hours);
} | php | public function subtractHours($hours)
{
$hours = (int) $hours;
$hours = -$hours;
return $this->addHours($hours);
} | [
"public",
"function",
"subtractHours",
"(",
"$",
"hours",
")",
"{",
"$",
"hours",
"=",
"(",
"int",
")",
"$",
"hours",
";",
"$",
"hours",
"=",
"-",
"$",
"hours",
";",
"return",
"$",
"this",
"->",
"addHours",
"(",
"$",
"hours",
")",
";",
"}"
] | Subtracts the specified number of hours from this date
@param integer $hours the number of hours to subtract.
@return this object on success or false on failure. | [
"Subtracts",
"the",
"specified",
"number",
"of",
"hours",
"from",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1533-L1538 |
33,560 | silverorange/swat | Swat/SwatDate.php | SwatDate.addMinutes | public function addMinutes($minutes)
{
$minutes = (int) $minutes;
$interval = new DateInterval('PT' . abs($minutes) . 'M');
if ($minutes < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | php | public function addMinutes($minutes)
{
$minutes = (int) $minutes;
$interval = new DateInterval('PT' . abs($minutes) . 'M');
if ($minutes < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | [
"public",
"function",
"addMinutes",
"(",
"$",
"minutes",
")",
"{",
"$",
"minutes",
"=",
"(",
"int",
")",
"$",
"minutes",
";",
"$",
"interval",
"=",
"new",
"DateInterval",
"(",
"'PT'",
".",
"abs",
"(",
"$",
"minutes",
")",
".",
"'M'",
")",
";",
"if",
"(",
"$",
"minutes",
"<",
"0",
")",
"{",
"$",
"interval",
"->",
"invert",
"=",
"1",
";",
"}",
"return",
"$",
"this",
"->",
"add",
"(",
"$",
"interval",
")",
";",
"}"
] | Adds the specified number of minutes to this date
@param integer $minutes the number of minutes to add.
@return this object on success or false on failure. | [
"Adds",
"the",
"specified",
"number",
"of",
"minutes",
"to",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1550-L1560 |
33,561 | silverorange/swat | Swat/SwatDate.php | SwatDate.subtractMinutes | public function subtractMinutes($minutes)
{
$minutes = (int) $minutes;
$minutes = -$minutes;
return $this->addMinutes($minutes);
} | php | public function subtractMinutes($minutes)
{
$minutes = (int) $minutes;
$minutes = -$minutes;
return $this->addMinutes($minutes);
} | [
"public",
"function",
"subtractMinutes",
"(",
"$",
"minutes",
")",
"{",
"$",
"minutes",
"=",
"(",
"int",
")",
"$",
"minutes",
";",
"$",
"minutes",
"=",
"-",
"$",
"minutes",
";",
"return",
"$",
"this",
"->",
"addMinutes",
"(",
"$",
"minutes",
")",
";",
"}"
] | Subtracts the specified number of minutes from this date
@param integer $minutes the number of minutes to subtract.
@return this object on success or false on failure. | [
"Subtracts",
"the",
"specified",
"number",
"of",
"minutes",
"from",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1572-L1577 |
33,562 | silverorange/swat | Swat/SwatDate.php | SwatDate.addSeconds | public function addSeconds($seconds)
{
$seconds = (float) $seconds;
$interval = new DateInterval('PT' . abs($seconds) . 'S');
if ($seconds < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | php | public function addSeconds($seconds)
{
$seconds = (float) $seconds;
$interval = new DateInterval('PT' . abs($seconds) . 'S');
if ($seconds < 0) {
$interval->invert = 1;
}
return $this->add($interval);
} | [
"public",
"function",
"addSeconds",
"(",
"$",
"seconds",
")",
"{",
"$",
"seconds",
"=",
"(",
"float",
")",
"$",
"seconds",
";",
"$",
"interval",
"=",
"new",
"DateInterval",
"(",
"'PT'",
".",
"abs",
"(",
"$",
"seconds",
")",
".",
"'S'",
")",
";",
"if",
"(",
"$",
"seconds",
"<",
"0",
")",
"{",
"$",
"interval",
"->",
"invert",
"=",
"1",
";",
"}",
"return",
"$",
"this",
"->",
"add",
"(",
"$",
"interval",
")",
";",
"}"
] | Adds the specified number of seconds to this date
@param float $seconds the number of seconds to add.
@return this object on success or false on failure. | [
"Adds",
"the",
"specified",
"number",
"of",
"seconds",
"to",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1589-L1599 |
33,563 | silverorange/swat | Swat/SwatDate.php | SwatDate.subtractSeconds | public function subtractSeconds($seconds)
{
$seconds = (float) $seconds;
$seconds = -$seconds;
return $this->addSeconds($seconds);
} | php | public function subtractSeconds($seconds)
{
$seconds = (float) $seconds;
$seconds = -$seconds;
return $this->addSeconds($seconds);
} | [
"public",
"function",
"subtractSeconds",
"(",
"$",
"seconds",
")",
"{",
"$",
"seconds",
"=",
"(",
"float",
")",
"$",
"seconds",
";",
"$",
"seconds",
"=",
"-",
"$",
"seconds",
";",
"return",
"$",
"this",
"->",
"addSeconds",
"(",
"$",
"seconds",
")",
";",
"}"
] | Subtracts the specified number of seconds from this date
@param float $seconds the number of seconds to subtract.
@return this object on success or false on failure. | [
"Subtracts",
"the",
"specified",
"number",
"of",
"seconds",
"from",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1611-L1616 |
33,564 | silverorange/swat | Swat/SwatDate.php | SwatDate.setDate | public function setDate($year, $month, $day)
{
if (!checkdate($month, $day, $year)) {
return false;
}
return parent::setDate($year, $month, $day);
} | php | public function setDate($year, $month, $day)
{
if (!checkdate($month, $day, $year)) {
return false;
}
return parent::setDate($year, $month, $day);
} | [
"public",
"function",
"setDate",
"(",
"$",
"year",
",",
"$",
"month",
",",
"$",
"day",
")",
"{",
"if",
"(",
"!",
"checkdate",
"(",
"$",
"month",
",",
"$",
"day",
",",
"$",
"year",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"parent",
"::",
"setDate",
"(",
"$",
"year",
",",
"$",
"month",
",",
"$",
"day",
")",
";",
"}"
] | Sets the date fields for this date
This differs from PHP's DateTime in that it returns false if the
parameters are not a valid date (i.e. February 31st).
@param integer $year the year.
@param integer $month the month.
@param integer $day the day.
@return mixed either this object on success, or false if the resulting
date is not a valid date. | [
"Sets",
"the",
"date",
"fields",
"for",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1634-L1641 |
33,565 | silverorange/swat | Swat/SwatDate.php | SwatDate.addStrictMonths | public function addStrictMonths($months)
{
$months = (int) $months;
$years = (int) ($months / 12);
$months = $months % 12;
$year = $this->getYear() + $years;
$month = $this->getMonth() + $months;
if ($month < 1) {
$year -= 1;
$month += 12;
} elseif ($month > 12) {
$year += 1;
$month -= 12;
}
$success = $this->setDate($year, $month, $this->getDay());
if (!$success) {
throw new Exception(
sprintf(
'Can not add %d whole months to %s.',
$months,
$this->format('c')
)
);
}
return $this;
} | php | public function addStrictMonths($months)
{
$months = (int) $months;
$years = (int) ($months / 12);
$months = $months % 12;
$year = $this->getYear() + $years;
$month = $this->getMonth() + $months;
if ($month < 1) {
$year -= 1;
$month += 12;
} elseif ($month > 12) {
$year += 1;
$month -= 12;
}
$success = $this->setDate($year, $month, $this->getDay());
if (!$success) {
throw new Exception(
sprintf(
'Can not add %d whole months to %s.',
$months,
$this->format('c')
)
);
}
return $this;
} | [
"public",
"function",
"addStrictMonths",
"(",
"$",
"months",
")",
"{",
"$",
"months",
"=",
"(",
"int",
")",
"$",
"months",
";",
"$",
"years",
"=",
"(",
"int",
")",
"(",
"$",
"months",
"/",
"12",
")",
";",
"$",
"months",
"=",
"$",
"months",
"%",
"12",
";",
"$",
"year",
"=",
"$",
"this",
"->",
"getYear",
"(",
")",
"+",
"$",
"years",
";",
"$",
"month",
"=",
"$",
"this",
"->",
"getMonth",
"(",
")",
"+",
"$",
"months",
";",
"if",
"(",
"$",
"month",
"<",
"1",
")",
"{",
"$",
"year",
"-=",
"1",
";",
"$",
"month",
"+=",
"12",
";",
"}",
"elseif",
"(",
"$",
"month",
">",
"12",
")",
"{",
"$",
"year",
"+=",
"1",
";",
"$",
"month",
"-=",
"12",
";",
"}",
"$",
"success",
"=",
"$",
"this",
"->",
"setDate",
"(",
"$",
"year",
",",
"$",
"month",
",",
"$",
"this",
"->",
"getDay",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"success",
")",
"{",
"throw",
"new",
"Exception",
"(",
"sprintf",
"(",
"'Can not add %d whole months to %s.'",
",",
"$",
"months",
",",
"$",
"this",
"->",
"format",
"(",
"'c'",
")",
")",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Adds months to this date without affecting the day of the month
This differs from {@link SwatDate::addMonths()} in how dates at the end
of a month are handled. In SwatDate::addMonths(), if one month is added
to January 31, the resulting date will be March 2 or 3 depending on
if it is a leap year.
In this method, if one month is added to January 31, an exception is
thrown.
@param integer $months the number of months to add.
@return SwatDate this object.
@throws Exception if the resulting date is invalid (i.e. February 30) an
exception is thrown. | [
"Adds",
"months",
"to",
"this",
"date",
"without",
"affecting",
"the",
"day",
"of",
"the",
"month"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1836-L1867 |
33,566 | silverorange/swat | Swat/SwatDate.php | SwatDate.unserialize | public function unserialize($serialized)
{
$data = unserialize($serialized);
// Calling __construct here is required to avoid PHP warnings. See
// PHP bug #65151. DateTime objects that are created through
// unserialization are not properly initialized until __construct() is
// called.
$this->__construct('@' . $data[0]);
// DateTime constructor with timestamp is always UTC so set time zone
$this->setTimezone(new DateTimeZone($data[1]));
} | php | public function unserialize($serialized)
{
$data = unserialize($serialized);
// Calling __construct here is required to avoid PHP warnings. See
// PHP bug #65151. DateTime objects that are created through
// unserialization are not properly initialized until __construct() is
// called.
$this->__construct('@' . $data[0]);
// DateTime constructor with timestamp is always UTC so set time zone
$this->setTimezone(new DateTimeZone($data[1]));
} | [
"public",
"function",
"unserialize",
"(",
"$",
"serialized",
")",
"{",
"$",
"data",
"=",
"unserialize",
"(",
"$",
"serialized",
")",
";",
"// Calling __construct here is required to avoid PHP warnings. See",
"// PHP bug #65151. DateTime objects that are created through",
"// unserialization are not properly initialized until __construct() is",
"// called.",
"$",
"this",
"->",
"__construct",
"(",
"'@'",
".",
"$",
"data",
"[",
"0",
"]",
")",
";",
"// DateTime constructor with timestamp is always UTC so set time zone",
"$",
"this",
"->",
"setTimezone",
"(",
"new",
"DateTimeZone",
"(",
"$",
"data",
"[",
"1",
"]",
")",
")",
";",
"}"
] | Unserializes this date
@param string $serialized the serialized date data. | [
"Unserializes",
"this",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDate.php#L1920-L1932 |
33,567 | brainworxx/kreXX | src/Analyse/Callback/Iterate/ThroughResource.php | ThroughResource.callMe | public function callMe()
{
// Allow the start event to change the provided meta data.
$output = $this->dispatchStartEvent();
// Temporarily disable code gen.
$isAllowedCodeGen = $this->pool->codegenHandler->getAllowCodegen();
$this->pool->codegenHandler->setAllowCodegen(false);
foreach ($this->parameters[static::PARAM_DATA] as $name => $data) {
$output .= $this->pool->routing->analysisHub(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($data)
->setName(str_replace('_', ' ', $name))
->setNormal($data)
);
}
// Reset code generation.
$this->pool->codegenHandler->setAllowCodegen($isAllowedCodeGen);
return $output;
} | php | public function callMe()
{
// Allow the start event to change the provided meta data.
$output = $this->dispatchStartEvent();
// Temporarily disable code gen.
$isAllowedCodeGen = $this->pool->codegenHandler->getAllowCodegen();
$this->pool->codegenHandler->setAllowCodegen(false);
foreach ($this->parameters[static::PARAM_DATA] as $name => $data) {
$output .= $this->pool->routing->analysisHub(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($data)
->setName(str_replace('_', ' ', $name))
->setNormal($data)
);
}
// Reset code generation.
$this->pool->codegenHandler->setAllowCodegen($isAllowedCodeGen);
return $output;
} | [
"public",
"function",
"callMe",
"(",
")",
"{",
"// Allow the start event to change the provided meta data.",
"$",
"output",
"=",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
";",
"// Temporarily disable code gen.",
"$",
"isAllowedCodeGen",
"=",
"$",
"this",
"->",
"pool",
"->",
"codegenHandler",
"->",
"getAllowCodegen",
"(",
")",
";",
"$",
"this",
"->",
"pool",
"->",
"codegenHandler",
"->",
"setAllowCodegen",
"(",
"false",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_DATA",
"]",
"as",
"$",
"name",
"=>",
"$",
"data",
")",
"{",
"$",
"output",
".=",
"$",
"this",
"->",
"pool",
"->",
"routing",
"->",
"analysisHub",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setData",
"(",
"$",
"data",
")",
"->",
"setName",
"(",
"str_replace",
"(",
"'_'",
",",
"' '",
",",
"$",
"name",
")",
")",
"->",
"setNormal",
"(",
"$",
"data",
")",
")",
";",
"}",
"// Reset code generation.",
"$",
"this",
"->",
"pool",
"->",
"codegenHandler",
"->",
"setAllowCodegen",
"(",
"$",
"isAllowedCodeGen",
")",
";",
"return",
"$",
"output",
";",
"}"
] | Renders the info of a resource.
@return string
The generated markup. | [
"Renders",
"the",
"info",
"of",
"a",
"resource",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughResource.php#L60-L82 |
33,568 | brainworxx/kreXX | src/Service/Factory/Pool.php | Pool.checkEnvironment | protected function checkEnvironment()
{
// Check chunk folder is writable.
// If not, give feedback!
$chunkFolder = $this->config->getChunkDir();
if (is_writeable($chunkFolder) === false) {
$chunkFolder = $this->fileService->filterFilePath($chunkFolder);
$this->messages->addMessage('chunksNotWritable', array($chunkFolder));
// We can work without chunks, but this will require much more memory!
$this->chunks->setUseChunks(false);
}
// Check if the log folder is writable.
// If not, give feedback!
$logFolder = $this->config->getLogDir();
if (is_writeable($logFolder) === false) {
$logFolder = $this->fileService->filterFilePath($logFolder);
$this->messages->addMessage('logNotWritable', array($logFolder));
// Tell the chunk output that we have no write access in the logging
// folder.
$this->chunks->setUseLogging(false);
}
// At this point, we won't inform the dev right away. The error message
// will pop up, when kreXX is actually displayed, no need to bother the
// dev just now.
} | php | protected function checkEnvironment()
{
// Check chunk folder is writable.
// If not, give feedback!
$chunkFolder = $this->config->getChunkDir();
if (is_writeable($chunkFolder) === false) {
$chunkFolder = $this->fileService->filterFilePath($chunkFolder);
$this->messages->addMessage('chunksNotWritable', array($chunkFolder));
// We can work without chunks, but this will require much more memory!
$this->chunks->setUseChunks(false);
}
// Check if the log folder is writable.
// If not, give feedback!
$logFolder = $this->config->getLogDir();
if (is_writeable($logFolder) === false) {
$logFolder = $this->fileService->filterFilePath($logFolder);
$this->messages->addMessage('logNotWritable', array($logFolder));
// Tell the chunk output that we have no write access in the logging
// folder.
$this->chunks->setUseLogging(false);
}
// At this point, we won't inform the dev right away. The error message
// will pop up, when kreXX is actually displayed, no need to bother the
// dev just now.
} | [
"protected",
"function",
"checkEnvironment",
"(",
")",
"{",
"// Check chunk folder is writable.",
"// If not, give feedback!",
"$",
"chunkFolder",
"=",
"$",
"this",
"->",
"config",
"->",
"getChunkDir",
"(",
")",
";",
"if",
"(",
"is_writeable",
"(",
"$",
"chunkFolder",
")",
"===",
"false",
")",
"{",
"$",
"chunkFolder",
"=",
"$",
"this",
"->",
"fileService",
"->",
"filterFilePath",
"(",
"$",
"chunkFolder",
")",
";",
"$",
"this",
"->",
"messages",
"->",
"addMessage",
"(",
"'chunksNotWritable'",
",",
"array",
"(",
"$",
"chunkFolder",
")",
")",
";",
"// We can work without chunks, but this will require much more memory!",
"$",
"this",
"->",
"chunks",
"->",
"setUseChunks",
"(",
"false",
")",
";",
"}",
"// Check if the log folder is writable.",
"// If not, give feedback!",
"$",
"logFolder",
"=",
"$",
"this",
"->",
"config",
"->",
"getLogDir",
"(",
")",
";",
"if",
"(",
"is_writeable",
"(",
"$",
"logFolder",
")",
"===",
"false",
")",
"{",
"$",
"logFolder",
"=",
"$",
"this",
"->",
"fileService",
"->",
"filterFilePath",
"(",
"$",
"logFolder",
")",
";",
"$",
"this",
"->",
"messages",
"->",
"addMessage",
"(",
"'logNotWritable'",
",",
"array",
"(",
"$",
"logFolder",
")",
")",
";",
"// Tell the chunk output that we have no write access in the logging",
"// folder.",
"$",
"this",
"->",
"chunks",
"->",
"setUseLogging",
"(",
"false",
")",
";",
"}",
"// At this point, we won't inform the dev right away. The error message",
"// will pop up, when kreXX is actually displayed, no need to bother the",
"// dev just now.",
"}"
] | Check if the environment is as it should be. | [
"Check",
"if",
"the",
"environment",
"is",
"as",
"it",
"should",
"be",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Factory/Pool.php#L200-L226 |
33,569 | silverorange/swat | Swat/SwatReplicableContainer.php | SwatReplicableContainer.init | public function init()
{
// TODO: remove this when deprecated $replicators property is removed
if ($this->replication_ids === null && $this->replicators !== null) {
$this->replication_ids = array_keys($this->replicators);
}
if ($this->replication_ids === null) {
$this->replication_ids = array(0);
}
// Remove children, these are now the prototype widgets
foreach ($this->children as $child_widget) {
$this->prototype_widgets[] = $this->remove($child_widget);
}
foreach ($this->replication_ids as $id) {
$this->addReplication($id);
}
parent::init();
} | php | public function init()
{
// TODO: remove this when deprecated $replicators property is removed
if ($this->replication_ids === null && $this->replicators !== null) {
$this->replication_ids = array_keys($this->replicators);
}
if ($this->replication_ids === null) {
$this->replication_ids = array(0);
}
// Remove children, these are now the prototype widgets
foreach ($this->children as $child_widget) {
$this->prototype_widgets[] = $this->remove($child_widget);
}
foreach ($this->replication_ids as $id) {
$this->addReplication($id);
}
parent::init();
} | [
"public",
"function",
"init",
"(",
")",
"{",
"// TODO: remove this when deprecated $replicators property is removed",
"if",
"(",
"$",
"this",
"->",
"replication_ids",
"===",
"null",
"&&",
"$",
"this",
"->",
"replicators",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"replication_ids",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"replicators",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"replication_ids",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"replication_ids",
"=",
"array",
"(",
"0",
")",
";",
"}",
"// Remove children, these are now the prototype widgets",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child_widget",
")",
"{",
"$",
"this",
"->",
"prototype_widgets",
"[",
"]",
"=",
"$",
"this",
"->",
"remove",
"(",
"$",
"child_widget",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"replication_ids",
"as",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"addReplication",
"(",
"$",
"id",
")",
";",
"}",
"parent",
"::",
"init",
"(",
")",
";",
"}"
] | Initilizes this replicable container
Goes through the internal widgets, clones them, and adds them to the
widget tree. | [
"Initilizes",
"this",
"replicable",
"container"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatReplicableContainer.php#L68-L89 |
33,570 | silverorange/swat | Swat/SwatReplicableContainer.php | SwatReplicableContainer.getWidget | public function getWidget($widget_id, $replicator_id)
{
$widget = null;
if (isset($this->widgets[$replicator_id][$widget_id])) {
$widget = $this->widgets[$replicator_id][$widget_id];
}
return $widget;
} | php | public function getWidget($widget_id, $replicator_id)
{
$widget = null;
if (isset($this->widgets[$replicator_id][$widget_id])) {
$widget = $this->widgets[$replicator_id][$widget_id];
}
return $widget;
} | [
"public",
"function",
"getWidget",
"(",
"$",
"widget_id",
",",
"$",
"replicator_id",
")",
"{",
"$",
"widget",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"widgets",
"[",
"$",
"replicator_id",
"]",
"[",
"$",
"widget_id",
"]",
")",
")",
"{",
"$",
"widget",
"=",
"$",
"this",
"->",
"widgets",
"[",
"$",
"replicator_id",
"]",
"[",
"$",
"widget_id",
"]",
";",
"}",
"return",
"$",
"widget",
";",
"}"
] | Retrives a reference to a replicated widget
@param string $widget_id the unique id of the original widget
@param string $replicator_id the replicator id of the replicated widget
@return SwatWidget a reference to the replicated widget, or null if the
widget is not found. | [
"Retrives",
"a",
"reference",
"to",
"a",
"replicated",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatReplicableContainer.php#L138-L147 |
33,571 | brainworxx/kreXX | src/Analyse/Routing/Process/ProcessOther.php | ProcessOther.process | public function process(Model $model)
{
// Unknown type, better encode it, just to be sure.
$type = $this->pool->encodingService->encodeString(gettype($model->getData()));
return $this->pool->render->renderSingleChild(
$model->setType($type)
->setNormal('Unhandled type: ' . $type)
->setHelpid('unhandedOtherHelp')
);
} | php | public function process(Model $model)
{
// Unknown type, better encode it, just to be sure.
$type = $this->pool->encodingService->encodeString(gettype($model->getData()));
return $this->pool->render->renderSingleChild(
$model->setType($type)
->setNormal('Unhandled type: ' . $type)
->setHelpid('unhandedOtherHelp')
);
} | [
"public",
"function",
"process",
"(",
"Model",
"$",
"model",
")",
"{",
"// Unknown type, better encode it, just to be sure.",
"$",
"type",
"=",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"encodeString",
"(",
"gettype",
"(",
"$",
"model",
"->",
"getData",
"(",
")",
")",
")",
";",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleChild",
"(",
"$",
"model",
"->",
"setType",
"(",
"$",
"type",
")",
"->",
"setNormal",
"(",
"'Unhandled type: '",
".",
"$",
"type",
")",
"->",
"setHelpid",
"(",
"'unhandedOtherHelp'",
")",
")",
";",
"}"
] | Render a 'dump' for a other type.
@param Model $model
The model with the data for the output.
@return string
The rendered markup. | [
"Render",
"a",
"dump",
"for",
"a",
"other",
"type",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessOther.php#L58-L67 |
33,572 | silverorange/swat | Swat/SwatTreeNode.php | SwatTreeNode.& | public function &getPath()
{
$path = array($this->index);
$parent = $this->parent;
while ($parent !== null) {
$path[] = $parent->index;
$parent = $parent->parent;
}
// we built the path backwards
$path = array_reverse($path);
return $path;
} | php | public function &getPath()
{
$path = array($this->index);
$parent = $this->parent;
while ($parent !== null) {
$path[] = $parent->index;
$parent = $parent->parent;
}
// we built the path backwards
$path = array_reverse($path);
return $path;
} | [
"public",
"function",
"&",
"getPath",
"(",
")",
"{",
"$",
"path",
"=",
"array",
"(",
"$",
"this",
"->",
"index",
")",
";",
"$",
"parent",
"=",
"$",
"this",
"->",
"parent",
";",
"while",
"(",
"$",
"parent",
"!==",
"null",
")",
"{",
"$",
"path",
"[",
"]",
"=",
"$",
"parent",
"->",
"index",
";",
"$",
"parent",
"=",
"$",
"parent",
"->",
"parent",
";",
"}",
"// we built the path backwards",
"$",
"path",
"=",
"array_reverse",
"(",
"$",
"path",
")",
";",
"return",
"$",
"path",
";",
"}"
] | Gets the path to this node
This method travels up the tree until it reaches a node with a parent
of 'null', building a path of ids along the way.
@return array an array of indexes that is the path to the given node
from the root of the current tree. | [
"Gets",
"the",
"path",
"to",
"this",
"node"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTreeNode.php#L94-L108 |
33,573 | silverorange/swat | Swat/SwatTreeNode.php | SwatTreeNode.count | public function count()
{
$count = 1;
foreach ($this->children as $child) {
$count += count($child);
}
return $count;
} | php | public function count()
{
$count = 1;
foreach ($this->children as $child) {
$count += count($child);
}
return $count;
} | [
"public",
"function",
"count",
"(",
")",
"{",
"$",
"count",
"=",
"1",
";",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child",
")",
"{",
"$",
"count",
"+=",
"count",
"(",
"$",
"child",
")",
";",
"}",
"return",
"$",
"count",
";",
"}"
] | Gets the number of nodes in this tree or subtree
This method is needed to fulfill the Countable interface.
@return integer the number of nodes in this tree or subtree. | [
"Gets",
"the",
"number",
"of",
"nodes",
"in",
"this",
"tree",
"or",
"subtree"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTreeNode.php#L261-L269 |
33,574 | brainworxx/kreXX | src/View/Output/Chunks.php | Chunks.chunkMe | public function chunkMe($string)
{
if ($this->useChunks === true && strlen($string) > 10000) {
// Get the key.
$key = $this->genKey();
// Detect the encoding in the chunk.
$this->detectEncoding($string);
// Write the key to the chunks folder.
$this->pool->fileService->putFileContents($this->chunkDir . $key . '.Krexx.tmp', $string);
// Return the first part plus the key.
return static::STRING_DELIMITER . $key . static::STRING_DELIMITER;
}
// Return the original, because it's too small.
return $string;
} | php | public function chunkMe($string)
{
if ($this->useChunks === true && strlen($string) > 10000) {
// Get the key.
$key = $this->genKey();
// Detect the encoding in the chunk.
$this->detectEncoding($string);
// Write the key to the chunks folder.
$this->pool->fileService->putFileContents($this->chunkDir . $key . '.Krexx.tmp', $string);
// Return the first part plus the key.
return static::STRING_DELIMITER . $key . static::STRING_DELIMITER;
}
// Return the original, because it's too small.
return $string;
} | [
"public",
"function",
"chunkMe",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useChunks",
"===",
"true",
"&&",
"strlen",
"(",
"$",
"string",
")",
">",
"10000",
")",
"{",
"// Get the key.",
"$",
"key",
"=",
"$",
"this",
"->",
"genKey",
"(",
")",
";",
"// Detect the encoding in the chunk.",
"$",
"this",
"->",
"detectEncoding",
"(",
"$",
"string",
")",
";",
"// Write the key to the chunks folder.",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"putFileContents",
"(",
"$",
"this",
"->",
"chunkDir",
".",
"$",
"key",
".",
"'.Krexx.tmp'",
",",
"$",
"string",
")",
";",
"// Return the first part plus the key.",
"return",
"static",
"::",
"STRING_DELIMITER",
".",
"$",
"key",
".",
"static",
"::",
"STRING_DELIMITER",
";",
"}",
"// Return the original, because it's too small.",
"return",
"$",
"string",
";",
"}"
] | Splits a string into small chunks.
The chunks are saved to disk and later on.
@param string $string
The data we want to split into chunks.
@return string
The key to the chunk, wrapped up in @@@@@@. | [
"Splits",
"a",
"string",
"into",
"small",
"chunks",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Output/Chunks.php#L160-L175 |
33,575 | brainworxx/kreXX | src/View/Output/Chunks.php | Chunks.dechunkMe | protected function dechunkMe($key)
{
$filename = $this->chunkDir . $key . '.Krexx.tmp';
// Read the file.
$string = $this->pool->fileService->getFileContents($filename);
// Delete it, we don't need it anymore.
$this->pool->fileService->deleteFile($filename);
return $string;
} | php | protected function dechunkMe($key)
{
$filename = $this->chunkDir . $key . '.Krexx.tmp';
// Read the file.
$string = $this->pool->fileService->getFileContents($filename);
// Delete it, we don't need it anymore.
$this->pool->fileService->deleteFile($filename);
return $string;
} | [
"protected",
"function",
"dechunkMe",
"(",
"$",
"key",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"chunkDir",
".",
"$",
"key",
".",
"'.Krexx.tmp'",
";",
"// Read the file.",
"$",
"string",
"=",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"getFileContents",
"(",
"$",
"filename",
")",
";",
"// Delete it, we don't need it anymore.",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"deleteFile",
"(",
"$",
"filename",
")",
";",
"return",
"$",
"string",
";",
"}"
] | Gets the original data from the string.
Reads the data from a file in the chunks folder.
The output may contain other chunk keys.
nothing more then a wrapper for file_get_contents()
@param string $key
The key of the chunk of which we want to get the data.
@return string
The original date | [
"Gets",
"the",
"original",
"data",
"from",
"the",
"string",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Output/Chunks.php#L205-L213 |
33,576 | brainworxx/kreXX | src/View/Output/Chunks.php | Chunks.isOutputHtml | protected function isOutputHtml()
{
static $result;
if ($result !== null) {
return $result;
}
if ($this->pool->config->getSetting(Fallback::SETTING_DETECT_AJAX) === Fallback::VALUE_FALSE) {
// We ignore the heades and send everything.
$result = true;
}
// When we have dispatched a PDF or Json, the browser will not be
// able to render the HTML output correctly.
foreach (headers_list() as $header) {
$header = strtolower($header);
if (strpos($header, 'content-type') !== false &&
strpos($header, 'html') === false
) {
// We do have none html content type.
$result = false;
}
}
// Found nothing, must be HTML.
return $result = true;
} | php | protected function isOutputHtml()
{
static $result;
if ($result !== null) {
return $result;
}
if ($this->pool->config->getSetting(Fallback::SETTING_DETECT_AJAX) === Fallback::VALUE_FALSE) {
// We ignore the heades and send everything.
$result = true;
}
// When we have dispatched a PDF or Json, the browser will not be
// able to render the HTML output correctly.
foreach (headers_list() as $header) {
$header = strtolower($header);
if (strpos($header, 'content-type') !== false &&
strpos($header, 'html') === false
) {
// We do have none html content type.
$result = false;
}
}
// Found nothing, must be HTML.
return $result = true;
} | [
"protected",
"function",
"isOutputHtml",
"(",
")",
"{",
"static",
"$",
"result",
";",
"if",
"(",
"$",
"result",
"!==",
"null",
")",
"{",
"return",
"$",
"result",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"pool",
"->",
"config",
"->",
"getSetting",
"(",
"Fallback",
"::",
"SETTING_DETECT_AJAX",
")",
"===",
"Fallback",
"::",
"VALUE_FALSE",
")",
"{",
"// We ignore the heades and send everything.",
"$",
"result",
"=",
"true",
";",
"}",
"// When we have dispatched a PDF or Json, the browser will not be",
"// able to render the HTML output correctly.",
"foreach",
"(",
"headers_list",
"(",
")",
"as",
"$",
"header",
")",
"{",
"$",
"header",
"=",
"strtolower",
"(",
"$",
"header",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"header",
",",
"'content-type'",
")",
"!==",
"false",
"&&",
"strpos",
"(",
"$",
"header",
",",
"'html'",
")",
"===",
"false",
")",
"{",
"// We do have none html content type.",
"$",
"result",
"=",
"false",
";",
"}",
"}",
"// Found nothing, must be HTML.",
"return",
"$",
"result",
"=",
"true",
";",
"}"
] | Is the output so far HTML?
This one gets called during the shutdown phase of PHP. There is a high
chance, that the header was already set.
@return bool
Well? Is it? | [
"Is",
"the",
"output",
"so",
"far",
"HTML?"
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Output/Chunks.php#L266-L293 |
33,577 | brainworxx/kreXX | src/View/Output/Chunks.php | Chunks.cleanupOldChunks | protected function cleanupOldChunks()
{
if ($this->useChunks === false) {
// We have no write access. Do nothing.
return;
}
static $beenHere = false;
// We only do this once.
if ($beenHere === true) {
return;
}
$beenHere = true;
// Clean up leftover files.
$chunkList = glob($this->chunkDir . '*.Krexx.tmp');
if (empty($chunkList) === false) {
$now = time();
foreach ($chunkList as $file) {
// We delete everything that is older than 15 minutes.
if (($this->pool->fileService->filetime($file) + 900) < $now) {
$this->pool->fileService->deleteFile($file);
}
}
}
} | php | protected function cleanupOldChunks()
{
if ($this->useChunks === false) {
// We have no write access. Do nothing.
return;
}
static $beenHere = false;
// We only do this once.
if ($beenHere === true) {
return;
}
$beenHere = true;
// Clean up leftover files.
$chunkList = glob($this->chunkDir . '*.Krexx.tmp');
if (empty($chunkList) === false) {
$now = time();
foreach ($chunkList as $file) {
// We delete everything that is older than 15 minutes.
if (($this->pool->fileService->filetime($file) + 900) < $now) {
$this->pool->fileService->deleteFile($file);
}
}
}
} | [
"protected",
"function",
"cleanupOldChunks",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useChunks",
"===",
"false",
")",
"{",
"// We have no write access. Do nothing.",
"return",
";",
"}",
"static",
"$",
"beenHere",
"=",
"false",
";",
"// We only do this once.",
"if",
"(",
"$",
"beenHere",
"===",
"true",
")",
"{",
"return",
";",
"}",
"$",
"beenHere",
"=",
"true",
";",
"// Clean up leftover files.",
"$",
"chunkList",
"=",
"glob",
"(",
"$",
"this",
"->",
"chunkDir",
".",
"'*.Krexx.tmp'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"chunkList",
")",
"===",
"false",
")",
"{",
"$",
"now",
"=",
"time",
"(",
")",
";",
"foreach",
"(",
"$",
"chunkList",
"as",
"$",
"file",
")",
"{",
"// We delete everything that is older than 15 minutes.",
"if",
"(",
"(",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"filetime",
"(",
"$",
"file",
")",
"+",
"900",
")",
"<",
"$",
"now",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"deleteFile",
"(",
"$",
"file",
")",
";",
"}",
"}",
"}",
"}"
] | Deletes chunk files older then 1 hour, in case there are some left. | [
"Deletes",
"chunk",
"files",
"older",
"then",
"1",
"hour",
"in",
"case",
"there",
"are",
"some",
"left",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Output/Chunks.php#L354-L380 |
33,578 | brainworxx/kreXX | src/View/Output/Chunks.php | Chunks.cleanupOldLogs | protected function cleanupOldLogs($logDir)
{
if ($this->useLogging === false) {
// We have no write access. Do nothing.
return;
}
// Cleanup old logfiles to prevent a overflow.
$logList = glob($logDir . '*.Krexx.html');
if (empty($logList) === true) {
return;
}
array_multisort(
array_map(array($this->pool->fileService, 'filetime'), $logList),
SORT_DESC,
$logList
);
$maxFileCount = (int)$this->pool->config->getSetting(Fallback::SETTING_MAX_FILES);
$count = 1;
// Cleanup logfiles.
foreach ($logList as $file) {
if ($count > $maxFileCount) {
$this->pool->fileService->deleteFile($file);
$this->pool->fileService->deleteFile($file . '.json');
}
++$count;
}
} | php | protected function cleanupOldLogs($logDir)
{
if ($this->useLogging === false) {
// We have no write access. Do nothing.
return;
}
// Cleanup old logfiles to prevent a overflow.
$logList = glob($logDir . '*.Krexx.html');
if (empty($logList) === true) {
return;
}
array_multisort(
array_map(array($this->pool->fileService, 'filetime'), $logList),
SORT_DESC,
$logList
);
$maxFileCount = (int)$this->pool->config->getSetting(Fallback::SETTING_MAX_FILES);
$count = 1;
// Cleanup logfiles.
foreach ($logList as $file) {
if ($count > $maxFileCount) {
$this->pool->fileService->deleteFile($file);
$this->pool->fileService->deleteFile($file . '.json');
}
++$count;
}
} | [
"protected",
"function",
"cleanupOldLogs",
"(",
"$",
"logDir",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useLogging",
"===",
"false",
")",
"{",
"// We have no write access. Do nothing.",
"return",
";",
"}",
"// Cleanup old logfiles to prevent a overflow.",
"$",
"logList",
"=",
"glob",
"(",
"$",
"logDir",
".",
"'*.Krexx.html'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"logList",
")",
"===",
"true",
")",
"{",
"return",
";",
"}",
"array_multisort",
"(",
"array_map",
"(",
"array",
"(",
"$",
"this",
"->",
"pool",
"->",
"fileService",
",",
"'filetime'",
")",
",",
"$",
"logList",
")",
",",
"SORT_DESC",
",",
"$",
"logList",
")",
";",
"$",
"maxFileCount",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"pool",
"->",
"config",
"->",
"getSetting",
"(",
"Fallback",
"::",
"SETTING_MAX_FILES",
")",
";",
"$",
"count",
"=",
"1",
";",
"// Cleanup logfiles.",
"foreach",
"(",
"$",
"logList",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"count",
">",
"$",
"maxFileCount",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"deleteFile",
"(",
"$",
"file",
")",
";",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"deleteFile",
"(",
"$",
"file",
".",
"'.json'",
")",
";",
"}",
"++",
"$",
"count",
";",
"}",
"}"
] | Deletes old logfiles.
@param string $logDir
The directory with the logfiles. | [
"Deletes",
"old",
"logfiles",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Output/Chunks.php#L388-L418 |
33,579 | brainworxx/kreXX | src/View/Output/Chunks.php | Chunks.detectEncoding | public function detectEncoding($string)
{
$encoding = $this->pool->encodingService->mbDetectEncoding($string);
// We need to decide, if we need to change the official encoding of
// the HTML output with a meta tag. We ignore everything in the
// doNothingEncoding array.
if (in_array($encoding, $this->doNothingEncoding, true) === false) {
$this->officialEncoding = $encoding;
}
} | php | public function detectEncoding($string)
{
$encoding = $this->pool->encodingService->mbDetectEncoding($string);
// We need to decide, if we need to change the official encoding of
// the HTML output with a meta tag. We ignore everything in the
// doNothingEncoding array.
if (in_array($encoding, $this->doNothingEncoding, true) === false) {
$this->officialEncoding = $encoding;
}
} | [
"public",
"function",
"detectEncoding",
"(",
"$",
"string",
")",
"{",
"$",
"encoding",
"=",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"mbDetectEncoding",
"(",
"$",
"string",
")",
";",
"// We need to decide, if we need to change the official encoding of",
"// the HTML output with a meta tag. We ignore everything in the",
"// doNothingEncoding array.",
"if",
"(",
"in_array",
"(",
"$",
"encoding",
",",
"$",
"this",
"->",
"doNothingEncoding",
",",
"true",
")",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"officialEncoding",
"=",
"$",
"encoding",
";",
"}",
"}"
] | Simple wrapper around mb_detect_encoding.
We also try to track the encoding we need to add to the output, so
people can use unicode function names.
We are not using it above, because there we are only handling broken
string encoding by completely encoding it, every char in there.
@see \Brainworxx\Krexx\Analyse\Routing\Process\ProcessString
@param string $string
The string we are processing. | [
"Simple",
"wrapper",
"around",
"mb_detect_encoding",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Output/Chunks.php#L486-L496 |
33,580 | rhoone/yii2-rhoone | models/Extension.php | Extension.setHeadwords | public function setHeadwords($headwords)
{
$results = [];
foreach ($headwords as $headword) {
$results[] = $this->setHeadword($headword);
}
return $results;
} | php | public function setHeadwords($headwords)
{
$results = [];
foreach ($headwords as $headword) {
$results[] = $this->setHeadword($headword);
}
return $results;
} | [
"public",
"function",
"setHeadwords",
"(",
"$",
"headwords",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"headwords",
"as",
"$",
"headword",
")",
"{",
"$",
"results",
"[",
"]",
"=",
"$",
"this",
"->",
"setHeadword",
"(",
"$",
"headword",
")",
";",
"}",
"return",
"$",
"results",
";",
"}"
] | Add headwords.
@param string[]|Headword[] $headwords
@return mixed | [
"Add",
"headwords",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/models/Extension.php#L228-L235 |
33,581 | honey-comb/core | src/Services/HCUserService.php | HCUserService.restore | public function restore(array $userIds): void
{
$this->getRepository()->restore($userIds);
event(new HCUserRestored($userIds));
} | php | public function restore(array $userIds): void
{
$this->getRepository()->restore($userIds);
event(new HCUserRestored($userIds));
} | [
"public",
"function",
"restore",
"(",
"array",
"$",
"userIds",
")",
":",
"void",
"{",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"restore",
"(",
"$",
"userIds",
")",
";",
"event",
"(",
"new",
"HCUserRestored",
"(",
"$",
"userIds",
")",
")",
";",
"}"
] | Restore soft deleted users
@param array $userIds | [
"Restore",
"soft",
"deleted",
"users"
] | 5c12aba31cae092e9681f0ae3e3664ed3fcec956 | https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Services/HCUserService.php#L364-L369 |
33,582 | rollun-com/rollun-datastore | src/DataStore/src/Rql/RqlParser.php | RqlParser.rqlDecode | public static function rqlDecode($rqlQueryString)
{
$rqlQueryString = RqlParser::encodedStrQuery($rqlQueryString);
$rqlQueryString = RqlParser::prepareStringRql($rqlQueryString);
$parser = new self();
$result = $parser->decode($rqlQueryString);
unset($parser);
return $result;
} | php | public static function rqlDecode($rqlQueryString)
{
$rqlQueryString = RqlParser::encodedStrQuery($rqlQueryString);
$rqlQueryString = RqlParser::prepareStringRql($rqlQueryString);
$parser = new self();
$result = $parser->decode($rqlQueryString);
unset($parser);
return $result;
} | [
"public",
"static",
"function",
"rqlDecode",
"(",
"$",
"rqlQueryString",
")",
"{",
"$",
"rqlQueryString",
"=",
"RqlParser",
"::",
"encodedStrQuery",
"(",
"$",
"rqlQueryString",
")",
";",
"$",
"rqlQueryString",
"=",
"RqlParser",
"::",
"prepareStringRql",
"(",
"$",
"rqlQueryString",
")",
";",
"$",
"parser",
"=",
"new",
"self",
"(",
")",
";",
"$",
"result",
"=",
"$",
"parser",
"->",
"decode",
"(",
"$",
"rqlQueryString",
")",
";",
"unset",
"(",
"$",
"parser",
")",
";",
"return",
"$",
"result",
";",
"}"
] | Static method for decode qrl string. Work without rawurlencode str
@param $rqlQueryString .
@return Query | [
"Static",
"method",
"for",
"decode",
"qrl",
"string",
".",
"Work",
"without",
"rawurlencode",
"str"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/Rql/RqlParser.php#L76-L85 |
33,583 | silverorange/swat | SwatDB/SwatDBReadaheadIterator.php | SwatDBReadaheadIterator.iterate | public function iterate()
{
$this->current = $this->getNext();
$this->key = $this->getNextKey();
$valid = $this->current !== null;
if ($valid) {
$this->iterator->next();
}
return $valid;
} | php | public function iterate()
{
$this->current = $this->getNext();
$this->key = $this->getNextKey();
$valid = $this->current !== null;
if ($valid) {
$this->iterator->next();
}
return $valid;
} | [
"public",
"function",
"iterate",
"(",
")",
"{",
"$",
"this",
"->",
"current",
"=",
"$",
"this",
"->",
"getNext",
"(",
")",
";",
"$",
"this",
"->",
"key",
"=",
"$",
"this",
"->",
"getNextKey",
"(",
")",
";",
"$",
"valid",
"=",
"$",
"this",
"->",
"current",
"!==",
"null",
";",
"if",
"(",
"$",
"valid",
")",
"{",
"$",
"this",
"->",
"iterator",
"->",
"next",
"(",
")",
";",
"}",
"return",
"$",
"valid",
";",
"}"
] | Iterates over this readahead iterator
@return boolean true if there is a next item. | [
"Iterates",
"over",
"this",
"readahead",
"iterator"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBReadaheadIterator.php#L164-L176 |
33,584 | silverorange/swat | SwatDB/SwatDBReadaheadIterator.php | SwatDBReadaheadIterator.rewind | public function rewind()
{
$this->iterator->rewind();
$this->current = null;
$this->key = null;
} | php | public function rewind()
{
$this->iterator->rewind();
$this->current = null;
$this->key = null;
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"$",
"this",
"->",
"iterator",
"->",
"rewind",
"(",
")",
";",
"$",
"this",
"->",
"current",
"=",
"null",
";",
"$",
"this",
"->",
"key",
"=",
"null",
";",
"}"
] | Rewinds this readahead iterator back to the start | [
"Rewinds",
"this",
"readahead",
"iterator",
"back",
"to",
"the",
"start"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBReadaheadIterator.php#L184-L189 |
33,585 | silverorange/swat | Swat/SwatYUI.php | SwatYUI.buildHtmlHeadEntrySet | private function buildHtmlHeadEntrySet(array $component_ids, $mode)
{
$set = new SwatHtmlHeadEntrySet();
foreach ($component_ids as $component_id) {
$set->addEntrySet(
self::$components[$component_id]->getHtmlHeadEntrySet($mode)
);
}
$set->addEntry($this->getAttributionHtmlHeadEntry());
return $set;
} | php | private function buildHtmlHeadEntrySet(array $component_ids, $mode)
{
$set = new SwatHtmlHeadEntrySet();
foreach ($component_ids as $component_id) {
$set->addEntrySet(
self::$components[$component_id]->getHtmlHeadEntrySet($mode)
);
}
$set->addEntry($this->getAttributionHtmlHeadEntry());
return $set;
} | [
"private",
"function",
"buildHtmlHeadEntrySet",
"(",
"array",
"$",
"component_ids",
",",
"$",
"mode",
")",
"{",
"$",
"set",
"=",
"new",
"SwatHtmlHeadEntrySet",
"(",
")",
";",
"foreach",
"(",
"$",
"component_ids",
"as",
"$",
"component_id",
")",
"{",
"$",
"set",
"->",
"addEntrySet",
"(",
"self",
"::",
"$",
"components",
"[",
"$",
"component_id",
"]",
"->",
"getHtmlHeadEntrySet",
"(",
"$",
"mode",
")",
")",
";",
"}",
"$",
"set",
"->",
"addEntry",
"(",
"$",
"this",
"->",
"getAttributionHtmlHeadEntry",
"(",
")",
")",
";",
"return",
"$",
"set",
";",
"}"
] | Builds the HTML head entry set required for the YUI components of this
object
@param array $component_ids an array of YUI component ids to build
HTML head entries for.
@param string $mode the YUI component mode to use.
@return SwatHtmlHeadEntrySet the full constructed set of HTML head
entries. | [
"Builds",
"the",
"HTML",
"head",
"entry",
"set",
"required",
"for",
"the",
"YUI",
"components",
"of",
"this",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatYUI.php#L117-L130 |
33,586 | brainworxx/kreXX | src/View/Output/Browser.php | Browser.shutdownCallback | public function shutdownCallback()
{
// Output our chunks.
// Every output is split into 4 chunk strings (header, messages,
// data, footer).
foreach ($this->chunkStrings as $chunkString) {
// Send it to the browser.
$this->pool->chunks->sendDechunkedToBrowser($chunkString);
}
} | php | public function shutdownCallback()
{
// Output our chunks.
// Every output is split into 4 chunk strings (header, messages,
// data, footer).
foreach ($this->chunkStrings as $chunkString) {
// Send it to the browser.
$this->pool->chunks->sendDechunkedToBrowser($chunkString);
}
} | [
"public",
"function",
"shutdownCallback",
"(",
")",
"{",
"// Output our chunks.",
"// Every output is split into 4 chunk strings (header, messages,",
"// data, footer).",
"foreach",
"(",
"$",
"this",
"->",
"chunkStrings",
"as",
"$",
"chunkString",
")",
"{",
"// Send it to the browser.",
"$",
"this",
"->",
"pool",
"->",
"chunks",
"->",
"sendDechunkedToBrowser",
"(",
"$",
"chunkString",
")",
";",
"}",
"}"
] | The shutdown callback.
It gets called when PHP is shutting down. It will render
out kreXX output, to guarantee minimal interference with
the hosting CMS. | [
"The",
"shutdown",
"callback",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Output/Browser.php#L82-L91 |
33,587 | honey-comb/core | src/Console/HCGenerateFormsCommand.php | HCGenerateFormsCommand.handle | public function handle(): void
{
$this->comment('Scanning form items..');
$filePaths = $this->helper->getConfigFilesSorted();
$formHolder = [];
foreach ($filePaths as $filePath) {
$file = json_decode(file_get_contents($filePath), true);
if (isset($file['formData'])) {
$formHolder = array_merge($formHolder, $file['formData']);
}
}
cache()->forget('hc-forms');
cache()->put('hc-forms', $formHolder, now()->addMonth());
$this->info('registered forms: ' . count($formHolder));
$this->comment('-');
} | php | public function handle(): void
{
$this->comment('Scanning form items..');
$filePaths = $this->helper->getConfigFilesSorted();
$formHolder = [];
foreach ($filePaths as $filePath) {
$file = json_decode(file_get_contents($filePath), true);
if (isset($file['formData'])) {
$formHolder = array_merge($formHolder, $file['formData']);
}
}
cache()->forget('hc-forms');
cache()->put('hc-forms', $formHolder, now()->addMonth());
$this->info('registered forms: ' . count($formHolder));
$this->comment('-');
} | [
"public",
"function",
"handle",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"comment",
"(",
"'Scanning form items..'",
")",
";",
"$",
"filePaths",
"=",
"$",
"this",
"->",
"helper",
"->",
"getConfigFilesSorted",
"(",
")",
";",
"$",
"formHolder",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"filePaths",
"as",
"$",
"filePath",
")",
"{",
"$",
"file",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"filePath",
")",
",",
"true",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"file",
"[",
"'formData'",
"]",
")",
")",
"{",
"$",
"formHolder",
"=",
"array_merge",
"(",
"$",
"formHolder",
",",
"$",
"file",
"[",
"'formData'",
"]",
")",
";",
"}",
"}",
"cache",
"(",
")",
"->",
"forget",
"(",
"'hc-forms'",
")",
";",
"cache",
"(",
")",
"->",
"put",
"(",
"'hc-forms'",
",",
"$",
"formHolder",
",",
"now",
"(",
")",
"->",
"addMonth",
"(",
")",
")",
";",
"$",
"this",
"->",
"info",
"(",
"'registered forms: '",
".",
"count",
"(",
"$",
"formHolder",
")",
")",
";",
"$",
"this",
"->",
"comment",
"(",
"'-'",
")",
";",
"}"
] | Get all honeycomb form config files and add it to cache | [
"Get",
"all",
"honeycomb",
"form",
"config",
"files",
"and",
"add",
"it",
"to",
"cache"
] | 5c12aba31cae092e9681f0ae3e3664ed3fcec956 | https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Console/HCGenerateFormsCommand.php#L75-L97 |
33,588 | brainworxx/kreXX | src/View/AbstractRender.php | AbstractRender.renderCaller | protected function renderCaller($file, $line)
{
return str_replace(
array(
static::MARKER_CALLER_FILE,
static::MARKER_CALLER_LINE,
),
array(
$file,
$line,
),
$this->getTemplateFileContent(static::FILE_CALLER)
);
} | php | protected function renderCaller($file, $line)
{
return str_replace(
array(
static::MARKER_CALLER_FILE,
static::MARKER_CALLER_LINE,
),
array(
$file,
$line,
),
$this->getTemplateFileContent(static::FILE_CALLER)
);
} | [
"protected",
"function",
"renderCaller",
"(",
"$",
"file",
",",
"$",
"line",
")",
"{",
"return",
"str_replace",
"(",
"array",
"(",
"static",
"::",
"MARKER_CALLER_FILE",
",",
"static",
"::",
"MARKER_CALLER_LINE",
",",
")",
",",
"array",
"(",
"$",
"file",
",",
"$",
"line",
",",
")",
",",
"$",
"this",
"->",
"getTemplateFileContent",
"(",
"static",
"::",
"FILE_CALLER",
")",
")",
";",
"}"
] | Renders the footer part, where we display from where krexx was called.
@param string $file
The file from where krexx was called.
@param string $line
The line number from where krexx was called.
@return string
The generated markup from the template files. | [
"Renders",
"the",
"footer",
"part",
"where",
"we",
"display",
"from",
"where",
"krexx",
"was",
"called",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/AbstractRender.php#L127-L140 |
33,589 | brainworxx/kreXX | src/View/AbstractRender.php | AbstractRender.renderHelp | protected function renderHelp(Model $model)
{
$data = $model->getJson();
// Test if we have anything to display at all.
if (empty($data) === true) {
return '';
}
// We have at least something to display here.
$helpRow = $this->getTemplateFileContent(static::FILE_HELPROW);
$helpContent = '';
// Add the stuff from the json after the help text, if any.
foreach ($data as $title => $text) {
$helpContent .= str_replace(
array(static::MARKER_HELP_TITLE, static::MARKER_HELP_TEXT),
array($title, $text),
$helpRow
);
}
// Add it into the wrapper.
return str_replace(static::MARKER_HELP, $helpContent, $this->getTemplateFileContent(static::FILE_HELP));
} | php | protected function renderHelp(Model $model)
{
$data = $model->getJson();
// Test if we have anything to display at all.
if (empty($data) === true) {
return '';
}
// We have at least something to display here.
$helpRow = $this->getTemplateFileContent(static::FILE_HELPROW);
$helpContent = '';
// Add the stuff from the json after the help text, if any.
foreach ($data as $title => $text) {
$helpContent .= str_replace(
array(static::MARKER_HELP_TITLE, static::MARKER_HELP_TEXT),
array($title, $text),
$helpRow
);
}
// Add it into the wrapper.
return str_replace(static::MARKER_HELP, $helpContent, $this->getTemplateFileContent(static::FILE_HELP));
} | [
"protected",
"function",
"renderHelp",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"data",
"=",
"$",
"model",
"->",
"getJson",
"(",
")",
";",
"// Test if we have anything to display at all.",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
"===",
"true",
")",
"{",
"return",
"''",
";",
"}",
"// We have at least something to display here.",
"$",
"helpRow",
"=",
"$",
"this",
"->",
"getTemplateFileContent",
"(",
"static",
"::",
"FILE_HELPROW",
")",
";",
"$",
"helpContent",
"=",
"''",
";",
"// Add the stuff from the json after the help text, if any.",
"foreach",
"(",
"$",
"data",
"as",
"$",
"title",
"=>",
"$",
"text",
")",
"{",
"$",
"helpContent",
".=",
"str_replace",
"(",
"array",
"(",
"static",
"::",
"MARKER_HELP_TITLE",
",",
"static",
"::",
"MARKER_HELP_TEXT",
")",
",",
"array",
"(",
"$",
"title",
",",
"$",
"text",
")",
",",
"$",
"helpRow",
")",
";",
"}",
"// Add it into the wrapper.",
"return",
"str_replace",
"(",
"static",
"::",
"MARKER_HELP",
",",
"$",
"helpContent",
",",
"$",
"this",
"->",
"getTemplateFileContent",
"(",
"static",
"::",
"FILE_HELP",
")",
")",
";",
"}"
] | Renders the helptext.
@param Model $model
The ID of the helptext.
@see Usage
@return string
The generated markup from the template files. | [
"Renders",
"the",
"helptext",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/AbstractRender.php#L153-L177 |
33,590 | brainworxx/kreXX | src/View/AbstractRender.php | AbstractRender.renderSearch | protected function renderSearch()
{
return str_replace(
static::MARKER_KREXX_ID,
$this->pool->recursionHandler->getMarker(),
$this->getTemplateFileContent(static::FILE_SEARCH)
);
} | php | protected function renderSearch()
{
return str_replace(
static::MARKER_KREXX_ID,
$this->pool->recursionHandler->getMarker(),
$this->getTemplateFileContent(static::FILE_SEARCH)
);
} | [
"protected",
"function",
"renderSearch",
"(",
")",
"{",
"return",
"str_replace",
"(",
"static",
"::",
"MARKER_KREXX_ID",
",",
"$",
"this",
"->",
"pool",
"->",
"recursionHandler",
"->",
"getMarker",
"(",
")",
",",
"$",
"this",
"->",
"getTemplateFileContent",
"(",
"static",
"::",
"FILE_SEARCH",
")",
")",
";",
"}"
] | Renders the search button and the search menu.
@return string
The generated markup from the template files. | [
"Renders",
"the",
"search",
"button",
"and",
"the",
"search",
"menu",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/AbstractRender.php#L203-L210 |
33,591 | brainworxx/kreXX | src/View/AbstractRender.php | AbstractRender.renderPluginList | protected function renderPluginList()
{
$result = '';
$template = $this->getTemplateFileContent(static::FILE_SI_PLUGIN);
foreach (SettingsGetter::getPlugins() as $plugin) {
if ($plugin[SettingsGetter::IS_ACTIVE] === true) {
$activeClass = 'kisactive';
$activeText = 'active';
} else {
$activeClass = 'kisinactive';
$activeText = 'inactive';
}
$result .= str_replace(
array(
static::MARKER_PLUGIN_ACTIVE_CLASS,
static::MARKER_PLUGIN_ACTIVE_TEXT,
static::MARKER_PLUGIN_TEXT,
),
array(
$activeClass,
$activeText,
$plugin[SettingsGetter::PLUGIN_NAME] . ' ' . $plugin[SettingsGetter::PLUGIN_VERSION]
),
$template
);
}
return $result;
} | php | protected function renderPluginList()
{
$result = '';
$template = $this->getTemplateFileContent(static::FILE_SI_PLUGIN);
foreach (SettingsGetter::getPlugins() as $plugin) {
if ($plugin[SettingsGetter::IS_ACTIVE] === true) {
$activeClass = 'kisactive';
$activeText = 'active';
} else {
$activeClass = 'kisinactive';
$activeText = 'inactive';
}
$result .= str_replace(
array(
static::MARKER_PLUGIN_ACTIVE_CLASS,
static::MARKER_PLUGIN_ACTIVE_TEXT,
static::MARKER_PLUGIN_TEXT,
),
array(
$activeClass,
$activeText,
$plugin[SettingsGetter::PLUGIN_NAME] . ' ' . $plugin[SettingsGetter::PLUGIN_VERSION]
),
$template
);
}
return $result;
} | [
"protected",
"function",
"renderPluginList",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"template",
"=",
"$",
"this",
"->",
"getTemplateFileContent",
"(",
"static",
"::",
"FILE_SI_PLUGIN",
")",
";",
"foreach",
"(",
"SettingsGetter",
"::",
"getPlugins",
"(",
")",
"as",
"$",
"plugin",
")",
"{",
"if",
"(",
"$",
"plugin",
"[",
"SettingsGetter",
"::",
"IS_ACTIVE",
"]",
"===",
"true",
")",
"{",
"$",
"activeClass",
"=",
"'kisactive'",
";",
"$",
"activeText",
"=",
"'active'",
";",
"}",
"else",
"{",
"$",
"activeClass",
"=",
"'kisinactive'",
";",
"$",
"activeText",
"=",
"'inactive'",
";",
"}",
"$",
"result",
".=",
"str_replace",
"(",
"array",
"(",
"static",
"::",
"MARKER_PLUGIN_ACTIVE_CLASS",
",",
"static",
"::",
"MARKER_PLUGIN_ACTIVE_TEXT",
",",
"static",
"::",
"MARKER_PLUGIN_TEXT",
",",
")",
",",
"array",
"(",
"$",
"activeClass",
",",
"$",
"activeText",
",",
"$",
"plugin",
"[",
"SettingsGetter",
"::",
"PLUGIN_NAME",
"]",
".",
"' '",
".",
"$",
"plugin",
"[",
"SettingsGetter",
"::",
"PLUGIN_VERSION",
"]",
")",
",",
"$",
"template",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | Render a list of all registered plugins.
@return string
The generated markup from the template files. | [
"Render",
"a",
"list",
"of",
"all",
"registered",
"plugins",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/AbstractRender.php#L218-L245 |
33,592 | brainworxx/kreXX | src/View/AbstractRender.php | AbstractRender.renderNest | protected function renderNest(Model $model, $isExpanded = false)
{
// Get the dom id.
$domid = $model->getDomid();
if ($domid !== '') {
$domid = 'id="' . $domid . '"';
}
// Are we expanding this one?
if ($isExpanded === true) {
$style = '';
} else {
$style = 'khidden';
}
return str_replace(
array(
static::MARKER_STYLE,
static::MARKER_MAIN_FUNCTION,
static::MARKER_DOM_ID,
),
array(
$style,
$model->renderMe(),
$domid,
),
$this->getTemplateFileContent(static::FILE_NEST)
);
} | php | protected function renderNest(Model $model, $isExpanded = false)
{
// Get the dom id.
$domid = $model->getDomid();
if ($domid !== '') {
$domid = 'id="' . $domid . '"';
}
// Are we expanding this one?
if ($isExpanded === true) {
$style = '';
} else {
$style = 'khidden';
}
return str_replace(
array(
static::MARKER_STYLE,
static::MARKER_MAIN_FUNCTION,
static::MARKER_DOM_ID,
),
array(
$style,
$model->renderMe(),
$domid,
),
$this->getTemplateFileContent(static::FILE_NEST)
);
} | [
"protected",
"function",
"renderNest",
"(",
"Model",
"$",
"model",
",",
"$",
"isExpanded",
"=",
"false",
")",
"{",
"// Get the dom id.",
"$",
"domid",
"=",
"$",
"model",
"->",
"getDomid",
"(",
")",
";",
"if",
"(",
"$",
"domid",
"!==",
"''",
")",
"{",
"$",
"domid",
"=",
"'id=\"'",
".",
"$",
"domid",
".",
"'\"'",
";",
"}",
"// Are we expanding this one?",
"if",
"(",
"$",
"isExpanded",
"===",
"true",
")",
"{",
"$",
"style",
"=",
"''",
";",
"}",
"else",
"{",
"$",
"style",
"=",
"'khidden'",
";",
"}",
"return",
"str_replace",
"(",
"array",
"(",
"static",
"::",
"MARKER_STYLE",
",",
"static",
"::",
"MARKER_MAIN_FUNCTION",
",",
"static",
"::",
"MARKER_DOM_ID",
",",
")",
",",
"array",
"(",
"$",
"style",
",",
"$",
"model",
"->",
"renderMe",
"(",
")",
",",
"$",
"domid",
",",
")",
",",
"$",
"this",
"->",
"getTemplateFileContent",
"(",
"static",
"::",
"FILE_NEST",
")",
")",
";",
"}"
] | Renders a nest with a anonymous function in the middle.
@param Model $model
The model, which hosts all the data we need.
@param boolean $isExpanded
The only expanded nest is the settings menu, when we render only the
settings menu.
@return string
The generated markup from the template files. | [
"Renders",
"a",
"nest",
"with",
"a",
"anonymous",
"function",
"in",
"the",
"middle",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/AbstractRender.php#L269-L297 |
33,593 | brainworxx/kreXX | src/View/AbstractRender.php | AbstractRender.getTemplateFileContent | protected function getTemplateFileContent($what)
{
static $fileCache = array();
if (isset($fileCache[$what]) === true) {
return $fileCache[$what];
}
$fileCache[$what] = preg_replace(
'/\s+/',
' ',
$this->pool->fileService->getFileContents($this->skinPath . $what . '.html')
);
return $fileCache[$what];
} | php | protected function getTemplateFileContent($what)
{
static $fileCache = array();
if (isset($fileCache[$what]) === true) {
return $fileCache[$what];
}
$fileCache[$what] = preg_replace(
'/\s+/',
' ',
$this->pool->fileService->getFileContents($this->skinPath . $what . '.html')
);
return $fileCache[$what];
} | [
"protected",
"function",
"getTemplateFileContent",
"(",
"$",
"what",
")",
"{",
"static",
"$",
"fileCache",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"fileCache",
"[",
"$",
"what",
"]",
")",
"===",
"true",
")",
"{",
"return",
"$",
"fileCache",
"[",
"$",
"what",
"]",
";",
"}",
"$",
"fileCache",
"[",
"$",
"what",
"]",
"=",
"preg_replace",
"(",
"'/\\s+/'",
",",
"' '",
",",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"getFileContents",
"(",
"$",
"this",
"->",
"skinPath",
".",
"$",
"what",
".",
"'.html'",
")",
")",
";",
"return",
"$",
"fileCache",
"[",
"$",
"what",
"]",
";",
"}"
] | Loads a template file from the skin folder.
@param string $what
Filename in the skin folder without the ".html" at the end.
@return string
The template file, without whitespaces. | [
"Loads",
"a",
"template",
"file",
"from",
"the",
"skin",
"folder",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/AbstractRender.php#L308-L322 |
33,594 | silverorange/swat | Swat/SwatTableViewOrderableColumn.php | SwatTableViewOrderableColumn.setDirection | public function setDirection($direction)
{
$this->direction = $direction;
$this->default_direction = $direction;
if ($this->view->orderby_column === null) {
$this->view->orderby_column = $this;
}
$this->view->default_orderby_column = $this;
$this->initFromGetVariables();
} | php | public function setDirection($direction)
{
$this->direction = $direction;
$this->default_direction = $direction;
if ($this->view->orderby_column === null) {
$this->view->orderby_column = $this;
}
$this->view->default_orderby_column = $this;
$this->initFromGetVariables();
} | [
"public",
"function",
"setDirection",
"(",
"$",
"direction",
")",
"{",
"$",
"this",
"->",
"direction",
"=",
"$",
"direction",
";",
"$",
"this",
"->",
"default_direction",
"=",
"$",
"direction",
";",
"if",
"(",
"$",
"this",
"->",
"view",
"->",
"orderby_column",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"view",
"->",
"orderby_column",
"=",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"view",
"->",
"default_orderby_column",
"=",
"$",
"this",
";",
"$",
"this",
"->",
"initFromGetVariables",
"(",
")",
";",
"}"
] | Sets the direction of ordering
This method sets the direction of ordering of the column, either asc,
desc, or none. Valid directions are:
- {@link SwatTableViewOrderableColumn::ORDER_BY_DIR_NONE},
- {@link SwatTableViewOrderableColumn::ORDER_BY_DIR_DESCENDING}, and
- {@link SwatTableViewOrderableColumn::ORDER_BY_DIR_ASCENDING}.
@param $direction integer One of the ORDER_BY_DIR_* class contants | [
"Sets",
"the",
"direction",
"of",
"ordering"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewOrderableColumn.php#L160-L172 |
33,595 | silverorange/swat | Swat/SwatTableViewOrderableColumn.php | SwatTableViewOrderableColumn.displayHeader | public function displayHeader()
{
$anchor = new SwatHtmlTag('a');
$anchor->href = $this->getLink();
$anchor->class = 'swat-table-view-orderable-column';
// Set direction-specific CSS class on the anchor.
if ($this->direction == self::ORDER_BY_DIR_DESCENDING) {
$anchor->class .= ' swat-table-view-orderable-column-descending';
} elseif ($this->direction == self::ORDER_BY_DIR_ASCENDING) {
$anchor->class .= ' swat-table-view-orderable-column-ascending';
}
$anchor->open();
if ($this->abbreviated_title === null) {
$this->displayTitle($this->title, $this->title_content_type);
} else {
$abbr_tag = new SwatHtmlTag('abbr');
$abbr_tag->title = $this->title;
$abbr_tag->open();
$this->displayTitle(
$this->abbreviated_title,
$this->abbreviated_title_content_type
);
$abbr_tag->close();
}
$anchor->close();
} | php | public function displayHeader()
{
$anchor = new SwatHtmlTag('a');
$anchor->href = $this->getLink();
$anchor->class = 'swat-table-view-orderable-column';
// Set direction-specific CSS class on the anchor.
if ($this->direction == self::ORDER_BY_DIR_DESCENDING) {
$anchor->class .= ' swat-table-view-orderable-column-descending';
} elseif ($this->direction == self::ORDER_BY_DIR_ASCENDING) {
$anchor->class .= ' swat-table-view-orderable-column-ascending';
}
$anchor->open();
if ($this->abbreviated_title === null) {
$this->displayTitle($this->title, $this->title_content_type);
} else {
$abbr_tag = new SwatHtmlTag('abbr');
$abbr_tag->title = $this->title;
$abbr_tag->open();
$this->displayTitle(
$this->abbreviated_title,
$this->abbreviated_title_content_type
);
$abbr_tag->close();
}
$anchor->close();
} | [
"public",
"function",
"displayHeader",
"(",
")",
"{",
"$",
"anchor",
"=",
"new",
"SwatHtmlTag",
"(",
"'a'",
")",
";",
"$",
"anchor",
"->",
"href",
"=",
"$",
"this",
"->",
"getLink",
"(",
")",
";",
"$",
"anchor",
"->",
"class",
"=",
"'swat-table-view-orderable-column'",
";",
"// Set direction-specific CSS class on the anchor.",
"if",
"(",
"$",
"this",
"->",
"direction",
"==",
"self",
"::",
"ORDER_BY_DIR_DESCENDING",
")",
"{",
"$",
"anchor",
"->",
"class",
".=",
"' swat-table-view-orderable-column-descending'",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"direction",
"==",
"self",
"::",
"ORDER_BY_DIR_ASCENDING",
")",
"{",
"$",
"anchor",
"->",
"class",
".=",
"' swat-table-view-orderable-column-ascending'",
";",
"}",
"$",
"anchor",
"->",
"open",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"abbreviated_title",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"displayTitle",
"(",
"$",
"this",
"->",
"title",
",",
"$",
"this",
"->",
"title_content_type",
")",
";",
"}",
"else",
"{",
"$",
"abbr_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'abbr'",
")",
";",
"$",
"abbr_tag",
"->",
"title",
"=",
"$",
"this",
"->",
"title",
";",
"$",
"abbr_tag",
"->",
"open",
"(",
")",
";",
"$",
"this",
"->",
"displayTitle",
"(",
"$",
"this",
"->",
"abbreviated_title",
",",
"$",
"this",
"->",
"abbreviated_title_content_type",
")",
";",
"$",
"abbr_tag",
"->",
"close",
"(",
")",
";",
"}",
"$",
"anchor",
"->",
"close",
"(",
")",
";",
"}"
] | Displays the column header for this table view column
This method displays an appropriate header based on the current
direction of ordering of this table view column. If the column has been
ordered, an image indicating the ordering is also displayed in the
header. | [
"Displays",
"the",
"column",
"header",
"for",
"this",
"table",
"view",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewOrderableColumn.php#L185-L216 |
33,596 | silverorange/swat | Swat/SwatTableViewOrderableColumn.php | SwatTableViewOrderableColumn.getDirectionAsString | public function getDirectionAsString(
$direction_id = null,
$include_nulls_ordering = true
) {
if ($direction_id === null) {
$direction_id = $this->direction;
}
switch ($direction_id) {
case self::ORDER_BY_DIR_NONE:
$direction = '';
break;
case self::ORDER_BY_DIR_ASCENDING:
$direction = 'asc';
break;
case self::ORDER_BY_DIR_DESCENDING:
$direction = 'desc';
break;
default:
throw new SwatException(
sprintf("Ordering direction '%s' not found.", $direction_id)
);
}
if ($include_nulls_ordering && $this->nulls_ordering !== null) {
switch ($this->nulls_ordering) {
case self::NULLS_FIRST:
$direction .= ' nulls first';
break;
case self::NULLS_LAST:
$direction .= ' nulls last';
break;
default:
throw new SwatException(
sprintf(
"Nulls ordering '%s' not found.",
$this->nulls_ordering
)
);
}
}
return $direction;
} | php | public function getDirectionAsString(
$direction_id = null,
$include_nulls_ordering = true
) {
if ($direction_id === null) {
$direction_id = $this->direction;
}
switch ($direction_id) {
case self::ORDER_BY_DIR_NONE:
$direction = '';
break;
case self::ORDER_BY_DIR_ASCENDING:
$direction = 'asc';
break;
case self::ORDER_BY_DIR_DESCENDING:
$direction = 'desc';
break;
default:
throw new SwatException(
sprintf("Ordering direction '%s' not found.", $direction_id)
);
}
if ($include_nulls_ordering && $this->nulls_ordering !== null) {
switch ($this->nulls_ordering) {
case self::NULLS_FIRST:
$direction .= ' nulls first';
break;
case self::NULLS_LAST:
$direction .= ' nulls last';
break;
default:
throw new SwatException(
sprintf(
"Nulls ordering '%s' not found.",
$this->nulls_ordering
)
);
}
}
return $direction;
} | [
"public",
"function",
"getDirectionAsString",
"(",
"$",
"direction_id",
"=",
"null",
",",
"$",
"include_nulls_ordering",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"direction_id",
"===",
"null",
")",
"{",
"$",
"direction_id",
"=",
"$",
"this",
"->",
"direction",
";",
"}",
"switch",
"(",
"$",
"direction_id",
")",
"{",
"case",
"self",
"::",
"ORDER_BY_DIR_NONE",
":",
"$",
"direction",
"=",
"''",
";",
"break",
";",
"case",
"self",
"::",
"ORDER_BY_DIR_ASCENDING",
":",
"$",
"direction",
"=",
"'asc'",
";",
"break",
";",
"case",
"self",
"::",
"ORDER_BY_DIR_DESCENDING",
":",
"$",
"direction",
"=",
"'desc'",
";",
"break",
";",
"default",
":",
"throw",
"new",
"SwatException",
"(",
"sprintf",
"(",
"\"Ordering direction '%s' not found.\"",
",",
"$",
"direction_id",
")",
")",
";",
"}",
"if",
"(",
"$",
"include_nulls_ordering",
"&&",
"$",
"this",
"->",
"nulls_ordering",
"!==",
"null",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"nulls_ordering",
")",
"{",
"case",
"self",
"::",
"NULLS_FIRST",
":",
"$",
"direction",
".=",
"' nulls first'",
";",
"break",
";",
"case",
"self",
"::",
"NULLS_LAST",
":",
"$",
"direction",
".=",
"' nulls last'",
";",
"break",
";",
"default",
":",
"throw",
"new",
"SwatException",
"(",
"sprintf",
"(",
"\"Nulls ordering '%s' not found.\"",
",",
"$",
"this",
"->",
"nulls_ordering",
")",
")",
";",
"}",
"}",
"return",
"$",
"direction",
";",
"}"
] | Gets the direction of ordering as a string
Retrieves the current ordering direction of this column or an arbitrary
direction constant as a string. The string is returned the lowercase
abbreviated form 'asc' or 'desc'.
@param integer $direction_id an optional direction constant to convert
to a string rather than using this
column's current direction.
@param boolean $include_nulls_ordering optional. If specified, an extra
string indicating the nulls
ordering behaviour is appended.
@return string the direction of ordering. | [
"Gets",
"the",
"direction",
"of",
"ordering",
"as",
"a",
"string"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewOrderableColumn.php#L237-L285 |
33,597 | silverorange/swat | Swat/SwatTableViewOrderableColumn.php | SwatTableViewOrderableColumn.getNextDirection | protected function getNextDirection()
{
switch ($this->direction) {
case self::ORDER_BY_DIR_NONE:
return self::ORDER_BY_DIR_ASCENDING;
case self::ORDER_BY_DIR_ASCENDING:
return self::ORDER_BY_DIR_DESCENDING;
case self::ORDER_BY_DIR_DESCENDING:
default:
if ($this->view->default_orderby_column === null) {
// tri-state
return self::ORDER_BY_DIR_NONE;
}
// bi-state
return self::ORDER_BY_DIR_ASCENDING;
}
} | php | protected function getNextDirection()
{
switch ($this->direction) {
case self::ORDER_BY_DIR_NONE:
return self::ORDER_BY_DIR_ASCENDING;
case self::ORDER_BY_DIR_ASCENDING:
return self::ORDER_BY_DIR_DESCENDING;
case self::ORDER_BY_DIR_DESCENDING:
default:
if ($this->view->default_orderby_column === null) {
// tri-state
return self::ORDER_BY_DIR_NONE;
}
// bi-state
return self::ORDER_BY_DIR_ASCENDING;
}
} | [
"protected",
"function",
"getNextDirection",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"direction",
")",
"{",
"case",
"self",
"::",
"ORDER_BY_DIR_NONE",
":",
"return",
"self",
"::",
"ORDER_BY_DIR_ASCENDING",
";",
"case",
"self",
"::",
"ORDER_BY_DIR_ASCENDING",
":",
"return",
"self",
"::",
"ORDER_BY_DIR_DESCENDING",
";",
"case",
"self",
"::",
"ORDER_BY_DIR_DESCENDING",
":",
"default",
":",
"if",
"(",
"$",
"this",
"->",
"view",
"->",
"default_orderby_column",
"===",
"null",
")",
"{",
"// tri-state",
"return",
"self",
"::",
"ORDER_BY_DIR_NONE",
";",
"}",
"// bi-state",
"return",
"self",
"::",
"ORDER_BY_DIR_ASCENDING",
";",
"}",
"}"
] | Gets the next direction or ordering in the rotation
As a user clicks on the comun headers the direction of ordering changes
from NONE => ASCSENDING => DESCENDING => NONE in a loop.
@return integer the next direction of ordering for this column. | [
"Gets",
"the",
"next",
"direction",
"or",
"ordering",
"in",
"the",
"rotation"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewOrderableColumn.php#L360-L379 |
33,598 | silverorange/swat | Swat/SwatTableViewOrderableColumn.php | SwatTableViewOrderableColumn.setDirectionByString | private function setDirectionByString($direction)
{
$direction = mb_strtolower($direction);
switch ($direction) {
case 'ascending':
case 'asc':
$this->direction = self::ORDER_BY_DIR_ASCENDING;
break;
case 'descending':
case 'desc':
$this->direction = self::ORDER_BY_DIR_DESCENDING;
break;
default:
$this->direction = self::ORDER_BY_DIR_NONE;
}
} | php | private function setDirectionByString($direction)
{
$direction = mb_strtolower($direction);
switch ($direction) {
case 'ascending':
case 'asc':
$this->direction = self::ORDER_BY_DIR_ASCENDING;
break;
case 'descending':
case 'desc':
$this->direction = self::ORDER_BY_DIR_DESCENDING;
break;
default:
$this->direction = self::ORDER_BY_DIR_NONE;
}
} | [
"private",
"function",
"setDirectionByString",
"(",
"$",
"direction",
")",
"{",
"$",
"direction",
"=",
"mb_strtolower",
"(",
"$",
"direction",
")",
";",
"switch",
"(",
"$",
"direction",
")",
"{",
"case",
"'ascending'",
":",
"case",
"'asc'",
":",
"$",
"this",
"->",
"direction",
"=",
"self",
"::",
"ORDER_BY_DIR_ASCENDING",
";",
"break",
";",
"case",
"'descending'",
":",
"case",
"'desc'",
":",
"$",
"this",
"->",
"direction",
"=",
"self",
"::",
"ORDER_BY_DIR_DESCENDING",
";",
"break",
";",
"default",
":",
"$",
"this",
"->",
"direction",
"=",
"self",
"::",
"ORDER_BY_DIR_NONE",
";",
"}",
"}"
] | Sets direction of ordering by a string
Sets the current ordering direction of this column.
@param string $direction ordering direction as a string. The direction
is case insensitive and may be the short form
'asc' or 'desc' or the long form 'ascending'
or 'descending'. | [
"Sets",
"direction",
"of",
"ordering",
"by",
"a",
"string"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewOrderableColumn.php#L394-L412 |
33,599 | silverorange/swat | Swat/SwatTableViewOrderableColumn.php | SwatTableViewOrderableColumn.getLink | private function getLink()
{
// unset GET vars that we want to ignore
$vars = $_GET;
foreach ($vars as $name => $value) {
if (in_array($name, $this->unset_get_vars)) {
unset($vars[$name]);
}
}
$key_orderby = $this->getLinkPrefix() . 'orderby';
$key_orderbydir = $this->getLinkPrefix() . 'orderbydir';
unset($vars[$key_orderby]);
unset($vars[$key_orderbydir]);
$next_dir = $this->getNextDirection();
if ($next_dir != $this->default_direction) {
$vars[$key_orderby] = $this->id;
$vars[$key_orderbydir] = $this->getDirectionAsString(
$next_dir,
false
);
}
// build the new link
$link = $this->link . '?';
$first = true;
foreach ($vars as $name => $value) {
if ($first) {
$first = false;
} else {
$link .= '&';
}
$link .= $name . '=' . $value;
}
return $link;
} | php | private function getLink()
{
// unset GET vars that we want to ignore
$vars = $_GET;
foreach ($vars as $name => $value) {
if (in_array($name, $this->unset_get_vars)) {
unset($vars[$name]);
}
}
$key_orderby = $this->getLinkPrefix() . 'orderby';
$key_orderbydir = $this->getLinkPrefix() . 'orderbydir';
unset($vars[$key_orderby]);
unset($vars[$key_orderbydir]);
$next_dir = $this->getNextDirection();
if ($next_dir != $this->default_direction) {
$vars[$key_orderby] = $this->id;
$vars[$key_orderbydir] = $this->getDirectionAsString(
$next_dir,
false
);
}
// build the new link
$link = $this->link . '?';
$first = true;
foreach ($vars as $name => $value) {
if ($first) {
$first = false;
} else {
$link .= '&';
}
$link .= $name . '=' . $value;
}
return $link;
} | [
"private",
"function",
"getLink",
"(",
")",
"{",
"// unset GET vars that we want to ignore",
"$",
"vars",
"=",
"$",
"_GET",
";",
"foreach",
"(",
"$",
"vars",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"unset_get_vars",
")",
")",
"{",
"unset",
"(",
"$",
"vars",
"[",
"$",
"name",
"]",
")",
";",
"}",
"}",
"$",
"key_orderby",
"=",
"$",
"this",
"->",
"getLinkPrefix",
"(",
")",
".",
"'orderby'",
";",
"$",
"key_orderbydir",
"=",
"$",
"this",
"->",
"getLinkPrefix",
"(",
")",
".",
"'orderbydir'",
";",
"unset",
"(",
"$",
"vars",
"[",
"$",
"key_orderby",
"]",
")",
";",
"unset",
"(",
"$",
"vars",
"[",
"$",
"key_orderbydir",
"]",
")",
";",
"$",
"next_dir",
"=",
"$",
"this",
"->",
"getNextDirection",
"(",
")",
";",
"if",
"(",
"$",
"next_dir",
"!=",
"$",
"this",
"->",
"default_direction",
")",
"{",
"$",
"vars",
"[",
"$",
"key_orderby",
"]",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"vars",
"[",
"$",
"key_orderbydir",
"]",
"=",
"$",
"this",
"->",
"getDirectionAsString",
"(",
"$",
"next_dir",
",",
"false",
")",
";",
"}",
"// build the new link",
"$",
"link",
"=",
"$",
"this",
"->",
"link",
".",
"'?'",
";",
"$",
"first",
"=",
"true",
";",
"foreach",
"(",
"$",
"vars",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"first",
")",
"{",
"$",
"first",
"=",
"false",
";",
"}",
"else",
"{",
"$",
"link",
".=",
"'&'",
";",
"}",
"$",
"link",
".=",
"$",
"name",
".",
"'='",
".",
"$",
"value",
";",
"}",
"return",
"$",
"link",
";",
"}"
] | Gets the link for this column's header
This method builds the link by appending special GET variables and
unsetting other ones.
@return string the link for this column's header. | [
"Gets",
"the",
"link",
"for",
"this",
"column",
"s",
"header"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewOrderableColumn.php#L425-L467 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.