_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q2800 | Uri.getNormalizedUriPath | train | private function getNormalizedUriPath()
{
$path = $this->getPath();
if ($this->getAuthority() === '') {
| php | {
"resource": ""
} |
q2801 | RedisCacheService.hGet | train | public function hGet($hashKey, $key)
{
$value = $this->redis->hGet($hashKey, $key);
if ($value) {
$value = gzinflate($value);
}
$jsonData = | php | {
"resource": ""
} |
q2802 | RedisCacheService.hSet | train | public function hSet($hashKey, $key, $data, $expireTime = 3600)
{
$data = (is_object($data) || is_array($data)) ? json_encode($data) : $data;
$data = gzdeflate($data, 0);
if (strlen($data) > 4096) {
$data = gzdeflate($data, 6);
| php | {
"resource": ""
} |
q2803 | Negotiation.header | train | public function header($header, $level = self::HIGH)
{
$header = strtolower($header);
if (empty($this->headers[$header])) {
| php | {
"resource": ""
} |
q2804 | Negotiation.qFactor | train | public static function qFactor($value, $level = self::HIGH)
{
$multivalues = explode(',', $value);
$headers = array();
foreach ($multivalues as $hvalues) {
if (substr_count($hvalues, ';') > 1) {
throw new Exception('Header contains a value with multiple semicolons: "' . $value . '"', 2);
}
$current = explode(';', $hvalues, 2);
if (empty($current[1])) {
$qvalue = 1.0;
} else {
$qvalue = self::parseQValue($current[1]);
| php | {
"resource": ""
} |
q2805 | Select.joinCondition | train | public function joinCondition()
{
if (!isset($this->_joinCondition)) { | php | {
"resource": ""
} |
q2806 | File.portion | train | public static function portion($path, $init = 0, $end = 1024, $lines = false)
{
self::fullpath($path);
if ($lines !== true) {
return file_get_contents($path, false, null, $init, $end);
}
| php | {
"resource": ""
} |
q2807 | File.isBinary | train | public static function isBinary($path)
{
self::fullpath($path);
$size = filesize($path);
if ($size >= 0 && $size < 2) {
return false;
| php | {
"resource": ""
} |
q2808 | File.size | train | public static function size($path)
{
$path = ltrim(self::fullpath($path), '/');
$ch = curl_init('file://' . $path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
$headers = curl_exec($ch);
curl_close($ch);
| php | {
"resource": ""
} |
q2809 | Selector.get | train | public function get($selector, \DOMNode $context = null, $registerNodeNS = | php | {
"resource": ""
} |
q2810 | AbstractEvent.isRunning | train | public function isRunning(Datetime $current = null)
{
$current = | php | {
"resource": ""
} |
q2811 | AbstractEvent.detach | train | public function detach()
{
$this->calendar->getEvents()->removeEvent($this); | php | {
"resource": ""
} |
q2812 | DefaultCertificateValidator.validateCert | train | public function validateCert($certPem) {
if ($this->getCaCert()) { | php | {
"resource": ""
} |
q2813 | DefaultCertificateValidator.getCrlUrl | train | public function getCrlUrl() {
if ($this->crlUrl === self::AUTOLOAD) {
$this->crlUrl = NULL; // Default if we can't find something else.
$caCertObj = X509Util::loadCACert($this->getCaCert());
// There can be multiple DPs, but in practice CiviRootCA only has one.
$crlDPs = $caCertObj->getExtension('id-ce-cRLDistributionPoints');
if (is_array($crlDPs)) {
foreach ($crlDPs as $crlDP) {
foreach ($crlDP['distributionPoint']['fullName'] | php | {
"resource": ""
} |
q2814 | UriPattern.matchUri | train | public function matchUri($uri, & $matches = [])
{
if ($this->matchAbsoluteUri($uri, $matches)) {
return true;
| php | {
"resource": ""
} |
q2815 | UriPattern.match | train | private function match($pattern, $subject, & $matches)
{
$matches = [];
$subject = (string) $subject;
if ($this->allowNonAscii || preg_match('/^[\\x00-\\x7F]*$/', $subject)) { | php | {
"resource": ""
} |
q2816 | UriPattern.getNamedPatterns | train | private function getNamedPatterns($matches)
{
foreach ($matches as $key => $value) {
| php | {
"resource": ""
} |
q2817 | UriPattern.buildPatterns | train | private static function buildPatterns()
{
$alpha = 'A-Za-z';
$digit = '0-9';
$hex = $digit . 'A-Fa-f';
$unreserved = "$alpha$digit\\-._~";
$delimiters = "!$&'()*+,;=";
$utf8 = '\\x80-\\xFF';
$octet = "(?:[$digit]|[1-9][$digit]|1[$digit]{2}|2[0-4]$digit|25[0-5])";
$ipv4address = "(?>$octet\\.$octet\\.$octet\\.$octet)";
$encoded = "%[$hex]{2}";
$h16 = "[$hex]{1,4}";
$ls32 = "(?:$h16:$h16|$ipv4address)";
$data = "[$unreserved$delimiters:@$utf8]++|$encoded";
// Defining the scheme
$scheme = "(?'scheme'(?>[$alpha][$alpha$digit+\\-.]*+))";
// Defining the authority
$ipv6address = "(?'IPv6address'" .
"(?:(?:$h16:){6}$ls32)|" .
"(?:::(?:$h16:){5}$ls32)|" .
"(?:(?:$h16)?::(?:$h16:){4}$ls32)|" .
"(?:(?:(?:$h16:){0,1}$h16)?::(?:$h16:){3}$ls32)|" .
"(?:(?:(?:$h16:){0,2}$h16)?::(?:$h16:){2}$ls32)|" .
"(?:(?:(?:$h16:){0,3}$h16)?::$h16:$ls32)|" .
"(?:(?:(?:$h16:){0,4}$h16)?::$ls32)|" .
"(?:(?:(?:$h16:){0,5}$h16)?::$h16)|" .
"(?:(?:(?:$h16:){0,6}$h16)?::))";
$regularName = "(?'reg_name'(?>(?:[$unreserved$delimiters$utf8]++|$encoded)*))";
$ipvFuture = "(?'IPvFuture'v[$hex]++\\.[$unreserved$delimiters:]++)";
$ipLiteral = "(?'IP_literal'\\[(?>$ipv6address|$ipvFuture)\\])";
$port = "(?'port'(?>[$digit]*+))";
$host = "(?'host'$ipLiteral|(?'IPv4address'$ipv4address)|$regularName)";
$userInfo = "(?'userinfo'(?>(?:[$unreserved$delimiters:$utf8]++|$encoded)*))";
$authority = "(?'authority'(?:$userInfo@)?$host(?::$port)?)";
// Defining the path
$segment = "(?>(?:$data)*)";
$segmentNotEmpty = "(?>(?:$data)+)";
$segmentNoScheme = "(?>([$unreserved$delimiters@$utf8]++|$encoded)+)";
| php | {
"resource": ""
} |
q2818 | FileSystem.createDirectories | train | public static function createDirectories(string $path, int $mode = 0777) : void
{
$exception = null;
try {
$success = ErrorCatcher::run(static function() use ($path, $mode) {
return mkdir($path, $mode, true);
});
if ($success === true) {
return;
}
} catch | php | {
"resource": ""
} |
q2819 | FileSystem.isFile | train | public static function isFile(string $path) : bool
{
try {
return ErrorCatcher::run(static function() use ($path) {
return is_file($path);
});
| php | {
"resource": ""
} |
q2820 | FileSystem.isDirectory | train | public static function isDirectory(string $path) : bool
{
try {
return ErrorCatcher::run(static function() use ($path) {
return is_dir($path);
});
| php | {
"resource": ""
} |
q2821 | FileSystem.isSymbolicLink | train | public static function isSymbolicLink(string $path) : bool
{
try {
return ErrorCatcher::run(static function() use ($path) {
return is_link($path);
});
| php | {
"resource": ""
} |
q2822 | FileSystem.createSymbolicLink | train | public static function createSymbolicLink(string $link, string $target) : void
{
$exception = null;
try {
$success = ErrorCatcher::run(static function() use ($link, $target) {
return symlink($target, $link);
});
if ($success === true) {
return;
} | php | {
"resource": ""
} |
q2823 | FileSystem.readSymbolicLink | train | public static function readSymbolicLink(string $path) : string
{
$exception = null;
try {
$result = ErrorCatcher::run(static function() use ($path) {
return readlink($path);
});
if ($result !== false) {
return $result;
}
| php | {
"resource": ""
} |
q2824 | FileSystem.getRealPath | train | public static function getRealPath(string $path) : string
{
$exception = null;
try {
$result = ErrorCatcher::run(static function() use ($path) {
return realpath($path);
});
if ($result !== false) {
return $result;
}
} catch (\ErrorException | php | {
"resource": ""
} |
q2825 | FileSystem.write | train | public static function write(string $path, $data, bool $append = false, bool $lock = false) : int
{
$flags = 0;
if ($append) {
$flags |= FILE_APPEND;
}
if ($lock) {
$flags |= LOCK_EX;
}
$exception = null;
try {
$result = ErrorCatcher::run(static function() use ($path, $data, $flags) {
return file_put_contents($path, $data, $flags);
});
| php | {
"resource": ""
} |
q2826 | FileSystem.read | train | public static function read(string $path, int $offset = 0, int $maxLength = null) : string
{
$exception = null;
try {
$result = ErrorCatcher::run(static function() use ($path, $offset, $maxLength) {
if ($maxLength === null) {
return file_get_contents($path, false, null, $offset);
}
return file_get_contents($path, false, null, $offset, $maxLength);
});
| php | {
"resource": ""
} |
q2827 | Curl.getInfo | train | public function getInfo(int $opt = null)
{
if ($opt === null) {
return curl_getinfo($this->curl);
| php | {
"resource": ""
} |
q2828 | UriParser.parse | train | public function parse($uri)
{
if (!$this->isValidString($uri)) {
return null;
}
$pattern = new UriPattern();
$pattern->allowNonAscii($this->mode !== self::MODE_RFC3986);
if ($pattern->matchUri($uri, $match)) {
try {
| php | {
"resource": ""
} |
q2829 | UriParser.isValidString | train | private function isValidString($uri)
{
if (preg_match('/^[\\x00-\\x7F]*$/', $uri)) {
return true;
} elseif ($this->mode === self::MODE_RFC3986) {
return false;
}
// Validate UTF-8 via regular expression to avoid mbstring dependency
$pattern =
'/^(?>
[\x00-\x7F]+ # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding over longs
| php | {
"resource": ""
} |
q2830 | UriParser.buildUri | train | private function buildUri(array $components)
{
$uri = new Uri();
if (isset($components['reg_name'])) {
$components['host'] = $this->decodeHost($components['host']);
}
foreach (array_intersect_key(self::$setters, $components) as $key => $method) {
$uri = call_user_func([$uri, $method], $components[$key]);
}
| php | {
"resource": ""
} |
q2831 | UriParser.decodeHost | train | private function decodeHost($hostname)
{
if (preg_match('/^[\\x00-\\x7F]*$/', $hostname)) {
return $hostname;
} elseif ($this->mode !== self::MODE_IDNA2003) {
throw new \InvalidArgumentException("Invalid hostname '$hostname'");
}
$hostname = idn_to_ascii($hostname);
| php | {
"resource": ""
} |
q2832 | App.env | train | public static function env($key, $value = null)
{
if (is_string($value) || is_bool($value) || is_numeric($value)) {
self::$configs[$key] = $value;
| php | {
"resource": ""
} |
q2833 | App.config | train | public static function config($path)
{
$data = \UtilsSandboxLoader('application/Config/' . strtr($path, '.', '/') . '.php');
foreach ($data as $key | php | {
"resource": ""
} |
q2834 | App.trigger | train | public static function trigger($name, array $args = array())
{
if ($name === 'error') {
self::$state = 5;
}
if (empty(self::$events[$name])) {
return null;
}
$listen = self::$events[$name];
usort($listen, function ($a, $b) | php | {
"resource": ""
} |
q2835 | App.off | train | public static function off($name, $callback = null)
{
if (empty(self::$events[$name])) {
return null;
} elseif ($callback === null) {
self::$events[$name] = array();
| php | {
"resource": ""
} |
q2836 | App.stop | train | public static function stop($code, $msg = null)
{
Response::status($code, false) && self::trigger('changestatus', array($code, $msg));
if (self::$state < 4) {
| php | {
"resource": ""
} |
q2837 | App.exec | train | public static function exec()
{
if (self::$state > 0) {
return null;
}
self::$state = 1;
self::trigger('init');
if (self::env('maintenance')) {
self::$state = 4;
self::stop(503);
}
self::trigger('changestatus', array(\UtilsStatusCode(), null));
$resp = Route::get();
if (is_integer($resp)) {
self::$state = 5;
self::stop($resp, 'Invalid route');
}
$callback = $resp['callback'];
if (!$callback instanceof \Closure) {
$parsed = explode(':', $callback, 2);
$callback = '\\Controller\\' . strtr($parsed[0], '.', '\\');
$callback = array(new $callback, $parsed[1]);
}
| php | {
"resource": ""
} |
q2838 | FixedArray.swap | train | public function swap(int $index1, int $index2) : void
{
if ($index1 !== $index2) {
$value = $this[$index1];
| php | {
"resource": ""
} |
q2839 | FixedArray.shiftUp | train | public function shiftUp(int $index) : void
{
if ($index + 1 === $this->count()) {
return;
| php | {
"resource": ""
} |
q2840 | FixedArray.shiftTo | train | public function shiftTo(int $index, int $newIndex) : void
{
while ($index > $newIndex) {
$this->shiftDown($index);
| php | {
"resource": ""
} |
q2841 | PadStringExtension.padStringFilter | train | public function padStringFilter($value, $padCharacter, $maxLength, $padType = 'STR_PAD_RIGHT')
{
if ($this->isNullOrEmptyString($padCharacter)) {
throw new \InvalidArgumentException('Pad String Filter cannot accept a null value or empty string as its first argument');
| php | {
"resource": ""
} |
q2842 | OpenGraphGenerator.generate | train | public function generate()
{
$html = array();
foreach ($this->properties as $property => $value):
if (is_array($value)):
foreach ($value as $_value) {
$html[] = strtr(
static::OPENGRAPH_TAG,
array(
'[property]' => static::OPENGRAPH_PREFIX . $property,
'[value]' => $_value
)
);
| php | {
"resource": ""
} |
q2843 | OpenGraphGenerator.fromRaw | train | public function fromRaw($properties)
{
$this->validateProperties($properties); | php | {
"resource": ""
} |
q2844 | OpenGraphGenerator.fromObject | train | public function fromObject(OpenGraphAware $object)
{
$properties = $object->getOpenGraphData();
$this->validateProperties($properties);
foreach ($properties | php | {
"resource": ""
} |
q2845 | OpenGraphGenerator.validateProperties | train | protected function validateProperties($properties)
{
foreach ($this->required as $required) {
if (!array_key_exists($required, | php | {
"resource": ""
} |
q2846 | DataTablesTwigExtension.jQueryDataTablesStandaloneFunction | train | public function jQueryDataTablesStandaloneFunction(array $args = []) {
return $this->jQueryDataTablesStandalone(ArrayHelper::get($args, "selector", ".table"), | php | {
"resource": ""
} |
q2847 | HttpRequest.execute | train | public function execute() {
$ch = \curl_init();
$this->setAuth($ch);
try {
switch (strtoupper($this->method)) {
case 'GET':
$this->executeGet($ch);
break;
case 'POST':
$this->executePost($ch);
break;
case 'PUT':
$this->executePut($ch);
break;
case 'PATCH':
$this->executePatch($ch);
break;
case 'DELETE':
$this->executeDelete($ch);
break;
// This custom case is used to execute a Multipart PUT request
case 'PUT_MP':
$this->method = 'PUT';
$this->executePutMultipart($ch);
| php | {
"resource": ""
} |
q2848 | HttpRequest.buildPostBody | train | public function buildPostBody($data = null) {
$reqBody = ($data !== null) ? $data : $this->request_body;
| php | {
"resource": ""
} |
q2849 | HttpRequest.executePutMultipart | train | protected function executePutMultipart($ch) {
$xml = $this->request_body;
$uri_string = $this->file_to_upload[0];
$file_name = $this->file_to_upload[1];
$post = array(
'ResourceDescriptor' => $xml,
$uri_string => '@' . $file_name . ';filename=' . basename($file_name)
);
\curl_setopt($ch, CURLOPT_TIMEOUT, 10);
\curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
| php | {
"resource": ""
} |
q2850 | HttpRequest.doExecute | train | protected function doExecute(&$curlHandle) {
$this->setCurlOpts($curlHandle);
$response = \curl_exec($curlHandle);
$header_size = \curl_getinfo($curlHandle, CURLINFO_HEADER_SIZE);
$this->response_body = substr($response, $header_size);
$this->response_headers = [];
$lines = explode("\r\n", substr($response, 0, $header_size));
foreach ($lines as $i => $line) {
if ($i === 0) {
$this->response_headers['http_code'] = $line;
$piece = explode(" ", $line);
if (count($piece) > 1) {
$this->response_headers['protocol'] = $piece[0];
$this->response_headers['status_code'] = $piece[1];
array_splice($piece, 0, 2); //Remove protocol and code
$this->response_headers['reason_phrase'] = implode(" ", $piece);
}
| php | {
"resource": ""
} |
q2851 | HttpRequest.setCurlOpts | train | protected function setCurlOpts(&$curlHandle) {
\curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
\curl_setopt($curlHandle, CURLOPT_URL, $this->url);
\curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
\curl_setopt($curlHandle, CURLOPT_VERBOSE, false);
| php | {
"resource": ""
} |
q2852 | HttpRequest.setAuth | train | protected function setAuth(&$curlHandle) {
if ($this->username !== null && $this->password !== null) {
\curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
\curl_setopt($curlHandle, CURLOPT_USERPWD, base64_encode($this->username . ':' . $this->password));
// | php | {
"resource": ""
} |
q2853 | HttpRequest.getResponseHeader | train | public function getResponseHeader($key = null) {
if (null != $key) {
if (array_key_exists($key, $this->response_headers)) {
| php | {
"resource": ""
} |
q2854 | Translatable.bootTranslatable | train | public static function bootTranslatable()
{
static::addGlobalScope(new TranslatableScope);
try {
$observer = | php | {
"resource": ""
} |
q2855 | DataTablesNormalizer.normalizeColumn | train | public static function normalizeColumn(DataTablesColumnInterface $column) {
$output = [];
ArrayHelper::set($output, "cellType", $column->getCellType(), [null]);
ArrayHelper::set($output, "classname", $column->getClassname(), [null]);
ArrayHelper::set($output, "contentPadding", $column->getContentPadding(), [null]);
ArrayHelper::set($output, "data", $column->getData(), [null]);
ArrayHelper::set($output, "defaultContent", $column->getDefaultContent(), [null]);
ArrayHelper::set($output, "name", $column->getName(), [null]);
ArrayHelper::set($output, "orderable", $column->getOrderable(), [null, true]);
ArrayHelper::set($output, "orderData", $column->getOrderData(), | php | {
"resource": ""
} |
q2856 | DataTablesNormalizer.normalizeResponse | train | public static function normalizeResponse(DataTablesResponseInterface $response) {
$output = [];
$output["data"] = $response->getData();
| php | {
"resource": ""
} |
q2857 | Language.isValidCode | train | public static function isValidCode( $code ) {
return
strcspn( $code, ":/\\\000" ) === strlen( $code )
| php | {
"resource": ""
} |
q2858 | Language.getLocalisationCache | train | public static function getLocalisationCache() {
if ( is_null( self::$dataCache ) ) {
global $wgLocalisationCacheConf;
$class = $wgLocalisationCacheConf['class'];
| php | {
"resource": ""
} |
q2859 | Language.getGenderNsText | train | function getGenderNsText( $index, $gender ) {
$ns = self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' );
| php | {
"resource": ""
} |
q2860 | Language.getLocalNsIndex | train | function getLocalNsIndex( $text ) {
$lctext = $this->lc( $text );
$ids = $this->getNamespaceIds();
return | php | {
"resource": ""
} |
q2861 | Language.getNsIndex | train | function getNsIndex( $text ) {
$lctext = $this->lc( $text );
if ( ( $ns = MWNamespace::getCanonicalIndex( $lctext ) ) !== null ) {
return $ns;
}
$ids | php | {
"resource": ""
} |
q2862 | Language.hebrewYearStart | train | private static function hebrewYearStart( $year ) {
$a = intval( ( 12 * ( $year - 1 ) + 17 ) % 19 );
$b = intval( ( $year - 1 ) % 4 );
$m = 32.044093161144 + 1.5542417966212 * $a + $b / 4.0 - 0.0031777940220923 * ( $year - 1 );
if ( $m < 0 ) {
$m--;
}
$Mar = intval( $m );
if ( $m < 0 ) {
$m++;
}
$m -= $Mar;
$c = intval( ( $Mar + 3 * ( $year - 1 ) + 5 * $b + 5 ) % 7 );
if ( $c == 0 && $a > 11 && $m >= 0.89772376543210 ) {
$Mar++;
} | php | {
"resource": ""
} |
q2863 | Language.romanNumeral | train | static function romanNumeral( $num ) {
static $table = array(
array( '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X' ),
array( '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', 'C' ),
array( '', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', 'M' ),
array( '', 'M', 'MM', 'MMM' )
);
$num = intval( $num );
if ( $num > 3000 || | php | {
"resource": ""
} |
q2864 | Language.uc | train | function uc( $str, $first = false ) {
if ( function_exists( 'mb_strtoupper' ) ) {
if ( $first ) {
if ( $this->isMultibyte( $str ) ) {
return mb_strtoupper( mb_substr( $str, 0, 1 ) ) . mb_substr( $str, 1 );
} else {
return ucfirst( $str );
}
} else {
return $this->isMultibyte( $str ) ? mb_strtoupper( $str ) : strtoupper( $str );
}
} else {
| php | {
"resource": ""
} |
q2865 | Language.ucwordbreaks | train | function ucwordbreaks( $str ) {
if ( $this->isMultibyte( $str ) ) {
$str = $this->lc( $str );
// since \b doesn't work for UTF-8, we explicitely define word break chars
$breaks = "[ \-\(\)\}\{\.,\?!]";
// find first letter after word break
$replaceRegexp = "/^([a-z]|[\\xc0-\\xff][\\x80-\\xbf]*)|$breaks([a-z]|[\\xc0-\\xff][\\x80-\\xbf]*)/";
if ( function_exists( 'mb_strtoupper' ) ) {
return preg_replace_callback(
$replaceRegexp,
array( $this, 'ucwordbreaksCallbackMB' ),
| php | {
"resource": ""
} |
q2866 | Language.firstChar | train | function firstChar( $s ) {
$matches = array();
preg_match(
'/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
'[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})/',
$s,
$matches
);
if ( isset( $matches[1] ) ) {
if ( strlen( $matches[1] ) != 3 ) {
return $matches[1];
}
// Break down Hangul syllables to grab the first jamo
$code = utf8ToCodepoint( $matches[1] );
if ( $code < 0xac00 || 0xd7a4 <= $code ) {
return $matches[1];
} elseif ( $code < 0xb098 ) {
return "\xe3\x84\xb1";
} elseif ( $code < 0xb2e4 ) {
return "\xe3\x84\xb4";
} elseif ( $code < 0xb77c ) {
return "\xe3\x84\xb7";
} elseif ( $code < 0xb9c8 ) {
return "\xe3\x84\xb9";
} elseif ( $code < 0xbc14 ) {
return "\xe3\x85\x81";
} elseif ( $code < | php | {
"resource": ""
} |
q2867 | Language.normalize | train | function normalize( $s ) {
global $wgAllUnicodeFixes;
$s = UtfNormal::cleanUp( $s );
if ( $wgAllUnicodeFixes ) {
$s = $this->transformUsingPairFile( 'normalize-ar.ser', | php | {
"resource": ""
} |
q2868 | Language.getMagic | train | function getMagic( $mw ) {
$this->doMagicHook();
if ( isset( $this->mMagicExtensions[$mw->mId] ) ) {
$rawEntry = $this->mMagicExtensions[$mw->mId];
} else {
$magicWords = $this->getMagicWords();
if ( isset( $magicWords[$mw->mId] ) ) {
$rawEntry = $magicWords[$mw->mId];
} else {
$rawEntry = false;
}
}
if ( | php | {
"resource": ""
} |
q2869 | Language.addMagicWordsByLang | train | function addMagicWordsByLang( $newWords ) {
$code = $this->getCode();
$fallbackChain = array();
while ( $code && !in_array( $code, $fallbackChain ) ) {
$fallbackChain[] = $code;
$code = self::getFallbackFor( $code ); | php | {
"resource": ""
} |
q2870 | Language.getSpecialPageAliases | train | function getSpecialPageAliases() {
// Cache aliases because it may be slow to load them
if ( is_null( $this->mExtendedSpecialPageAliases ) ) {
// Initialise array
$this->mExtendedSpecialPageAliases =
self::$dataCache->getItem( $this->mCode, 'specialPageAliases' ); | php | {
"resource": ""
} |
q2871 | Language.preConvertPlural | train | protected function preConvertPlural( /* Array */ $forms, $count ) {
while ( count( $forms ) < $count ) { | php | {
"resource": ""
} |
q2872 | Language.getFileName | train | static function getFileName( $prefix = 'Language', $code, $suffix = '.php' ) {
// Protect against path traversal
if ( !Language::isValidCode( $code )
|| strcspn( $code, ":/\\\000" ) !== strlen( $code ) )
{ | php | {
"resource": ""
} |
q2873 | MorrisBase.toArray | train | public function toArray()
{
$return = [];
foreach ( $this as $property => $value ) {
if ( '__' == substr( $property, 0, 2 ) || '' === $value || is_null( $value ) || ( is_array( $value ) && empty( $value ) ) ) {
continue;
}
if ( in_array( $property, | php | {
"resource": ""
} |
q2874 | MorrisBase.toJSON | train | public function toJSON()
{
$json = json_encode( $this->toArray() );
return str_replace(
[
'"%hoverCallback%"',
'"%formatter%"',
'"%dateFormat%"',
],
[ | php | {
"resource": ""
} |
q2875 | MorrisBase.toJavascript | train | public function toJavascript()
{
ob_start();
?>
<script type="text/javascript">
jQuery( function( $ )
{
"use strict";
Morris.<?php echo $this->__chart_type ?>(
<?php echo $this->toJSON() ?>
); | php | {
"resource": ""
} |
q2876 | Tx_Oelib_MapperRegistry.getByClassName | train | private function getByClassName($className)
{
if ($className === '') {
throw new \InvalidArgumentException('$className must not be empty.', 1331488868);
}
$unifiedClassName = self::unifyClassName($className);
if (!isset($this->mappers[$unifiedClassName])) {
if (!class_exists($className, true)) {
throw new \InvalidArgumentException(
'No mapper class "' . $className . '" could be found.'
);
}
/** @var \Tx_Oelib_DataMapper $mapper */
$mapper = | php | {
"resource": ""
} |
q2877 | AbstractDataTablesProvider.renderButtons | train | protected function renderButtons($entity, $editRoute, $deleteRoute = null, $enableDelete = true) {
// Initialize the titles.
$titles = [];
$titles[] = $this->getTranslator()->trans("label.edit", [], "CoreBundle");
$titles[] = $this->getTranslator()->trans("label.delete", [], "CoreBundle");
// Initialize the actions.
$actions = [];
$actions[] = $this->getButtonTwigExtension()->bootstrapButtonDefaultFunction(["icon" => "pencil", "title" => $titles[0], "size" => "xs"]);
$actions[] = $this->getButtonTwigExtension()->bootstrapButtonDangerFunction(["icon" => "trash", "title" => $titles[1], "size" => "xs"]);
// Initialize the routes.
$routes = [];
$routes[] = $this->getRouter()->generate($editRoute, ["id" => $entity->getId()]);
$routes[] = $this->getRouter()->generate("jquery_datatables_delete", ["name" => $this->getName(), "id" => $entity->getId()]);
| php | {
"resource": ""
} |
q2878 | AbstractDataTablesProvider.renderFloat | train | protected function renderFloat($number, $decimals = 2, $decPoint = ".", $thousandsSep = ",") {
if (null === $number) {
return "";
}
| php | {
"resource": ""
} |
q2879 | AbstractDataTablesProvider.wrapContent | train | protected function wrapContent($prefix, $content, $suffix) {
$output = [];
if (null !== $prefix) {
$output[] = $prefix;
}
$output[] = $content;
| php | {
"resource": ""
} |
q2880 | Tx_Oelib_Session.getInstance | train | public static function getInstance($type)
{
self::checkType($type);
if (!isset(self::$instances[$type])) { | php | {
"resource": ""
} |
q2881 | Tx_Oelib_Session.setInstance | train | public static function setInstance($type, \Tx_Oelib_Session $instance)
{
self::checkType($type);
| php | {
"resource": ""
} |
q2882 | GiroCheckout_SDK_PaydirektTransaction.validateParams | train | public function validateParams( $p_aParams, &$p_strError ) {
if( isset($p_aParams['shoppingCartType']) ) {
$strShoppingCartType = trim($p_aParams['shoppingCartType']);
}
if (empty($strShoppingCartType)) {
$strShoppingCartType = "MIXED"; // Default value
}
if( isset($p_aParams['shippingAddresseFirstName']) ) {
$strFirstName = trim( $p_aParams['shippingAddresseFirstName'] );
}
else {
$strFirstName = "";
}
if( isset($p_aParams['shippingAddresseLastName']) ) {
$strLastName = trim( $p_aParams['shippingAddresseLastName'] );
}
else {
$strLastName = "";
}
if( isset($p_aParams['shippingEmail']) ) {
$strEmail = trim( $p_aParams['shippingEmail'] );
}
else {
$strEmail = "";
}
if( isset($p_aParams['shippingZipCode']) ) {
$strZipCode = trim($p_aParams['shippingZipCode']);
}
else {
$strZipCode = "";
}
if( isset($p_aParams['shippingCity']) ) {
$strCity = trim( $p_aParams['shippingCity'] );
}
else {
$strCity = "";
}
if( isset($p_aParams['shippingCountry']) ) {
$strCountry = trim( $p_aParams['shippingCountry'] );
}
else {
$strCountry = "";
}
// Validate shopping cart type
if ( !in_array($strShoppingCartType, array(
'PHYSICAL',
'DIGITAL',
'MIXED',
'ANONYMOUS_DONATION',
'AUTHORITIES_PAYMENT',
))) {
$p_strError = "Shopping cart type";
| php | {
"resource": ""
} |
q2883 | AnnotationLoader.loadClassMetadata | train | public function loadClassMetadata(Mapping\ClassMetadataInterface $metadata)
{
$reflClass = $metadata->getReflectionClass();
//Iterate over properties to get | php | {
"resource": ""
} |
q2884 | SitewideContentTaxonomy.updateColumns | train | public function updateColumns($itemType, &$columns)
{
if ($itemType !== 'Pages') {
return;
}
// Check if pages has the tags field
if (!self::enabled()) {
return;
}
// Set column
$field = Config::inst()->get(__CLASS__, 'tag_field');
$columns['Terms'] = [
'printonly' => true, // Hide on page report
| php | {
"resource": ""
} |
q2885 | SitewideContentTaxonomy.enabled | train | public static function enabled()
{
if (!class_exists(TaxonomyTerm::class)) {
return false;
| php | {
"resource": ""
} |
q2886 | SubscriptionFactory.addEntitySubject | train | public function addEntitySubject($id, $type = null, $idKey = "id", $typeKey = "type")
{
if(!isset($this->_subscription->subject)){
$this->_subscription->subject = (object) [
"entities" => [],
"condition" => (object)["attrs" => []]
];
}
$entity = (object) [];
$entity->$idKey = $id;
| php | {
"resource": ""
} |
q2887 | SubscriptionFactory.addAttrCondition | train | public function addAttrCondition($attr) {
if(!isset($this->_subscription->subject)){
$this->_subscription->subject = (object) [];
}
if(!isset($this->_subscription->subject->condition)){
$this->_subscription->subject->condition = (object) [];
}
if (!isset($this->_subscription->subject->condition->attrs)) | php | {
"resource": ""
} |
q2888 | SubscriptionFactory.addExpressionCondition | train | public function addExpressionCondition($expression) {
if(!isset($this->_subscription->subject)){
$this->_subscription->subject = (object) [];
}
if(!isset($this->_subscription->subject->condition)){
| php | {
"resource": ""
} |
q2889 | Backoff.setOptions | train | public function setOptions(array $options) : BackoffInterface
{
| php | {
"resource": ""
} |
q2890 | Backoff.exponential | train | public function exponential(int $attempt) : float
{
if (!is_int($attempt)) {
throw new InvalidArgumentException('Attempt must be an integer');
}
if ($attempt < 1) {
throw new InvalidArgumentException('Attempt must be >= 1');
}
if ($this->maxAttempsExceeded($attempt)) {
throw new BackoffException(
sprintf(
"The number | php | {
"resource": ""
} |
q2891 | Backoff.equalJitter | train | public function equalJitter(int $attempt) : int
{
$half = ($this->exponential($attempt) / 2);
| php | {
"resource": ""
} |
q2892 | Backoff.fullJitter | train | public function fullJitter(int $attempt) : int
{
| php | {
"resource": ""
} |
q2893 | Backoff.random | train | protected function random(float $min, float $max) : float | php | {
"resource": ""
} |
q2894 | AbstractRequest.getRequestHeaders | train | public function getRequestHeaders()
{
// common headers
$headers = array(
'Accept' => 'application/json',
);
// set content type
if ($this->getHttpMethod() !== 'GET') {
$headers['Content-Type'] = 'application/x-www-form-urlencoded';
}
| php | {
"resource": ""
} |
q2895 | AbstractRequest.sendData | train | public function sendData($data)
{
// enforce TLS >= v1.2 (https://www.payway.com.au/rest-docs/index.html#basics)
$config = $this->httpClient->getConfig();
$curlOptions = $config->get('curl.options');
$curlOptions[CURLOPT_SSLVERSION] = 6;
$config->set('curl.options', $curlOptions);
$this->httpClient->setConfig($config);
// don't throw exceptions for 4xx errors
$this->httpClient->getEventDispatcher()->addListener(
'request.error',
function ($event) {
if ($event['response']->isClientError()) {
$event->stopPropagation();
}
}
);
if ($this->getSSLCertificatePath()) {
$this->httpClient->setSslVerification($this->getSSLCertificatePath());
}
$request = $this->httpClient->createRequest(
$this->getHttpMethod(),
$this->getEndpoint(),
$this->getRequestHeaders(),
$data
); | php | {
"resource": ""
} |
q2896 | AbstractRequest.addToData | train | public function addToData(array $data = array(), array $parms = array())
{
foreach ($parms as $parm) {
$getter = 'get' . ucfirst($parm);
if (method_exists($this, | php | {
"resource": ""
} |
q2897 | Tx_Oelib_ConfigurationRegistry.getByNamespace | train | private function getByNamespace($namespace)
{
$this->checkForNonEmptyNamespace($namespace);
if (!isset($this->configurations[$namespace])) {
| php | {
"resource": ""
} |
q2898 | Tx_Oelib_ConfigurationRegistry.set | train | public function set($namespace, \Tx_Oelib_Configuration $configuration)
{
$this->checkForNonEmptyNamespace($namespace);
if (isset($this->configurations[$namespace])) {
| php | {
"resource": ""
} |
q2899 | Tx_Oelib_ConfigurationRegistry.retrieveConfigurationFromTypoScriptSetup | train | private function retrieveConfigurationFromTypoScriptSetup($namespace)
{
$data = $this->getCompleteTypoScriptSetup();
$namespaceParts = explode('.', $namespace);
foreach ($namespaceParts as $namespacePart) {
if (!array_key_exists($namespacePart . '.', $data)) {
$data = [];
break;
}
$data = $data[$namespacePart . '.'];
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.