_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q8600 | Net_SmartIRC.reconnect | train | public function reconnect()
{
// remember in which channels we are joined
$channels = array();
foreach ($this->_channels as $value) {
if (empty($value->key)) {
$channels[] = array('name' => $value->name);
} else {
$channels[] = array('n... | php | {
"resource": ""
} |
q8601 | Net_SmartIRC.login | train | public function login($nick, $realname, $usermode = 0, $username = null,
$password = null
) {
$this->log(SMARTIRC_DEBUG_CONNECTION, 'DEBUG_CONNECTION: logging in',
__FILE__, __LINE__
);
$this->_nick = str_replace(' ', '', $nick);
$this->_realname = $realname;
... | php | {
"resource": ""
} |
q8602 | Net_SmartIRC.send | train | public function send($data, $priority = SMARTIRC_MEDIUM)
{
switch ($priority) {
case SMARTIRC_CRITICAL:
$this->_rawsend($data);
break;
case SMARTIRC_HIGH:
case SMARTIRC_MEDIUM:
case SMARTIRC_LOW:
$this->_message... | php | {
"resource": ""
} |
q8603 | Net_SmartIRC.isJoined | train | public function isJoined($channel, $nickname = null)
{
if (!$this->_channelsyncing) {
$this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING: isJoined() is called '
.'and the required Channel Syncing is not activated!',
__FILE__, __LINE__
);
return fal... | php | {
"resource": ""
} |
q8604 | Net_SmartIRC.isFounder | train | public function isFounder($channel, $nickname = null)
{
if (!$this->_channelsyncing) {
$this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING: isFounder() is called '
.'and the required Channel Syncing is not activated!',
__FILE__, __LINE__
);
return f... | php | {
"resource": ""
} |
q8605 | Net_SmartIRC.isAdmin | train | public function isAdmin($channel, $nickname = null)
{
if (!$this->_channelsyncing) {
$this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING: isAdmin() is called '
.'and the required Channel Syncing is not activated!',
__FILE__, __LINE__
);
return false... | php | {
"resource": ""
} |
q8606 | Net_SmartIRC.isOpped | train | public function isOpped($channel, $nickname = null)
{
if (!$this->_channelsyncing) {
$this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING: isOpped() is called '
.'and the required Channel Syncing is not activated!',
__FILE__, __LINE__
);
return false... | php | {
"resource": ""
} |
q8607 | Net_SmartIRC.isHopped | train | public function isHopped($channel, $nickname = null)
{
if (!$this->_channelsyncing) {
$this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING: isHopped() is called '
.'and the required Channel Syncing is not activated!',
__FILE__, __LINE__
);
return fal... | php | {
"resource": ""
} |
q8608 | Net_SmartIRC.isVoiced | train | public function isVoiced($channel, $nickname = null)
{
if (!$this->_channelsyncing) {
$this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING: isVoiced() is called '
.'and the required Channel Syncing is not activated!',
__FILE__, __LINE__
);
return fal... | php | {
"resource": ""
} |
q8609 | Net_SmartIRC.isBanned | train | public function isBanned($channel, $hostmask)
{
if (!$this->_channelsyncing) {
$this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING: isBanned() is called '
.'and the required Channel Syncing is not activated!',
__FILE__, __LINE__
);
return false;
... | php | {
"resource": ""
} |
q8610 | Net_SmartIRC.listenFor | train | public function listenFor($messagetype, $regex = '.*')
{
$listenfor = new Net_SmartIRC_listenfor();
$this->registerActionHandler($messagetype, $regex, array($listenfor, 'handler'));
$this->listen();
return $listenfor->result;
} | php | {
"resource": ""
} |
q8611 | Net_SmartIRC.registerActionHandler | train | public function registerActionHandler($handlertype, $regexhandler, $object,
$methodname = ''
) {
// precheck
if (!($handlertype & SMARTIRC_TYPE_ALL)) {
$this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING: passed invalid handler'
.'type to registerActionHandler()', __FILE__... | php | {
"resource": ""
} |
q8612 | Net_SmartIRC.unregisterActionHandler | train | public function unregisterActionHandler($handlertype, $regexhandler,
$object, $methodname = ''
) {
// precheck
if (!($handlertype & SMARTIRC_TYPE_ALL)) {
$this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING: passed invalid handler'
.'type to unregisterActionHandler()', __FI... | php | {
"resource": ""
} |
q8613 | Net_SmartIRC.unregisterActionId | train | public function unregisterActionId($id)
{
if (is_array($id)) {
foreach ($id as $each) {
$this->unregisterActionId($each);
}
return $this;
}
foreach ($this->_actionhandler as $i => &$handlerinfo) {
if ($handlerinfo['id'] == $id)... | php | {
"resource": ""
} |
q8614 | Net_SmartIRC.registerTimeHandler | train | public function registerTimeHandler($interval, $object, $methodname = '')
{
$id = $this->_timehandlerid++;
if (!empty($methodname)) {
$object = array($object, $methodname);
}
$this->_timehandler[] = array(
'id' => $id,
'interval' => $interval,
... | php | {
"resource": ""
} |
q8615 | Net_SmartIRC.unregisterTimeId | train | public function unregisterTimeId($id)
{
if (is_array($id)) {
foreach ($id as $each) {
$this->unregisterTimeId($each);
}
return $this;
}
foreach ($this->_timehandler as $i => &$handlerinfo) {
if ($handlerinfo['id'] == $id) {
... | php | {
"resource": ""
} |
q8616 | Net_SmartIRC.unloadModule | train | public function unloadModule($name)
{
$this->log(SMARTIRC_DEBUG_MODULES, 'DEBUG_MODULES: unloading module: '
."$name...", __FILE__, __LINE__
);
if (isset($this->_modules[$name])) {
if (in_array('module_exit',
get_class_methods(get_class($this->_mo... | php | {
"resource": ""
} |
q8617 | Net_SmartIRC._adduser | train | protected function _adduser(&$channel, &$newuser)
{
$lowerednick = strtolower($newuser->nick);
if ($this->isJoined($channel->name, $newuser->nick)) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: '
.'updating user: '.$newuser->nick.' on channel: '
... | php | {
"resource": ""
} |
q8618 | Net_SmartIRC._callTimeHandlers | train | protected function _callTimeHandlers()
{
foreach ($this->_timehandler as &$handlerinfo) {
$microtimestamp = microtime(true);
if ($microtimestamp >= $handlerinfo['lastmicrotimestamp']
+ ($handlerinfo['interval'] / 1000.0)
) {
$callback = $ha... | php | {
"resource": ""
} |
q8619 | Net_SmartIRC._pingcheck | train | protected function _pingcheck()
{
$time = time();
if ($time - $this->_lastrx > $this->_rxtimeout) {
$this->reconnect();
$this->_lastrx = $time;
} elseif ($time - $this->_lastrx > $this->_rxtimeout/2) {
$this->send('PING '.$this->_address, SMARTIRC_CRITICAL... | php | {
"resource": ""
} |
q8620 | Net_SmartIRC._rawsend | train | protected function _rawsend($data)
{
if ($this->_updatestate() != SMARTIRC_STATE_CONNECTED) {
return false;
}
$this->log(SMARTIRC_DEBUG_IRCMESSAGES, 'DEBUG_IRCMESSAGES: sent: "'
.$data.'"', __FILE__, __LINE__
);
$result = fwrite($this->_socket, $data... | php | {
"resource": ""
} |
q8621 | Net_SmartIRC._removeuser | train | protected function _removeuser($ircdata)
{
if ($ircdata->type & (SMARTIRC_TYPE_PART | SMARTIRC_TYPE_QUIT)) {
$nick = $ircdata->nick;
} else if ($ircdata->type & SMARTIRC_TYPE_KICK) {
$nick = $ircdata->params[1];
} else {
$this->log(SMARTIRC_DEBUG_CHANNELSY... | php | {
"resource": ""
} |
q8622 | Net_SmartIRC_listenfor.handler | train | public function handler(&$irc, &$ircdata)
{
$irc->log(SMARTIRC_DEBUG_ACTIONHANDLER,
'DEBUG_ACTIONHANDLER: listenfor handler called', __FILE__, __LINE__
);
$this->result[] = $ircdata;
$irc->disconnect();
} | php | {
"resource": ""
} |
q8623 | MelisFrontShowListFromFolderPlugin.createOptionsForms | train | public function createOptionsForms()
{
// construct form
$factory = new \Zend\Form\Factory();
$formElements = $this->getServiceLocator()->get('FormElementManager');
$factory->setFormElementManager($formElements);
$formConfig = $this->pluginBackConfig['modal_form'];
$... | php | {
"resource": ""
} |
q8624 | Safeurl.make | train | public function make($text, $options = null)
{
$this->setUserOptions($options); // set user defined options
$text = $this->decode($text); // decode UTF-8 chars
$text = trim($text); // trim
$text = $this->lower($text); // convert to lowercase
$text = $this->strip($text... | php | {
"resource": ""
} |
q8625 | Safeurl.setUserOptions | train | private function setUserOptions($options)
{
if (is_array($options)) {
foreach ($options as $property => $value) {
$this->$property = $value;
}
}
} | php | {
"resource": ""
} |
q8626 | Safeurl.convertCharacters | train | public function convertCharacters($text)
{
$text = html_entity_decode($text, ENT_QUOTES, $this->decode_charset);
$text = strtr($text, $this->translation_table);
return $text;
} | php | {
"resource": ""
} |
q8627 | Safeurl.filter | train | private function filter($text)
{
$text = preg_replace("/[^&a-z0-9-_\s']/i", '', $text);
$text = str_replace(' ', $this->separator, $text);
$text = trim(preg_replace("/{$this->separator}{2,}/", $this->separator, $text), $this->separator);
return $text;
} | php | {
"resource": ""
} |
q8628 | BackupListener.onBackupStarted | train | public function onBackupStarted(BackupEvent $event)
{
$database = $event->getDatabase();
$database->set('started', (new \DateTime())->format(\DateTime::RFC3339));
} | php | {
"resource": ""
} |
q8629 | BackupListener.onBackup | train | public function onBackup(BackupEvent $event)
{
$plugin = $this->pluginRegistry->getPlugin($event->getOption('plugin'));
$optionsResolver = new OptionsResolver();
$plugin->configureOptionsResolver($optionsResolver);
$parameter = $optionsResolver->resolve($event->getOption('parameter'... | php | {
"resource": ""
} |
q8630 | BackupListener.onBackupFinished | train | public function onBackupFinished(BackupEvent $event)
{
$database = $event->getDatabase();
$database->set('finished', (new \DateTime())->format(\DateTime::RFC3339));
$database->set('state', $event->getStatus());
if (BackupStatus::STATE_FAILED === $event->getStatus()) {
$d... | php | {
"resource": ""
} |
q8631 | BackupListener.serializeException | train | private function serializeException(\Exception $exception)
{
return [
'message' => $exception->getMessage(),
'code' => $exception->getCode(),
'trace' => $exception->getTrace(),
'file' => $exception->getFile(),
'line' => $exception->getLine(),
... | php | {
"resource": ""
} |
q8632 | DoctrineMigrationRepository.repositoryExists | train | public function repositoryExists()
{
$schema = $this->em->getConnection()->getSchemaManager();
$tables = array_filter($schema->listTables(), function ($value) {
return $value->getName() === 'migrations';
});
return !empty($tables);
} | php | {
"resource": ""
} |
q8633 | Gdaemon.writeAndReadSocket | train | protected function writeAndReadSocket($buffer)
{
$this->writeSocket($buffer . self::SOCKET_MSG_ENDL);
$read = $this->readSocket();
return $read;
} | php | {
"resource": ""
} |
q8634 | AuthClient.AuthEnable | train | public function AuthEnable(AuthEnableRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/AuthEnable',
$argument,
['\Etcdserverpb\AuthEnableResponse', 'decode'],
$metadata, $options);
} | php | {
"resource": ""
} |
q8635 | AuthClient.AuthDisable | train | public function AuthDisable(AuthDisableRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/AuthDisable',
$argument,
['\Etcdserverpb\AuthDisableResponse', 'decode'],
$metadata, $options);
... | php | {
"resource": ""
} |
q8636 | AuthClient.Authenticate | train | public function Authenticate(AuthenticateRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/Authenticate',
$argument,
['\Etcdserverpb\AuthenticateResponse', 'decode'],
$metadata, $options);... | php | {
"resource": ""
} |
q8637 | AuthClient.UserAdd | train | public function UserAdd(AuthUserAddRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/UserAdd',
$argument,
['\Etcdserverpb\AuthUserAddResponse', 'decode'],
$metadata, $options);
} | php | {
"resource": ""
} |
q8638 | AuthClient.UserGet | train | public function UserGet(AuthUserGetRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/UserGet',
$argument,
['\Etcdserverpb\AuthUserGetResponse', 'decode'],
$metadata, $options);
} | php | {
"resource": ""
} |
q8639 | AuthClient.UserList | train | public function UserList(AuthUserListRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/UserList',
$argument,
['\Etcdserverpb\AuthUserListResponse', 'decode'],
$metadata, $options);
} | php | {
"resource": ""
} |
q8640 | AuthClient.UserDelete | train | public function UserDelete(AuthUserDeleteRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/UserDelete',
$argument,
['\Etcdserverpb\AuthUserDeleteResponse', 'decode'],
$metadata, $options);
... | php | {
"resource": ""
} |
q8641 | AuthClient.UserChangePassword | train | public function UserChangePassword(AuthUserChangePasswordRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/UserChangePassword',
$argument,
['\Etcdserverpb\AuthUserChangePasswordResponse', 'decod... | php | {
"resource": ""
} |
q8642 | AuthClient.UserGrantRole | train | public function UserGrantRole(AuthUserGrantRoleRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/UserGrantRole',
$argument,
['\Etcdserverpb\AuthUserGrantRoleResponse', 'decode'],
$metadat... | php | {
"resource": ""
} |
q8643 | AuthClient.UserRevokeRole | train | public function UserRevokeRole(AuthUserRevokeRoleRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/UserRevokeRole',
$argument,
['\Etcdserverpb\AuthUserRevokeRoleResponse', 'decode'],
$me... | php | {
"resource": ""
} |
q8644 | AuthClient.RoleAdd | train | public function RoleAdd(AuthRoleAddRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/RoleAdd',
$argument,
['\Etcdserverpb\AuthRoleAddResponse', 'decode'],
$metadata, $options);
} | php | {
"resource": ""
} |
q8645 | AuthClient.RoleGet | train | public function RoleGet(AuthRoleGetRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/RoleGet',
$argument,
['\Etcdserverpb\AuthRoleGetResponse', 'decode'],
$metadata, $options);
} | php | {
"resource": ""
} |
q8646 | AuthClient.RoleList | train | public function RoleList(AuthRoleListRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/RoleList',
$argument,
['\Etcdserverpb\AuthRoleListResponse', 'decode'],
$metadata, $options);
} | php | {
"resource": ""
} |
q8647 | AuthClient.RoleDelete | train | public function RoleDelete(AuthRoleDeleteRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/RoleDelete',
$argument,
['\Etcdserverpb\AuthRoleDeleteResponse', 'decode'],
$metadata, $options);
... | php | {
"resource": ""
} |
q8648 | AuthClient.RoleGrantPermission | train | public function RoleGrantPermission(AuthRoleGrantPermissionRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/RoleGrantPermission',
$argument,
['\Etcdserverpb\AuthRoleGrantPermissionResponse', '... | php | {
"resource": ""
} |
q8649 | AuthClient.RoleRevokePermission | train | public function RoleRevokePermission(AuthRoleRevokePermissionRequest $argument,
$metadata = [], $options = [])
{
return $this->_simpleRequest('/etcdserverpb.Auth/RoleRevokePermission',
$argument,
['\Etcdserverpb\AuthRoleRevokePermissionRespons... | php | {
"resource": ""
} |
q8650 | Model.load | train | public function load($relations)
{
$query = $this->newQuery()->with(
is_string($relations) ? func_get_args() : $relations
);
$query->eagerLoadRelations([$this]);
return $this;
} | php | {
"resource": ""
} |
q8651 | Model.freshTimestamp | train | public function freshTimestamp()
{
$t = microtime(true);
$micro = sprintf("%06d",($t - floor($t)) * 1000000);
return new Carbon(date('Y-m-d H:i:s.'.$micro, $t));
} | php | {
"resource": ""
} |
q8652 | FileDescriptorProto.addDependency | train | public function addDependency($value)
{
if ($this->dependency === null) {
$this->dependency = new \Protobuf\ScalarCollection();
}
$this->dependency->add($value);
} | php | {
"resource": ""
} |
q8653 | FileDescriptorProto.addPublicDependency | train | public function addPublicDependency($value)
{
if ($this->public_dependency === null) {
$this->public_dependency = new \Protobuf\ScalarCollection();
}
$this->public_dependency->add($value);
} | php | {
"resource": ""
} |
q8654 | FileDescriptorProto.addWeakDependency | train | public function addWeakDependency($value)
{
if ($this->weak_dependency === null) {
$this->weak_dependency = new \Protobuf\ScalarCollection();
}
$this->weak_dependency->add($value);
} | php | {
"resource": ""
} |
q8655 | FileDescriptorProto.addMessageType | train | public function addMessageType(\google\protobuf\DescriptorProto $value)
{
if ($this->message_type === null) {
$this->message_type = new \Protobuf\MessageCollection();
}
$this->message_type->add($value);
} | php | {
"resource": ""
} |
q8656 | FileDescriptorProto.addEnumType | train | public function addEnumType(\google\protobuf\EnumDescriptorProto $value)
{
if ($this->enum_type === null) {
$this->enum_type = new \Protobuf\MessageCollection();
}
$this->enum_type->add($value);
} | php | {
"resource": ""
} |
q8657 | FileDescriptorProto.addService | train | public function addService(\google\protobuf\ServiceDescriptorProto $value)
{
if ($this->service === null) {
$this->service = new \Protobuf\MessageCollection();
}
$this->service->add($value);
} | php | {
"resource": ""
} |
q8658 | FileDescriptorProto.addExtension | train | public function addExtension(\google\protobuf\FieldDescriptorProto $value)
{
if ($this->extension === null) {
$this->extension = new \Protobuf\MessageCollection();
}
$this->extension->add($value);
} | php | {
"resource": ""
} |
q8659 | SshConnection.execute | train | public function execute($command, callable $callback = null)
{
$this->login();
return $this->ssh->exec(sprintf('cd %s; %s', $this->directory, $command), $callback);
} | php | {
"resource": ""
} |
q8660 | SshConnection.executeNanbando | train | public function executeNanbando($command, array $parameter, callable $callback = null)
{
$this->login();
$parameterString = [];
foreach ($parameter as $key => $value) {
if (!is_array($value)) {
$value = [$value];
}
foreach ($value as $ite... | php | {
"resource": ""
} |
q8661 | SshConnection.get | train | public function get($remoteFile, $localFile)
{
$this->login();
if (!isset($this->ssh)) {
return false;
}
if (!$this->ssh->exec('scp -f ' . escapeshellarg($remoteFile), false)) { // -f = from
return false;
}
$this->sendPacket("\0");
i... | php | {
"resource": ""
} |
q8662 | SshConnection.login | train | private function login()
{
if ($this->loggedIn) {
return;
}
if (array_key_exists('rsakey', $this->sshConfig)) {
$this->loginWithRsaKey();
} elseif (array_key_exists('password', $this->sshConfig)) {
$this->loginWithPassword();
}
$t... | php | {
"resource": ""
} |
q8663 | SshConnection.loginWithPassword | train | private function loginWithPassword()
{
$password = $this->sshConfig['password'];
if (!is_string($password)) {
$password = $this->askForPassword(
sprintf(
'Password for %s@%s:%s: ',
$this->sshConfig['username'],
$... | php | {
"resource": ""
} |
q8664 | SshConnection.loginWithRsaKey | train | private function loginWithRsaKey()
{
$key = new RSA();
$password = $this->sshConfig['rsakey']['password'];
if ($password) {
if (!is_string($password)) {
$password = $this->askForPassword(
sprintf('Password for file "%s": ', $this->sshConfig['rs... | php | {
"resource": ""
} |
q8665 | SshConnection.askForPassword | train | private function askForPassword($question)
{
$questionHelper = new QuestionHelper();
$question = new Question($question);
$question->setHidden(true);
$question->setHiddenFallback(false);
$password = $questionHelper->ask($this->input, $this->output, $question);
$this... | php | {
"resource": ""
} |
q8666 | SshConnection.validate | train | private function validate()
{
if (!$this->testServer($this->ssh, sprintf('-d "%s"', $this->directory))) {
throw new SshValidateException('Directory does not exists');
}
if (!$this->testServer($this->ssh, sprintf('-x "%s"', $this->executable), $this->directory)) {
thr... | php | {
"resource": ""
} |
q8667 | AmaranHandler.create | train | public function create()
{
$script = "<script>\n\t$(function(){ \n\t\t";
if ($this->click) {
$script .= "\t$('".$this->click[0]."').on('".$this->click[1]."',function(){ \n\t\t\t\t $.amaran(". json_encode($this->amaran).") \n\t\t\t}); \n\t\t});\n\t</script>\n";
} else {
... | php | {
"resource": ""
} |
q8668 | Builder.whereSub | train | protected function whereSub($column, $operator, Closure $callback, $boolean)
{
$type = 'Sub';
$query = $this->newQuery();
// Once we have the query instance we can simply execute it so it can add all
// of the sub-select's conditions to itself, and then we can cache it off
... | php | {
"resource": ""
} |
q8669 | Builder.whereInSub | train | protected function whereInSub($column, Closure $callback, $boolean, $not)
{
$type = $not ? 'NotInSub' : 'InSub';
// To create the exists sub-select, we will actually create a query and call the
// provided callback with the query so the developer may set any of the query
// conditio... | php | {
"resource": ""
} |
q8670 | Builder.whereTime | train | public function whereTime($column, $operator, $value, $boolean = 'and')
{
return $this->addDateBasedWhere('Time', $column, $operator, $value, $boolean);
} | php | {
"resource": ""
} |
q8671 | Builder.backupFieldsForCount | train | protected function backupFieldsForCount()
{
foreach (['orders', 'limit', 'offset', 'columns'] as $field) {
$this->backups[$field] = $this->{$field};
$this->{$field} = null;
}
foreach (['order', 'select'] as $key) {
$this->bindingBackups[$key] = $this->bi... | php | {
"resource": ""
} |
q8672 | UploadListener.createFileHistory | train | protected function createFileHistory(PostPersistEvent $event)
{
// Find original filename in request uploaded file
$files = $event->getRequest()->files->all();
$uploadedFile = array_pop($files);
$originalFileName = $uploadedFile->getClientOriginalName();
// Get generated fil... | php | {
"resource": ""
} |
q8673 | Builder.mergeConstraintsFrom | train | public function mergeConstraintsFrom(Builder $from)
{
$whereBindings = array_get(
$from->getQuery()->getRawBindings(), 'where', []
);
// Here we have some other query that we want to merge the where constraints from. We will
// copy over any where constraints on the query... | php | {
"resource": ""
} |
q8674 | Builder.firstOr | train | public function firstOr($columns = ['*'], callable $callback = null)
{
if (is_callable($columns)) {
$callback = $columns;
$columns = ['*'];
}
if (! is_null($model = $this->first($columns))) {
return $model;
}
return call_user_func($callb... | php | {
"resource": ""
} |
q8675 | ModelFactory.map | train | public function map($row){
$class = $this->modelClass;
$model = new $class($this->db, $row, false);
$model->setAttribute('table', $this->table)->setAttribute('pk', $this->pk);
return $model;
} | php | {
"resource": ""
} |
q8676 | ModelFactory.mapModels | train | public function mapModels($rows){
$rst = array();
foreach($rows as $row){
$rst[] = $this->map($row);
}
return $rst;
} | php | {
"resource": ""
} |
q8677 | ModelFactory.create | train | public function create($row = array()){
$class = $this->modelClass;
$model = new $class($this->db, $row);
$model->setAttribute('table', $this->table)->setAttribute('pk', $this->pk);
return $model;
} | php | {
"resource": ""
} |
q8678 | ModelFactory.count | train | public function count($conditions = '', $params = array()){
return $this->db->builder()->select('COUNT(*)')->from($this->table)->where($conditions, $params)->queryValue();
} | php | {
"resource": ""
} |
q8679 | ModelFactory.findOne | train | public function findOne($conditions, $params = array()){
$row = $this->db->builder()->select()->from($this->table)->where($conditions, $params)->limit(1)->queryRow();
if(false === $row){
return false;
}
return $this->map($row);
} | php | {
"resource": ""
} |
q8680 | ModelFactory.findByPK | train | public function findByPK($pk){
$pkConditions = $this->buildPKConditions($this->pk, $pk);
return $this->findOne($pkConditions[0], $pkConditions[1]);
} | php | {
"resource": ""
} |
q8681 | ModelFactory.findMany | train | public function findMany($conditions = '', $params = array(), $orderBy = null, $limit = null, $offset = null){
$cmd = $this->db->builder()->select()->from($this->table)->where($conditions, $params);
if($orderBy){
$cmd->orderBy($orderBy);
}
$rows = $cmd->limit($limit, $offset)... | php | {
"resource": ""
} |
q8682 | ModelFactory.findManyBy | train | public function findManyBy($key, $value, $orderBy = null, $limit = null, $offset = null){
return $this->findMany($key.'=:key', array(':key' => $value), $orderBy, $limit, $offset);
} | php | {
"resource": ""
} |
q8683 | ModelFactory.update | train | public function update($values, $conditions, $params = array()){
return $this->db->builder()->update($this->table, $values, $conditions, $params);
} | php | {
"resource": ""
} |
q8684 | ModelFactory.updateByPK | train | public function updateByPK($pk, $values){
$pkConditions = $this->buildPKConditions($this->pk, $pk);
return $this->update($values, $pkConditions[0], $pkConditions[1]);
} | php | {
"resource": ""
} |
q8685 | ModelFactory.delete | train | public function delete($conditions, $params = array()){
return $this->db->builder()->delete($this->table, $conditions, $params);
} | php | {
"resource": ""
} |
q8686 | ModelFactory.deleteByPK | train | public function deleteByPK($pk){
$pkConditions = $this->buildPKConditions($this->pk, $pk);
return $this->delete($pkConditions[0], $pkConditions[1]);
} | php | {
"resource": ""
} |
q8687 | BelongsToMany.findMany | train | public function findMany($ids, $columns = ['*'])
{
return empty($ids) ? [] : $this->whereIn(
$this->getRelated()->getQualifiedKeyName(), $ids
)->get($columns);
} | php | {
"resource": ""
} |
q8688 | curlMaster.Array2string | train | private function Array2string($arr, $glue = '&') {
if (!is_array($arr)) {
throw new Exception('Argument arr must be array');;
}
$new = array();
foreach ($arr as $k => $v) {
$new[] = urlencode($k) .'='. urlencode($v);
}
return implode($glue, $new);
} | php | {
"resource": ""
} |
q8689 | curlMaster.getHeaders | train | private function getHeaders($str) {
$str = explode(self::LE . self::LE, $str);
$str = reset($str);
$str = explode(self::LE, $str);
$new = array();
$s = 1;
foreach ($str as $line) {
$pos = strpos($line, ': ');
if ($pos !== false) {
$key = strtolower(substr($line, 0, $pos));
... | php | {
"resource": ""
} |
q8690 | curlMaster.getBody | train | private function getBody($str) {
$str = substr($str, strpos($str, self::LE . self::LE));
return trim($str);
} | php | {
"resource": ""
} |
q8691 | curlMaster.ParseCachingHeader | train | private function ParseCachingHeader($arr) {
if (!empty($arr['cache-control'])) {
if (strpos('no-cache', $arr['cache-control']) !== false) {
return 0;
}
if (strpos('no-store', $arr['cache-control']) !== false) {
return 0;
}
if (strpos('max-age=0', $arr['cache-control'])... | php | {
"resource": ""
} |
q8692 | curlMaster.GetCookieFileName | train | private function GetCookieFileName($url) {
$temp = parse_url($url);
$ext = (string) $this->CookieMaxAge;
return $this->CacheDir .'/CURL_COOKIE-'. sha1($temp['host']) .'.'. $ext;
} | php | {
"resource": ""
} |
q8693 | curlMaster.DeleteChacheFile | train | public function DeleteChacheFile($filename) {
if (preg_match('/^\/CURL_RESPON-[0-9a-f]{40}\.\d+$/', $filename)) {
$filename = $this->CacheDir . $filename;
if (file_exists($filename)) {
unlink($filename);
}
}
} | php | {
"resource": ""
} |
q8694 | curlMaster.FilePutContents | train | private function FilePutContents($file, $str) {
$fileObj = new SplFileObject($file, 'w');
while (!$fileObj->flock(LOCK_EX)) {
usleep(1);
}
$bytes = $fileObj->fwrite($str);
$fileObj->flock(LOCK_UN);
return $bytes;
} | php | {
"resource": ""
} |
q8695 | curlMaster.FileGetContents | train | private function FileGetContents($file) {
$fileObj = new SplFileObject($file, 'r');
while (!$fileObj->flock(LOCK_EX)) {
usleep(1);
}
$str = $fileObj->fread($fileObj->getSize());
$fileObj->flock(LOCK_UN);
return $str;
} | php | {
"resource": ""
} |
q8696 | PWEModule.getBaseLink | train | protected function getBaseLink()
{
$res = '.';
$res .= str_repeat("/..", sizeof($this->PWE->getURL()->getParamsAsArray()));
return $res;
} | php | {
"resource": ""
} |
q8697 | App.addRoute | train | public function addRoute(string $method, string $route, ...$callback)
{
$method = strtolower($method);
$route = ltrim($route, '/');
$group = rtrim($this->group, '/') . '/';
$route = $group . $route;
$scope = $this->middleware->count();
$this->layer[$method][] = new Ro... | php | {
"resource": ""
} |
q8698 | App.import | train | public function import(array $loader)
{
$this->loader = $loader;
foreach ($loader as $alias => $namespace) {
$alias = $this->alias($alias);
$this->container->set($alias, function ($c) use ($alias, $namespace) {
if (is_callable([$namespace, 'make'])) {
... | php | {
"resource": ""
} |
q8699 | ApplicationData.getData | train | public function getData()
{
$data = [];
foreach ($this->providerList as $provider) {
$data += $provider->getData();
}
return $data;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.