sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
protected function generateKey($processArgs)
{
$process = new Process(sprintf('openssl %s', $processArgs));
$process->setTimeout(3600);
$process->run(function ($type, $buffer) {
$this->io->write($buffer);
});
if (!$process->isSuccessful()) {
throw ne... | Generate a RSA key.
@param string $processArgs
@param Outputinterface $output
@throws ProcessFailedException | entailment |
public function addField($name, array $attributes)
{
//Argument 1 must be a string
Argument::i()->test(1, 'string');
$this->fields[$name] = $attributes;
return $this;
} | Adds a field in the table
@param *string $name Column name
@param *array $attributes Column attributes
@return Eden\Mysql\Create | entailment |
public function addKey($name, array $fields)
{
//Argument 1 must be a string
Argument::i()->test(1, 'string');
$this->keys[$name] = $fields;
return $this;
} | Adds an index key
@param *string $name Name of key
@param *array $fields List of key fields
@return Eden\Mysql\Create | entailment |
public function addUniqueKey($name, array $fields)
{
//Argument 1 must be a string
Argument::i()->test(1, 'string');
$this->uniqueKeys[$name] = $fields;
return $this;
} | Adds a unique key
@param *string $name Name of key
@param *array $fields List of key fields
@return Eden\Mysql\Create | entailment |
protected function convertToResource($data)
{
return File::make($this->client, $this->bib, $this->representation, $data->pid)
->init($data);
} | Convert a data element to a resource object.
@param $data
@return File | entailment |
protected function convertToResource($data)
{
return Location::make($this->client, $this->library, $data->code)
->init($data);
} | Convert a data element to a resource object.
@param $data
@return Location | entailment |
public function registerAction()
{
$userIdentityField = $this->container->getParameter('rch_jwt_user.user_identity_field');
$userManager = $this->container->get('fos_user.user_manager');
$userClass = $userManager->getClass();
$rules = [
$userIdentityField => [
... | Register a new User and authenticate it.
Required request parameters: %user_identity_field% (configured), password
@return object The authentication token | entailment |
public function loginFromOAuthResponseAction()
{
$userManager = $this->container->get('fos_user.user_manager');
$userIdentityField = $this->container->get('rch_jwt_user.user_identity_field');
$data = $this->get('rch_jwt_user.credential_fetcher')
->create([
$userI... | Registers and authenticates User from a facebook OAuth Response.
@return object The authentication token | entailment |
protected function createUser(array $data, UserProviderInterface $userManager)
{
$userIdentityfield = $this->container->getParameter('rch_jwt_user.user_identity_field');
$user = $userManager->createUser()
->setUsername($data[$userIdentityfield])
->setEmail($data[$userIdentit... | Creates a new User.
@param array $data
@param bool $isOAuth
@return UserInterface $user | entailment |
protected function renderToken(UserInterface $user, $statusCode = 200)
{
$body = [
'token' => $this->container->get('lexik_jwt_authentication.jwt_manager')->create($user),
'refresh_token' => $this->attachRefreshToken($user),
'user' => $user->getUsername()... | Generates a JWT from given User.
@param UserInterface $user
@param int $statusCode
@return array Response body containing the User and its tokens | entailment |
protected function attachRefreshToken(UserInterface $user)
{
$refreshTokenManager = $this->container->get('gesdinet.jwtrefreshtoken.refresh_token_manager');
$refreshToken = $refreshTokenManager->getLastFromUsername($user->getUsername());
$refreshTokenTtl = $this->container->getParameter('ges... | Provides a refresh token.
@param UserInterface $user
@return string The refresh Json Web Token. | entailment |
protected function isValidFacebookAccount($id, $accessToken)
{
$client = new \Goutte\Client();
$client->request('GET', sprintf('https://graph.facebook.com/me?access_token=%s', $accessToken));
$response = json_decode($client->getResponse()->getContent());
if ($response->error) {
... | @param int $facebookId Facebook account id
@param string $facebookAccessToken Facebook access token
@return bool Facebook account status | entailment |
protected function createJsonResponseForException(UserException $exception)
{
$message = $exception->getMessage();
$statusCode = $exception->getStatusCode();
$content = ['error' => str_replace('"', '\'', $message)];
return new JsonResponse($content, $statusCode);
} | Create JsonResponse for Exception.
@param UserException $exception
@return JsonResponse | entailment |
public function handle()
{
if (is_null($this->argument('character_id')))
$this->warn('No character id specified. Using null token.');
else
$refresh_token = RefreshToken::findOrFail($this->argument('character_id'));
$this->argument('job_class')::dispatch($refresh_tok... | Execute the console command. | entailment |
public function renameTable($table, $name)
{
//Argument 1 must be a string, 2 must be string
Argument::i()->test(1, 'string')->argument(2, 'string');
$this->query = 'RENAME TABLE `' . $table . '` TO `' . $name . '`';
return $this;
} | Query for renaming a table
@param *string $table The name of the table
@param *string $name The new name of the table
@return Eden\Mysql\Utility | entailment |
public function showColumns($table, $where = null)
{
//Argument 1 must be a string, 2 must be string null
Argument::i()->test(1, 'string')->test(2, 'string', 'null');
$where = $where ? ' WHERE '.$where : null;
$this->query = 'SHOW FULL COLUMNS FROM `' . $table .'`' . $where;... | Query for showing all columns of a table
@param *string $table The name of the table
@param *string|null $where Filter/s
@return Eden\Mysql\Utility | entailment |
public function showTables($like = null)
{
Argument::i()->test(1, 'string', 'null');
$like = $like ? ' LIKE '.$like : null;
$this->query = 'SHOW TABLES'.$like;
return $this;
} | Query for showing all tables
@param string|null $like The like pattern
@return Eden\Mysql\Utility | entailment |
protected function convertToResource($data)
{
return Representation::make($this->client, $this->bib, $data->id)
->init($data);
} | Convert a data element to a resource object.
@param $data
@return Representation | entailment |
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('rch_jwt_user');
$rootNode
->children()
->scalarNode('user_class')
->isRequired()
->cannotBeEmpty()
... | {@inheritdoc} | entailment |
protected function configureProperties(OptionsResolver $resolver)
{
parent::configureProperties($resolver);
$resolver
->setRequired('socket')
->setAllowedTypes('socket', 'string');
$resolver
->setDefined('socket_owner')
->setAllowedTypes('soc... | {@inheritdoc} | entailment |
public function handle()
{
$esi = app('esi-client')->get();
$esi->setVersion(''); // meta URI lives in /
Configuration::getInstance()->cache = NullCache::class;
try {
$esi->invoke('get', '/ping');
} catch (RequestFailedException $e) {
$this->err... | Execute the console command.
@throws \Seat\Eseye\Exceptions\InvalidContainerDataException | entailment |
public function prepend(ContainerBuilder $container)
{
$kernelRootDir = $container->getParameter('kernel.root_dir');
$configs = $this->processConfiguration(new Configuration(), $container->getExtensionConfig($this->getAlias()));
$fosUserProviderId = 'fos_user.user_provider.username_email';
... | {@inheritdoc} | entailment |
public function updateCMSFields(FieldList $fields)
{
if (Config::inst()->get(SeoObjectExtension::class, 'use_webmaster_tag')) {
$fields->addFieldToTab(
"Root.SEO",
TextareaField::create(
"GoogleWebmasterMetaTag",
_t('SEO.SEO... | updateCMSFields.
Update Silverstripe CMS Fields for SEO Module
@param FieldList | entailment |
public function handle()
{
$this->line('SeAT Admin Login URL Generator');
$admin = User::firstOrNew(['name' => 'admin']);
if (! $admin->exists) {
$this->warn('User \'admin\' does not exist. It will be created.');
$admin->fill([
'name' ... | Execute the console command.
@throws \Exception | entailment |
public function setRequirements()
{
if (!isset($this->options['requirements']) || $this->options['requirements'] === null) {
return $this;
}
$requirements = $this->options['requirements'];
if (!is_array($requirements)) {
$requirements = [$requirements];
... | Set requirements. | entailment |
public function removeSection($section)
{
if ($has = $this->hasSection($section)) {
unset($this->sections[$section]);
}
return $has;
} | Removes a section by name.
@param string $section
@return bool | entailment |
public function toArray()
{
$ini = [];
foreach ($this->sections as $sectionName => $section) {
$ini[$sectionName] = $section->getProperties();
}
return $ini;
} | Converts the configuration to array.
@return array | entailment |
public function mapSection($section, $className)
{
if (false === class_exists($className)) {
throw new \InvalidArgumentException('This section class does not exist');
} elseif (false === is_a($className, 'Supervisor\Configuration\Section', true)) {
throw new \InvalidArgumentE... | Adds or overrides a default section mapping.
@param string $section
@param string $className | entailment |
public function findSection($section)
{
if (isset($this->sectionMap[$section])) {
return $this->sectionMap[$section];
}
return false;
} | Finds a section class by name.
@param string $section
@return string|bool | entailment |
protected function configureProperties(OptionsResolver $resolver)
{
parent::configureProperties($resolver);
$resolver->setDefined('buffer_size')
->setAllowedTypes('buffer_size', 'integer');
$resolver->setDefined('events');
$this->configureArrayProperty('events', $resolv... | {@inheritdoc} | entailment |
protected function convertToResource($data)
{
return Item::make($this->client, $this->bib, $this->holding, $data->item_data->pid)
->init($data);
} | Convert a data element to a resource object.
@param $data
@return Item | entailment |
public function fromBarcode($barcode)
{
$destinationUrl = $this->client->getRedirectLocation('/items', ['item_barcode' => $barcode]);
// Extract the MMS ID from the redirect target URL.
// Example: https://api-eu.hosted.exlibrisgroup.com/almaws/v1/bibs/999211285764702204/holdings/2215674644... | Get an Item object from a barcode.
@param string $barcode
@return Item|null | entailment |
public function connect(array $options = array())
{
$host = $port = null;
if (!is_null($this->host)) {
$host = 'host='.$this->host.';';
if (!is_null($this->port)) {
$port = 'port='.$this->port.';';
}
}
$connection ... | Connects to the database
@param array $options the connection options
@return | entailment |
public function subselect($parentQuery, $select = '*')
{
//Argument 2 must be a string
Argument::i()->test(2, 'string');
return Subselect::i($parentQuery, $select);
} | Returns the Subselect query builder
@param string $parentQuery The parent query
@param string $select List of columns
@return Eden\Mysql\Subselect | entailment |
public function getColumns($table, $filters = null)
{
//Argument 1 must be a string
Argument::i()->test(1, 'string');
$query = $this->utility();
if (is_array($filters)) {
foreach ($filters as $i => $filter) {
//array('post_id=%s AND post_... | Returns the columns and attributes given the table name
@param string $table The name of the table
@param array $filters Where filters
@return array|false | entailment |
public function getPrimaryKey($table)
{
//Argument 1 must be a string
Argument::i()->test(1, 'string');
$query = $this->utility();
$results = $this->getColumns($table, "`Key` = 'PRI'");
return isset($results[0]['Field']) ? $results[0]['Field'] : null;
} | Peturns the primary key name given the table
@param string $table Table name
@return string | entailment |
public function getSchema()
{
$backup = array();
$tables = $this->getTables();
foreach ($tables as $table) {
$backup[] = $this->getBackup();
}
return implode("\n\n", $backup);
} | Returns the whole enitre schema and rows
of the current databse
@return string | entailment |
public function getTables($like = null)
{
//Argument 1 must be a string or null
Argument::i()->test(1, 'string', 'null');
$query = $this->utility();
$like = $like ? $this->bind($like) : null;
$results = $this->query($query->showTables($like), $q->getBinds());
... | Returns a listing of tables in the DB
@param string|null $like The like pattern
@return attay|false | entailment |
public function getTableSchema($table)
{
//Argument 1 must be a string
Argument::i()->test(1, 'string');
$backup = array();
//get the schema
$schema = $this->getColumns($table);
if (count($schema)) {
//lets rebuild this schema
$query =... | Returns the whole enitre schema and rows
of the current table
@param *string $table Name of table
@return string | entailment |
public function attach(Task $task, $task_name = null)
{
if (is_null($task_name)) {
$task_name = count($this->tasks);
}
$this->tasks[$task_name] = $task;
curl_multi_add_handle($this->curl, $task->createCurl());
$deferred = new Deferred();
$this->deferred[$t... | add new task and return a promise
@param Task $task
@param null $task_name
@return \React\Promise\PromiseInterface | entailment |
public function fire()
{
Assets::withChain([
new Locations($this->token), new Names($this->token),
])->dispatch($this->token)->onQueue($this->queue);
Bookmarks::withChain([
new Folders($this->token),
])->dispatch($this->token)->onQueue($this->queue);
... | Fires the command.
@return mixed | entailment |
public function get($user_id, $params = [])
{
return User::make($this->client, $user_id)
->setParams($params);
} | Get a User object by id.
@param $user_id int
@param $params array Additional query string parameters
@return User | entailment |
public function search($query, array $options = [])
{
// Max number of records to fetch. Set to 0 to fetch all.
$limit = array_key_exists('limit', $options) ? $options['limit'] : 0;
// Set to true to do a phrase search
$phrase = array_key_exists('phrase', $options) ? $options['phras... | Iterates over all users matching the given query.
Handles continuation.
@param string $query
@param array $options
@return \Generator | entailment |
public function get($mms_id, $expand = null)
{
$params = ['expand' => $expand];
return Bib::make($this->client, $mms_id)
->setParams($params);
} | Get a Bib object.
@param string $mms_id
@param array $expand Expand the bibliographic record with additional information.
@return Bib | entailment |
public function fromBarcode($barcode)
{
$destinationUrl = $this->client->getRedirectLocation('/items', ['item_barcode' => $barcode]);
// Extract the MMS ID from the redirect target URL.
// Example: https://api-eu.hosted.exlibrisgroup.com/almaws/v1/bibs/999211285764702204/holdings/2215674644... | Get a Bib object from a item barcode.
@param string $barcode
@return Bib | entailment |
public function fromHoldingsId($holdings_id)
{
$data = $this->client->getXML('/bibs', ['holdings_id' => $holdings_id]);
return $this->get($data->text('bib/mms_id'))
->init($data->first('bib'));
} | Get a Bib object from a holdings ID.
@param string $holdings_id
@return Bib | entailment |
public function search($cql, $batchSize = 10)
{
$this->client->assertHasSruClient();
foreach ($this->client->sru->all($cql, $batchSize) as $sruRecord) {
yield Bib::fromSruRecord($sruRecord, $this->client);
}
} | Get Bib records from SRU search. You must have an SRU client connected
to the Alma client (see `Client::setSruClient()`).
Returns a generator that handles continuation under the hood.
@param string $cql The CQL query
@param int $batchSize Number of records to return in each batch.
@return \Generator|Bib[] | entailment |
public function handle()
{
// Start by warning the user about the command that will be run
$this->comment('Warning! This Laravel command uses exec() to execute a ');
$this->comment('mysql shell command to import an extracted dump. Due');
$this->comment('to the way the command is con... | Query the eveseat/resources repository for SDE
related information.
@throws \Seat\Services\Exceptions\SettingException | entailment |
public function getJsonResource()
{
$result = $this->getGuzzle()->request('GET',
'https://raw.githubusercontent.com/eveseat/resources/master/sde.json', [
'headers' => ['Accept' => 'application/json'],
]);
if ($result->getStatusCode() != 200)
retu... | Query the eveseat/resources repository for SDE
related information.
@return mixed | entailment |
public function getGuzzle()
{
if ($this->guzzle)
return $this->guzzle;
$this->guzzle = new Client();
return $this->guzzle;
} | Get an instance of Guzzle.
@return \GuzzleHttp\Client | entailment |
public function isStorageOk()
{
$storage = storage_path() . '/sde/' . $this->json->version . '/';
$this->info('Storage path is: ' . $storage);
if (File::isWritable(storage_path())) {
// Check that the path exists
if (! File::exists($storage))
File::... | Check that the storage path is ok. I needed it
will be automatically created.
@return bool | entailment |
public function getSde()
{
$this->line('Downloading...');
$bar = $this->getProgressBar(count($this->json->tables));
foreach ($this->json->tables as $table) {
$url = str_replace(':version', $this->json->version, $this->json->url) .
$table . $this->json->format;
... | Download the EVE Sde from Fuzzwork and save it
in the storage_path/sde folder. | entailment |
public function getProgressBar($iterations)
{
$bar = $this->output->createProgressBar($iterations);
$bar->setFormat(' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s% %memory:6s%');
return $bar;
} | Get a new progress bar to display based on the
amount of iterations we expect to use.
@param $iterations
@return \Symfony\Component\Console\Helper\ProgressBar | entailment |
public function importSde()
{
$this->line('Importing...');
$bar = $this->getProgressBar(count($this->json->tables));
foreach ($this->json->tables as $table) {
$archive_path = $this->storage_path . $table . $this->json->format;
$extracted_path = $this->storage_path ... | Extract the SDE files downloaded and run the MySQL command
to import them into the database. | entailment |
public function connect(array $options = array())
{
$this->connection = new \PDO('sqlite:'.$this->path);
$this->connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$this->trigger('connect');
return $this;
} | Connects to the database
@param array $options The connection options
@return Eden\Sqlite\Index | entailment |
public function getColumns($table)
{
//Argument 1 must be a string
Argument::i()->test(1, 'string');
$query = $this->utility()->showColumns($table);
$results = $this->query($query, $this->getBinds());
$columns = array();
foreach ($results as $column)... | Returns the columns and attributes given the table name
@param *string $table The name of the table
@return array|false | entailment |
public function insertRows($table, array $settings, $bind = true)
{
//argument test
Argument::i()
//Argument 1 must be a string
->test(1, 'string')
//Argument 3 must be an array or bool
->test(3, 'array', 'bool');
//this is an array of... | Inserts multiple rows into a table
@param *string $table Table name
@param array $setting Key/value 2D array matching table columns
@param bool|array $bind Whether to compute with binded variables
@return Eden\Sqlite\Index | entailment |
public function select($select = 'ROWID,*')
{
//Argument 1 must be a string or array
Argument::i()->test(1, 'string', 'array');
return \Eden\Sql\Select::i($select);
} | Returns the select query builder
@param string|array $select Column list
@return Eden\Sql\Select | entailment |
public function all($status = 'ACTIVE')
{
$ids = [$this->data->primary_id];
foreach ($this->data->user_identifier as $identifier) {
if (is_null($status) || $identifier->status == $status) {
$ids[] = $identifier->value;
}
}
return $ids;
} | Get a flat array of all the user IDs.
@param string $status (Default: 'ACTIVE').
@return string[] | entailment |
public function allOfType($value, $status = 'ACTIVE')
{
$ids = [];
foreach ($this->data->user_identifier as $identifier) {
if ($identifier->id_type->value == $value && (is_null($status) || $identifier->status == $status)) {
$ids[] = $identifier->value;
}
... | Get all active user identifiers of a given type, like 'BARCODE' or 'UNIV_ID'.
@param string $value
@param string $status
@return array | entailment |
public function firstOfType($value, $status = 'ACTIVE')
{
foreach ($this->data->user_identifier as $identifier) {
if ($identifier->id_type->value == $value && (is_null($status) || $identifier->status == $status)) {
return $identifier->value;
}
}
} | Get the first active user identifier of a given type, like 'BARCODE' or 'UNIV_ID'.
@param string $value
@param string $status
@return null|string | entailment |
public function load(Configuration $configuration = null)
{
if (!$this->filesystem->has($this->file)) {
throw new LoaderException(sprintf('File "%s" not found', $this->file));
}
if (!$fileContents = $this->filesystem->read($this->file)) {
throw new LoaderException(sp... | {@inheritdoc} | entailment |
protected function onData($data)
{
if (is_null($this->totalRecordCount)) {
$this->totalRecordCount = $data->total_record_count;
}
if (!isset($data->{$this->responseKey})) {
return;
}
foreach ($data->{$this->responseKey} as $result) {
$thi... | Called when data is available on the object.
The resource classes can use this method to process the data.
@param $data | entailment |
protected function convertToResource($data)
{
return Request::make($this->client, User::make($this->client, $data->user_primary_id), $data->request_id)
->init($data);
} | Convert a data element to a resource object.
@param $data
@return Request | entailment |
public function register()
{
$this->mergeConfigFrom(
__DIR__ . '/../../config/alma.php',
'alma'
);
$this->app->singleton(AlmaClient::class, function ($app) {
// Create Alma client
$alma = new AlmaClient(
$app['config']->get('a... | Register the service provider.
@return void | entailment |
public function addForeignKey($name, $table, $key)
{
//argument test
Argument::i()
->test(1, 'string') //Argument 1 must be a string
->test(2, 'string') //Argument 2 must be a string
->test(3, 'string'); //Argument 3 must be a string
... | Adds an index key
@param *string $name Name of column
@param *string $table Name of foreign table
@param *string $key Name of key
@return Eden\Sqlite\Create | entailment |
public function getQuery($unbind = false)
{
$table = '"'.$this->name.'"';
$fields = array();
foreach ($this->fields as $name => $attr) {
$field = array('"'.$name.'"');
if (isset($attr['type'])) {
$field[] = isset($attr['length']) ?
... | Returns the string version of the query
@param bool $unbind Whether to unbind variables
@return string | entailment |
protected function convertToResource($data)
{
return ResourceSharingRequest::make($this->client, $data->request_id)
->init($data);
} | Convert a data element to a resource object.
@param $data
@return mixed | entailment |
protected function convertToResource($data)
{
$bib = $this->client->bibs->get($data->resource_metadata->mms_id->value);
return RequestedResource::make($this->client, $this->library, $this->params['circ_desk'], $bib)
->init($data);
} | Convert a data element to a resource object.
@param $data
@return mixed | entailment |
public static function Jaro($string1, $string2) {
$str1_len = strlen($string1);
$str2_len = strlen($string2);
// theoretical distance
$distance = (int) floor(min($str1_len, $str2_len) / 2.0);
// get common characters
$commons1 = self::getCommonCharacters($string1, $str... | The higher the Jaro–Winkler distance for two strings is, the more
similar the strings are. The Jaro–Winkler distance metric is designed
and best suited for short strings such as person names. The score is
normalized such that 0 equates to no similarity and 1 is an exact match.
@param type $string1
@param type $string2... | entailment |
protected static function sum_hash($c, $h) {
$h = ($h * self::HASH_PRIME) % pow(2, 32);
$h = ($h ^ $c) % pow(2, 32);
return $h;
} | /* A simple non-rolling hash, based on the FNV hash | entailment |
public function digestAuth($realm, array $users)
{
if ($this->isCLIRequest()) {
return;
}
if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
$this->sendAuthenticateHeader($realm);
exit();
}
if (!($data = $this->httpDigestParse($_SERVER['PHP_AUTH_... | Perform digest HTTP authentication
Note: HTTP authentication is disabled, if application
runs in command-line (CLI) mode
@param string $realm
@param array $users username => password | entailment |
protected function isSSLRequest()
{
if (isset($_SERVER['HTTPS'])) {
if ('on' == strtolower($_SERVER['HTTPS'])) {
return true;
}
if ('1' == $_SERVER['HTTPS']) {
return true;
}
} elseif (isset($_SERVER['SERVER_PORT']) && ... | Checks, if application is requested via secure SSL
@return bool | entailment |
public function handle()
{
$this->line('SeAT Cache Clearing Tool');
$this->line('');
if (! $this->confirm('Are you sure you want to clear ALL caches (file/redis/db)?', true)) {
$this->warn('Exiting without clearing cache');
return;
}
$this->clear_... | Execute the console command. | entailment |
public function clear_redis_cache()
{
$redis_host = config('database.redis.default.host');
$redis_port = config('database.redis.default.port');
$this->info('Clearing the Redis Cache at: ' . $redis_host . ':' . $redis_port);
try {
$redis = new Client([
... | Flush all keys in Redis. | entailment |
public function clear_eseye_cache()
{
// Eseye Cache Clearing
$eseye_cache = config('eveapi.config.eseye_cache');
if (File::isWritable($eseye_cache)) {
$this->info('Clearing the Eseye Cache at: ' . $eseye_cache);
if (! File::deleteDirectory($eseye_cache, true))
... | Clear the Eseye Storage Cache. | entailment |
protected function onData($data)
{
if (isset($this->bib_data)) {
$this->bib->init($this->bib_data);
}
if (isset($this->holding_data)) {
$this->holding->init($this->holding_data);
}
} | Called when data is available to be processed.
@param mixed $data | entailment |
public function checkOut(User $user, Library $library, $circ_desk = 'DEFAULT_CIRC_DESK')
{
$postData = [
'library' => ['value' => $library->code],
'circ_desk' => ['value' => $circ_desk],
];
$data = $this->client->postJSON(
$this->url('/loans', ['user_id... | Create a new loan.
@param User $user
@param Library $library
@param string $circ_desk
@throws \Scriptotek\Alma\Exception\RequestFailed
@return Loan | entailment |
public function scanIn(Library $library, $circ_desk = 'DEFAULT_CIRC_DESK', $params = [])
{
$params['op'] = 'scan';
$params['library'] = $library->code;
$params['circ_desk'] = $circ_desk;
$data = $this->client->postJSON($this->url('', $params));
return ScanInResponse::make($... | Perform scan-in on item.
@param Library $library
@param string $circ_desk
@param array $params
@throws \Scriptotek\Alma\Exception\RequestFailed
@return ScanInResponse | entailment |
public function getLoan()
{
$data = $this->client->getJSON($this->url('/loans'));
if ($data->total_record_count == 1) {
return Loan::make(
$this->client,
User::make($this->client, $data->item_loan[0]->user_id),
$data->item_loan[0]->loan_id... | Get the current loan as a Loan object, or null if the item is not loaned out.
@returns Loan|null | entailment |
public function onAuthenticationSuccessResponse(AuthenticationSuccessEvent $event)
{
$data = $event->getData();
$data['user'] = $event->getUser()->getUsername();
$event->setData($data);
} | Add public data to the authentication response.
@param AuthenticationSuccessEvent $event | entailment |
public function handle()
{
$tokens = RefreshToken::all()
->when($this->argument('character_id'), function ($tokens) {
return $tokens->where('character_id', $this->argument('character_id'));
})
->each(function ($token) {
// Fire the class... | Execute the console command. | entailment |
protected function fetchBatch($attempt = 1, $chunkSize = null)
{
if ($this->isFinished) {
return;
}
$results = $this->client->getXML($this->url('', [
'path' => $this->resumptionToken ? null : $this->path,
'limit' => $chunkSize ?: $this->chunkSize,
... | Note: chunkSize must be between 25 and 1000.
@param int $attempt
@param int $chunkSize
@return void | entailment |
protected function readColumnHeaders(QuiteSimpleXMLElement $results)
{
$headers = array_map(function (QuiteSimpleXMLElement $node) {
return $node->attr('saw-sql:columnHeading');
}, $results->all('//xsd:complexType[@name="Row"]/xsd:sequence/xsd:element[position()>1]'));
if (!coun... | Read column headers from response, and check that we got the right number of columns back.
@param QuiteSimpleXMLElement $results | entailment |
public function handle()
{
$this->line('SeAT Admin Email Set Tool');
$this->info('The current admin email is: ' . Seat::get('admin_contact'));
$this->question('Please enter the new administrator email address:');
$email = $this->ask('Email: ');
while (! filter_var($email, ... | Execute the console command.
@throws \Seat\Services\Exceptions\SettingException | entailment |
public function getItem()
{
$bib = Bib::make($this->client, $this->data->bib_data->mms_id);
$holding = Holding::make($this->client, $bib, $this->data->holding_data->holding_id);
return Item::make(
$this->client,
$bib,
$holding,
$this->data->it... | Get the scanned-in item.
@return Item | entailment |
public function getHolding()
{
$bib = Bib::make($this->client, $this->data->bib_data->mms_id);
return Holding::make(
$this->client,
$bib,
$this->data->holding_data->holding_id
)->init($this->data->holding_data);
} | Get the Holding object for the scanned-in item.
@return Holding | entailment |
public function getBib()
{
return Bib::make(
$this->client,
$this->data->bib_data->mms_id
)->init($this->data->bib_data);
} | Get the Bib object for the scanned-in item.
@return Bib | entailment |
public function handle()
{
$this->line('SeAT Diagnostics');
$this->line('If you are not already doing so, it is recommended that you ' .
'run this as the user the workers are running as.');
$this->line('Eg:');
$this->info(' sudo -u apache php artisan seat:admin:diagno... | Execute the console command. | entailment |
public function environment_info()
{
$this->line(' * Getting environment information');
// Get the current user.
$user = posix_getpwuid(posix_geteuid())['name'];
// Warn if we are running as root.
if ($user === 'root') {
$this->error('WARNING: This command is ... | Print some information about the current environment. | entailment |
public function check_storage()
{
$this->line(' * Checking storage');
if (! File::isWritable(storage_path()))
$this->error(storage_path() . ' is not writable');
else
$this->info(storage_path() . ' is writable');
if (! File::isWritable(config('eveapi.config.e... | Check access to some important storage paths. | entailment |
public function check_database()
{
$this->line(' * Checking Database');
$this->table(['Setting', 'Value'], [
['Connection', env('DB_CONNECTION')],
['Host', env('DB_HOST')],
['Database', env('DB_DATABASE')],
['Username', env('DB_USERNAME')],
... | Check if database access is OK. | entailment |
public function check_redis()
{
$this->line(' * Checking Redis');
$this->table(['Setting', 'Value'], [
['Host', config('database.redis.default.host')],
['Port', config('database.redis.default.port')],
['Database', config('database.redis.default.database')],
... | Check of redis access is OK. | entailment |
public function check_pheal()
{
$this->line(' * Checking ESI Access');
$esi = app('esi-client')->get();
$esi->setVersion('v1');
Configuration::getInstance()->cache = NullCache::class;
try {
$result = $esi->invoke('get', '/status/');
$this->info('Se... | Check if access to the EVE API OK. | entailment |
public function init($data = null)
{
if ($this->initialized) {
return $this;
}
if (is_null($data)) {
$data = $this->fetchData();
}
if ($this->isInitialized($data)) {
$this->initialized = true;
}
$this->data = $data;
... | Load data onto this object. Chainable method.
@param \stdClass|QuiteSimpleXMLElement $data
@return $this | entailment |
protected function url($path = '', $query = [])
{
$path = $this->urlBase() . $path;
$query = http_build_query(array_merge($this->params, $query));
$url = $path;
if (!empty($query)) {
$url .= '?' . $query;
}
return $url;
} | Build a relative URL for a resource.
@param string $path
@param array $query
@return string | entailment |
public function getItem()
{
if (isset($this->barcode)) {
return $this->client->items->fromBarcode($this->barcode);
}
} | Get the related Item, if any.
@return Item|null | entailment |
protected function convertToResource($data)
{
return Collection::make($this->client, $data->id)
->init($data);
} | Convert a data element to a resource object.
@param $data
@return Representation | entailment |
public function parseSections(array $sections, Configuration $configuration = null)
{
if (is_null($configuration)) {
$configuration = new Configuration();
}
foreach ($sections as $sectionName => $section) {
$name = explode(':', $sectionName, 2);
$class =... | Parses a section array.
@param array $sections
@param Configuration|null $configuration
@return Configuration | entailment |
protected function renderHtml($data)
{
$html = $this->getHtmlPrefix();
$html .= $this->arrayToHtml($data);
$html .= $this->getHtmlPostfix();
return $html;
} | Render Array as HTML (thanks to joind.in's -api project!)
This code is cribbed from https://github.com/joindin/joindin-api/blob/master/src/views/HtmlView.php
@return string | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.