repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
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", ...
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
train
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", ")", ";", "}", "$", "...
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
train
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"...
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
train
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", ...
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
train
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", ":", "...
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
train
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", "(", "...
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
train
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", "(", ")", ";", ...
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
train
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 ...
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
train
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", "=", "$...
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
train
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", ...
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
train
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", ":", "$", ...
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
train
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", ...
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
train
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", "(", ...
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
train
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
train
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", "(...
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
train
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
train
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", "(", "$", ...
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
train
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
train
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", "(", ...
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
train
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
train
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"...
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
train
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
train
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'", ")", ";", "i...
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
train
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
train
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", ...
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
train
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", "%", ...
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
train
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", "// un...
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
train
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", "->", ...
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
train
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...
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
train
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", "->"...
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
train
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", "]", ")", ")...
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
train
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", "->", "ge...
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
train
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", ...
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
train
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
train
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",...
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
train
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", "->"...
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
train
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", "(",...
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
train
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."...
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
train
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.", "$", "logLis...
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
train
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...
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
train
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", "(", "$", ...
Add headwords. @param string[]|Headword[] $headwords @return mixed
[ "Add", "headwords", "." ]
f6ae90d466ea6f34bba404be0aba03e37ef369ad
https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/models/Extension.php#L228-L235
train
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
train
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", "(", "$"...
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
train
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", "->", ...
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
train
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
train
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", ")", "{", "$", "...
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
train
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...
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
train
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", "=", "...
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
train
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", ",...
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
train
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", ")", "{...
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
train
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", "(...
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
train
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",...
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
train
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", "!==", "''", ")", "{", ...
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
train
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", "$", "fi...
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
train
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_co...
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
train
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-or...
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
train
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",...
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
train
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_ASCEND...
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
train
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...
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
train
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 .= '&amp;'; } $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 .= '&amp;'; } $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", ",", ...
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
train
silverorange/swat
Swat/SwatTableViewOrderableColumn.php
SwatTableViewOrderableColumn.initFromGetVariables
private function initFromGetVariables() { $key_orderby = $this->getLinkPrefix() . 'orderby'; $key_orderbydir = $this->getLinkPrefix() . 'orderbydir'; if (isset($_GET[$key_orderby]) && $_GET[$key_orderby] == $this->id) { $this->view->orderby_column = $this; if (isset($_GET[$key_orderbydir])) { $this->setDirectionByString($_GET[$key_orderbydir]); } } }
php
private function initFromGetVariables() { $key_orderby = $this->getLinkPrefix() . 'orderby'; $key_orderbydir = $this->getLinkPrefix() . 'orderbydir'; if (isset($_GET[$key_orderby]) && $_GET[$key_orderby] == $this->id) { $this->view->orderby_column = $this; if (isset($_GET[$key_orderbydir])) { $this->setDirectionByString($_GET[$key_orderbydir]); } } }
[ "private", "function", "initFromGetVariables", "(", ")", "{", "$", "key_orderby", "=", "$", "this", "->", "getLinkPrefix", "(", ")", ".", "'orderby'", ";", "$", "key_orderbydir", "=", "$", "this", "->", "getLinkPrefix", "(", ")", ".", "'orderbydir'", ";", ...
Process GET variables and set class variables
[ "Process", "GET", "variables", "and", "set", "class", "variables" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewOrderableColumn.php#L475-L487
train
zeroem/ZeroemCurlBundle
Curl/MultiManager.php
MultiManager.addRequest
public function addRequest(Request $request) { $oid = spl_object_hash($request); if(!isset($this->requests[$oid])) { $this->requests[$oid] = $request; curl_multi_add_handle($this->handle, $request->getHandle()); } return $this; }
php
public function addRequest(Request $request) { $oid = spl_object_hash($request); if(!isset($this->requests[$oid])) { $this->requests[$oid] = $request; curl_multi_add_handle($this->handle, $request->getHandle()); } return $this; }
[ "public", "function", "addRequest", "(", "Request", "$", "request", ")", "{", "$", "oid", "=", "spl_object_hash", "(", "$", "request", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "requests", "[", "$", "oid", "]", ")", ")", "{", "$", ...
Add a cURL request to be processed in parallel Alias of the curl_multi_add_handle function @param Request $request A Request object to be executed @return MultiManager $this
[ "Add", "a", "cURL", "request", "to", "be", "processed", "in", "parallel" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/MultiManager.php#L86-L95
train
zeroem/ZeroemCurlBundle
Curl/MultiManager.php
MultiManager.removeRequest
public function removeRequest(Request $request) { $oid = spl_object_hash($request); $result = false; if(isset($this->requests[$oid])) { unset($this->requests[$oid]); $result = $request; curl_multi_remove_handle($this->handle, $request->getHandle()); } return $result; }
php
public function removeRequest(Request $request) { $oid = spl_object_hash($request); $result = false; if(isset($this->requests[$oid])) { unset($this->requests[$oid]); $result = $request; curl_multi_remove_handle($this->handle, $request->getHandle()); } return $result; }
[ "public", "function", "removeRequest", "(", "Request", "$", "request", ")", "{", "$", "oid", "=", "spl_object_hash", "(", "$", "request", ")", ";", "$", "result", "=", "false", ";", "if", "(", "isset", "(", "$", "this", "->", "requests", "[", "$", "o...
Remove a request from the execution stack Analogous to the curl_multi_remove_handle function @param Request $request The Request to be removed @return Request|boolean the request that was removed or false if the request isn't managed by this object
[ "Remove", "a", "request", "from", "the", "execution", "stack" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/MultiManager.php#L105-L116
train
zeroem/ZeroemCurlBundle
Curl/MultiManager.php
MultiManager.execute
public function execute() { if($this->blocking) { return $this->executeBlocking(); } else { return $this->errorCheck( curl_multi_exec($this->handle,$active) ); } }
php
public function execute() { if($this->blocking) { return $this->executeBlocking(); } else { return $this->errorCheck( curl_multi_exec($this->handle,$active) ); } }
[ "public", "function", "execute", "(", ")", "{", "if", "(", "$", "this", "->", "blocking", ")", "{", "return", "$", "this", "->", "executeBlocking", "(", ")", ";", "}", "else", "{", "return", "$", "this", "->", "errorCheck", "(", "curl_multi_exec", "(",...
Execute the registered Request objects in parallel Analogous to curl_multi_exec @return int the result of curl_multi_exec @throws CurlErrorException
[ "Execute", "the", "registered", "Request", "objects", "in", "parallel" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/MultiManager.php#L138-L146
train
zeroem/ZeroemCurlBundle
Curl/MultiManager.php
MultiManager.processInfo
private function processInfo(array $info) { $request = $this->findRequest($info["handle"]); if(isset($this->dispatcher) && false !== $request) { $this->dispatcher->dispatch( CurlEvents::MULTI_INFO, new MultiInfoEvent( $this, $request, new MultiInfo($info) ) ); } }
php
private function processInfo(array $info) { $request = $this->findRequest($info["handle"]); if(isset($this->dispatcher) && false !== $request) { $this->dispatcher->dispatch( CurlEvents::MULTI_INFO, new MultiInfoEvent( $this, $request, new MultiInfo($info) ) ); } }
[ "private", "function", "processInfo", "(", "array", "$", "info", ")", "{", "$", "request", "=", "$", "this", "->", "findRequest", "(", "$", "info", "[", "\"handle\"", "]", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "dispatcher", ")", "&&",...
Process and callbacks associated with the handle returned by curl_multi_info_read @param array $info data array from curl_multi_info_read
[ "Process", "and", "callbacks", "associated", "with", "the", "handle", "returned", "by", "curl_multi_info_read" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/MultiManager.php#L192-L205
train
zeroem/ZeroemCurlBundle
Curl/MultiManager.php
MultiManager.findRequest
public function findRequest($handle) { foreach($this->requests as $request) { if($handle === $request->getHandle()) { return $request; } } return false; }
php
public function findRequest($handle) { foreach($this->requests as $request) { if($handle === $request->getHandle()) { return $request; } } return false; }
[ "public", "function", "findRequest", "(", "$", "handle", ")", "{", "foreach", "(", "$", "this", "->", "requests", "as", "$", "request", ")", "{", "if", "(", "$", "handle", "===", "$", "request", "->", "getHandle", "(", ")", ")", "{", "return", "$", ...
Given a cURL handle, locate the request object associated with it @param resource $handle a cURL handle @return Request|boolean the associated Request object or false if it is not found
[ "Given", "a", "cURL", "handle", "locate", "the", "request", "object", "associated", "with", "it" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/MultiManager.php#L213-L221
train
brainworxx/kreXX
src/Service/Factory/Event.php
Event.dispatch
public function dispatch($name, AbstractCallback $callback, Model $model = null) { if (isset($this->register[$name]) === false) { // No registered handler. Early return. return ''; } $output = ''; // Got to handel them all. foreach ($this->register[$name] as $classname) { $output .= $this->pool->createClass($classname)->handle($callback, $model); } return $output; }
php
public function dispatch($name, AbstractCallback $callback, Model $model = null) { if (isset($this->register[$name]) === false) { // No registered handler. Early return. return ''; } $output = ''; // Got to handel them all. foreach ($this->register[$name] as $classname) { $output .= $this->pool->createClass($classname)->handle($callback, $model); } return $output; }
[ "public", "function", "dispatch", "(", "$", "name", ",", "AbstractCallback", "$", "callback", ",", "Model", "$", "model", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "register", "[", "$", "name", "]", ")", "===", "false", ")", ...
Dispatches an event. @param string $name The name of the event. @param AbstractCallback $callback The parameters for the callback. @param \Brainworxx\Krexx\Analyse\Model|null $model The model so far, if available. @return string The generated markup from the event handlers This will only get dispatched, if you use the start event.
[ "Dispatches", "an", "event", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Factory/Event.php#L90-L105
train
TypiCMS/Menus
src/Repositories/EloquentMenu.php
EloquentMenu.prepare
public function prepare($items = null) { $items->each(function ($item) { $item->items = collect(); if ($item->has_categories) { $item->items = $this->prepare(ProjectCategories::allForMenu($item->page->uri())); } $item->href = $this->setHref($item); $item->class = $this->setClass($item); }); return $items; }
php
public function prepare($items = null) { $items->each(function ($item) { $item->items = collect(); if ($item->has_categories) { $item->items = $this->prepare(ProjectCategories::allForMenu($item->page->uri())); } $item->href = $this->setHref($item); $item->class = $this->setClass($item); }); return $items; }
[ "public", "function", "prepare", "(", "$", "items", "=", "null", ")", "{", "$", "items", "->", "each", "(", "function", "(", "$", "item", ")", "{", "$", "item", "->", "items", "=", "collect", "(", ")", ";", "if", "(", "$", "item", "->", "has_cate...
Set href and classes for each items in collection. @param $items @return \TypiCMS\NestableCollection
[ "Set", "href", "and", "classes", "for", "each", "items", "in", "collection", "." ]
628211bf23dfd035c85140e5a6ad28882bed50cb
https://github.com/TypiCMS/Menus/blob/628211bf23dfd035c85140e5a6ad28882bed50cb/src/Repositories/EloquentMenu.php#L82-L94
train
TypiCMS/Menus
src/Repositories/EloquentMenu.php
EloquentMenu.setHref
public function setHref($menulink) { if ($menulink->url) { return $menulink->url; } if ($menulink->page) { return $menulink->page->uri(); } return '/'; }
php
public function setHref($menulink) { if ($menulink->url) { return $menulink->url; } if ($menulink->page) { return $menulink->page->uri(); } return '/'; }
[ "public", "function", "setHref", "(", "$", "menulink", ")", "{", "if", "(", "$", "menulink", "->", "url", ")", "{", "return", "$", "menulink", "->", "url", ";", "}", "if", "(", "$", "menulink", "->", "page", ")", "{", "return", "$", "menulink", "->...
1. If menulink has url field, take it. 2. If menulink has a page, take the uri of the page in the current locale. @param $menulink @return string uri
[ "1", ".", "If", "menulink", "has", "url", "field", "take", "it", ".", "2", ".", "If", "menulink", "has", "a", "page", "take", "the", "uri", "of", "the", "page", "in", "the", "current", "locale", "." ]
628211bf23dfd035c85140e5a6ad28882bed50cb
https://github.com/TypiCMS/Menus/blob/628211bf23dfd035c85140e5a6ad28882bed50cb/src/Repositories/EloquentMenu.php#L104-L114
train
TypiCMS/Menus
src/Repositories/EloquentMenu.php
EloquentMenu.setClass
public function setClass($menulink) { $classArray = preg_split('/ /', $menulink->class, null, PREG_SPLIT_NO_EMPTY); // add active class if current uri is equal to item uri or contains // item uri and is bigger than 3 to avoid homepage link always active ('/', '/lg') $pattern = $menulink->href; if (strlen($menulink->href) > 3) { $pattern .= '*'; } if (request()->is($pattern)) { $classArray[] = 'active'; } return implode(' ', $classArray); }
php
public function setClass($menulink) { $classArray = preg_split('/ /', $menulink->class, null, PREG_SPLIT_NO_EMPTY); // add active class if current uri is equal to item uri or contains // item uri and is bigger than 3 to avoid homepage link always active ('/', '/lg') $pattern = $menulink->href; if (strlen($menulink->href) > 3) { $pattern .= '*'; } if (request()->is($pattern)) { $classArray[] = 'active'; } return implode(' ', $classArray); }
[ "public", "function", "setClass", "(", "$", "menulink", ")", "{", "$", "classArray", "=", "preg_split", "(", "'/ /'", ",", "$", "menulink", "->", "class", ",", "null", ",", "PREG_SPLIT_NO_EMPTY", ")", ";", "// add active class if current uri is equal to item uri or ...
Take the classes from field and add active if needed. @param $menulink @return string classes
[ "Take", "the", "classes", "from", "field", "and", "add", "active", "if", "needed", "." ]
628211bf23dfd035c85140e5a6ad28882bed50cb
https://github.com/TypiCMS/Menus/blob/628211bf23dfd035c85140e5a6ad28882bed50cb/src/Repositories/EloquentMenu.php#L123-L137
train
FreeDSx/Socket
src/FreeDSx/Socket/Socket.php
Socket.create
public static function create(string $host, array $options = []) : Socket { return (new self(null, $options))->connect($host); }
php
public static function create(string $host, array $options = []) : Socket { return (new self(null, $options))->connect($host); }
[ "public", "static", "function", "create", "(", "string", "$", "host", ",", "array", "$", "options", "=", "[", "]", ")", ":", "Socket", "{", "return", "(", "new", "self", "(", "null", ",", "$", "options", ")", ")", "->", "connect", "(", "$", "host",...
Create a socket by connecting to a specific host. @param string $host @param array $options @return Socket @throws ConnectionException
[ "Create", "a", "socket", "by", "connecting", "to", "a", "specific", "host", "." ]
d74683bf8b827e91a8ca051805c55dacaf64f93d
https://github.com/FreeDSx/Socket/blob/d74683bf8b827e91a8ca051805c55dacaf64f93d/src/FreeDSx/Socket/Socket.php#L264-L267
train
FreeDSx/Socket
src/FreeDSx/Socket/Socket.php
Socket.tcp
public static function tcp(string $host, array $options = []) : Socket { return self::create($host, \array_merge($options, ['transport' => 'tcp'])); }
php
public static function tcp(string $host, array $options = []) : Socket { return self::create($host, \array_merge($options, ['transport' => 'tcp'])); }
[ "public", "static", "function", "tcp", "(", "string", "$", "host", ",", "array", "$", "options", "=", "[", "]", ")", ":", "Socket", "{", "return", "self", "::", "create", "(", "$", "host", ",", "\\", "array_merge", "(", "$", "options", ",", "[", "'...
Create a TCP based socket. @param string $host @param array $options @return Socket @throws ConnectionException
[ "Create", "a", "TCP", "based", "socket", "." ]
d74683bf8b827e91a8ca051805c55dacaf64f93d
https://github.com/FreeDSx/Socket/blob/d74683bf8b827e91a8ca051805c55dacaf64f93d/src/FreeDSx/Socket/Socket.php#L277-L280
train
FreeDSx/Socket
src/FreeDSx/Socket/Socket.php
Socket.udp
public static function udp(string $host, array $options = []) : Socket { return self::create($host, \array_merge($options, [ 'transport' => 'udp', 'buffer_size' => 65507, ])); }
php
public static function udp(string $host, array $options = []) : Socket { return self::create($host, \array_merge($options, [ 'transport' => 'udp', 'buffer_size' => 65507, ])); }
[ "public", "static", "function", "udp", "(", "string", "$", "host", ",", "array", "$", "options", "=", "[", "]", ")", ":", "Socket", "{", "return", "self", "::", "create", "(", "$", "host", ",", "\\", "array_merge", "(", "$", "options", ",", "[", "'...
Create a UDP based socket. @param string $host @param array $options @return Socket @throws ConnectionException
[ "Create", "a", "UDP", "based", "socket", "." ]
d74683bf8b827e91a8ca051805c55dacaf64f93d
https://github.com/FreeDSx/Socket/blob/d74683bf8b827e91a8ca051805c55dacaf64f93d/src/FreeDSx/Socket/Socket.php#L290-L296
train
silverorange/swat
Swat/SwatListEntry.php
SwatListEntry.display
public function display() { if (!$this->visible) { return; } // Do not have a maxlength on the XHTML input tag. This relies on // internal knowledge of the parent::display() method. $old_maxlength = $this->maxlength; $this->maxlength = null; parent::display(); $this->maxlength = $old_maxlength; }
php
public function display() { if (!$this->visible) { return; } // Do not have a maxlength on the XHTML input tag. This relies on // internal knowledge of the parent::display() method. $old_maxlength = $this->maxlength; $this->maxlength = null; parent::display(); $this->maxlength = $old_maxlength; }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "// Do not have a maxlength on the XHTML input tag. This relies on", "// internal knowledge of the parent::display() method.", "$", "old_maxlength", ...
Displays this list entry
[ "Displays", "this", "list", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatListEntry.php#L98-L112
train
silverorange/swat
Swat/SwatListEntry.php
SwatListEntry.setState
public function setState($values) { if (is_array($values)) { $this->values = $values; } else { $this->values = $this->splitValues($values); } }
php
public function setState($values) { if (is_array($values)) { $this->values = $values; } else { $this->values = $this->splitValues($values); } }
[ "public", "function", "setState", "(", "$", "values", ")", "{", "if", "(", "is_array", "(", "$", "values", ")", ")", "{", "$", "this", "->", "values", "=", "$", "values", ";", "}", "else", "{", "$", "this", "->", "values", "=", "$", "this", "->",...
Sets the current state of this list entry widget @param string $state the new state of this list entry widget. @see SwatState::setState()
[ "Sets", "the", "current", "state", "of", "this", "list", "entry", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatListEntry.php#L260-L267
train
silverorange/swat
Swat/SwatListEntry.php
SwatListEntry.getDisplayValue
protected function getDisplayValue($value) { if ($this->trim_whitespace && $this->delimiter != ' ') { return implode($this->delimiter . ' ', $this->values); } else { return implode($this->delimiter, $this->values); } }
php
protected function getDisplayValue($value) { if ($this->trim_whitespace && $this->delimiter != ' ') { return implode($this->delimiter . ' ', $this->values); } else { return implode($this->delimiter, $this->values); } }
[ "protected", "function", "getDisplayValue", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "trim_whitespace", "&&", "$", "this", "->", "delimiter", "!=", "' '", ")", "{", "return", "implode", "(", "$", "this", "->", "delimiter", ".", "' '", ...
Gets the value displayed in the XHTML input For list entry, this is a delimiter separated string containing the elements of {@link SwatListEntry::$values}. @param array $value the value to format for display. @return string the values displayed in the XHTML input.
[ "Gets", "the", "value", "displayed", "in", "the", "XHTML", "input" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatListEntry.php#L282-L289
train
silverorange/swat
Swat/SwatListEntry.php
SwatListEntry.getNote
public function getNote() { $message = null; $locale = SwatI18NLocale::get(); if ( $this->max_entries !== null && $this->max_entries > 0 && $this->min_entries === null ) { $message = new SwatMessage( sprintf( Swat::ngettext( 'List can contain at most %s entry', 'List can contain at most %s entries', $this->max_entries ), $locale->formatNumber($this->max_entries) ) ); } elseif ( ($this->max_entries === null || $this->max_entries === 0) && $this->min_entries > 1 && $this->required == true ) { $message = new SwatMessage( sprintf( Swat::ngettext( 'List must contain at least %s entry', 'List must contain at least %s entries', $this->min_entries ), $locale->formatNumber($this->min_entries) ) ); } elseif ( $this->max_entries !== null && $this->max_entries > 0 && $this->min_entries !== null && $this->required == true ) { $message = new SwatMessage( sprintf( 'List must contain between %s and %s entries.', $locale->formatNumber($this->min_entries), $locale->formatNumber($this->max_entries) ) ); } return $message; }
php
public function getNote() { $message = null; $locale = SwatI18NLocale::get(); if ( $this->max_entries !== null && $this->max_entries > 0 && $this->min_entries === null ) { $message = new SwatMessage( sprintf( Swat::ngettext( 'List can contain at most %s entry', 'List can contain at most %s entries', $this->max_entries ), $locale->formatNumber($this->max_entries) ) ); } elseif ( ($this->max_entries === null || $this->max_entries === 0) && $this->min_entries > 1 && $this->required == true ) { $message = new SwatMessage( sprintf( Swat::ngettext( 'List must contain at least %s entry', 'List must contain at least %s entries', $this->min_entries ), $locale->formatNumber($this->min_entries) ) ); } elseif ( $this->max_entries !== null && $this->max_entries > 0 && $this->min_entries !== null && $this->required == true ) { $message = new SwatMessage( sprintf( 'List must contain between %s and %s entries.', $locale->formatNumber($this->min_entries), $locale->formatNumber($this->max_entries) ) ); } return $message; }
[ "public", "function", "getNote", "(", ")", "{", "$", "message", "=", "null", ";", "$", "locale", "=", "SwatI18NLocale", "::", "get", "(", ")", ";", "if", "(", "$", "this", "->", "max_entries", "!==", "null", "&&", "$", "this", "->", "max_entries", ">...
Gets a note describing the rules on this list entry This note informs the user what numbers of entries are valid for this list entry. This note does not mention anything about what type of delimiter is used. Developers are responsible for ensuring that users are notified what type of delimiters are used. @return SwatMessage an informative note of how to use this list entry. @see SwatControl::getNote()
[ "Gets", "a", "note", "describing", "the", "rules", "on", "this", "list", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatListEntry.php#L306-L357
train
silverorange/swat
Swat/SwatListEntry.php
SwatListEntry.splitValues
protected function splitValues($value) { $delimiter = preg_quote($this->delimiter, '/'); if ($this->trim_whitespace) { $expression = '/\s*' . $delimiter . '\s*/u'; } else { $expression = '/' . $delimiter . '/u'; } return preg_split($expression, $value, -1, PREG_SPLIT_NO_EMPTY); }
php
protected function splitValues($value) { $delimiter = preg_quote($this->delimiter, '/'); if ($this->trim_whitespace) { $expression = '/\s*' . $delimiter . '\s*/u'; } else { $expression = '/' . $delimiter . '/u'; } return preg_split($expression, $value, -1, PREG_SPLIT_NO_EMPTY); }
[ "protected", "function", "splitValues", "(", "$", "value", ")", "{", "$", "delimiter", "=", "preg_quote", "(", "$", "this", "->", "delimiter", ",", "'/'", ")", ";", "if", "(", "$", "this", "->", "trim_whitespace", ")", "{", "$", "expression", "=", "'/\...
Splits a value string with entries separated by delimiters into an array If {@link SwatListEntry::$trim_whitespace} is set to true, whitespace is not included in the split values. @param string $value the string to split. @return array the string of delimiter separated values split into an array of values.
[ "Splits", "a", "value", "string", "with", "entries", "separated", "by", "delimiters", "into", "an", "array" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatListEntry.php#L374-L385
train
silverorange/swat
Swat/SwatHtmlTag.php
SwatHtmlTag.addAttributes
public function addAttributes($attributes) { if (is_array($attributes)) { $this->attributes = array_merge($this->attributes, $attributes); } }
php
public function addAttributes($attributes) { if (is_array($attributes)) { $this->attributes = array_merge($this->attributes, $attributes); } }
[ "public", "function", "addAttributes", "(", "$", "attributes", ")", "{", "if", "(", "is_array", "(", "$", "attributes", ")", ")", "{", "$", "this", "->", "attributes", "=", "array_merge", "(", "$", "this", "->", "attributes", ",", "$", "attributes", ")",...
Adds an array of attributes to this XHTML tag If entries in the attributes array coincide with existing attributes of this XHTML tag, the attributes in the array overwrite the existing attributes. @param array an array of attribute-value pairs of the form 'attribute' => 'value'.
[ "Adds", "an", "array", "of", "attributes", "to", "this", "XHTML", "tag" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlTag.php#L103-L108
train
silverorange/swat
Swat/SwatHtmlTag.php
SwatHtmlTag.display
public function display() { if ($this->content === null) { $this->openInternal(true); } else { $this->openInternal(false); $this->displayContent(); $this->close(); } }
php
public function display() { if ($this->content === null) { $this->openInternal(true); } else { $this->openInternal(false); $this->displayContent(); $this->close(); } }
[ "public", "function", "display", "(", ")", "{", "if", "(", "$", "this", "->", "content", "===", "null", ")", "{", "$", "this", "->", "openInternal", "(", "true", ")", ";", "}", "else", "{", "$", "this", "->", "openInternal", "(", "false", ")", ";",...
Displays this tag Output the opening tag including all its attributes and implicitly close the tag. If explicit closing is desired, use {@link SwatHtmlTag::open()} and {@link SwatHtmlTag::close()} instead. If {@link SwatHtmlTag::content} is set then the content is displayed between an opening and closing tag, otherwise a self-closing tag is displayed. @see SwatHtmlTag::open()
[ "Displays", "this", "tag" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlTag.php#L141-L150
train
silverorange/swat
Swat/SwatHtmlTag.php
SwatHtmlTag.displayContent
public function displayContent() { if ($this->content !== null) { if ($this->content_type === 'text/plain') { echo SwatString::minimizeEntities($this->content); } else { echo $this->content; } } }
php
public function displayContent() { if ($this->content !== null) { if ($this->content_type === 'text/plain') { echo SwatString::minimizeEntities($this->content); } else { echo $this->content; } } }
[ "public", "function", "displayContent", "(", ")", "{", "if", "(", "$", "this", "->", "content", "!==", "null", ")", "{", "if", "(", "$", "this", "->", "content_type", "===", "'text/plain'", ")", "{", "echo", "SwatString", "::", "minimizeEntities", "(", "...
Displays the content of this tag If {@link SwatHtmlTag::content} is set then the content is displayed. @see SwatHtmlTag::display()
[ "Displays", "the", "content", "of", "this", "tag" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlTag.php#L162-L171
train
silverorange/swat
Swat/SwatHtmlTag.php
SwatHtmlTag.openInternal
private function openInternal($self_closing = false) { echo '<', $this->tag_name; foreach ($this->attributes as $attribute => $value) { if ($value !== null) { echo ' ', $attribute, '="', SwatString::minimizeEntities($value), '"'; } } if ($self_closing) { echo ' />'; } else { echo '>'; } }
php
private function openInternal($self_closing = false) { echo '<', $this->tag_name; foreach ($this->attributes as $attribute => $value) { if ($value !== null) { echo ' ', $attribute, '="', SwatString::minimizeEntities($value), '"'; } } if ($self_closing) { echo ' />'; } else { echo '>'; } }
[ "private", "function", "openInternal", "(", "$", "self_closing", "=", "false", ")", "{", "echo", "'<'", ",", "$", "this", "->", "tag_name", ";", "foreach", "(", "$", "this", "->", "attributes", "as", "$", "attribute", "=>", "$", "value", ")", "{", "if"...
Outputs opening tag and all attributes This is a helper method that does the attribute displaying when opening this tag. This method can also display self-closing XHTML tags. @param boolean $self_closing whether this tag should be displayed as a self-closing tag.
[ "Outputs", "opening", "tag", "and", "all", "attributes" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlTag.php#L309-L328
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/DataStoreAbstract.php
DataStoreAbstract.getKeys
protected function getKeys() { $identifier = $this->getIdentifier(); $query = new Query(); $selectNode = new Node\SelectNode([$identifier]); $query->setSelect($selectNode); $queryResult = $this->query($query); $keysArray = []; foreach ($queryResult as $row) { $keysArray[] = $row[$identifier]; } return $keysArray; }
php
protected function getKeys() { $identifier = $this->getIdentifier(); $query = new Query(); $selectNode = new Node\SelectNode([$identifier]); $query->setSelect($selectNode); $queryResult = $this->query($query); $keysArray = []; foreach ($queryResult as $row) { $keysArray[] = $row[$identifier]; } return $keysArray; }
[ "protected", "function", "getKeys", "(", ")", "{", "$", "identifier", "=", "$", "this", "->", "getIdentifier", "(", ")", ";", "$", "query", "=", "new", "Query", "(", ")", ";", "$", "selectNode", "=", "new", "Node", "\\", "SelectNode", "(", "[", "$", ...
Return array of keys or empty array @return array
[ "Return", "array", "of", "keys", "or", "empty", "array" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/DataStoreAbstract.php#L494-L509
train
silverorange/swat
Swat/SwatHtmlHeadEntrySet.php
SwatHtmlHeadEntrySet.addEntry
public function addEntry($entry) { if (is_string($entry)) { $class = $this->getClassFromType($entry); if ($class === null) { throw new SwatClassNotFoundException( 'SwatHtmlHeadEntry class not found for entry string of "' . $entry . '".' ); } $entry = new $class($entry); } if (!($entry instanceof SwatHtmlHeadEntry)) { throw new SwatInvalidTypeException( 'Added entry must be either a string or an instance of a' . 'SwatHtmlHeadEntry.', 0, $entry ); } $uri = $entry->getUri(); if (!array_key_exists($uri, $this->entries)) { $this->entries[$uri] = $entry; } }
php
public function addEntry($entry) { if (is_string($entry)) { $class = $this->getClassFromType($entry); if ($class === null) { throw new SwatClassNotFoundException( 'SwatHtmlHeadEntry class not found for entry string of "' . $entry . '".' ); } $entry = new $class($entry); } if (!($entry instanceof SwatHtmlHeadEntry)) { throw new SwatInvalidTypeException( 'Added entry must be either a string or an instance of a' . 'SwatHtmlHeadEntry.', 0, $entry ); } $uri = $entry->getUri(); if (!array_key_exists($uri, $this->entries)) { $this->entries[$uri] = $entry; } }
[ "public", "function", "addEntry", "(", "$", "entry", ")", "{", "if", "(", "is_string", "(", "$", "entry", ")", ")", "{", "$", "class", "=", "$", "this", "->", "getClassFromType", "(", "$", "entry", ")", ";", "if", "(", "$", "class", "===", "null", ...
Adds a HTML head entry to this set @param SwatHtmlHeadEntry|string $entry the entry to add.
[ "Adds", "a", "HTML", "head", "entry", "to", "this", "set" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlHeadEntrySet.php#L62-L91
train
silverorange/swat
Swat/SwatHtmlHeadEntrySet.php
SwatHtmlHeadEntrySet.addEntrySet
public function addEntrySet(SwatHtmlHeadEntrySet $set) { $this->entries = array_merge($this->entries, $set->entries); }
php
public function addEntrySet(SwatHtmlHeadEntrySet $set) { $this->entries = array_merge($this->entries, $set->entries); }
[ "public", "function", "addEntrySet", "(", "SwatHtmlHeadEntrySet", "$", "set", ")", "{", "$", "this", "->", "entries", "=", "array_merge", "(", "$", "this", "->", "entries", ",", "$", "set", "->", "entries", ")", ";", "}" ]
Adds a set of HTML head entries to this set @param SwatHtmlHeadEntrySet $set the set to add.
[ "Adds", "a", "set", "of", "HTML", "head", "entries", "to", "this", "set" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlHeadEntrySet.php#L101-L104
train
silverorange/swat
Swat/SwatHtmlHeadEntrySet.php
SwatHtmlHeadEntrySet.getByType
public function getByType($type) { $class = __CLASS__; $set = new $class(); foreach ($this->entries as $entry) { if ($entry->getType() === $type) { $set->addEntry($entry); } } return $set; }
php
public function getByType($type) { $class = __CLASS__; $set = new $class(); foreach ($this->entries as $entry) { if ($entry->getType() === $type) { $set->addEntry($entry); } } return $set; }
[ "public", "function", "getByType", "(", "$", "type", ")", "{", "$", "class", "=", "__CLASS__", ";", "$", "set", "=", "new", "$", "class", "(", ")", ";", "foreach", "(", "$", "this", "->", "entries", "as", "$", "entry", ")", "{", "if", "(", "$", ...
Gets a subset of this set by the entry type @param string $type the type of HTML head entry to get. For example, 'SwatJavaScriptHtmlHeadEntry'. @return SwatHtmlHeadEntrySet a subset of this set containing only entries of the specified type. If no such entries exist, an empty set is returned.
[ "Gets", "a", "subset", "of", "this", "set", "by", "the", "entry", "type" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlHeadEntrySet.php#L189-L199
train
brainworxx/kreXX
src/Analyse/Callback/Iterate/ThroughMethodAnalysis.php
ThroughMethodAnalysis.callMe
public function callMe() { $output = $this->dispatchStartEvent(); foreach ($this->parameters[static::PARAM_DATA] as $key => $string) { /** @var Model $model */ $model = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($string) ->setName($key) ->setType(static::TYPE_REFLECTION); if ($key === static::META_COMMENT || $key === static::META_DECLARED_IN || $key === static::META_SOURCE) { $model->setNormal(static::UNKNOWN_VALUE); $model->setHasExtra(true); } else { $model->setNormal($string); } $output .= $this->pool->render->renderSingleChild( $this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $model ) ); } return $output; }
php
public function callMe() { $output = $this->dispatchStartEvent(); foreach ($this->parameters[static::PARAM_DATA] as $key => $string) { /** @var Model $model */ $model = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($string) ->setName($key) ->setType(static::TYPE_REFLECTION); if ($key === static::META_COMMENT || $key === static::META_DECLARED_IN || $key === static::META_SOURCE) { $model->setNormal(static::UNKNOWN_VALUE); $model->setHasExtra(true); } else { $model->setNormal($string); } $output .= $this->pool->render->renderSingleChild( $this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $model ) ); } return $output; }
[ "public", "function", "callMe", "(", ")", "{", "$", "output", "=", "$", "this", "->", "dispatchStartEvent", "(", ")", ";", "foreach", "(", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_DATA", "]", "as", "$", "key", "=>", "$", "string", ...
Renders the info of a single method. @return string The generated markup.
[ "Renders", "the", "info", "of", "a", "single", "method", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughMethodAnalysis.php#L61-L88
train
brainworxx/kreXX
src/Service/Config/From/Ini.php
Ini.loadIniFile
public function loadIniFile($path) { $this->iniSettings = (array)parse_ini_string( $this->pool->fileService->getFileContents($path, false), true ); return $this; }
php
public function loadIniFile($path) { $this->iniSettings = (array)parse_ini_string( $this->pool->fileService->getFileContents($path, false), true ); return $this; }
[ "public", "function", "loadIniFile", "(", "$", "path", ")", "{", "$", "this", "->", "iniSettings", "=", "(", "array", ")", "parse_ini_string", "(", "$", "this", "->", "pool", "->", "fileService", "->", "getFileContents", "(", "$", "path", ",", "false", "...
Setter for the ini path. @param string $path The path to the ini file. @return $this Return $this, for chaining.
[ "Setter", "for", "the", "ini", "path", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/From/Ini.php#L82-L91
train
brainworxx/kreXX
src/Service/Config/From/Ini.php
Ini.getFeConfig
public function getFeConfig($name) { // Load it from the file. $filevalue = $this->getFeConfigFromFile($name); // Do we have a value? if (empty($filevalue) === true) { // Fallback to factory settings. if (isset($this->feConfigFallback[$name]) === true) { return array( ($this->feConfigFallback[$name][static::RENDER][static::RENDER_EDITABLE] === static::VALUE_TRUE), $this->feConfigFallback[$name][static::RENDER][static::RENDER_TYPE] ); } // Unknown parameter and nothing in the fallback! // This should never happen, btw. return array(false, static::RENDER_TYPE_NONE); } return array( ($filevalue[static::RENDER_EDITABLE] === static::VALUE_TRUE), $filevalue[static::RENDER_TYPE] ); }
php
public function getFeConfig($name) { // Load it from the file. $filevalue = $this->getFeConfigFromFile($name); // Do we have a value? if (empty($filevalue) === true) { // Fallback to factory settings. if (isset($this->feConfigFallback[$name]) === true) { return array( ($this->feConfigFallback[$name][static::RENDER][static::RENDER_EDITABLE] === static::VALUE_TRUE), $this->feConfigFallback[$name][static::RENDER][static::RENDER_TYPE] ); } // Unknown parameter and nothing in the fallback! // This should never happen, btw. return array(false, static::RENDER_TYPE_NONE); } return array( ($filevalue[static::RENDER_EDITABLE] === static::VALUE_TRUE), $filevalue[static::RENDER_TYPE] ); }
[ "public", "function", "getFeConfig", "(", "$", "name", ")", "{", "// Load it from the file.", "$", "filevalue", "=", "$", "this", "->", "getFeConfigFromFile", "(", "$", "name", ")", ";", "// Do we have a value?", "if", "(", "empty", "(", "$", "filevalue", ")",...
Get the configuration of the frontend config form. @param string $name The parameter name you want to render. @return array The configuration (is it editable, a dropdown, a textfield, ...)
[ "Get", "the", "configuration", "of", "the", "frontend", "config", "form", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/From/Ini.php#L102-L125
train
brainworxx/kreXX
src/Service/Config/From/Ini.php
Ini.getFeConfigFromFile
public function getFeConfigFromFile($parameterName) { // Get the human readable stuff from the ini file. $value = $this->getConfigFromFile('feEditing', $parameterName); if (empty($value) === true) { // Sorry, no value stored. return null; } // Get the rendering type. $type = $this->feConfigFallback[$parameterName][static::RENDER][static::RENDER_TYPE]; // Stitch together the setting. switch ($value) { case static::RENDER_TYPE_NONE: $type = static::RENDER_TYPE_NONE; $editable = static::VALUE_FALSE; break; case static::RENDER_TYPE_INI_DISPLAY: $editable = static::VALUE_FALSE; break; case static::RENDER_TYPE_INI_FULL: $editable = static::VALUE_TRUE; break; default: // Unknown setting. // Fallback to no display, just in case. $type = static::RENDER_TYPE_NONE; $editable = static::VALUE_FALSE; break; } return array( static::RENDER_TYPE => $type, static::RENDER_EDITABLE => $editable, ); }
php
public function getFeConfigFromFile($parameterName) { // Get the human readable stuff from the ini file. $value = $this->getConfigFromFile('feEditing', $parameterName); if (empty($value) === true) { // Sorry, no value stored. return null; } // Get the rendering type. $type = $this->feConfigFallback[$parameterName][static::RENDER][static::RENDER_TYPE]; // Stitch together the setting. switch ($value) { case static::RENDER_TYPE_NONE: $type = static::RENDER_TYPE_NONE; $editable = static::VALUE_FALSE; break; case static::RENDER_TYPE_INI_DISPLAY: $editable = static::VALUE_FALSE; break; case static::RENDER_TYPE_INI_FULL: $editable = static::VALUE_TRUE; break; default: // Unknown setting. // Fallback to no display, just in case. $type = static::RENDER_TYPE_NONE; $editable = static::VALUE_FALSE; break; } return array( static::RENDER_TYPE => $type, static::RENDER_EDITABLE => $editable, ); }
[ "public", "function", "getFeConfigFromFile", "(", "$", "parameterName", ")", "{", "// Get the human readable stuff from the ini file.", "$", "value", "=", "$", "this", "->", "getConfigFromFile", "(", "'feEditing'", ",", "$", "parameterName", ")", ";", "if", "(", "em...
Get the config of the frontend config form from the file. @param string $parameterName The parameter you want to render. @return array|null The configuration (is it editable, a dropdown, a textfield, ...)
[ "Get", "the", "config", "of", "the", "frontend", "config", "form", "from", "the", "file", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/From/Ini.php#L136-L176
train
brainworxx/kreXX
src/Service/Config/From/Ini.php
Ini.getConfigFromFile
public function getConfigFromFile($group, $name) { // Do we have a value in the ini? // Does it validate? if (isset($this->iniSettings[$group][$name]) === true && $this->security->evaluateSetting($group, $name, $this->iniSettings[$group][$name]) === true ) { return $this->iniSettings[$group][$name]; } return null; }
php
public function getConfigFromFile($group, $name) { // Do we have a value in the ini? // Does it validate? if (isset($this->iniSettings[$group][$name]) === true && $this->security->evaluateSetting($group, $name, $this->iniSettings[$group][$name]) === true ) { return $this->iniSettings[$group][$name]; } return null; }
[ "public", "function", "getConfigFromFile", "(", "$", "group", ",", "$", "name", ")", "{", "// Do we have a value in the ini?", "// Does it validate?", "if", "(", "isset", "(", "$", "this", "->", "iniSettings", "[", "$", "group", "]", "[", "$", "name", "]", "...
Returns settings from the ini file. @param string $group The group name inside of the ini. @param string $name The name of the setting. @return string The value from the file.
[ "Returns", "settings", "from", "the", "ini", "file", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/From/Ini.php#L189-L200
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php
ConditionBuilderAbstract.makeAbstractQueryOperator
public function makeAbstractQueryOperator(AbstractQueryNode $queryNode) { switch (true) { case ($queryNode instanceof AbstractScalarOperatorNode): return $this->makeScalarOperator($queryNode); case ($queryNode instanceof AbstractLogicOperatorNode): return $this->makeLogicOperator($queryNode); case ($queryNode instanceof AbstractArrayOperatorNode): return $this->makeArrayOperator($queryNode); case ($queryNode instanceof BinaryOperatorNodeAbstract): return $this->makeBinaryOperator($queryNode); default: throw new DataStoreException('The Node type not supported: ' . $queryNode->getNodeName()); } }
php
public function makeAbstractQueryOperator(AbstractQueryNode $queryNode) { switch (true) { case ($queryNode instanceof AbstractScalarOperatorNode): return $this->makeScalarOperator($queryNode); case ($queryNode instanceof AbstractLogicOperatorNode): return $this->makeLogicOperator($queryNode); case ($queryNode instanceof AbstractArrayOperatorNode): return $this->makeArrayOperator($queryNode); case ($queryNode instanceof BinaryOperatorNodeAbstract): return $this->makeBinaryOperator($queryNode); default: throw new DataStoreException('The Node type not supported: ' . $queryNode->getNodeName()); } }
[ "public", "function", "makeAbstractQueryOperator", "(", "AbstractQueryNode", "$", "queryNode", ")", "{", "switch", "(", "true", ")", "{", "case", "(", "$", "queryNode", "instanceof", "AbstractScalarOperatorNode", ")", ":", "return", "$", "this", "->", "makeScalarO...
Make string with conditions for not null Query @param AbstractQueryNode $queryNode @return string @throws DataStoreException
[ "Make", "string", "with", "conditions", "for", "not", "null", "Query" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php#L65-L79
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php
ConditionBuilderAbstract.makeBinaryOperator
public function makeBinaryOperator(BinaryOperatorNodeAbstract $node) { $nodeName = $node->getNodeName(); if (!isset($this->literals['BinaryOperator'][$nodeName])) { throw new DataStoreException( 'The Binary Operator not supported: ' . $nodeName ); } $strQuery = $this->literals['BinaryOperator'][$nodeName]['before'] . $this->prepareFieldName($node->getField()) . $this->literals['BinaryOperator'][$nodeName]['after']; return $strQuery; }
php
public function makeBinaryOperator(BinaryOperatorNodeAbstract $node) { $nodeName = $node->getNodeName(); if (!isset($this->literals['BinaryOperator'][$nodeName])) { throw new DataStoreException( 'The Binary Operator not supported: ' . $nodeName ); } $strQuery = $this->literals['BinaryOperator'][$nodeName]['before'] . $this->prepareFieldName($node->getField()) . $this->literals['BinaryOperator'][$nodeName]['after']; return $strQuery; }
[ "public", "function", "makeBinaryOperator", "(", "BinaryOperatorNodeAbstract", "$", "node", ")", "{", "$", "nodeName", "=", "$", "node", "->", "getNodeName", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "literals", "[", "'BinaryOperator'",...
Make string with conditions for binary operators @param BinaryOperatorNodeAbstract $node @return string
[ "Make", "string", "with", "conditions", "for", "binary", "operators" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php#L87-L102
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php
ConditionBuilderAbstract.getValueFromGlob
public function getValueFromGlob(Glob $globNode) { $reflection = new \ReflectionClass($globNode); $globProperty = $reflection->getProperty('glob'); $globProperty->setAccessible(true); $glob = $globProperty->getValue($globNode); $globProperty->setAccessible(false); return $glob; }
php
public function getValueFromGlob(Glob $globNode) { $reflection = new \ReflectionClass($globNode); $globProperty = $reflection->getProperty('glob'); $globProperty->setAccessible(true); $glob = $globProperty->getValue($globNode); $globProperty->setAccessible(false); return $glob; }
[ "public", "function", "getValueFromGlob", "(", "Glob", "$", "globNode", ")", "{", "$", "reflection", "=", "new", "\\", "ReflectionClass", "(", "$", "globNode", ")", ";", "$", "globProperty", "=", "$", "reflection", "->", "getProperty", "(", "'glob'", ")", ...
Return value from Glob I have no idea why, but Xiag\Rql\Parser\DataType\Glob have not method getValue(). We fix it/ @see Glob @param Glob $globNode @return string
[ "Return", "value", "from", "Glob" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php#L173-L182
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php
ConditionBuilderAbstract.makeLogicOperator
public function makeLogicOperator(AbstractLogicOperatorNode $node) { $nodeName = $node->getNodeName(); if (!isset($this->literals['LogicOperator'][$nodeName])) { throw new DataStoreException( 'The Logic Operator not supported: ' . $nodeName ); } $arrayQueries = $node->getQueries(); $strQuery = $this->literals['LogicOperator'][$nodeName]['before']; foreach ($arrayQueries as $queryNode) { /* @var $queryNode AbstractQueryNode */ $strQuery = $strQuery . $this->makeAbstractQueryOperator($queryNode) . $this->literals['LogicOperator'][$nodeName]['between']; } $strQuery = rtrim($strQuery, $this->literals['LogicOperator'][$nodeName]['between']); $strQuery = $strQuery . $this->literals['LogicOperator'][$nodeName]['after']; return $strQuery; }
php
public function makeLogicOperator(AbstractLogicOperatorNode $node) { $nodeName = $node->getNodeName(); if (!isset($this->literals['LogicOperator'][$nodeName])) { throw new DataStoreException( 'The Logic Operator not supported: ' . $nodeName ); } $arrayQueries = $node->getQueries(); $strQuery = $this->literals['LogicOperator'][$nodeName]['before']; foreach ($arrayQueries as $queryNode) { /* @var $queryNode AbstractQueryNode */ $strQuery = $strQuery . $this->makeAbstractQueryOperator($queryNode) . $this->literals['LogicOperator'][$nodeName]['between']; } $strQuery = rtrim($strQuery, $this->literals['LogicOperator'][$nodeName]['between']); $strQuery = $strQuery . $this->literals['LogicOperator'][$nodeName]['after']; return $strQuery; }
[ "public", "function", "makeLogicOperator", "(", "AbstractLogicOperatorNode", "$", "node", ")", "{", "$", "nodeName", "=", "$", "node", "->", "getNodeName", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "literals", "[", "'LogicOperator'", ...
Make string with conditions for LogicOperatorNode @param AbstractLogicOperatorNode $node @return string @throws DataStoreException
[ "Make", "string", "with", "conditions", "for", "LogicOperatorNode" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php#L191-L214
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php
ConditionBuilderAbstract.makeArrayOperator
public function makeArrayOperator(AbstractArrayOperatorNode $node) { $nodeName = $node->getNodeName(); if (!isset($this->literals['ArrayOperator'][$nodeName])) { throw new DataStoreException( 'The Array Operator not supported: ' . $nodeName ); } $arrayValues = $node->getValues(); $strQuery = $this->literals['ArrayOperator'][$nodeName]['before'] . $this->prepareFieldName($node->getField()) . $this->literals['ArrayOperator'][$nodeName]['between']; foreach ($arrayValues as $value) { $strQuery = $strQuery . $this->prepareFieldValue($value) . $this->literals['ArrayOperator'][$nodeName]['delimiter']; } $strQuery = rtrim($strQuery, $this->literals['ArrayOperator'][$nodeName]['delimiter']); $strQuery = $strQuery . $this->literals['ArrayOperator'][$nodeName]['after']; return $strQuery; }
php
public function makeArrayOperator(AbstractArrayOperatorNode $node) { $nodeName = $node->getNodeName(); if (!isset($this->literals['ArrayOperator'][$nodeName])) { throw new DataStoreException( 'The Array Operator not supported: ' . $nodeName ); } $arrayValues = $node->getValues(); $strQuery = $this->literals['ArrayOperator'][$nodeName]['before'] . $this->prepareFieldName($node->getField()) . $this->literals['ArrayOperator'][$nodeName]['between']; foreach ($arrayValues as $value) { $strQuery = $strQuery . $this->prepareFieldValue($value) . $this->literals['ArrayOperator'][$nodeName]['delimiter']; } $strQuery = rtrim($strQuery, $this->literals['ArrayOperator'][$nodeName]['delimiter']); $strQuery = $strQuery . $this->literals['ArrayOperator'][$nodeName]['after']; return $strQuery; }
[ "public", "function", "makeArrayOperator", "(", "AbstractArrayOperatorNode", "$", "node", ")", "{", "$", "nodeName", "=", "$", "node", "->", "getNodeName", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "literals", "[", "'ArrayOperator'", ...
Make string with conditions for ArrayOperatorNode @param AbstractArrayOperatorNode $node @return string @throws DataStoreException
[ "Make", "string", "with", "conditions", "for", "ArrayOperatorNode" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php#L223-L248
train
silverorange/swat
Swat/SwatToolLink.php
SwatToolLink.display
public function display() { if (!$this->visible) { return; } parent::display(); $tag = $this->isSensitive() ? $this->getSensitiveTag() : $this->getInsensitiveTag(); $tag->open(); $icon_span = new SwatHtmlTag('span'); if ($this->isSensitive()) { $icon_span->class = 'swat-tool-link-icon'; } else { $icon_span->class = 'swat-tool-link-icon swat-tool-link-icon-insensitive'; } $icon_span->setContent(''); $icon_span->display(); $title_span = new SwatHtmlTag('span'); $title_span->class = 'swat-tool-link-title'; $title_span->setContent($this->title, $this->content_type); $title_span->display(); $tag->close(); }
php
public function display() { if (!$this->visible) { return; } parent::display(); $tag = $this->isSensitive() ? $this->getSensitiveTag() : $this->getInsensitiveTag(); $tag->open(); $icon_span = new SwatHtmlTag('span'); if ($this->isSensitive()) { $icon_span->class = 'swat-tool-link-icon'; } else { $icon_span->class = 'swat-tool-link-icon swat-tool-link-icon-insensitive'; } $icon_span->setContent(''); $icon_span->display(); $title_span = new SwatHtmlTag('span'); $title_span->class = 'swat-tool-link-title'; $title_span->setContent($this->title, $this->content_type); $title_span->display(); $tag->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "tag", "=", "$", "this", "->", "isSensitive", "(", ")", "?", "$", "this", ...
Displays this tool link
[ "Displays", "this", "tool", "link" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolLink.php#L148-L181
train
silverorange/swat
Swat/SwatToolLink.php
SwatToolLink.setFromStock
public function setFromStock($stock_id, $overwrite_properties = true) { switch ($stock_id) { case 'create': $title = Swat::_('Create'); $class = 'swat-tool-link-create'; break; case 'add': $title = Swat::_('Add'); $class = 'swat-tool-link-add'; break; case 'edit': $title = Swat::_('Edit'); $class = 'swat-tool-link-edit'; break; case 'download': $title = Swat::_('Download'); $class = 'swat-tool-link-download'; break; case 'delete': $title = Swat::_('Delete'); $class = 'swat-tool-link-delete'; break; case 'cancel': $title = Swat::_('Cancel'); $class = 'swat-tool-link-cancel'; break; case 'preview': $title = Swat::_('Preview'); $class = 'swat-tool-link-preview'; break; case 'change-order': $title = Swat::_('Change Order'); $class = 'swat-tool-link-change-order'; break; case 'help': $title = Swat::_('Help'); $class = 'swat-tool-link-help'; break; case 'print': $title = Swat::_('Print'); $class = 'swat-tool-link-print'; break; case 'email': $title = Swat::_('Email'); $class = 'swat-tool-link-email'; break; default: throw new SwatUndefinedStockTypeException( "Stock type with id of '{$stock_id}' not found.", 0, $stock_id ); } if ($overwrite_properties || $this->title === null) { $this->title = $title; } $this->stock_class = $class; }
php
public function setFromStock($stock_id, $overwrite_properties = true) { switch ($stock_id) { case 'create': $title = Swat::_('Create'); $class = 'swat-tool-link-create'; break; case 'add': $title = Swat::_('Add'); $class = 'swat-tool-link-add'; break; case 'edit': $title = Swat::_('Edit'); $class = 'swat-tool-link-edit'; break; case 'download': $title = Swat::_('Download'); $class = 'swat-tool-link-download'; break; case 'delete': $title = Swat::_('Delete'); $class = 'swat-tool-link-delete'; break; case 'cancel': $title = Swat::_('Cancel'); $class = 'swat-tool-link-cancel'; break; case 'preview': $title = Swat::_('Preview'); $class = 'swat-tool-link-preview'; break; case 'change-order': $title = Swat::_('Change Order'); $class = 'swat-tool-link-change-order'; break; case 'help': $title = Swat::_('Help'); $class = 'swat-tool-link-help'; break; case 'print': $title = Swat::_('Print'); $class = 'swat-tool-link-print'; break; case 'email': $title = Swat::_('Email'); $class = 'swat-tool-link-email'; break; default: throw new SwatUndefinedStockTypeException( "Stock type with id of '{$stock_id}' not found.", 0, $stock_id ); } if ($overwrite_properties || $this->title === null) { $this->title = $title; } $this->stock_class = $class; }
[ "public", "function", "setFromStock", "(", "$", "stock_id", ",", "$", "overwrite_properties", "=", "true", ")", "{", "switch", "(", "$", "stock_id", ")", "{", "case", "'create'", ":", "$", "title", "=", "Swat", "::", "_", "(", "'Create'", ")", ";", "$"...
Sets the values of this tool link to a stock type Valid stock type ids are: - create - add - edit - delete - cancel - preview - change-order - help - print - email @param string $stock_id the identifier of the stock type to use. @param boolean $overwrite_properties whether to overwrite properties if they are already set. @throws SwatUndefinedStockTypeException
[ "Sets", "the", "values", "of", "this", "tool", "link", "to", "a", "stock", "type" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolLink.php#L208-L279
train
silverorange/swat
Swat/SwatToolLink.php
SwatToolLink.getCSSClassNames
protected function getCSSClassNames() { $classes = array('swat-tool-link'); if (!$this->isSensitive()) { $classes[] = 'swat-tool-link-insensitive'; } if ($this->stock_class !== null) { $classes[] = $this->stock_class; } $classes = array_merge($classes, $this->classes); return $classes; }
php
protected function getCSSClassNames() { $classes = array('swat-tool-link'); if (!$this->isSensitive()) { $classes[] = 'swat-tool-link-insensitive'; } if ($this->stock_class !== null) { $classes[] = $this->stock_class; } $classes = array_merge($classes, $this->classes); return $classes; }
[ "protected", "function", "getCSSClassNames", "(", ")", "{", "$", "classes", "=", "array", "(", "'swat-tool-link'", ")", ";", "if", "(", "!", "$", "this", "->", "isSensitive", "(", ")", ")", "{", "$", "classes", "[", "]", "=", "'swat-tool-link-insensitive'"...
Gets the array of CSS classes that are applied to this tool link @return array the array of CSS classes that are applied to this tool link.
[ "Gets", "the", "array", "of", "CSS", "classes", "that", "are", "applied", "to", "this", "tool", "link" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolLink.php#L290-L305
train
silverorange/swat
Swat/SwatToolLink.php
SwatToolLink.getSensitiveTag
protected function getSensitiveTag() { $tag = new SwatHtmlTag('a'); $tag->id = $this->id; $tag->class = $this->getCSSClassString(); if ($this->target !== null) { $tag->target = $this->target; } if ($this->value === null) { $tag->href = $this->link; } elseif (is_array($this->value)) { $tag->href = vsprintf($this->link, $this->value); } else { $tag->href = sprintf($this->link, $this->value); } if ($this->tooltip !== null) { $tag->title = $this->tooltip; } $tag->accesskey = $this->access_key; return $tag; }
php
protected function getSensitiveTag() { $tag = new SwatHtmlTag('a'); $tag->id = $this->id; $tag->class = $this->getCSSClassString(); if ($this->target !== null) { $tag->target = $this->target; } if ($this->value === null) { $tag->href = $this->link; } elseif (is_array($this->value)) { $tag->href = vsprintf($this->link, $this->value); } else { $tag->href = sprintf($this->link, $this->value); } if ($this->tooltip !== null) { $tag->title = $this->tooltip; } $tag->accesskey = $this->access_key; return $tag; }
[ "protected", "function", "getSensitiveTag", "(", ")", "{", "$", "tag", "=", "new", "SwatHtmlTag", "(", "'a'", ")", ";", "$", "tag", "->", "id", "=", "$", "this", "->", "id", ";", "$", "tag", "->", "class", "=", "$", "this", "->", "getCSSClassString",...
Gets the tag used to display this tool link when it is sensitive @return SwatHtmlTag the tag used to display this tool link when it is sensitive.
[ "Gets", "the", "tag", "used", "to", "display", "this", "tool", "link", "when", "it", "is", "sensitive" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolLink.php#L316-L342
train