_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q250100 | ThemeAssetsInstallCommand._hardCopy | validation | private function _hardCopy(string $originDir, string $targetDir): string
{
$this->filesystem->mkdir($targetDir, 0777);
// We use a custom iterator to ignore VCS files
$this->filesystem->mirror($originDir, $targetDir, Finder::create()->ignoreDotFiles(false)->in($originDir));
return A... | php | {
"resource": ""
} |
q250101 | BlogPost.onBeforePublish | validation | public function onBeforePublish() {
if ($this->dbObject('PublishDate')->InPast() && !$this->isPublished()) {
$this->setCastedField("PublishDate", time());
$this->write();
}
} | php | {
"resource": ""
} |
q250102 | BlogPost.canView | validation | public function canView($member = null) {
if(!parent::canView($member)) return false;
if($this->PublishDate) {
$publishDate = $this->dbObject("PublishDate");
if($publishDate->InFuture() && !Permission::checkMember($member, "VIEW_DRAFT_CONTENT")) {
return false;
}
}
return true;
} | php | {
"resource": ""
} |
q250103 | BlogPost.getYearlyArchiveLink | validation | public function getYearlyArchiveLink() {
$date = $this->dbObject("PublishDate");
return Controller::join_links($this->Parent()->Link("archive"), $date->format("Y"));
} | php | {
"resource": ""
} |
q250104 | GridFieldAddByDBField.getHTMLFragments | validation | public function getHTMLFragments($gridField) {
$dataClass = $gridField->getList()->dataClass();
$obj = singleton($dataClass);
if(!$obj->canCreate()) return "";
$dbField = $this->getDataObjectField();
$textField = TextField::create(
"gridfieldaddbydbfield[" . $obj->ClassName . "][" . Convert::raw2... | php | {
"resource": ""
} |
q250105 | BlogPostFilter.augmentSQL | validation | public function augmentSQL(SQLQuery &$query) {
$stage = Versioned::current_stage();
if($stage == 'Live' || !Permission::check("VIEW_DRAFT_CONTENT")) {
$query->addWhere("PublishDate < '" . Convert::raw2sql(SS_Datetime::now()) . "'");
}
} | php | {
"resource": ""
} |
q250106 | Runner.run | validation | public function run(PayloadInterface $payload)
{
$tasks = $this->getTaskCollection()->getTasks();
$tasksCount = $tasks->count();
if (0 === $tasksCount) {
throw new LogicException('Can\'t invoke task run. Empty task collection set.');
}
$this->log(LogLevel::INFO,... | php | {
"resource": ""
} |
q250107 | Runner.runTask | validation | private function runTask(TaskInterface $task, PayloadInterface $payload)
{
$this->logTask($task, LogLevel::INFO, 'Starting execution.');
try {
if (!$task->unless()) {
$this->dispatch('runner.task.unless', $task, $payload);
$this->logTask($task, LogLevel::... | php | {
"resource": ""
} |
q250108 | Runner.logTask | validation | protected function logTask(TaskInterface $task, $level, $message, array $context = array())
{
$class = get_class($task);
$message = sprintf('Task: %s. ', $class) . $message;
$this->log($level, $message, $context);
} | php | {
"resource": ""
} |
q250109 | Runner.notify | validation | public function notify(PayloadInterface $payload)
{
foreach ($this->runners as $runner) {
/** @var Runner $runner */
$runner->run($payload);
}
return $this;
} | php | {
"resource": ""
} |
q250110 | Runner.attach | validation | public function attach(Runner $runner)
{
if ($this->runners->contains($runner)) {
throw new LogicException('Can\'t attach already attached runner.');
}
$this->runners->attach($runner);
return $this;
} | php | {
"resource": ""
} |
q250111 | Runner.detach | validation | public function detach(Runner $runner)
{
if (!$this->runners->contains($runner)) {
throw new LogicException('Can\'t detach not attached runner.');
}
$this->runners->detach($runner);
return $this;
} | php | {
"resource": ""
} |
q250112 | Runner.on | validation | public function on($eventName, callable $callable)
{
\Assert\that($eventName)->string()->notEmpty();
$this->eventDispatcher->addListener($eventName, $callable);
return $this;
} | php | {
"resource": ""
} |
q250113 | Mail.buildAttachmentPart | validation | private function buildAttachmentPart() {
if (count($this->attachments) > 0) {
$attachment_part = '';
foreach ($this->attachments as $attachment) {
$file_str = chunk_split(base64_encode(file_get_contents($attachment)));
$attachment_part .= "--MIME_BOUNDRY\nContent-Type: ".$this->getMimeTy... | php | {
"resource": ""
} |
q250114 | Mail.buildHeaders | validation | private function buildHeaders($required_headers = []) {
$build_headers = array_merge($this->headers, $required_headers);
$headers = [];
foreach ($build_headers as $name => $value) {
$headers[] = "{$name}: {$value}";
}
return implode("\r\n", $headers)."\nThis is a multi-part message in MIME for... | php | {
"resource": ""
} |
q250115 | Mail.addAttachment | validation | public function addAttachment($attachment) {
if (!file_exists($attachment)) {
pines_error('Invalid attachment.');
return false;
}
$this->attachments[] = $attachment;
return true;
} | php | {
"resource": ""
} |
q250116 | Mail.getMimeType | validation | public function getMimeType($attachment) {
$attachment = explode('.', basename($attachment));
if (!isset($this->mimeTypes[strtolower($attachment[count($attachment) - 1])])) {
pines_error('MIME Type not found.');
return null;
}
return $this->mimeTypes[strtolower($attachment[count($attachment)... | php | {
"resource": ""
} |
q250117 | Mail.send | validation | public function send() {
// First verify values.
if (!preg_match('/^.+@.+$/', $this->sender)) {
return false;
}
if (!preg_match('/^.+@.+$/', $this->recipient)) {
return false;
}
if (!$this->subject || strlen($this->subject) > 255) {
return false;
}
// Headers that must... | php | {
"resource": ""
} |
q250118 | Mail.formatDate | validation | public static function formatDate($timestamp, $type = 'full_sort', $format = '', $timezone = null) {
// Determine the format to use.
switch ($type) {
case 'date_sort':
$format = 'Y-m-d';
break;
case 'date_long':
$format = 'l, F j, Y';
break;
case 'date_med':
... | php | {
"resource": ""
} |
q250119 | UnixEnvironment.safeSendSignal | validation | private function safeSendSignal($process, string $signal, int $mappedSignal): void
{
if (true !== proc_terminate($process, $mappedSignal)) {
throw new CommandExecutionException(
'Call to proc_terminate with signal "' . $signal . '" failed for unknown reason.'
);
... | php | {
"resource": ""
} |
q250120 | UnixEnvironment.isValidHomeDirectory | validation | private function isValidHomeDirectory(string $path): bool
{
$valid = false;
if ('~/' === substr($path, 0, 2)) {
$valid = $this->isValidFullPath(
$this->expandHomeDirectory($path)
);
}
return $valid;
} | php | {
"resource": ""
} |
q250121 | UnixEnvironment.isValidFullPath | validation | private function isValidFullPath(string $path): bool
{
$valid = false;
if ('/' === substr($path, 0, 1) && is_executable($path)) {
$valid = true;
}
return $valid;
} | php | {
"resource": ""
} |
q250122 | UnixEnvironment.isValidRelativePath | validation | private function isValidRelativePath(string $relativePath, string $cwd): bool
{
$valid = false;
if ('./' === substr($relativePath, 0, 2)) {
$tmpPath = $cwd . DIRECTORY_SEPARATOR . substr($relativePath, 2, strlen($relativePath));
$valid = $this->isValidFullPath($tmpPath);
... | php | {
"resource": ""
} |
q250123 | UnixEnvironment.isValidGlobalCommand | validation | private function isValidGlobalCommand(string $command): bool
{
$valid = false;
if (strlen($command)) {
// Check for command in path list
foreach ($this->paths as $pathDir) {
$tmpPath = $pathDir . DIRECTORY_SEPARATOR . $command;
if ($this->isVa... | php | {
"resource": ""
} |
q250124 | Ups.getQuote | validation | public function getQuote($credentials, $options)
{
// Load the credentials
$this->loadCredentials($credentials);
// Run the options array through the default check
$options = $this->checkDefaults($options);
$residential_flag = ($this->commercial_rates) ? '' : '<ResidentialAddressIndicator/>';
$negotiate... | php | {
"resource": ""
} |
q250125 | Ups.buildPackages | validation | private function buildPackages($number, $weight, $measurement = 'LBS')
{
$packages = array();
if($number > 1)
{
$individual_weight = $weight / $number;
for($i = 0; $i < $number; $i++)
{
$packages[] = '<Package>
<PackagingType>
<Code>02</Code>
</PackagingType>
<PackageWeight>
... | php | {
"resource": ""
} |
q250126 | Ups.send | validation | private function send()
{
$ch = curl_init($this->url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
cu... | php | {
"resource": ""
} |
q250127 | Ups.parseResult | validation | private function parseResult()
{
if($this->xml_result->Response->ResponseStatusCode != '1')
{
return array(
'Error' => array(
'ErrorSeverity' => "{$this->xml_result->Response->Error->ErrorSeverity}",
'ErrorCode' => "{$this->xml_result->Response->Error->ErrorCode}",
'ErrorDescription' => "{$th... | php | {
"resource": ""
} |
q250128 | Ups.checkDefaults | validation | private function checkDefaults($options)
{
if(!isset($options['request_option']))
{
$options['request_option'] = 'Shop';
}
if(!isset($options['from_country']))
{
$options['from_country'] = 'US';
}
if(!isset($options['to_country']))
{
$options['to_country'] = 'US';
}
if(!isset($options['ser... | php | {
"resource": ""
} |
q250129 | Routerunner.process | validation | public function process(ServerRequestInterface $request, RequestHandlerInterface $requestHandler): ResponseInterface
{
$this->container->set(ServerRequestInterface::class, $request);
$result = $this->dispatch($this->route($request));
if ($result instanceof ResponseInterface) {
re... | php | {
"resource": ""
} |
q250130 | Container.set | validation | public function set($key, $value)
{
if (is_callable($value)) {
$this->registerFactory($key, $value, false);
} else {
$this->sm->setService($key, $value);
}
} | php | {
"resource": ""
} |
q250131 | Container.get | validation | public function get($key, $default = null)
{
return $this->has($key) ? $this->sm->get($key) : $default;
} | php | {
"resource": ""
} |
q250132 | Container.singleton | validation | public function singleton($key, $value)
{
if (is_callable($value)) {
$this->registerFactory($key, $value);
} else {
$this->sm->setService($key, $value);
}
} | php | {
"resource": ""
} |
q250133 | Container.consumeSlimContainer | validation | public function consumeSlimContainer(Set $container)
{
foreach ($container as $key => $value) {
if ($value instanceof \Closure) {
// Try to determin if this belongs to a singleton or not
$refFunc = new \ReflectionFunction($value);
// Slim singleton... | php | {
"resource": ""
} |
q250134 | Container.registerFactory | validation | protected function registerFactory($key, callable $callable, $shared = true)
{
$this->sm->setFactory($key, new CallbackWrapper($this, $callable));
$this->sm->setShared($key, $shared);
} | php | {
"resource": ""
} |
q250135 | CI_Base_Model._initialize_schema | validation | protected function _initialize_schema()
{
$this->set_database($this->_database_group);
$this->_fetch_table();
$this->_fetch_primary_key();
if($this->primary_key == null && $this->is_base_model_instance()) {
return;
}
$this->_fields = $this->get_fields()... | php | {
"resource": ""
} |
q250136 | CI_Base_Model._initialize_event_listeners | validation | protected function _initialize_event_listeners()
{
foreach($this->event_listeners as $event_listener => $e)
{
if(isset($this->$event_listener) && !empty($this->$event_listener)){
foreach($this->$event_listener as $event){
$this->subscribe($event_listen... | php | {
"resource": ""
} |
q250137 | CI_Base_Model.get_many_by | validation | public function get_many_by()
{
$where = func_get_args();
$this->apply_soft_delete_filter();
$this->_set_where($where);
return $this->get_all();
} | php | {
"resource": ""
} |
q250138 | CI_Base_Model.insert_many | validation | public function insert_many($data, $insert_individual = false)
{
if($insert_individual){
return $this->_insert_individual($data);
}
return $this->_insert_batch($data);
} | php | {
"resource": ""
} |
q250139 | CI_Base_Model.update | validation | public function update($primary_value, $data)
{
$data = $this->_do_pre_update($data);
if ($data !== FALSE)
{
$result = $this->_database->where($this->primary_key, $primary_value)
->set($data)
->update($this->_table);
$this->trigger('a... | php | {
"resource": ""
} |
q250140 | CI_Base_Model.update_many | validation | public function update_many($primary_values, $data)
{
$data = $this->_do_pre_update($data);
if ($data !== FALSE)
{
$result = $this->_database->where_in($this->primary_key, $primary_values)
->set($data)
->update($this->_table);
$this->... | php | {
"resource": ""
} |
q250141 | CI_Base_Model.update_by | validation | public function update_by()
{
$args = func_get_args();
$data = array_pop($args);
$data = $this->_do_pre_update($data);
if ($data !== FALSE)
{
$this->_set_where($args);
return $this->_update($data);
}
return FALSE;
} | php | {
"resource": ""
} |
q250142 | CI_Base_Model.update_batch | validation | public function update_batch($data, $where_key)
{
$_data = array();
foreach ($data as $key => $row) {
if (false !== $row = $this->_do_pre_update($row)) {
$_data[$key] = $row;
}
}
return $this->_database->update_batch($this->_table, $_data, $... | php | {
"resource": ""
} |
q250143 | CI_Base_Model.delete | validation | public function delete($id, $time = 'NOW()')
{
$this->_database->where($this->primary_key, $id);
return $this->_delete($id, $time);
} | php | {
"resource": ""
} |
q250144 | CI_Base_Model.delete_by_at | validation | public function delete_by_at($condition, $time)
{
$this->prevent_if_not_soft_deletable();
$this->_set_where($condition);
return $this->_delete($condition, $time);
} | php | {
"resource": ""
} |
q250145 | CI_Base_Model.delete_many | validation | public function delete_many($primary_values, $time='NOW()')
{
$this->_database->where_in($this->primary_key, $primary_values);
return $this->_delete($primary_values, $time);
} | php | {
"resource": ""
} |
q250146 | CI_Base_Model.dropdown | validation | function dropdown()
{
$args = func_get_args();
if(count($args) == 2)
{
list($key, $value) = $args;
}
else
{
$key = $this->primary_key;
$value = $args[0];
}
$this->trigger('before_dropdown', array( $key, $value ));
... | php | {
"resource": ""
} |
q250147 | CI_Base_Model.count_by | validation | public function count_by()
{
$where = func_get_args();
$this->_set_where($where);
$this->apply_soft_delete_filter();
return $this->_database->count_all_results($this->_table);
} | php | {
"resource": ""
} |
q250148 | CI_Base_Model.get_next_id | validation | public function get_next_id()
{
return (int) $this->_database->select('AUTO_INCREMENT')
->from('information_schema.TABLES')
->where('TABLE_NAME', $this->_database->dbprefix($this->get_table()))
->where('TABLE_SCHEMA', $this->_database->database)->get()->row()->AUTO_INCREM... | php | {
"resource": ""
} |
q250149 | CI_Base_Model.created_at | validation | public function created_at($row)
{
if (is_object($row))
{
$row->{$this->created_at_key} = date('Y-m-d H:i:s');
}
else
{
$row[$this->created_at_key] = date('Y-m-d H:i:s');
}
return $row;
} | php | {
"resource": ""
} |
q250150 | CI_Base_Model.serialize_row | validation | public function serialize_row($row)
{
foreach ($this->callback_parameters as $column)
{
$row[$column] = serialize($row[$column]);
}
return $row;
} | php | {
"resource": ""
} |
q250151 | CI_Base_Model.getCallableFunction | validation | private function getCallableFunction($method)
{
if (is_callable($method)) {
return $method;
}
if (is_string($method) && is_callable(array($this, $method))) {
return array($this, $method);
}
return FALSE;
} | php | {
"resource": ""
} |
q250152 | CI_Base_Model.apply_soft_delete_filter | validation | protected function apply_soft_delete_filter()
{
if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE) {
if($this->_temporary_only_deleted)
{
$where = "`{$this->deleted_at_key}` <= NOW()";
}
else
{
$where... | php | {
"resource": ""
} |
q250153 | CI_Base_Model._fetch_primary_key | validation | protected function _fetch_primary_key()
{
if($this->is_base_model_instance()) {
return;
}
if ($this->primary_key == NULL && $this->_database) {
$this->primary_key = $this->execute_query("SHOW KEYS FROM `" . $this->_database->dbprefix($this->_table) . "` WHERE Key_nam... | php | {
"resource": ""
} |
q250154 | CI_Base_Model._set_where | validation | protected function _set_where($params)
{
if (count($params) == 1)
{
$this->_database->where($params[0]);
}
else if(count($params) == 2)
{
$this->_database->where($params[0], $params[1]);
}
else if(count($params) == 3)
{
... | php | {
"resource": ""
} |
q250155 | Base62.decode | validation | public function decode($value, $b = 62)
{
$limit = strlen($value);
$result = strpos($this->base, $value[0]);
for ($i = 1; $i < $limit; $i++) {
$result = $b * $result + strpos($this->base, $value[$i]);
}
return $result;
} | php | {
"resource": ""
} |
q250156 | Base62.encode | validation | public function encode($value, $b = 62)
{
$r = (int) $value % $b;
$result = $this->base[$r];
$q = floor((int) $value / $b);
while ($q) {
$r = $q % $b;
$q = floor($q / $b);
$result = $this->base[$r].$result;
}
return $result;
} | php | {
"resource": ""
} |
q250157 | BibliographicRecord.parseSubjectAddedEntry | validation | public function parseSubjectAddedEntry(QuiteSimpleXmlElement &$node)
{
$out = array('term' => '', 'vocabulary' => null);
$vocabularies = array(
'0' => 'lcsh',
'1' => 'lccsh', // LC subject headings for children's literature
'2' => 'mesh', // Medical Subject Headin... | php | {
"resource": ""
} |
q250158 | SemaphoreClient.message | validation | public function message( $messageId )
{
$params = [
'query' => [
'apikey' => $this->apikey,
]
];
$response = $this->client->get( 'messages/' . $messageId, $params );
return $response->getBody();
} | php | {
"resource": ""
} |
q250159 | SemaphoreClient.messages | validation | public function messages( $options )
{
$params = [
'query' => [
'apikey' => $this->apikey,
'limit' => 100,
'page' => 1
]
];
//Set optional parameters
if( array_key_exists( 'limit', $options ) )
{
$params['query']['li... | php | {
"resource": ""
} |
q250160 | Record.parseAuthority | validation | protected function parseAuthority($authority, &$out)
{
if (!empty($authority)) {
$out['id'] = $authority;
if (preg_match('/\((.*?)\)(.*)/', $authority, $matches)) {
// As used by at least OCLC and Bibsys
$out['vocabulary'] = $matches[1];
... | php | {
"resource": ""
} |
q250161 | Record.parseRelator | validation | protected function parseRelator(&$node, &$out, $default = null)
{
$relterm = $node->text('marc:subfield[@code="e"]');
$relcode = $node->text('marc:subfield[@code="4"]');
if (!empty($relcode)) {
$out['role'] = $relcode;
} elseif (!empty($relterm)) {
$out['role'... | php | {
"resource": ""
} |
q250162 | Record.parseRelationship | validation | protected function parseRelationship($node)
{
$rel = array();
$x = preg_replace('/\(.*?\)/', '', $node->text('marc:subfield[@code="w"]'));
if (!empty($x)) {
$rel['id'] = $x;
}
$x = $node->text('marc:subfield[@code="t"]');
if (!empty($x)) {
$r... | php | {
"resource": ""
} |
q250163 | Patch.apply | validation | public function apply($targetDocument, $patchDocument)
{
if ($targetDocument === null || !is_object($targetDocument) || is_array($targetDocument)) {
$targetDocument = new \stdClass();
}
if ($patchDocument === null || !is_object($patchDocument) || is_array($patchDocument)) {
... | php | {
"resource": ""
} |
q250164 | Patch.generate | validation | public function generate($sourceDocument, $targetDocument)
{
if ($sourceDocument === null || $targetDocument === null) {
return $targetDocument;
}
if ($sourceDocument == new \stdClass()) {
return null;
}
if (is_array($sourceDocument)) {
i... | php | {
"resource": ""
} |
q250165 | Patch.merge | validation | public function merge($patchDocument1, $patchDocument2)
{
if ($patchDocument1 === null || $patchDocument2 === null
|| !is_object($patchDocument1) || !is_object($patchDocument2)
) {
return $patchDocument2;
}
$patchDocument = $patchDocument1;
$patchDocu... | php | {
"resource": ""
} |
q250166 | ObjectMapper.mapJson | validation | public function mapJson($json, $targetClass)
{
// Check if the JSON is valid
if (!is_array($data = json_decode($json, true))) {
throw new InvalidJsonException();
}
// Pre initialize the result
$result = null;
// Check if the target object is a collection... | php | {
"resource": ""
} |
q250167 | ConfigService.fetch | validation | public static function fetch($dir = false)
{
if (false === $dir) {
$dir = getcwd();
}
$config = [];
$files = glob($dir.'/config/*.config.php', GLOB_BRACE);
foreach ($files as $file) {
$config = array_merge($config, (require $file));
}
... | php | {
"resource": ""
} |
q250168 | GeneratorFactory.fetch | validation | public function fetch($name)
{
$generator = false;
if (array_key_exists($name, $this->generators)) {
$generator = $this->generators[$name];
}
return $generator;
} | php | {
"resource": ""
} |
q250169 | GeneratorFactory.add | validation | public function add($name, GeneratorInterface $class)
{
if (array_key_exists($name, $this->generators)) {
throw new \InvalidArgumentException('Generator already exists.');
}
$this->generators[$name] = $class;
} | php | {
"resource": ""
} |
q250170 | FontAwesome.stack | validation | public function stack($icons)
{
if (count($icons) !== 2)
{
throw new \InvalidArgumentException('Expecting exactly 2 icons in the stack');
}
$contents = [];
$index = 2;
foreach ($icons as $key => $value)
{
$contents[] = $this->getStackI... | php | {
"resource": ""
} |
q250171 | FontAwesome.getStackIconElement | validation | protected function getStackIconElement($key, $value, $index)
{
$element = $value;
if (is_string($key))
{
$element = $this->icon($key)->addClass($value);
}
else if (is_string($value))
{
$element = $this->icon($value);
}
if ( !i... | php | {
"resource": ""
} |
q250172 | RouteService.addRoute | validation | private function addRoute($method)
{
switch ($method) {
case 'index':
$methodMap = ['GET'];
$realRoute = '$route';
$controllerCallable = $this->controllerLocation.':indexAction';
break;
case 'get':
... | php | {
"resource": ""
} |
q250173 | Module.loadDependencies | validation | public function loadDependencies()
{
// load the apis config
$config = ConfigService::fetch(dirname(__DIR__));
// load the app config
$config = array_merge($config, ConfigService::fetch());
$moduleService = new ModuleService;
if (! array_key_exists('slim-api', $confi... | php | {
"resource": ""
} |
q250174 | DependencyService.addDependency | validation | private function addDependency($name, $template)
{
$this->commands[] = strtr($template, ['$namespace' => $this->namespaceRoot, '$name' => $name]);
} | php | {
"resource": ""
} |
q250175 | DependencyService.fetch | validation | public function fetch($name)
{
$template = false;
if (array_key_exists($name, $this->templates)) {
$template = $this->templates[$name];
}
return $template;
} | php | {
"resource": ""
} |
q250176 | DependencyService.add | validation | public function add($name, $template)
{
if (array_key_exists($name, $this->templates)) {
throw new \InvalidArgumentException('Template already exists.');
}
$this->templates[$name] = $template;
} | php | {
"resource": ""
} |
q250177 | Changesets.createChangeset | validation | public function createChangeset($changesets=array())
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
'oauth_token_secret' => $token['secret'],
);
// Set the API base
$base = 'changeset/create';
// Build the request path.
$path... | php | {
"resource": ""
} |
q250178 | Changesets.readChangeset | validation | public function readChangeset($id)
{
// Set the API base
$base = 'changeset/' . $id;
// Build the request path.
$path = $this->getOption('api.url') . $base;
// Send the request.
$xmlString = $this->sendRequest($path);
return $xmlString->changeset;
} | php | {
"resource": ""
} |
q250179 | Changesets.updateChangeset | validation | public function updateChangeset($id, $tags = array())
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
);
// Set the API base
$base = 'changeset/' . $id;
// Build the request path.
$path = $this->getOption('api.url') . $base;
// Creat... | php | {
"resource": ""
} |
q250180 | Changesets.closeChangeset | validation | public function closeChangeset($id)
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
);
// Set the API base
$base = 'changeset/' . $id . '/close';
// Build the request path.
$path = $this->getOption('api.url') . $base;
$header['format... | php | {
"resource": ""
} |
q250181 | Changesets.downloadChangeset | validation | public function downloadChangeset($id)
{
// Set the API base
$base = 'changeset/' . $id . '/download';
// Build the request path.
$path = $this->getOption('api.url') . $base;
// Send the request.
$xmlString = $this->sendRequest($path);
return $xmlString->create;
} | php | {
"resource": ""
} |
q250182 | Changesets.expandBBoxChangeset | validation | public function expandBBoxChangeset($id, $nodes)
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
);
// Set the API base
$base = 'changeset/' . $id . '/expand_bbox';
// Build the request path.
$path = $this->getOption('api.url') . $base;... | php | {
"resource": ""
} |
q250183 | Changesets.queryChangeset | validation | public function queryChangeset($param)
{
// Set the API base
$base = 'changesets/' . $param;
// Build the request path.
$path = $this->getOption('api.url') . $base;
// Send the request.
$xmlString = $this->sendRequest($path);
return $xmlString->osm;
} | php | {
"resource": ""
} |
q250184 | Changesets.diffUploadChangeset | validation | public function diffUploadChangeset($xml, $id)
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
);
// Set the API base
$base = 'changeset/' . $id . '/upload';
// Build the request path.
$path = $this->getOption('api.url') . $base;
$he... | php | {
"resource": ""
} |
q250185 | User.getDetails | validation | public function getDetails()
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
);
// Set the API base
$base = 'user/details';
// Build the request path.
$path = $this->getOption('api.url') . $base;
// Send the request.
$response = $t... | php | {
"resource": ""
} |
q250186 | User.replacePreferences | validation | public function replacePreferences($preferences)
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
);
// Set the API base
$base = 'user/preferences';
// Build the request path.
$path = $this->getOption('api.url') . $base;
// Create a l... | php | {
"resource": ""
} |
q250187 | User.changePreference | validation | public function changePreference($key, $preference)
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
);
// Set the API base
$base = 'user/preferences/' . $key;
// Build the request path.
$path = $this->getOption('api.url') . $base;
//... | php | {
"resource": ""
} |
q250188 | Gps.uploadTrace | validation | public function uploadTrace($file, $description, $tags, $public, $visibility, $username, $password)
{
// Set parameters.
$parameters = array(
'file' => $file,
'description' => $description,
'tags' => $tags,
'public' => $public,
'visibility' => $visibility,
);
// Set the API ... | php | {
"resource": ""
} |
q250189 | Gps.downloadTraceMetadetails | validation | public function downloadTraceMetadetails($id, $username, $password)
{
// Set the API base
$base = 'gpx/' . $id . '/details';
// Build the request path.
$path = $this->getOption('api.url') . $base;
// Send the request.
return $this->sendRequest($path, 'GET', array('Authorization' => 'Basic ' . base64_enco... | php | {
"resource": ""
} |
q250190 | RouteMock.constructUrl | validation | function constructUrl(Request $appRequest, Nette\Http\Url $refUrl)
{
return $this->getRouter()->constructUrl($appRequest, $refUrl);
} | php | {
"resource": ""
} |
q250191 | ModulesExtension.addRouters | validation | private function addRouters()
{
$builder = $this->getContainerBuilder();
// Get application router
$router = $builder->getDefinition('router');
// Init collections
$routerFactories = array();
foreach ($builder->findByTag(self::TAG_ROUTER) as $serviceName => $priority) {
// Priority is not defined...
... | php | {
"resource": ""
} |
q250192 | Info.getCapabilities | validation | public function getCapabilities()
{
// Set the API base
$base = 'capabilities';
// Build the request path.
$path = $this->getOption('api.url') . $base;
// Send the request.
$response = $this->oauth->oauthRequest($path, 'GET', array());
return simplexml_load_string($response->body);
} | php | {
"resource": ""
} |
q250193 | Info.retrieveMapData | validation | public function retrieveMapData($left, $bottom, $right, $top)
{
// Set the API base
$base = 'map?bbox=' . $left . ',' . $bottom . ',' . $right . ',' . $top;
// Build the request path.
$path = $this->getOption('api.url') . $base;
// Send the request.
$response = $this->oauth->oauthRequest($path, 'GET', ar... | php | {
"resource": ""
} |
q250194 | Elements.createNode | validation | public function createNode($changeset, $latitude, $longitude, $tags)
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
);
// Set the API base
$base = 'node/create';
// Build the request path.
$path = $this->getOption('api.url') . $base;
... | php | {
"resource": ""
} |
q250195 | Elements.createWay | validation | public function createWay($changeset, $tags, $nds)
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
);
// Set the API base
$base = 'way/create';
// Build the request path.
$path = $this->getOption('api.url') . $base;
$tagList = '';
... | php | {
"resource": ""
} |
q250196 | Elements.createRelation | validation | public function createRelation($changeset, $tags, $members)
{
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oauth_token' => $token['key'],
);
// Set the API base
$base = 'relation/create';
// Build the request path.
$path = $this->getOption('api.url') . $base;
$ta... | php | {
"resource": ""
} |
q250197 | Elements.waysForNode | validation | public function waysForNode($id)
{
// Set the API base
$base = 'node/' . $id . '/ways';
// Build the request path.
$path = $this->getOption('api.url') . $base;
// Send the request.
$xmlString = $this->sendRequest($path);
return $xmlString->way;
} | php | {
"resource": ""
} |
q250198 | Elements.redaction | validation | public function redaction($element, $id, $version, $redactionId)
{
if ($element != 'node' && $element != 'way' && $element != 'relation')
{
throw new \DomainException('Element should be a node, a way or a relation');
}
$token = $this->oauth->getToken();
// Set parameters.
$parameters = array(
'oaut... | php | {
"resource": ""
} |
q250199 | OAuth.validateResponse | validation | public function validateResponse($url, $response)
{
if ($response->code != 200)
{
$error = htmlspecialchars($response->body);
throw new \DomainException($error, $response->code);
}
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.