_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q257000 | Downloader.getVersion | test | public function getVersion(): ?string
{
if (!$this->version) {
$this->version = self::getLatestVersion();
}
return $this->version;
} | php | {
"resource": ""
} |
q257001 | Downloader.getFileUrl | test | public function getFileUrl(): string
{
$version = $this->getVersion();
Assert::that($version, 'Invalid version (expected format is X.Y.Z)')
->notEmpty()
->regex('/^\d+\.\d+\.[\da-z\-]+$/i');
$versionParts = explode('.', $version);
$devVersion = '';
i... | php | {
"resource": ""
} |
q257002 | Downloader.download | test | public function download(): int
{
$targetPath = $this->getFilePath();
if (!is_dir(dirname($targetPath))) {
mkdir(dirname($targetPath), 0777, true);
}
$fileUrl = $this->getFileUrl();
$fp = @fopen($fileUrl, 'rb');
$responseHeaders = get_headers($fileUrl);... | php | {
"resource": ""
} |
q257003 | Select2.selectByVisiblePartialText | test | public function selectByVisiblePartialText($text): void
{
$this->openDropdownOptions();
$this->log('Sending keys to select2: %s', $text);
$inputSelector = WebDriverBy::cssSelector(
$this->isMultiple() ? $this->select2Selector . ' input' : '#select2-drop input'
);
... | php | {
"resource": ""
} |
q257004 | Legacy.saveWithName | test | public function saveWithName($data, string $legacyName): void
{
$filename = $this->getLegacyFullPath($legacyName);
$this->log('Saving data as Legacy "%s" to file "%s"', $legacyName, $filename);
$this->debug('Legacy data: %s', $this->getPrintableValue($data));
if (@file_put_contents(... | php | {
"resource": ""
} |
q257005 | Legacy.save | test | public function save($data, string $type = self::LEGACY_TYPE_CASE): void
{
$this->saveWithName($data, $this->getLegacyName($type));
} | php | {
"resource": ""
} |
q257006 | Legacy.load | test | public function load(string $type = self::LEGACY_TYPE_CASE)
{
return $this->loadWithName($this->getLegacyName($type));
} | php | {
"resource": ""
} |
q257007 | Legacy.loadWithName | test | public function loadWithName(string $legacyName)
{
$filename = $this->getLegacyFullPath($legacyName);
$this->log('Reading Legacy "%s" from file "%s"', $legacyName, $filename);
$data = @file_get_contents($filename);
if ($data === false) {
throw new LegacyException('Canno... | php | {
"resource": ""
} |
q257008 | SeleniumServerAdapter.isAccessible | test | public function isAccessible(): bool
{
// Check connection to server is possible
$seleniumConnection = @fsockopen(
$this->serverUrlParts['host'],
$this->serverUrlParts['port'],
$connectionErrorNo,
$connectionError,
5
);
if (... | php | {
"resource": ""
} |
q257009 | SeleniumServerAdapter.isSeleniumServer | test | public function isSeleniumServer(): bool
{
// Check server properly responds to http requests
$context = stream_context_create(['http' => ['ignore_errors' => true, 'timeout' => 5]]);
$responseData = @file_get_contents($this->getServerUrl() . self::STATUS_ENDPOINT, false, $context);
... | php | {
"resource": ""
} |
q257010 | SeleniumServerAdapter.getCloudService | test | public function getCloudService(): string
{
// If cloud service value is not yet initialized, attempt to connect to the server first
if ($this->cloudService === null) {
if (!$this->isSeleniumServer()) {
throw new \RuntimeException(sprintf('Unable to connect to remote serv... | php | {
"resource": ""
} |
q257011 | SeleniumServerAdapter.guessPort | test | protected function guessPort(string $host, string $scheme): int
{
if ($scheme === 'https') {
return self::DEFAULT_PORT_CLOUD_SERVICE_HTTPS;
}
foreach (['saucelabs.com', 'browserstack.com', 'testingbot.com'] as $knownCloudHost) {
if (mb_strpos($host, $knownCloudHost) ... | php | {
"resource": ""
} |
q257012 | SeleniumServerAdapter.detectCloudServiceByStatus | test | private function detectCloudServiceByStatus($responseData): string
{
if (isset($responseData->value, $responseData->value->build, $responseData->value->build->version)) {
if ($responseData->value->build->version === 'Sauce Labs') {
return self::CLOUD_SERVICE_SAUCELABS;
... | php | {
"resource": ""
} |
q257013 | ProcessSetCreator.buildProcess | test | protected function buildProcess(string $fileName, array $phpunitArgs = []): Process
{
$capabilities = (new KeyValueCapabilityOptionsParser())
->parse($this->input->getOption(RunCommand::OPTION_CAPABILITY));
$env = [
'BROWSER_NAME' => $this->input->getArgument(RunCommand::ARG... | php | {
"resource": ""
} |
q257014 | ProcessSetCreator.getExcludingGroups | test | private function getExcludingGroups(array $excludeGroups, array $annotations): array
{
$excludingGroups = [];
if (!empty($excludeGroups) && array_key_exists('group', $annotations)) {
if (!empty(array_intersect($excludeGroups, $annotations['group']))) {
$excludingGroups =... | php | {
"resource": ""
} |
q257015 | SnapshotListener.takeSnapshot | test | protected function takeSnapshot(AbstractTestCase $test): void
{
if (!$test->wd instanceof RemoteWebDriver) {
$test->appendTestLog('[WARN] WebDriver instance not found, cannot take snapshot.');
return;
}
$savePath = ConfigProvider::getInstance()->logsDir . DIRECTORY_... | php | {
"resource": ""
} |
q257016 | SnapshotListener.getSnapshotUrl | test | protected function getSnapshotUrl(string $path): string
{
if (getenv('JENKINS_URL') && getenv('BUILD_URL') && getenv('WORKSPACE')) {
$realPath = realpath($path);
if ($realPath) {
// from absolute path, remove workspace
$path = str_replace(getenv('WORKS... | php | {
"resource": ""
} |
q257017 | ListenerInstantiator.instantiate | test | public function instantiate(EventDispatcher $dispatcher, string $dirToSearchForListeners): void
{
$listeners = $this->searchListeners($dirToSearchForListeners);
foreach ($listeners as $listener) {
$r = new \ReflectionClass($listener);
if ($r->implementsInterface('Symfony\\Co... | php | {
"resource": ""
} |
q257018 | XmlPublisher.getFilePath | test | public function getFilePath(): string
{
if (!$this->fileDir) {
$this->fileDir = ConfigProvider::getInstance()->logsDir;
}
return $this->fileDir . '/' . $this->fileName;
} | php | {
"resource": ""
} |
q257019 | XmlPublisher.quoteXpathAttribute | test | protected function quoteXpathAttribute(string $input): string
{
if (mb_strpos($input, '\'') === false) { // Selector does not contain single quotes
return "'$input'"; // Encapsulate with double quotes
}
if (mb_strpos($input, '"') === false) { // Selector contain single quotes bu... | php | {
"resource": ""
} |
q257020 | MaxTotalDelayStrategy.optimize | test | public function optimize(OutTree $tree): array
{
// get root node of the tree
$root = $tree->getVertexRoot();
// get all root descendants vertices (without the root vertex itself)
$children = $tree->getVerticesDescendant($root);
// for each vertex (process) get maximum tota... | php | {
"resource": ""
} |
q257021 | KeyValueCapabilityOptionsParser.castToGuessedDataType | test | private function castToGuessedDataType(string $value)
{
$stringValueWithoutQuotes = $this->removeEncapsulatingQuotes($value);
if ($stringValueWithoutQuotes !== null) {
return $stringValueWithoutQuotes;
}
$intValue = filter_var($value, FILTER_VALIDATE_INT, []);
if... | php | {
"resource": ""
} |
q257022 | ProcessWrapper.checkProcessTimeout | test | public function checkProcessTimeout(): ?string
{
try {
$this->getProcess()->checkTimeout();
} catch (ProcessTimedOutException $e) {
$this->setStatus(self::PROCESS_STATUS_DONE);
return sprintf(
'Process for class "%s" exceeded the timeout of %d sec... | php | {
"resource": ""
} |
q257023 | ProcessWrapper.resolveResult | test | private function resolveResult(): string
{
$exitCode = $this->getProcess()->getExitCode();
// If the process was not even started, mark its result as failed
if ($exitCode === null) {
return self::PROCESS_RESULT_FAILED;
}
switch ($exitCode) {
case Tes... | php | {
"resource": ""
} |
q257024 | TimelineDataBuilder.getExecutors | test | private function getExecutors(): array
{
$testElements = $this->xml->xpath('//testcase/test[@status="done"]');
$hasTestWithoutExecutor = false;
$executors = [];
foreach ($testElements as $testElement) {
$executorValue = (string) $testElement['executor'];
if ... | php | {
"resource": ""
} |
q257025 | CapabilitiesResolver.setupCiCapabilities | test | protected function setupCiCapabilities(
DesiredCapabilities $capabilities,
AbstractTestCase $test
): DesiredCapabilities {
$ci = $this->ciDetector->detect();
$capabilities->setCapability(
'build',
$this->config->env . '-' . $ci->getBuildNumber()
);
... | php | {
"resource": ""
} |
q257026 | ConfigProvider.setCustomConfigurationOptions | test | public function setCustomConfigurationOptions(array $customConfigurationOptions): void
{
if ($this->config !== null) {
throw new \RuntimeException(
'Custom configuration options can be set only before initialization of configuration'
);
}
$this->custo... | php | {
"resource": ""
} |
q257027 | ConfigProvider.retrieveConfigurationValues | test | private function retrieveConfigurationValues(array $options): array
{
$outputValues = [];
foreach ($options as $option) {
$value = getenv($option);
// value was not retrieved => fail
if ($value === false) {
throw new \RuntimeException(sprintf('%s... | php | {
"resource": ""
} |
q257028 | ExecutionLoop.dequeueProcessesWithoutDelay | test | protected function dequeueProcessesWithoutDelay(): void
{
$queuedProcesses = $this->processSet->get(ProcessWrapper::PROCESS_STATUS_QUEUED);
foreach ($queuedProcesses as $className => $processWrapper) {
if ($processWrapper->isDelayed()) {
$this->io->writeln(
... | php | {
"resource": ""
} |
q257029 | ExecutionLoop.flushProcessOutput | test | protected function flushProcessOutput(ProcessWrapper $processWrapper): void
{
$this->io->output(
$processWrapper->getProcess()->getIncrementalOutput(),
$processWrapper->getClassName()
);
$this->io->errorOutput(
$processWrapper->getProcess()->getIncremental... | php | {
"resource": ""
} |
q257030 | Favoriteability.favorite | test | public function favorite($class)
{
return $this->favorites()->where('favoriteable_type', $class)->with('favoriteable')->get()->mapWithKeys(function ($item) {
return [$item['favoriteable']->id=>$item['favoriteable']];
});
} | php | {
"resource": ""
} |
q257031 | MergeHTMLReportsTask.countSummary | test | private function countSummary($dstFile){
$tests = (new \DOMXPath($dstFile))->query("//table/tr[contains(@class,'scenarioRow')]");
foreach($tests as $test){
$class = str_replace('scenarioRow ', '', $test->getAttribute('class'));
switch($class){
case 'scenarioSucces... | php | {
"resource": ""
} |
q257032 | MergeHTMLReportsTask.updateSummaryTable | test | private function updateSummaryTable($dstFile){
$dstFile = new \DOMXPath($dstFile);
$pathFor = function ($type) { return "//div[@id='stepContainerSummary']//td[@class='$type']";};
$dstFile->query($pathFor('scenarioSuccessValue'))->item(0)->nodeValue = $this->countSuccess;
$dstFile->query(... | php | {
"resource": ""
} |
q257033 | MergeHTMLReportsTask.moveSummaryTable | test | private function moveSummaryTable($dstFile,$node){
$summaryTable = (new \DOMXPath($dstFile))->query("//div[@id='stepContainerSummary']")
->item(0)->parentNode->parentNode;
$node->appendChild($dstFile->importNode($summaryTable,true));
} | php | {
"resource": ""
} |
q257034 | MergeHTMLReportsTask.updateButtons | test | private function updateButtons($dstFile){
$nodes = (new \DOMXPath($dstFile))->query("//div[@class='layout']/table/tr[contains(@class, 'scenarioRow')]");
for($i=2;$i<$nodes->length;$i+=2){
$n = $i/2 + 1;
$p = $nodes->item($i)->childNodes->item(1)->childNodes->item(1);
... | php | {
"resource": ""
} |
q257035 | Favoriteable.addFavorite | test | public function addFavorite($user_id = null)
{
$favorite = new Favorite(['user_id' => ($user_id) ? $user_id : Auth::id()]);
$this->favorites()->save($favorite);
} | php | {
"resource": ""
} |
q257036 | Favoriteable.removeFavorite | test | public function removeFavorite($user_id = null)
{
$this->favorites()->where('user_id', ($user_id) ? $user_id : Auth::id())->delete();
} | php | {
"resource": ""
} |
q257037 | Favoriteable.toggleFavorite | test | public function toggleFavorite($user_id = null)
{
$this->isFavorited($user_id) ? $this->removeFavorite($user_id) : $this->addFavorite($user_id) ;
} | php | {
"resource": ""
} |
q257038 | Favoriteable.isFavorited | test | public function isFavorited($user_id = null)
{
return $this->favorites()->where('user_id', ($user_id) ? $user_id : Auth::id())->exists();
} | php | {
"resource": ""
} |
q257039 | Favoriteable.favoritedBy | test | public function favoritedBy()
{
return $this->favorites()->with('user')->get()->mapWithKeys(function ($item) {
return [$item['user']->id => $item['user']];
});
} | php | {
"resource": ""
} |
q257040 | Generator.getPermissions | test | public function getPermissions()
{
$permissions = [
$this->manage_permission
];
if ($this->create) {
$permissions[] = $this->create_permission;
$permissions[] = $this->store_permission;
}
if ($this->edit) {
$permissions[] = $th... | php | {
"resource": ""
} |
q257041 | Generator.insertToLanguageFiles | test | public function insertToLanguageFiles()
{
//Model singular version
$model_singular = Str::singular($this->originalName);
//Model Plural version
$model_plural = Str::plural($this->originalName);
//Model Plural key
$model_plural_key = strtolower(Str::plural($this->model... | php | {
"resource": ""
} |
q257042 | Generator.createViewFiles | test | public function createViewFiles()
{
//Getiing model
$model = $this->model;
//lowercase version of model
$model_lower = strtolower($model);
//lowercase and plural version of model
$model_lower_plural = Str::plural($model_lower);
//View folder name
$view... | php | {
"resource": ""
} |
q257043 | Generator.createMigration | test | public function createMigration()
{
$table = $this->table;
if (Schema::hasTable($table)) {
return 'Table Already Exists!';
} else {
//Calling Artisan command to create table
Artisan::call('make:migration', [
'name' => 'create_'.$table.... | php | {
"resource": ""
} |
q257044 | Generator.createEvents | test | public function createEvents()
{
if (!empty($this->events)) {
$base_path = $this->event_namespace;
foreach ($this->events as $event) {
$path = escapeSlashes($base_path.DIRECTORY_SEPARATOR.$event);
$model = str_replace(DIRECTORY_SEPARATOR, '\\', $path)... | php | {
"resource": ""
} |
q257045 | Generator.generateFile | test | public function generateFile($stub_name, $replacements, $file, $contents = null)
{
if ($stub_name) {
//Getting the Stub Files Content
$file_contents = $this->files->get($this->getStubPath().$stub_name.'.stub');
} else {
//Getting the Stub Files Content
... | php | {
"resource": ""
} |
q257046 | Generator.getStubPath | test | public function getStubPath()
{
$path = resource_path('views'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'generator'.DIRECTORY_SEPARATOR.'Stubs'.DIRECTORY_SEPARATOR);
$package_stubs_path = base_path('vendor'.DIRECTORY_SEPARATOR.'bvipul'.DIRECTORY_SEPARATOR.'generator'.DIRECTORY_SEPARATOR.'src'... | php | {
"resource": ""
} |
q257047 | ModuleController.checkNamespace | test | public function checkNamespace(Request $request)
{
if (isset($request->path)) {
$path = $this->parseModel($request->path);
$path = base_path(trim(str_replace('\\', '/', $request->path)), '\\');
$path = str_replace('App', 'app', $path);
if (file_exists($path.'.... | php | {
"resource": ""
} |
q257048 | ModuleController.checkTable | test | public function checkTable(Request $request)
{
if ($request->table) {
if (Schema::hasTable($request->table)) {
return response()->json((object) [
'type' => 'error',
'message' => 'Table exists Already',
]);
} e... | php | {
"resource": ""
} |
q257049 | Multi.onOneRandomServer | test | public function onOneRandomServer()
{
$keys = array_keys($this->getServerConfig());
do {
$randServerRank = array_rand($keys);
if ($redis = $this->getRedisFromServerConfig($keys[$randServerRank])) {
$this->selectedRedis = array($keys[$randServerRank] => $redis... | php | {
"resource": ""
} |
q257050 | Multi.onAllServer | test | public function onAllServer($strict = true)
{
foreach ($this->getServerConfig() as $idServer => $config) {
if ($redis = $this->getRedisFromServerConfig($idServer)) {
$this->selectedRedis[$idServer] = $redis;
} else {
if ($strict) {
... | php | {
"resource": ""
} |
q257051 | Multi.onOneServer | test | public function onOneServer($idServer, $strict = true)
{
$redisList = $this->getServerConfig();
// The server must exist..
if (array_key_exists($idServer, $redisList)) {
// and must be available
if ($redis = $this->getRedisFromServerConfig($idServer)) {
... | php | {
"resource": ""
} |
q257052 | Multi.onOneKeyServer | test | public function onOneKeyServer($key)
{
$this->selectedRedis[] = $this->getRedis($key);
$this->multiRedis = false;
return $this;
} | php | {
"resource": ""
} |
q257053 | Multi.callRedisCommand | test | protected function callRedisCommand(PredisProxy $redis, $name, $arguments)
{
$start = microtime(true);
try {
$return = call_user_func_array(array($redis, $name), $arguments);
$this->notifyEvent($name, $arguments, microtime(true) - $start);
} catch (Predis\PredisExcept... | php | {
"resource": ""
} |
q257054 | Manager.setCurrentDb | test | public function setCurrentDb($v)
{
if (!is_int($v)) {
throw new Exception("please describe the db as an integer ^^");
}
if ($v == Cache::CACHE) {
throw new Exception("cant use ".Cache::CACHE." in class ".__CLASS__);
}
$this->currentDb = $v;
re... | php | {
"resource": ""
} |
q257055 | Cache.del | test | public function del($keys)
{
if (!is_array($keys)) {
$keys = array($keys);
}
$funcs = array();
// séparation en serveur
foreach ($keys as $key) {
$keyP = $this->getPatternKey().$key;
$funcs[$key] = function ($redis) use ($keyP) {
... | php | {
"resource": ""
} |
q257056 | Cache.set | test | public function set($key, $value, $ttl = null)
{
if ($this->getCompress()) {
$value = self::compress($value);
}
$keyP = $this->getPatternKey().$key;
if (is_null($ttl)) {
$func = function ($redis) use ($keyP, $value) {
$start = microtime(true)... | php | {
"resource": ""
} |
q257057 | Cache.exists | test | public function exists($key)
{
$start = microtime(true);
$ret = $this->getRedis($key)->exists($this->getPatternKey().$key);
$this->notifyEvent('exists', array($this->getPatternKey().$key), microtime(true) - $start);
return (boolean) $ret;
} | php | {
"resource": ""
} |
q257058 | Cache.type | test | public function type($key)
{
$start = microtime(true);
$ret = (string)$this->getRedis($key)->type($this->getPatternKey().$key);
$this->notifyEvent('type', array($this->getPatternKey().$key), microtime(true) - $start);
return $ret;
} | php | {
"resource": ""
} |
q257059 | Cache.expire | test | public function expire($key, $ttl)
{
if ($ttl <= 0) {
throw new Exception('ttl arg cant be negative');
}
$keyP = $this->getPatternKey().$key;
$func = function ($redis) use ($keyP, $ttl) {
try {
$start = microtime(true);
$ret = ... | php | {
"resource": ""
} |
q257060 | Cache.flush | test | public function flush()
{
$pattern = $this->getPatternKey();
$arrReturn = $this->runOnAllRedisServer(
function ($redis) use ($pattern) {
$wasDeleted = 0;
$allKeys = $redis->keys($pattern.'*'); // all keys started with the namespace
if (coun... | php | {
"resource": ""
} |
q257061 | Cache.exec | test | public function exec()
{
if (true === $this->multi) {
$ret = array();
$this->multi = false;
// exec
foreach ($this->execList as $todos) {
$redis = $todos[0]['redis']; // ^^ not so secure ?
$this->notifyEvent('multi', arr... | php | {
"resource": ""
} |
q257062 | Cache.dbSize | test | public function dbSize($idServer = null)
{
if (is_null($idServer)) {
$servers = $this->getServerConfig();
$dbsize = array();
foreach (array_keys($servers) as $idServer) {
$redis = $this->getRedisFromServerConfig($idServer);
$dbsize[$idSer... | php | {
"resource": ""
} |
q257063 | Cache.addToExecList | test | protected function addToExecList($key, \Closure $func)
{
$redis = $this->getRedis($key);
$this->execList[md5(serialize($redis))][] = array(
'key' => $key,
'function' => $func,
'redis' => $redis
);
} | php | {
"resource": ""
} |
q257064 | ConsoleListener.dispatch | test | protected function dispatch($eventName, BaseConsoleEvent $e)
{
if (!is_null($this->eventDispatcher)) {
$class = str_replace(
'Symfony\Component\Console\Event',
'M6Web\Bundle\StatsdBundle\Event',
get_class($e)
);
$finaleEven... | php | {
"resource": ""
} |
q257065 | Client.addTiming | test | private function addTiming($event, $timingMethod, $node, $tags = [])
{
$timing = $this->getEventValue($event, $timingMethod);
if ($timing > 0) {
$this->timing($node, $timing, 1, $tags);
}
} | php | {
"resource": ""
} |
q257066 | Client.replaceConfigPlaceholder | test | private function replaceConfigPlaceholder($event, $eventName, $string)
{
// `event->getName()` is deprecated, we have to replace <name> directly with $eventName
$string = str_replace('<name>', $eventName, $string);
if ((preg_match_all('/<([^>]*)>/', $string, $matches) > 0) and ($this->prope... | php | {
"resource": ""
} |
q257067 | Client.mergeTags | test | private function mergeTags($event, $config)
{
$configTags = isset($config['tags']) ? $config['tags'] : [];
if ($event instanceof MonitorableEventInterface) {
return array_merge($configTags, $event->getTags());
}
return $configTags;
} | php | {
"resource": ""
} |
q257068 | Listener.dispatchMemory | test | private function dispatchMemory()
{
$memory = memory_get_peak_usage(true);
$memory = ($memory > 1024 ? intval($memory / 1024) : 0);
$this->eventDispatcher->dispatch(
'statsd.memory_usage',
new StatsdEvent($memory)
);
} | php | {
"resource": ""
} |
q257069 | Listener.dispatchRequestTime | test | private function dispatchRequestTime(PostResponseEvent $event)
{
$request = $event->getRequest();
$startTime = $request->server->get('REQUEST_TIME_FLOAT', $request->server->get('REQUEST_TIME'));
$time = microtime(true) - $startTime;
$time = round($time * 1000);
$... | php | {
"resource": ""
} |
q257070 | ConsoleEvent.createFromConsoleEvent | test | public static function createFromConsoleEvent(BaseConsoleEvent $e, $startTime = null, $executionTime = null)
{
if (static::support($e)) {
return new static($e, $startTime, $executionTime);
} else {
throw \InvalidArgumentException('Invalid event type.');
}
} | php | {
"resource": ""
} |
q257071 | Parser.srid | test | protected function srid()
{
$this->match(Lexer::T_SRID);
$this->match(Lexer::T_EQUALS);
$this->match(Lexer::T_INTEGER);
$srid = $this->lexer->value();
$this->match(Lexer::T_SEMICOLON);
return $srid;
} | php | {
"resource": ""
} |
q257072 | Parser.geometry | test | protected function geometry()
{
$type = $this->type();
$this->type = $type;
if ($this->lexer->isNextTokenAny(array(Lexer::T_Z, Lexer::T_M, Lexer::T_ZM))) {
$this->match($this->lexer->lookahead['type']);
$this->dimension = $this->lexer->value();
}
... | php | {
"resource": ""
} |
q257073 | Parser.point | test | protected function point()
{
if (null !== $this->dimension) {
return $this->coordinates(2 + strlen($this->dimension));
}
$values = $this->coordinates(2);
for ($i = 3; $i <= 4 && $this->lexer->isNextTokenAny(array(Lexer::T_FLOAT, Lexer::T_INTEGER)); $i++) {
$... | php | {
"resource": ""
} |
q257074 | Parser.coordinate | test | protected function coordinate()
{
$this->match(($this->lexer->isNextToken(Lexer::T_FLOAT) ? Lexer::T_FLOAT : Lexer::T_INTEGER));
return $this->lexer->value();
} | php | {
"resource": ""
} |
q257075 | Parser.pointList | test | protected function pointList()
{
$points = array($this->point());
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
$this->match(Lexer::T_COMMA);
$points[] = $this->point();
}
return $points;
} | php | {
"resource": ""
} |
q257076 | Parser.pointLists | test | protected function pointLists()
{
$this->match(Lexer::T_OPEN_PARENTHESIS);
$pointLists = array($this->pointList());
$this->match(Lexer::T_CLOSE_PARENTHESIS);
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
$this->match(Lexer::T_COMMA);
$this->match(Lexe... | php | {
"resource": ""
} |
q257077 | Parser.multiPolygon | test | protected function multiPolygon()
{
$this->match(Lexer::T_OPEN_PARENTHESIS);
$polygons = array($this->polygon());
$this->match(Lexer::T_CLOSE_PARENTHESIS);
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
$this->match(Lexer::T_COMMA);
$this->match(Lexer:... | php | {
"resource": ""
} |
q257078 | Parser.geometryCollection | test | protected function geometryCollection()
{
$collection = array($this->geometry());
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
$this->match(Lexer::T_COMMA);
$collection[] = $this->geometry();
}
return $collection;
} | php | {
"resource": ""
} |
q257079 | Parser.match | test | protected function match($token)
{
$lookaheadType = $this->lexer->lookahead['type'];
if ($lookaheadType !== $token && ($token !== Lexer::T_TYPE || $lookaheadType <= Lexer::T_TYPE)) {
throw $this->syntaxError($this->lexer->getLiteral($token));
}
$this->lexer->moveNext();... | php | {
"resource": ""
} |
q257080 | Parser.syntaxError | test | private function syntaxError($expected)
{
$expected = sprintf('Expected %s, got', $expected);
$token = $this->lexer->lookahead;
$found = null === $this->lexer->lookahead ? 'end of string.' : sprintf('"%s"', $token['value']);
$message = sprintf(
'[Syntax Error] line... | php | {
"resource": ""
} |
q257081 | Request.createResponseParts | test | protected function createResponseParts($responseParts) {
if ($responseParts === null) {
return array();
}
$responses = array();
foreach ($responseParts as $responsePart) {
$responses[] = new Response($responsePart);
}
return $responses;
} | php | {
"resource": ""
} |
q257082 | Request.getTime | test | public function getTime() {
if (isset($this->data['time'])) {
$requestTime = new \DateTime();
//TODO: fix the microseconds to miliseconds
$requestTime->createFromFormat("Y-m-dTH:i:s.uZ", $this->data["time"]);
return $requestTime;
}
return null;
} | php | {
"resource": ""
} |
q257083 | BrowserBase.createApiClient | test | protected function createApiClient() {
// Provide a BC switch between guzzle 5 and guzzle 6.
if (class_exists('GuzzleHttp\Psr7\Response')) {
$this->apiClient = new Client(array("base_uri" => $this->getPhantomJSHost()));
}
else {
$this->apiClient = new Client(array("base_url" => $this->getPha... | php | {
"resource": ""
} |
q257084 | BrowserBase.command | test | public function command() {
try {
$args = func_get_args();
$commandName = $args[0];
array_shift($args);
$messageToSend = json_encode(array('name' => $commandName, 'args' => $args));
/** @var $commandResponse \GuzzleHttp\Psr7\Response|\GuzzleHttp\Message\Response */
$commandRespon... | php | {
"resource": ""
} |
q257085 | Response.getRedirectUrl | test | public function getRedirectUrl() {
if (isset($this->data['redirectUrl']) && !empty($this->data['redirectUrl'])) {
return $this->data['redirectUrl'];
}
return null;
} | php | {
"resource": ""
} |
q257086 | BrowserRenderTrait.checkRenderOptions | test | protected function checkRenderOptions($options) {
//Default is full and no selection
if (count($options) === 0) {
$options["full"] = true;
$options["selector"] = null;
}
if (isset($options["full"]) && isset($options["selector"])) {
if ($options["full"]) {
//Whatever it is, ful... | php | {
"resource": ""
} |
q257087 | BrowserRenderTrait.render | test | public function render($path, $options = array()) {
$fixedOptions = $this->checkRenderOptions($options);
return $this->command('render', $path, $fixedOptions["full"], $fixedOptions["selector"]);
} | php | {
"resource": ""
} |
q257088 | BrowserRenderTrait.renderBase64 | test | public function renderBase64($imageFormat, $options = array()) {
$fixedOptions = $this->checkRenderOptions($options);
return $this->command('render_base64', $imageFormat, $fixedOptions["full"], $fixedOptions["selector"]);
} | php | {
"resource": ""
} |
q257089 | BrowserPageElementTrait.find | test | public function find($method, $selector) {
$result = $this->command('find', $method, $selector);
$found["page_id"] = $result["page_id"];
foreach ($result["ids"] as $id) {
$found["ids"][] = $id;
}
return $found;
} | php | {
"resource": ""
} |
q257090 | BrowserPageElementTrait.findWithin | test | public function findWithin($pageId, $elementId, $method, $selector) {
return $this->command('find_within', $pageId, $elementId, $method, $selector);
} | php | {
"resource": ""
} |
q257091 | BrowserPageElementTrait.setAttribute | test | public function setAttribute($pageId, $elementId, $name, $value) {
return $this->command('set_attribute', $pageId, $elementId, $name, $value);
} | php | {
"resource": ""
} |
q257092 | BrowserPageElementTrait.keyEvent | test | public function keyEvent($pageId, $elementId, $keyEvent, $key, $modifier) {
return $this->command("key_event", $pageId, $elementId, $keyEvent, $key, $modifier);
} | php | {
"resource": ""
} |
q257093 | BrowserPageElementTrait.selectOption | test | public function selectOption($pageId, $elementId, $value, $multiple = false) {
return $this->command("select_option", $pageId, $elementId, $value, $multiple);
} | php | {
"resource": ""
} |
q257094 | BrowserConfigurationTrait.debug | test | public function debug($enable = false) {
$this->debug = $enable;
return $this->command('set_debug', $this->debug);
} | php | {
"resource": ""
} |
q257095 | BrowserConfigurationTrait.setProxy | test | public function setProxy($proxy)
{
$args = array('set_proxy');
if ($proxy !== false)
{
if (preg_match('~^(http|socks5)://(?:([^:@/]*?):([^:@/]*?)@)?([^:@/]+):(\d+)$~', $proxy, $components))
{
array_push($args, $components[4], intval($components[5], 10), $components[1]);
if (str... | php | {
"resource": ""
} |
q257096 | BrowserNetworkTrait.networkTraffic | test | public function networkTraffic() {
$networkTraffic = $this->command('network_traffic');
$requestTraffic = array();
if (count($networkTraffic) === 0) {
return null;
}
foreach ($networkTraffic as $traffic) {
$requestTraffic[] = new Request($traffic["request"], $traffic["responseParts"]);... | php | {
"resource": ""
} |
q257097 | BrowserCookieTrait.cookies | test | public function cookies() {
$cookies = $this->command('cookies');
$objCookies = array();
foreach ($cookies as $cookie) {
$objCookies[$cookie["name"]] = new Cookie($cookie);
}
return $objCookies;
} | php | {
"resource": ""
} |
q257098 | BrowserCookieTrait.setCookie | test | public function setCookie($cookie) {
//TODO: add error control when the cookie array is not valid
if (isset($cookie["expires"])) {
$cookie["expires"] = intval($cookie["expires"]) * 1000;
}
$cookie['value'] = urlencode($cookie['value']);
return $this->command('set_cookie', $cookie);
} | php | {
"resource": ""
} |
q257099 | JavascriptError.javascriptErrors | test | public function javascriptErrors() {
$jsErrors = array();
$errors = $this->response["error"]["args"][0];
foreach ($errors as $error) {
$jsErrors[] = new JSErrorItem($error["message"], $error["stack"]);
}
return $jsErrors;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.