_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q267600 | Uri.param | test | public function param($key)
{
return isset($this->params[$key])
? $this->params[$key]
: null;
} | php | {
"resource": ""
} |
q267601 | Uri.rebase | test | public function rebase($base)
{
return new static([
'scheme' => $this->scheme,
'user' => $this->user,
'pass' => $this->password,
'host' => $this->host,
'port' => $this->port,
'base' => $base,
'path' => $this->path,
... | php | {
"resource": ""
} |
q267602 | RouteCollection.addRoute | test | public function addRoute(Route $route): void
{
$key = md5(\json_encode((array) $route));
$this->routes[$key] = $route;
foreach ($route->getRequestMethods() as $requestMethod) {
// If this is a dynamic route
if ($route->isDynamic()) {
//... | php | {
"resource": ""
} |
q267603 | RouteCollection.staticRoute | test | public function staticRoute(string $method, string $path): ? Route
{
return $this->route($this->staticRoutes[$method][$path] ?? $path);
} | php | {
"resource": ""
} |
q267604 | RouteCollection.issetStaticRoute | test | public function issetStaticRoute(string $method, string $path): bool
{
return isset($this->staticRoutes[$method][$path]);
} | php | {
"resource": ""
} |
q267605 | RouteCollection.dynamicRoute | test | public function dynamicRoute(string $method, string $regex): ? Route
{
return $this->route($this->dynamicRoutes[$method][$regex] ?? $regex);
} | php | {
"resource": ""
} |
q267606 | RouteCollection.issetDynamicRoute | test | public function issetDynamicRoute(string $method, string $regex): bool
{
return isset($this->dynamicRoutes[$method][$regex]);
} | php | {
"resource": ""
} |
q267607 | RouteCollection.namedRoute | test | public function namedRoute(string $name): ? Route
{
return $this->route($this->namedRoutes[$name] ?? $name);
} | php | {
"resource": ""
} |
q267608 | CrudView.createSubLeaves | test | protected function createSubLeaves()
{
parent::createSubLeaves();
$this->registerSubLeaf(new Button("Save", "Save", function(){
$this->model->savePressedEvent->raise();
}));
$this->registerSubLeaf(new Button("Delete", "Delete", function(){
$this->model->dele... | php | {
"resource": ""
} |
q267609 | Locator.locate | test | public static function locate($filename)
{
if (@file_exists($filename)) return $filename;
$_f = CarteBlanche::getPath('carte_blanche_core').$filename;
if (!empty($_f) && @file_exists($_f)) return $_f;
$include_paths = explode(PATH_SEPARATOR,get_include_path());
foreach($inc... | php | {
"resource": ""
} |
q267610 | Number.convert | test | public function convert(NumberSystem $newSystem)
{
$newDigits = [];
$decimalValue = gmp_init($this->decimalValue());
do {
$divisionResult = gmp_div_qr($decimalValue, $newSystem->getBase());
$remainder = gmp_strval($divisionResult[1]);
$decimalValue = $div... | php | {
"resource": ""
} |
q267611 | Number.equals | test | public function equals(Number $comparedNumber)
{
if ($this->value() !== $comparedNumber->value() ||
!$this->getNumberSystem()->equals($comparedNumber->getNumberSystem())) {
return false;
}
return true;
} | php | {
"resource": ""
} |
q267612 | Number.decimalValue | test | protected function decimalValue()
{
$base = $this->numberSystem->getBase();
$result = 0;
foreach (array_reverse($this->getDigits()) as $position => $value) {
$numberSystemPosition = $this->numberSystem->getSymbolPosition($value);
$result += $numberSystemPosition * po... | php | {
"resource": ""
} |
q267613 | Number.add | test | public function add(Number $addend)
{
$resultDecimalValue = $this->decimalValue() + $addend->decimalValue();
$result = new Number($resultDecimalValue);
return $result->convert($this->getNumberSystem());
} | php | {
"resource": ""
} |
q267614 | Number.subtract | test | public function subtract(Number $subtractor)
{
$resultDecimalValue = $this->decimalValue() - $subtractor->decimalValue();
$result = new Number($resultDecimalValue);
return $result->convert($this->getNumberSystem());
} | php | {
"resource": ""
} |
q267615 | Number.multiply | test | public function multiply(Number $multiplicator)
{
$resultDecimalValue = $this->decimalValue() * $multiplicator->decimalValue();
$result = new Number($resultDecimalValue);
return $result->convert($this->getNumberSystem());
} | php | {
"resource": ""
} |
q267616 | Number.divide | test | public function divide(Number $multiplicator)
{
$resultDecimalValue = round($this->decimalValue() / $multiplicator->decimalValue(), 0);
$result = new Number($resultDecimalValue);
return $result->convert($this->getNumberSystem());
} | php | {
"resource": ""
} |
q267617 | Mysqli.getAdapter | test | public static function getAdapter(\Mysqli $mysqli)
{
$driver = new Driver\Mysqli\Mysqli($mysqli);
$adapter = new Adapter($driver);
return $adapter;
} | php | {
"resource": ""
} |
q267618 | CloneModel.aliasList | test | public static function aliasList()
{
$result = [];
foreach (\Yii::$aliases as $alias => $data) {
if (is_array($data)) {
$result = array_merge($result, array_keys($data));
} else {
$result[] = $alias;
}
}
asort($resul... | php | {
"resource": ""
} |
q267619 | CloneModel.findAliases | test | public static function findAliases($query)
{
$query = '@' . str_replace('@', '', $query);
$pattern = '/' . preg_quote($query, '/') . '/';
return preg_grep($pattern, self::aliasList());
} | php | {
"resource": ""
} |
q267620 | CloneModel.replace | test | private function replace()
{
$destination = Yii::getAlias($this->destination);
$destinationModuleName = $this->getDestinationModuleName();
foreach (FileHelper::findFiles($destination) as $path) {
if (!$this->replace && in_array($path, $this->keepFiles)) {
continue... | php | {
"resource": ""
} |
q267621 | HTTP_Request2_SocketWrapper.readLine | test | public function readLine($bufferSize, $localTimeout = null)
{
$line = '';
while (!feof($this->socket)) {
if (null !== $localTimeout) {
stream_set_timeout($this->socket, $localTimeout);
} elseif ($this->deadline) {
stream_set_timeout($thi... | php | {
"resource": ""
} |
q267622 | HTTP_Request2_SocketWrapper.enableCrypto | test | public function enableCrypto()
{
$modes = array(
STREAM_CRYPTO_METHOD_TLS_CLIENT,
STREAM_CRYPTO_METHOD_SSLv3_CLIENT,
STREAM_CRYPTO_METHOD_SSLv23_CLIENT,
STREAM_CRYPTO_METHOD_SSLv2_CLIENT
);
foreach ($modes as $mode) {
if ... | php | {
"resource": ""
} |
q267623 | HTTP_Request2_SocketWrapper.checkTimeout | test | protected function checkTimeout()
{
$info = stream_get_meta_data($this->socket);
if ($info['timed_out'] || $this->deadline && time() > $this->deadline) {
$reason = $this->deadline
? "after {$this->timeout} second(s)"
: 'due to default_socket_timeout ... | php | {
"resource": ""
} |
q267624 | SlimBridge.addRoute | test | public function addRoute(RouteInterface $route) {
if (!$route->isValid()) {
//perhaps some log?
return;
}
$routeValue = $route->getAction()->getValue();
$this->app->map(
[strtolower($route->getMethod()->getValue())],
$route->getUri()->getV... | php | {
"resource": ""
} |
q267625 | Attributes.setItems | test | private function setItems(array $items)
{
$this->items = array_merge($this->defaults, $items);
$this->checkAttributes();
return $this;
} | php | {
"resource": ""
} |
q267626 | Attributes.build | test | public function build($siteKey, array $items = [])
{
$this->setItems($items);
$output = [];
foreach ($this->getItems($siteKey) as $key => $value) {
$output[] = trim($key) . '="' . trim($value) . '"';
}
return implode(' ', $output);
} | php | {
"resource": ""
} |
q267627 | Attributes.prepareNameAttribute | test | public function prepareNameAttribute($name)
{
if (is_null($name)) return [];
if ($name === NoCaptcha::CAPTCHA_NAME) {
throw new InvalidArgumentException(
'The captcha name must be different from "' . NoCaptcha::CAPTCHA_NAME . '".'
);
}
return... | php | {
"resource": ""
} |
q267628 | Attributes.checkDataAttribute | test | private function checkDataAttribute($name, $default, array $available)
{
$item = $this->getItem($name);
if ( ! is_null($item)) {
$item = (is_string($item) and in_array($item, $available))
? strtolower(trim($item))
: $default;
$this->setItem($... | php | {
"resource": ""
} |
q267629 | SingleUseQueue.add | test | public function add($resource)
{
if (!isset($this->added[$path = $resource->getPath()])) {
$this->queue->add($resource);
$this->added[$path] = true;
}
} | php | {
"resource": ""
} |
q267630 | DayBuilder.fromArray | test | public static function fromArray($dayOfWeek, array $openingIntervals): Day
{
$intervals = [];
foreach ($openingIntervals as $interval) {
if ($interval instanceof TimeIntervalInterface) {
$intervals[] = $interval;
} elseif (\is_array($intervals)) {
... | php | {
"resource": ""
} |
q267631 | DayBuilder.fromAssociativeArray | test | public static function fromAssociativeArray(array $data): DayInterface
{
if (!isset($data['openingIntervals'], $data['dayOfWeek']) || !\is_array($data['openingIntervals'])) {
throw new \InvalidArgumentException('Array is not valid.');
}
$openingIntervals = [];
foreach ($... | php | {
"resource": ""
} |
q267632 | DayBuilder.isIntervalAllDay | test | private static function isIntervalAllDay(Time $start, Time $end): bool
{
if ($start->getHours() !== 0 || $start->getMinutes() !== 0 || $start->getSeconds() !== 0) {
return false;
}
if ($end->getHours() !== 24 || $end->getMinutes() !== 0 || $end->getSeconds() !== 0) {
... | php | {
"resource": ""
} |
q267633 | Request.fromArray | test | public static function fromArray(Array $data)
{
$request = new static();
if (!isset($data['body']) || !isset($data['request'])) {
throw new UnexpectedValueException(
'Unexpected data, invalid data'
);
}
$body = $data['body'];
$params ... | php | {
"resource": ""
} |
q267634 | Request.setServerInfo | test | public function setServerInfo(array $info)
{
$this->server = $info;
if (isset($info['name']) && $info['name']) $name = (string) $info['name'];
else $name = sprintf('%s:%s', $info['host'], $info['port']);
$this->setServerGlobal('SERVER_NAME', $name);
$this->setServerGlobal(... | php | {
"resource": ""
} |
q267635 | Request.setHeaders | test | public function setHeaders(array $headers)
{
parent::addHeaders($headers);
$this->setServerGlobal('HTTP_HOST', (string) $this->getHeader('Host')[0]);
$this->setServerGlobal('HTTP_ACCEPT', (string) $this->getHeader('Accept')[0]);
$this->setServerGlobal('HTTP_CONNECTION', (string) $th... | php | {
"resource": ""
} |
q267636 | Request.setPostFields | test | public function setPostFields(array $fields)
{
$this->post = $fields;
$body = new Message\Body();
$body->append(http_build_query($fields));
parent::setBody($body);
$_POST = $fields;
$_REQUEST = array_merge($_GET, $_POST);
} | php | {
"resource": ""
} |
q267637 | Request.setQueryFields | test | public function setQueryFields(array $fields)
{
$this->get = $fields;
$this->setServerGlobal('QUERY_STRING', $this->getQueryData());
$_GET = $fields;
$_REQUEST = array_merge($_GET, $_POST);
} | php | {
"resource": ""
} |
q267638 | Request.getHeader | test | public function getHeader($header, $into_class = null)
{
$header = parent::getHeader($header);
if (!is_array($header)) {
return [$header];
}
return $header;
} | php | {
"resource": ""
} |
q267639 | Request.toArray | test | public function toArray()
{
return array(
'url' => $this->getRequestUrl(),
'method' => $this->getRequestMethod(),
'headers' => $this->getHeaders(),
'post' => $this->getPostFields(),
'get' => $this->getQueryFields(),
'server' => $this->g... | php | {
"resource": ""
} |
q267640 | NativeConsole.addCommand | test | public function addCommand(Command $command): void
{
$command->setMethod($command->getMethod() ?? static::RUN_METHOD);
$dispatcher = $this->app->dispatcher();
$dispatcher->verifyClassMethod($command);
$dispatcher->verifyFunction($command);
$dispatcher->verifyClosure($command... | php | {
"resource": ""
} |
q267641 | NativeConsole.addParsedCommand | test | protected function addParsedCommand(Command $command, array $parsedCommand): void
{
// Set the properties
$command->setRegex($parsedCommand['regex']);
$command->setParams($parsedCommand['params']);
$command->setSegments($parsedCommand['segments']);
// Set the command in the ... | php | {
"resource": ""
} |
q267642 | NativeConsole.command | test | public function command(string $name): ? Command
{
return $this->hasCommand($name)
? self::$commands[self::$namedCommands[$name]]
: null;
} | php | {
"resource": ""
} |
q267643 | NativeConsole.removeCommand | test | public function removeCommand(string $name): void
{
if ($this->hasCommand($name)) {
unset(
self::$commands[self::$namedCommands[$name]],
self::$namedCommands[$name]
);
}
} | php | {
"resource": ""
} |
q267644 | NativeConsole.matchCommand | test | public function matchCommand(string $path): Command
{
// If the path matches a set command path
if (isset(self::$commands[$path])) {
return self::$commands[$path];
}
$command = null;
// Otherwise iterate through the commands and attempt to match via regex
... | php | {
"resource": ""
} |
q267645 | NativeConsole.all | test | public function all(): array
{
// Iterate through all the command providers to set any deferred
// commands
foreach (self::$provided as $provided => $provider) {
// Initialize the provided command
$this->initializeProvided($provided);
}
return self::$... | php | {
"resource": ""
} |
q267646 | NativeConsole.setup | test | public function setup(bool $force = false, bool $useCache = true): void
{
// If the console was already setup no need to do it again
if (self::$setup && ! $force) {
return;
}
// The console is setting up
self::$setup = true;
// If the application should ... | php | {
"resource": ""
} |
q267647 | NativeConsole.setupFromCache | test | protected function setupFromCache(): void
{
// Set the application console with said file
$cache = $this->app->config()['cache']['console']
?? require $this->app->config()['console']['cacheFilePath'];
self::$commands = unserialize(
base64_decode($cache['commands... | php | {
"resource": ""
} |
q267648 | NativeConsole.getCacheable | test | public function getCacheable(): array
{
$this->setup(true, false);
return [
'commands' => base64_encode(serialize(self::$commands)),
'paths' => self::$paths,
'namedCommands' => self::$namedCommands,
'provided' => self::$provided,
... | php | {
"resource": ""
} |
q267649 | Zend_Filter_Word_Separator_Abstract.setSeparator | test | public function setSeparator($separator)
{
if ($separator == null) {
throw new Zend_Filter_Exception('"' . $separator . '" is not a valid separator.');
}
$this->_separator = $separator;
return $this;
} | php | {
"resource": ""
} |
q267650 | NativeEvents.listen | test | public function listen(string $event, Listener $listener): void
{
$this->add($event);
$this->app->dispatcher()->verifyDispatch($listener);
// If this listener has an id
if (null !== $listener->getId()) {
// Use it when setting to allow removal
// or checking... | php | {
"resource": ""
} |
q267651 | NativeEvents.listenMany | test | public function listenMany(Listener $listener, string ...$events): void
{
// Iterate through the events
foreach ($events as $event) {
// Set a new listener for the event
$this->listen($event, $listener);
}
} | php | {
"resource": ""
} |
q267652 | NativeEvents.hasListener | test | public function hasListener(string $event, string $listenerId): bool
{
return $this->has($event) && isset(self::$events[$event][$listenerId]);
} | php | {
"resource": ""
} |
q267653 | NativeEvents.removeListener | test | public function removeListener(string $event, string $listenerId): void
{
// If the listener exists
if ($this->hasListener($event, $listenerId)) {
// Unset it
unset(self::$events[$event][$listenerId]);
}
} | php | {
"resource": ""
} |
q267654 | NativeEvents.hasListeners | test | public function hasListeners(string $event): bool
{
return $this->has($event) && ! empty(self::$events[$event]);
} | php | {
"resource": ""
} |
q267655 | NativeEvents.add | test | public function add(string $event): void
{
if (! $this->has($event)) {
self::$events[$event] = [];
}
} | php | {
"resource": ""
} |
q267656 | NativeEvents.remove | test | public function remove(string $event): void
{
if ($this->has($event)) {
unset(self::$events[$event]);
}
} | php | {
"resource": ""
} |
q267657 | NativeEvents.trigger | test | public function trigger(string $event, array $arguments = null): array
{
// The responses
$responses = [];
if (! $this->has($event) || ! $this->hasListeners($event)) {
return $responses;
}
// Iterate through all the event's listeners
foreach ($this->getL... | php | {
"resource": ""
} |
q267658 | NativeEvents.setup | test | public function setup(bool $force = false, bool $useCache = true): void
{
if (self::$setup && ! $force) {
return;
}
self::$setup = true;
// If the application should use the events cache files
if ($useCache && $this->app->config()['events']['useCache']) {
... | php | {
"resource": ""
} |
q267659 | NativeEvents.setupFromCache | test | protected function setupFromCache(): void
{
// Set the application events with said file
$cache = $this->app->config()['cache']['events']
?? require $this->app->config()['events']['cacheFilePath'];
self::$events = unserialize(
base64_decode($cache['events'], true),
... | php | {
"resource": ""
} |
q267660 | TemplatingTrait.init | test | public function init($options) {
$this->template = '';
$this->template_data = '';
$this->template_dir_orig = '';
if ($options['templatepath'] != '') {
$this->template_dir_orig = $options['templatepath'];
}
// compile dir is required and must be writable
$this->compile_dir_orig = $options['... | php | {
"resource": ""
} |
q267661 | TemplatingTrait.checkTemplateExists | test | public function checkTemplateExists($filepath,$options = array(),$tmplpath = '') {
if (is_array($this->template_dir_orig) && $tmplpath == '') {
foreach ($this->template_dir_orig as $path) {
$exists = $this->checkTemplateExists($filepath,$options,$path);
if ($exists) {
return true;
}
}
... | php | {
"resource": ""
} |
q267662 | TemplatingTrait.fetchTemplate | test | public function fetchTemplate() {
if ($this->template != '' &&
$this->template_data == '' &&
!$this->checkTemplateExists($this->template)) {
throw new \Exception(sprintf('Template file %s not found',$this->template));
}
if ($this->template != '') {
return $this->fetchFromFile();
} else {
... | php | {
"resource": ""
} |
q267663 | Config.load | test | public function load(array $options = [])
{
$options = array_replace_recursive(
$this->getOption('loadOptions', []),
$options
);
// Simple shortcuts
$options['readerOptions']['file'] = $options['readerOptions']['file'] ?? $options['file'];
$options['r... | php | {
"resource": ""
} |
q267664 | Config.save | test | public function save(array $options = [])
{
$options = array_merge(
[
'file' => null,
'writerOptions' => []
],
$options
);
// Simple shortcut
$options['writerOptions']['file'] = $options['file'];
... | php | {
"resource": ""
} |
q267665 | Config.initializeReader | test | protected function initializeReader()
{
$reader = $this->getOption('reader');
if (is_string($reader)) {
switch ($reader) {
case 'array':
$reader = new ArrayReader();
break;
case 'file':
$reader ... | php | {
"resource": ""
} |
q267666 | Config.initializeWriter | test | protected function initializeWriter()
{
$writer = $this->getOption('writer');
if (is_string($writer)) {
switch ($writer) {
case 'array':
$writer = new ArrayWriter();
break;
case 'file':
$writer ... | php | {
"resource": ""
} |
q267667 | Config.getDefaultOptions | test | public function getDefaultOptions(): array
{
return [
'reader' => 'file',
'writer' => 'file',
'onAfterLoad' => function(Config $config, array $options) {},
'onBeforeSave' => function(Config $config, array $optio... | php | {
"resource": ""
} |
q267668 | CryptDatabase.encrypt | test | protected function encrypt($data, $key)
{
$keySize = openssl_cipher_iv_length(static::CRYPT_MODE);
$padding = $keySize - (mb_strlen($data, '8bit') % $keySize);
/** @noinspection CryptographicallySecureRandomnessInspection */
$iv = openssl_random_pseudo_bytes($keySize);
$key... | php | {
"resource": ""
} |
q267669 | CryptDatabase.decrypt | test | protected function decrypt($data, $key)
{
$base64 = base64_decode($data, true);
$keySize = openssl_cipher_iv_length(static::CRYPT_MODE);
$key = $this->generateKey($key);
$iv = substr($base64, 0, $keySize);
$results = substr($base64, $keySize);
$results = o... | php | {
"resource": ""
} |
q267670 | CryptDatabase.generateKey | test | protected function generateKey($key)
{
$keySize = openssl_cipher_iv_length(static::CRYPT_MODE);
$key = hash(
'SHA256', $this->options->getClassName() . ':' . $this->sessionName . ':' . $key, true
);
return substr($key, 0, $keySize);
} | php | {
"resource": ""
} |
q267671 | ExceptionHandler.throwToStdout | test | public function throwToStdout($exception, $full = true, $asJson = false)
{
$httpCode = method_exists($exception, 'getHttpCode') ? call_user_func([$exception, 'getHttpCode']) : 500;
$logger = $this->getStdioLogger();
$message = $this->getExceptionData($exception, $full, true);
if ($lo... | php | {
"resource": ""
} |
q267672 | ExceptionHandler.renderException | test | private function renderException($exception, $full = false)
{
$app = \Reaction::$app;
try {
$rendered = View::renderPhpStateless($this->getViewFileForException($exception), [
'exceptionName' => $this->getExceptionName($exception),
'exception' => $exception... | php | {
"resource": ""
} |
q267673 | ExceptionHandler.getViewFileForException | test | private function getViewFileForException($exception)
{
$basePath = \Reaction::$app->getAlias('@views/error');
$tplName = 'general.php';
if ($exception instanceof HttpExceptionInterface) {
$code = $exception->statusCode;
} else {
$code = $exception->getCode();
... | php | {
"resource": ""
} |
q267674 | ExceptionHandler.getResponse | test | private function getResponse($code = 500, $headers = [], $body = null)
{
if (isset($body) && is_array($body)) {
if (!isset($body['error'])) {
$body = ['error' => $body];
}
$body = json_encode($body);
$headers['Content-type'] = 'application/json... | php | {
"resource": ""
} |
q267675 | ExceptionHandler.getExceptionData | test | private function getExceptionData($exception, $full = false, $plainText = false)
{
if ($plainText) {
$text = $exception->getMessage() . "\n";
if ($full) {
$text .= $exception->getFile() . " #" . $exception->getLine() . "\n";
$text .= $exception->getTra... | php | {
"resource": ""
} |
q267676 | ExceptionHandler.getStdioLogger | test | private function getStdioLogger()
{
try {
/** @var StdioLogger $logger */
$logger = \Reaction::$di->get('stdioLogger');
} catch (\Throwable $exception) {
$logger = null;
}
return $logger;
} | php | {
"resource": ""
} |
q267677 | CachedSessionHandler.read | test | public function read($id)
{
$key = $this->getSessionKey($id);
return $this->getDataFromCache($key)->then(
function($record) {
return $this->extractData($record, true);
}
)->then(
null,
function($error = null) use ($id) {
... | php | {
"resource": ""
} |
q267678 | CachedSessionHandler.write | test | public function write($id, $data)
{
$key = $this->getSessionKey($id);
$record = $this->packRecord($data);
return $this->writeDataToCache($key, $record)->then(
function() use ($id) {
$this->keys[$id] = time();
return $this->read($id);
},... | php | {
"resource": ""
} |
q267679 | CachedSessionHandler.destroy | test | public function destroy($id, $archiveRemove = false)
{
if (isset($this->keys[$id])) {
unset($this->keys[$id]);
}
$key = $this->getSessionKey($id);
return $this->cache->delete($key)->then(
function() use ($id) { return $id; },
function($error = null... | php | {
"resource": ""
} |
q267680 | CachedSessionHandler.updateTimestamp | test | public function updateTimestamp($id, $data = null)
{
$self = $this;
return $this->read($id)->then(
function($dataStored) use ($self, $id, $data) {
if (isset($data)) {
$dataStored = $data;
}
return $self->write($id, $data... | php | {
"resource": ""
} |
q267681 | CachedSessionHandler.extractData | test | public function extractData($sessionRecord = [], $unserialize = false) {
$data = isset($sessionRecord[$this->dataKey]) ? $sessionRecord[$this->dataKey] : [];
return $unserialize && is_string($data) ? $this->unserializeData($data) : $data;
} | php | {
"resource": ""
} |
q267682 | CachedSessionHandler.extractTimestamp | test | protected function extractTimestamp($record = []) {
return isset($record[$this->timestampKey]) ? $record[$this->timestampKey] : null;
} | php | {
"resource": ""
} |
q267683 | CachedSessionHandler.getDataFromCache | test | protected function getDataFromCache($key) {
$self = $this;
return (new Promise(function($r, $c) use ($self, $key) {
$self->cache
->get($key)
->then(function($data) {
return $data !== null ? $data : reject(null);
})->then(fun... | php | {
"resource": ""
} |
q267684 | Exception.getMessageWithVariables | test | final public function getMessageWithVariables(): string
{
if (empty($this->message)) {
throw new \Exception(sprintf(
'Exception %s does not have a message',
get_class($this)
), Level::CRITICAL);
}
$message = $this->message;
pr... | php | {
"resource": ""
} |
q267685 | CreateMySqlDao.constraint | test | private final function constraint(TableInterface $table): string
{
$mySql = $selfKey = $foreignKey = "";
$name = $table->get($table::ATTR_NAME);
foreach ($table->get($table::ATTR_KEY) as $key => $value) {
if (KeyInterface::FOREIGN !== $value->getType()) {
$selfKey... | php | {
"resource": ""
} |
q267686 | CreateMySqlDao.addAutoIncrement | test | private final function addAutoIncrement(string $key, array $column): string
{
$autoIncrement = "";
if (array_key_exists($key, $column) && in_array(
ColumnInterface::OPT_AUTO_INCREMENT,
$column[$key]->getOption())) {
$autoIncrement .= "MODIFY "
... | php | {
"resource": ""
} |
q267687 | CreateMySqlDao.addKey | test | private final function addKey(KeyInterface $key, string $name): string
{
return "ADD " . $this->constant($key->getType())
. " `k_" . $name . "`"
. " (`" . implode("`, `", ($key->getSubject())) . "`),\n";
} | php | {
"resource": ""
} |
q267688 | CreateMySqlDao.addForeign | test | private final function addForeign(KeyInterface $key, string $name): string
{
return "ADD CONSTRAINT" . " `fk_" . $name . "`"
. " " . $this->constant($key->getType())
. " (`" . implode("`, `", ($key->getSubject())) . "`) "
. " REFERENCES `" . $key->getForeigner() . "`"
... | php | {
"resource": ""
} |
q267689 | CreateMySqlDao.getColumnSyntaxe | test | private final function getColumnSyntaxe(ColumnInterface $column)
{
$mySql = "`" . $column->getName() . "` "
. $this->constant($column->getType())
. "(" . $column->getSize() . ")";
foreach ($column->getOption() as $option) {
$const = $this->constant($option);... | php | {
"resource": ""
} |
q267690 | Plugin.jumpstart | test | public function jumpstart()
{
$this->getLoader()->action('activate_' . $this->getBasename(), array($this, 'activate'));
$this->getLoader()->action('deactivate_' . $this->getBasename(), array($this, 'deactivate'));
$this->getLoader()->action('uninstall_' . $this->getBasename(), array($this, '... | php | {
"resource": ""
} |
q267691 | CreateIterationExceptionCapableTrait._createIterationException | test | protected function _createIterationException(
$message = null,
$code = null,
RootException $previous = null,
IterationInterface $iteration = null
) {
return new IterationException($message, $code, $previous, $iteration);
} | php | {
"resource": ""
} |
q267692 | NavBar.renderToggleButton | test | protected function renderToggleButton()
{
$icon = $this->htmlHlp->tag('span', '', ['class' => 'navbar-toggler-icon']);
$screenReader = isset($this->screenReaderToggleText)
? "<span class=\"sr-only\">{$this->screenReaderToggleText}</span>"
: '';
return $this->htmlHlp-... | php | {
"resource": ""
} |
q267693 | Money.getResponse | test | protected function getResponse($templateName, $isNaked = false)
{
$this->response = new ResponseTemplate();
$content = $this->getTemplate($templateName);
if (!$isNaked) {
$content = $this->getLayout($content);
}
$this->response->setHttpCode(200)->setContent($co... | php | {
"resource": ""
} |
q267694 | Money.getModuleName | test | protected function getModuleName()
{
if (empty($this->appModuleName)) {
$className = trim(get_class($this));
$namespace = substr(__NAMESPACE__, 0, strrpos(__NAMESPACE__, '\\'));
$namespace = substr($namespace, 0, strrpos($namespace, '\\')) . '\Module\\';
$clas... | php | {
"resource": ""
} |
q267695 | Reflection.loadClassReflection | test | public static function loadClassReflection($class)
{
if (is_object($class)) {
$class = get_class($class);
}
if (isset(self::$classReflections[$class])) {
return self::$classReflections[$class];
}
$reflection = new \ReflectionClass($class);
s... | php | {
"resource": ""
} |
q267696 | Reflection.loadObjectReflection | test | public static function loadObjectReflection($object)
{
if (!is_object($object)) {
throw new \InvalidArgumentException(sprintf(
'Could not load reflection for non object. Given: "%s".',
gettype($object)
));
}
$hash = spl_object_hash($ob... | php | {
"resource": ""
} |
q267697 | Reflection.loadPropertyReflection | test | public static function loadPropertyReflection($object, $property, $searchInParents = true)
{
$reflection = self::loadClassReflection($object);
if (!$searchInParents) {
return $reflection->getProperty($property);
}
$exception = null;
do {
try {
... | php | {
"resource": ""
} |
q267698 | Reflection.getCalledMethod | test | public static function getCalledMethod(\ReflectionFunctionAbstract $method, $closureInfo = true)
{
if ($method->isClosure()) {
if ($closureInfo) {
return sprintf(
'Closure [%s:%d]',
$method->getFileName(),
$method->getSt... | php | {
"resource": ""
} |
q267699 | Reflection.getClassProperties | test | public static function getClassProperties($class, $inParents = false, $filter = null)
{
if ($filter === null) {
$filter = \ReflectionProperty::IS_PRIVATE
| \ReflectionProperty::IS_PROTECTED
| \ReflectionProperty::IS_PUBLIC;
}
$reflection = self::l... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.