id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
45,700
eveseat/services
src/Repositories/Corporation/Standings.php
Standings.getCorporationStandings
public function getCorporationStandings(int $corporation_id, int $chunk = 50) { return CorporationStanding::where('corporation_id', $corporation_id) ->leftJoin('chrFactions', 'from_id', '=', 'factionID') ->orderBy('from_type') ->paginate($chunk); }
php
public function getCorporationStandings(int $corporation_id, int $chunk = 50) { return CorporationStanding::where('corporation_id', $corporation_id) ->leftJoin('chrFactions', 'from_id', '=', 'factionID') ->orderBy('from_type') ->paginate($chunk); }
[ "public", "function", "getCorporationStandings", "(", "int", "$", "corporation_id", ",", "int", "$", "chunk", "=", "50", ")", "{", "return", "CorporationStanding", "::", "where", "(", "'corporation_id'", ",", "$", "corporation_id", ")", "->", "leftJoin", "(", ...
Return the standings for a Corporation. @param int $corporation_id @param int $chunk @return mixed
[ "Return", "the", "standings", "for", "a", "Corporation", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Standings.php#L41-L48
45,701
eveseat/services
src/Repositories/Corporation/Corporation.php
Corporation.getAllCorporationsWithAffiliationsAndFilters
public function getAllCorporationsWithAffiliationsAndFilters(bool $get = true) { // Get the User for permissions and affiliation // checks $user = auth()->user(); // Start a fresh query $corporations = new CorporationInfo(); // Check if this user us a superuser. If not, // limit to stuff only they can see. if (! $user->hasSuperUser()) $corporations = $corporations->whereIn('corporation_id', array_keys($user->getAffiliationMap()['corp'])); if ($get) return $corporations->orderBy('name', 'desc') ->get(); return $corporations->getQuery(); }
php
public function getAllCorporationsWithAffiliationsAndFilters(bool $get = true) { // Get the User for permissions and affiliation // checks $user = auth()->user(); // Start a fresh query $corporations = new CorporationInfo(); // Check if this user us a superuser. If not, // limit to stuff only they can see. if (! $user->hasSuperUser()) $corporations = $corporations->whereIn('corporation_id', array_keys($user->getAffiliationMap()['corp'])); if ($get) return $corporations->orderBy('name', 'desc') ->get(); return $corporations->getQuery(); }
[ "public", "function", "getAllCorporationsWithAffiliationsAndFilters", "(", "bool", "$", "get", "=", "true", ")", "{", "// Get the User for permissions and affiliation", "// checks", "$", "user", "=", "auth", "(", ")", "->", "user", "(", ")", ";", "// Start a fresh que...
Return the corporations for which a user has access. @param bool $get @return mixed
[ "Return", "the", "corporations", "for", "which", "a", "user", "has", "access", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Corporation.php#L49-L71
45,702
eveseat/services
src/Repositories/Corporation/Ledger.php
Ledger.getCorporationLedgerBountyPrizeDates
public function getCorporationLedgerBountyPrizeDates(int $corporation_id): Collection { return CorporationWalletJournal::select(DB::raw('DISTINCT MONTH(date) as month, YEAR(date) as year')) ->where('corporation_id', $corporation_id) ->whereIn('ref_type', ['bounty_prizes', 'bounty_prize']) ->orderBy('date', 'desc') ->get(); }
php
public function getCorporationLedgerBountyPrizeDates(int $corporation_id): Collection { return CorporationWalletJournal::select(DB::raw('DISTINCT MONTH(date) as month, YEAR(date) as year')) ->where('corporation_id', $corporation_id) ->whereIn('ref_type', ['bounty_prizes', 'bounty_prize']) ->orderBy('date', 'desc') ->get(); }
[ "public", "function", "getCorporationLedgerBountyPrizeDates", "(", "int", "$", "corporation_id", ")", ":", "Collection", "{", "return", "CorporationWalletJournal", "::", "select", "(", "DB", "::", "raw", "(", "'DISTINCT MONTH(date) as month, YEAR(date) as year'", ")", ")"...
Return the Bounty Prize Payout dates for a Corporation. @param int $corporation_id @return \Illuminate\Support\Collection
[ "Return", "the", "Bounty", "Prize", "Payout", "dates", "for", "a", "Corporation", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Ledger.php#L42-L50
45,703
eveseat/services
src/Traits/NotableTrait.php
NotableTrait.addNote
public static function addNote( int $object_id, string $title, string $note): Note { return Note::create([ 'object_type' => __CLASS__, 'object_id' => $object_id, 'title' => $title, 'note' => $note, ]); }
php
public static function addNote( int $object_id, string $title, string $note): Note { return Note::create([ 'object_type' => __CLASS__, 'object_id' => $object_id, 'title' => $title, 'note' => $note, ]); }
[ "public", "static", "function", "addNote", "(", "int", "$", "object_id", ",", "string", "$", "title", ",", "string", "$", "note", ")", ":", "Note", "{", "return", "Note", "::", "create", "(", "[", "'object_type'", "=>", "__CLASS__", ",", "'object_id'", "...
Add a note. @param int $object_id @param string $title @param string $note @return \Seat\Services\Models\Note
[ "Add", "a", "note", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Traits/NotableTrait.php#L43-L54
45,704
eveseat/services
src/Traits/NotableTrait.php
NotableTrait.getNote
public static function getNote(int $object_id, int $note_id): Builder { return Note::where('object_type', __CLASS__) ->where('object_id', $object_id) ->where('id', $note_id); }
php
public static function getNote(int $object_id, int $note_id): Builder { return Note::where('object_type', __CLASS__) ->where('object_id', $object_id) ->where('id', $note_id); }
[ "public", "static", "function", "getNote", "(", "int", "$", "object_id", ",", "int", "$", "note_id", ")", ":", "Builder", "{", "return", "Note", "::", "where", "(", "'object_type'", ",", "__CLASS__", ")", "->", "where", "(", "'object_id'", ",", "$", "obj...
Get a single note. @param int $object_id @param int $note_id @return \Illuminate\Database\Eloquent\Builder
[ "Get", "a", "single", "note", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Traits/NotableTrait.php#L79-L86
45,705
eveseat/services
src/Traits/NotableTrait.php
NotableTrait.deleteNote
public static function deleteNote(int $object_id, int $note_id): int { return Note::where('object_type', __CLASS__) ->where('object_id', $object_id) ->where('id', $note_id) ->delete(); }
php
public static function deleteNote(int $object_id, int $note_id): int { return Note::where('object_type', __CLASS__) ->where('object_id', $object_id) ->where('id', $note_id) ->delete(); }
[ "public", "static", "function", "deleteNote", "(", "int", "$", "object_id", ",", "int", "$", "note_id", ")", ":", "int", "{", "return", "Note", "::", "where", "(", "'object_type'", ",", "__CLASS__", ")", "->", "where", "(", "'object_id'", ",", "$", "obje...
Delete a single note. @param int $object_id @param int $note_id @return int
[ "Delete", "a", "single", "note", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Traits/NotableTrait.php#L96-L104
45,706
eveseat/services
src/Traits/NotableTrait.php
NotableTrait.updateNote
public static function updateNote( int $object_id, int $note_id, string $title = null, string $note = null) { $note_record = Note::where('object_type', __CLASS__) ->where('object_id', $object_id) ->where('id', $note_id) ->first(); if (! is_null($title)) $note_record->title = $title; if (! is_null($note)) $note_record->note = $note; $note_record->save(); }
php
public static function updateNote( int $object_id, int $note_id, string $title = null, string $note = null) { $note_record = Note::where('object_type', __CLASS__) ->where('object_id', $object_id) ->where('id', $note_id) ->first(); if (! is_null($title)) $note_record->title = $title; if (! is_null($note)) $note_record->note = $note; $note_record->save(); }
[ "public", "static", "function", "updateNote", "(", "int", "$", "object_id", ",", "int", "$", "note_id", ",", "string", "$", "title", "=", "null", ",", "string", "$", "note", "=", "null", ")", "{", "$", "note_record", "=", "Note", "::", "where", "(", ...
Update a single note with a new title or note. @param int $object_id @param int $note_id @param string|null $title @param string|null $note
[ "Update", "a", "single", "note", "with", "a", "new", "title", "or", "note", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Traits/NotableTrait.php#L114-L131
45,707
eveseat/services
src/Repositories/Character/Skills.php
Skills.getCharacterSkillsInformation
public function getCharacterSkillsInformation(int $character_id): Collection { return CharacterSkill::join('invTypes', 'character_skills.skill_id', '=', 'invTypes.typeID') ->join('invGroups', 'invTypes.groupID', '=', 'invGroups.groupID') ->where('character_skills.character_id', $character_id) ->orderBy('invTypes.typeName') ->get(); }
php
public function getCharacterSkillsInformation(int $character_id): Collection { return CharacterSkill::join('invTypes', 'character_skills.skill_id', '=', 'invTypes.typeID') ->join('invGroups', 'invTypes.groupID', '=', 'invGroups.groupID') ->where('character_skills.character_id', $character_id) ->orderBy('invTypes.typeName') ->get(); }
[ "public", "function", "getCharacterSkillsInformation", "(", "int", "$", "character_id", ")", ":", "Collection", "{", "return", "CharacterSkill", "::", "join", "(", "'invTypes'", ",", "'character_skills.skill_id'", ",", "'='", ",", "'invTypes.typeID'", ")", "->", "jo...
Return the skills detail for a specific Character. @param int $character_id @return \Illuminate\Support\Collection
[ "Return", "the", "skills", "detail", "for", "a", "specific", "Character", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Skills.php#L39-L50
45,708
eveseat/services
src/Repositories/Character/Skills.php
Skills.getCharacterSkillQueue
public function getCharacterSkillQueue(int $character_id): Collection { return CharacterSkillQueue::where('characterID', $character_id) ->where('queue_position', '>', 0) ->orderBy('queue_position') ->get(); }
php
public function getCharacterSkillQueue(int $character_id): Collection { return CharacterSkillQueue::where('characterID', $character_id) ->where('queue_position', '>', 0) ->orderBy('queue_position') ->get(); }
[ "public", "function", "getCharacterSkillQueue", "(", "int", "$", "character_id", ")", ":", "Collection", "{", "return", "CharacterSkillQueue", "::", "where", "(", "'characterID'", ",", "$", "character_id", ")", "->", "where", "(", "'queue_position'", ",", "'>'", ...
Return a characters current Skill Queue. @param int $character_id @return \Illuminate\Support\Collection
[ "Return", "a", "characters", "current", "Skill", "Queue", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Skills.php#L74-L82
45,709
eveseat/services
src/Repositories/Character/Skills.php
Skills.getCharacterSkillsAmountPerLevel
public function getCharacterSkillsAmountPerLevel(int $character_id): array { $skills = CharacterSkill::where('character_id', $character_id) ->get(); return [ $skills->where('trained_skill_level', 0)->count(), $skills->where('trained_skill_level', 1)->count(), $skills->where('trained_skill_level', 2)->count(), $skills->where('trained_skill_level', 3)->count(), $skills->where('trained_skill_level', 4)->count(), $skills->where('trained_skill_level', 5)->count(), ]; }
php
public function getCharacterSkillsAmountPerLevel(int $character_id): array { $skills = CharacterSkill::where('character_id', $character_id) ->get(); return [ $skills->where('trained_skill_level', 0)->count(), $skills->where('trained_skill_level', 1)->count(), $skills->where('trained_skill_level', 2)->count(), $skills->where('trained_skill_level', 3)->count(), $skills->where('trained_skill_level', 4)->count(), $skills->where('trained_skill_level', 5)->count(), ]; }
[ "public", "function", "getCharacterSkillsAmountPerLevel", "(", "int", "$", "character_id", ")", ":", "array", "{", "$", "skills", "=", "CharacterSkill", "::", "where", "(", "'character_id'", ",", "$", "character_id", ")", "->", "get", "(", ")", ";", "return", ...
Get the numer of skills per Level for a character. @param int $character_id @return array
[ "Get", "the", "numer", "of", "skills", "per", "Level", "for", "a", "character", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Skills.php#L91-L105
45,710
eveseat/services
src/Repositories/Character/Skills.php
Skills.getCharacterSkillCoverage
public function getCharacterSkillCoverage(int $character_id): Collection { $in_game_skills = DB::table('invTypes') ->join( 'invMarketGroups', 'invMarketGroups.marketGroupID', '=', 'invTypes.marketGroupID' ) ->where('parentGroupID', '?')// binding at [1] ->select( 'marketGroupName', DB::raw('COUNT(invTypes.marketGroupID) * 5 as amount') ) ->groupBy('marketGroupName') ->toSql(); $character_skills = CharacterSkill::join( 'invTypes', 'invTypes.typeID', '=', 'character_skills.skill_id' ) ->join( 'invMarketGroups', 'invMarketGroups.marketGroupID', '=', 'invTypes.marketGroupID' ) ->where('character_id', '?')// binding at [2] ->select( 'marketGroupName', DB::raw('COUNT(invTypes.marketGroupID) * character_skills.trained_skill_level as amount') ) ->groupBy(['marketGroupName', 'trained_skill_level']) ->toSql(); $skills = DB::table( DB::raw('(' . $in_game_skills . ') a') ) ->leftJoin( DB::raw('(' . $character_skills . ') b'), 'a.marketGroupName', 'b.marketGroupName' ) ->select( 'a.marketGroupName', DB::raw('a.amount AS gameAmount'), DB::raw('SUM(b.amount) AS characterAmount') ) ->groupBy(['a.marketGroupName', 'a.amount']) ->addBinding(150, 'select')// binding [1] ->addBinding($character_id, 'select')// binding [2] ->get(); return $skills; }
php
public function getCharacterSkillCoverage(int $character_id): Collection { $in_game_skills = DB::table('invTypes') ->join( 'invMarketGroups', 'invMarketGroups.marketGroupID', '=', 'invTypes.marketGroupID' ) ->where('parentGroupID', '?')// binding at [1] ->select( 'marketGroupName', DB::raw('COUNT(invTypes.marketGroupID) * 5 as amount') ) ->groupBy('marketGroupName') ->toSql(); $character_skills = CharacterSkill::join( 'invTypes', 'invTypes.typeID', '=', 'character_skills.skill_id' ) ->join( 'invMarketGroups', 'invMarketGroups.marketGroupID', '=', 'invTypes.marketGroupID' ) ->where('character_id', '?')// binding at [2] ->select( 'marketGroupName', DB::raw('COUNT(invTypes.marketGroupID) * character_skills.trained_skill_level as amount') ) ->groupBy(['marketGroupName', 'trained_skill_level']) ->toSql(); $skills = DB::table( DB::raw('(' . $in_game_skills . ') a') ) ->leftJoin( DB::raw('(' . $character_skills . ') b'), 'a.marketGroupName', 'b.marketGroupName' ) ->select( 'a.marketGroupName', DB::raw('a.amount AS gameAmount'), DB::raw('SUM(b.amount) AS characterAmount') ) ->groupBy(['a.marketGroupName', 'a.amount']) ->addBinding(150, 'select')// binding [1] ->addBinding($character_id, 'select')// binding [2] ->get(); return $skills; }
[ "public", "function", "getCharacterSkillCoverage", "(", "int", "$", "character_id", ")", ":", "Collection", "{", "$", "in_game_skills", "=", "DB", "::", "table", "(", "'invTypes'", ")", "->", "join", "(", "'invMarketGroups'", ",", "'invMarketGroups.marketGroupID'", ...
Get a characters skill as well as category completion ration rate. TODO: This is definitely a candidate for a better refactor! @param int $character_id @return \Illuminate\Support\Collection
[ "Get", "a", "characters", "skill", "as", "well", "as", "category", "completion", "ration", "rate", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Skills.php#L117-L170
45,711
eveseat/services
src/Settings/Settings.php
Settings.get
public static function get($name, $for_id = null) { // Pickup the value from the cache if we can. Otherwise, // read the value for the database and cache it for next // time. return Cache::rememberForever(self::get_key_prefix($name, self::get_affected_id($for_id)), function () use ($name, $for_id) { // Init a new MODEL $value = (new static::$model); // If we are not in the global scope, add a constraint // to be user group specific. if (static::$scope != 'global') $value = $value->where('group_id', self::get_affected_id($for_id)); // Retrieve the value $value = $value->where('name', $name) ->value('value'); if ($value) return json_decode($value); // If we have no value, check if we can return // a default setting if (array_key_exists($name, static::$defaults)) return static::$defaults[$name]; return null; }); }
php
public static function get($name, $for_id = null) { // Pickup the value from the cache if we can. Otherwise, // read the value for the database and cache it for next // time. return Cache::rememberForever(self::get_key_prefix($name, self::get_affected_id($for_id)), function () use ($name, $for_id) { // Init a new MODEL $value = (new static::$model); // If we are not in the global scope, add a constraint // to be user group specific. if (static::$scope != 'global') $value = $value->where('group_id', self::get_affected_id($for_id)); // Retrieve the value $value = $value->where('name', $name) ->value('value'); if ($value) return json_decode($value); // If we have no value, check if we can return // a default setting if (array_key_exists($name, static::$defaults)) return static::$defaults[$name]; return null; }); }
[ "public", "static", "function", "get", "(", "$", "name", ",", "$", "for_id", "=", "null", ")", "{", "// Pickup the value from the cache if we can. Otherwise,", "// read the value for the database and cache it for next", "// time.", "return", "Cache", "::", "rememberForever", ...
Retrieve a setting by name. @param $name @param null $for_id @return mixed @throws \Seat\Services\Exceptions\SettingException
[ "Retrieve", "a", "setting", "by", "name", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Settings/Settings.php#L72-L103
45,712
eveseat/services
src/Settings/Settings.php
Settings.get_key_prefix
public static function get_key_prefix($name, $for_id = null) { // Ensure we have a prefix to work with. if (is_null(static::$prefix)) throw new SettingException('No prefix defined. Have you extended and declared $prefix?'); // Prefix user keys with group_id if (static::$scope != 'global') return implode('.', [$for_id, static::$prefix, $name]); // Global keys only with the global prefix. return implode('.', [static::$prefix, $name]); }
php
public static function get_key_prefix($name, $for_id = null) { // Ensure we have a prefix to work with. if (is_null(static::$prefix)) throw new SettingException('No prefix defined. Have you extended and declared $prefix?'); // Prefix user keys with group_id if (static::$scope != 'global') return implode('.', [$for_id, static::$prefix, $name]); // Global keys only with the global prefix. return implode('.', [static::$prefix, $name]); }
[ "public", "static", "function", "get_key_prefix", "(", "$", "name", ",", "$", "for_id", "=", "null", ")", "{", "// Ensure we have a prefix to work with.", "if", "(", "is_null", "(", "static", "::", "$", "prefix", ")", ")", "throw", "new", "SettingException", "...
Determine the unique prefix for the key by name. @param $name @param $for_id @return string @throws \Seat\Services\Exceptions\SettingException
[ "Determine", "the", "unique", "prefix", "for", "the", "key", "by", "name", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Settings/Settings.php#L114-L127
45,713
eveseat/services
src/Settings/Settings.php
Settings.get_affected_id
public static function get_affected_id($for_id) { // Without auth, return what we have. if (! auth()->check()) return $for_id; if (is_null($for_id)) return auth()->user()->group->id; return $for_id; }
php
public static function get_affected_id($for_id) { // Without auth, return what we have. if (! auth()->check()) return $for_id; if (is_null($for_id)) return auth()->user()->group->id; return $for_id; }
[ "public", "static", "function", "get_affected_id", "(", "$", "for_id", ")", "{", "// Without auth, return what we have.", "if", "(", "!", "auth", "(", ")", "->", "check", "(", ")", ")", "return", "$", "for_id", ";", "if", "(", "is_null", "(", "$", "for_id"...
Determine the effected group id. If this is for a specific id use that, otherwise assume the currently logged in user's id. If we dont have an already logged in session, well then we make the $for_id null. @param $for_id @return int|null
[ "Determine", "the", "effected", "group", "id", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Settings/Settings.php#L141-L152
45,714
eveseat/services
src/Repositories/Character/Contacts.php
Contacts.getCharacterContacts
public function getCharacterContacts(Collection $character_ids, array $standings): Builder { return CharacterContact::whereIn('character_contacts.character_id', $character_ids->toArray()) ->whereIn('standing', $standings); }
php
public function getCharacterContacts(Collection $character_ids, array $standings): Builder { return CharacterContact::whereIn('character_contacts.character_id', $character_ids->toArray()) ->whereIn('standing', $standings); }
[ "public", "function", "getCharacterContacts", "(", "Collection", "$", "character_ids", ",", "array", "$", "standings", ")", ":", "Builder", "{", "return", "CharacterContact", "::", "whereIn", "(", "'character_contacts.character_id'", ",", "$", "character_ids", "->", ...
Get a characters contact list. @param \Illuminate\Support\Collection $character_ids @param array $standings @return \Illuminate\Database\Eloquent\Builder
[ "Get", "a", "characters", "contact", "list", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Contacts.php#L41-L46
45,715
eveseat/services
src/Jobs/Analytics.php
Analytics.handle
public function handle() { // Do nothing if tracking is disabled if (! $this->allowTracking()) return; // Send the hit based on the hit type switch ($this->hit->type) { case 'event': $this->sendEvent(); break; case 'exception': $this->sendException(); break; default: break; } }
php
public function handle() { // Do nothing if tracking is disabled if (! $this->allowTracking()) return; // Send the hit based on the hit type switch ($this->hit->type) { case 'event': $this->sendEvent(); break; case 'exception': $this->sendException(); break; default: break; } }
[ "public", "function", "handle", "(", ")", "{", "// Do nothing if tracking is disabled", "if", "(", "!", "$", "this", "->", "allowTracking", "(", ")", ")", "return", ";", "// Send the hit based on the hit type", "switch", "(", "$", "this", "->", "hit", "->", "typ...
Execute the job, keeping in mind that if tracking is disabled, nothing should be sent and the job should just return. @return void @throws \Seat\Services\Exceptions\SettingException
[ "Execute", "the", "job", "keeping", "in", "mind", "that", "if", "tracking", "is", "disabled", "nothing", "should", "be", "sent", "and", "the", "job", "should", "just", "return", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Jobs/Analytics.php#L85-L107
45,716
eveseat/services
src/Jobs/Analytics.php
Analytics.sendEvent
public function sendEvent() { $this->send('event', [ 'ec' => $this->hit->ec, // Event Category 'ea' => $this->hit->ea, // Event Action 'el' => $this->hit->el, // Event Label 'ev' => $this->hit->ev, // Event Value ]); }
php
public function sendEvent() { $this->send('event', [ 'ec' => $this->hit->ec, // Event Category 'ea' => $this->hit->ea, // Event Action 'el' => $this->hit->el, // Event Label 'ev' => $this->hit->ev, // Event Value ]); }
[ "public", "function", "sendEvent", "(", ")", "{", "$", "this", "->", "send", "(", "'event'", ",", "[", "'ec'", "=>", "$", "this", "->", "hit", "->", "ec", ",", "// Event Category", "'ea'", "=>", "$", "this", "->", "hit", "->", "ea", ",", "// Event Ac...
Send an 'event' type hit to GA.
[ "Send", "an", "event", "type", "hit", "to", "GA", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Jobs/Analytics.php#L127-L137
45,717
eveseat/services
src/Jobs/Analytics.php
Analytics.send
private function send($type, array $query) { $client = new Client([ 'base_uri' => 'https://www.google-analytics.com/', 'timeout' => 5.0, ]); // Check if we are in debug mode $uri = $this->debug ? '/debug/collect' : '/collect'; // Submit the hit $client->get($uri, [ 'query' => array_merge([ // Fields referenced from: // https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters // Required Fields // https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#required 'v' => 1, // Protocol Version 'tid' => $this->tracking_id, // Google Tracking-ID 'cid' => $this->getClientID(), // Unique Client-ID 't' => $type, // Event // Optional Fields 'aip' => 1, // Anonymize the IP of the calling client 'an' => 'SeAT', // App Name // Versions of the currently installed packages. 'av' => 'api/' . config('api.config.version') . ', ' . 'console/' . config('console.config.version') . ', ' . 'eveapi/' . config('eveapi.config.version') . ', ' . 'notifications/' . config('notifications.config.version') . ', ' . 'web/' . config('web.config.version') . ', ' . 'services/' . config('services.config.version') . ', ', // User Agent is comprised of OS Name(s), Release(r) // and Machine Type(m). Examples: // Darwin/15.6.0/x86_64 // Linux/2.6.32-642.el6.x86_64/x86_64 // // See: // http://php.net/manual/en/function.php-uname.php 'ua' => 'SeAT/' . php_uname('s') . '/' . php_uname('r') . '/' . php_uname('m'), 'z' => rand(1, 10000), // Cache Busting Random Value ], $query), ]); }
php
private function send($type, array $query) { $client = new Client([ 'base_uri' => 'https://www.google-analytics.com/', 'timeout' => 5.0, ]); // Check if we are in debug mode $uri = $this->debug ? '/debug/collect' : '/collect'; // Submit the hit $client->get($uri, [ 'query' => array_merge([ // Fields referenced from: // https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters // Required Fields // https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#required 'v' => 1, // Protocol Version 'tid' => $this->tracking_id, // Google Tracking-ID 'cid' => $this->getClientID(), // Unique Client-ID 't' => $type, // Event // Optional Fields 'aip' => 1, // Anonymize the IP of the calling client 'an' => 'SeAT', // App Name // Versions of the currently installed packages. 'av' => 'api/' . config('api.config.version') . ', ' . 'console/' . config('console.config.version') . ', ' . 'eveapi/' . config('eveapi.config.version') . ', ' . 'notifications/' . config('notifications.config.version') . ', ' . 'web/' . config('web.config.version') . ', ' . 'services/' . config('services.config.version') . ', ', // User Agent is comprised of OS Name(s), Release(r) // and Machine Type(m). Examples: // Darwin/15.6.0/x86_64 // Linux/2.6.32-642.el6.x86_64/x86_64 // // See: // http://php.net/manual/en/function.php-uname.php 'ua' => 'SeAT/' . php_uname('s') . '/' . php_uname('r') . '/' . php_uname('m'), 'z' => rand(1, 10000), // Cache Busting Random Value ], $query), ]); }
[ "private", "function", "send", "(", "$", "type", ",", "array", "$", "query", ")", "{", "$", "client", "=", "new", "Client", "(", "[", "'base_uri'", "=>", "'https://www.google-analytics.com/'", ",", "'timeout'", "=>", "5.0", ",", "]", ")", ";", "// Check if...
Send the GA Hit. @param $type @param array $query @throws \Seat\Services\Exceptions\SettingException
[ "Send", "the", "GA", "Hit", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Jobs/Analytics.php#L147-L199
45,718
eveseat/services
src/Repositories/Corporation/Industry.php
Industry.getCorporationIndustry
public function getCorporationIndustry(int $corporation_id, bool $get = true) { $industry = DB::table('corporation_industry_jobs as a') ->select(DB::raw(' a.*, ramActivities.*, blueprintType.typeName as blueprintTypeName, productType.typeName as productTypeName, -- -- Start Facility Name Lookup -- CASE when a.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000000) when a.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000001) when a.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id-6000000) when a.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id) when a.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id) when a.location_id >= 61000000 then (SELECT c.name FROM `universe_structures` AS c WHERE c.structure_id = a.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID = a.location_id) end AS facilityName')) ->leftJoin( 'ramActivities', 'ramActivities.activityID', '=', 'a.activity_id')// corporation_industry_jobs aliased to a ->join( 'invTypes as blueprintType', 'blueprintType.typeID', '=', 'a.blueprint_type_id' ) ->join( 'invTypes as productType', 'productType.typeID', '=', 'a.product_type_id' ) ->where('a.corporation_id', $corporation_id); if ($get) return $industry ->orderBy('end_date', 'desc') ->get(); return $industry; }
php
public function getCorporationIndustry(int $corporation_id, bool $get = true) { $industry = DB::table('corporation_industry_jobs as a') ->select(DB::raw(' a.*, ramActivities.*, blueprintType.typeName as blueprintTypeName, productType.typeName as productTypeName, -- -- Start Facility Name Lookup -- CASE when a.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000000) when a.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000001) when a.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id-6000000) when a.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id) when a.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id) when a.location_id >= 61000000 then (SELECT c.name FROM `universe_structures` AS c WHERE c.structure_id = a.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID = a.location_id) end AS facilityName')) ->leftJoin( 'ramActivities', 'ramActivities.activityID', '=', 'a.activity_id')// corporation_industry_jobs aliased to a ->join( 'invTypes as blueprintType', 'blueprintType.typeID', '=', 'a.blueprint_type_id' ) ->join( 'invTypes as productType', 'productType.typeID', '=', 'a.product_type_id' ) ->where('a.corporation_id', $corporation_id); if ($get) return $industry ->orderBy('end_date', 'desc') ->get(); return $industry; }
[ "public", "function", "getCorporationIndustry", "(", "int", "$", "corporation_id", ",", "bool", "$", "get", "=", "true", ")", "{", "$", "industry", "=", "DB", "::", "table", "(", "'corporation_industry_jobs as a'", ")", "->", "select", "(", "DB", "::", "raw"...
Return the Industry jobs for a Corporation. @param int $corporation_id @param bool $get @return \Illuminate\Support\Collection
[ "Return", "the", "Industry", "jobs", "for", "a", "Corporation", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Industry.php#L43-L103
45,719
eveseat/services
src/Repositories/Character/Character.php
Character.getAllCharactersWithAffiliations
public function getAllCharactersWithAffiliations(bool $get = true) { // TODO : rewrite the method according to the new ACL mechanic // Get the User for permissions and affiliation // checks $user = auth()->user(); // Which characters does the currently logged in user have? $user_character_ids = auth()->user()->associatedCharacterIds(); // Start the character information query $characters = new CharacterInfo; // If the user is not a super user, return only the characters the // user has access to. if (! $user->hasSuperUser()) { $characters = $characters->where(function ($query) use ($user, $user_character_ids) { // If the user has any affiliations and can // list those characters, add them if ($user->has('character.list', false)) $query->orWhereIn('character_id', array_keys($user->getAffiliationMap()['char'])); $query->orWhereIn('character_id', $user_character_ids); }); } if ($get) return $characters ->orderBy('name') ->get(); return $characters->getQuery(); }
php
public function getAllCharactersWithAffiliations(bool $get = true) { // TODO : rewrite the method according to the new ACL mechanic // Get the User for permissions and affiliation // checks $user = auth()->user(); // Which characters does the currently logged in user have? $user_character_ids = auth()->user()->associatedCharacterIds(); // Start the character information query $characters = new CharacterInfo; // If the user is not a super user, return only the characters the // user has access to. if (! $user->hasSuperUser()) { $characters = $characters->where(function ($query) use ($user, $user_character_ids) { // If the user has any affiliations and can // list those characters, add them if ($user->has('character.list', false)) $query->orWhereIn('character_id', array_keys($user->getAffiliationMap()['char'])); $query->orWhereIn('character_id', $user_character_ids); }); } if ($get) return $characters ->orderBy('name') ->get(); return $characters->getQuery(); }
[ "public", "function", "getAllCharactersWithAffiliations", "(", "bool", "$", "get", "=", "true", ")", "{", "// TODO : rewrite the method according to the new ACL mechanic", "// Get the User for permissions and affiliation", "// checks", "$", "user", "=", "auth", "(", ")", "->"...
Query the database for characters, keeping filters, permissions and affiliations in mind. @param bool $get @return mixed
[ "Query", "the", "database", "for", "characters", "keeping", "filters", "permissions", "and", "affiliations", "in", "mind", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Character.php#L51-L89
45,720
eveseat/services
src/Repositories/Character/Character.php
Character.getCharacterAlliances
public function getCharacterAlliances(): Collection { $user = auth()->user(); $alliances = CharacterInfo::join( 'alliance_members', 'alliance_members.corporation_id', 'character_infos.corporation_id') ->join( 'alliances', 'alliances.alliance_id', 'alliance_members.alliance_id') ->distinct(); // If the user us a super user, return all if (! $user->hasSuperUser()) { $alliances = $alliances->orWhere(function ($query) use ($user) { // If the user has any affiliations and can // list those characters, add them if ($user->has('character.list', false)) $query = $query->whereIn('character_id', array_keys($user->getAffiliationMap()['char'])); // Add any characters from owner API keys $query->orWhere('character_id', $user->id); }); } return $alliances->orderBy('alliances.name') ->pluck('alliances.name') ->filter(function ($item) { // Filter out the null alliance name return ! is_null($item); }); }
php
public function getCharacterAlliances(): Collection { $user = auth()->user(); $alliances = CharacterInfo::join( 'alliance_members', 'alliance_members.corporation_id', 'character_infos.corporation_id') ->join( 'alliances', 'alliances.alliance_id', 'alliance_members.alliance_id') ->distinct(); // If the user us a super user, return all if (! $user->hasSuperUser()) { $alliances = $alliances->orWhere(function ($query) use ($user) { // If the user has any affiliations and can // list those characters, add them if ($user->has('character.list', false)) $query = $query->whereIn('character_id', array_keys($user->getAffiliationMap()['char'])); // Add any characters from owner API keys $query->orWhere('character_id', $user->id); }); } return $alliances->orderBy('alliances.name') ->pluck('alliances.name') ->filter(function ($item) { // Filter out the null alliance name return ! is_null($item); }); }
[ "public", "function", "getCharacterAlliances", "(", ")", ":", "Collection", "{", "$", "user", "=", "auth", "(", ")", "->", "user", "(", ")", ";", "$", "alliances", "=", "CharacterInfo", "::", "join", "(", "'alliance_members'", ",", "'alliance_members.corporati...
Get a list of alliances the current authenticated user has access to. @return \Illuminate\Support\Collection
[ "Get", "a", "list", "of", "alliances", "the", "current", "authenticated", "user", "has", "access", "to", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Character.php#L97-L136
45,721
eveseat/services
src/Repositories/Character/Character.php
Character.getCharacterCorporations
public function getCharacterCorporations() { // TODO : rewrite the method according to the new ACL mechanic $user = auth()->user(); $corporations = ApiKeyInfoCharacters::join( 'eve_api_keys', 'eve_api_keys.key_id', '=', 'account_api_key_info_characters.keyID') ->distinct(); // If the user us a super user, return all if (! $user->hasSuperUser()) { $corporations = $corporations->orWhere(function ($query) use ($user) { // If the user has any affiliations and can // list those characters, add them if ($user->has('character.list', false)) $query = $query->whereIn('characterID', array_keys($user->getAffiliationMap()['char'])); // Add any characters from owner API keys $query->orWhere('eve_api_keys.user_id', $user->id); }); } return $corporations->orderBy('corporationName') ->pluck('corporationName'); }
php
public function getCharacterCorporations() { // TODO : rewrite the method according to the new ACL mechanic $user = auth()->user(); $corporations = ApiKeyInfoCharacters::join( 'eve_api_keys', 'eve_api_keys.key_id', '=', 'account_api_key_info_characters.keyID') ->distinct(); // If the user us a super user, return all if (! $user->hasSuperUser()) { $corporations = $corporations->orWhere(function ($query) use ($user) { // If the user has any affiliations and can // list those characters, add them if ($user->has('character.list', false)) $query = $query->whereIn('characterID', array_keys($user->getAffiliationMap()['char'])); // Add any characters from owner API keys $query->orWhere('eve_api_keys.user_id', $user->id); }); } return $corporations->orderBy('corporationName') ->pluck('corporationName'); }
[ "public", "function", "getCharacterCorporations", "(", ")", "{", "// TODO : rewrite the method according to the new ACL mechanic", "$", "user", "=", "auth", "(", ")", "->", "user", "(", ")", ";", "$", "corporations", "=", "ApiKeyInfoCharacters", "::", "join", "(", "...
Get a list of corporations the current authenticated user has access to. @deprecated replace by new ACL system. Must be move to ACL trait @return mixed
[ "Get", "a", "list", "of", "corporations", "the", "current", "authenticated", "user", "has", "access", "to", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Character.php#L146-L177
45,722
eveseat/services
src/Repositories/Corporation/Market.php
Market.getCorporationMarketOrders
public function getCorporationMarketOrders(int $corporation_id) { return DB::table(DB::raw('corporation_orders as a')) ->select(DB::raw( ' -- -- Select All -- *, -- -- Start stationName Lookup -- CASE when a.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000000) when a.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000001) when a.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id-6000000) when a.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id) when a.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id) when a.location_id >= 61000000 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID = a.location_id) end AS stationName, -- -- add total -- a.price * a.volume_total AS price_total')) ->join( 'invTypes', 'a.type_id', '=', 'invTypes.typeID') ->join( 'invGroups', 'invTypes.groupID', '=', 'invGroups.groupID') ->where('a.corporation_id', $corporation_id); }
php
public function getCorporationMarketOrders(int $corporation_id) { return DB::table(DB::raw('corporation_orders as a')) ->select(DB::raw( ' -- -- Select All -- *, -- -- Start stationName Lookup -- CASE when a.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000000) when a.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000001) when a.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id-6000000) when a.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id) when a.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id) when a.location_id >= 61000000 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID = a.location_id) end AS stationName, -- -- add total -- a.price * a.volume_total AS price_total')) ->join( 'invTypes', 'a.type_id', '=', 'invTypes.typeID') ->join( 'invGroups', 'invTypes.groupID', '=', 'invGroups.groupID') ->where('a.corporation_id', $corporation_id); }
[ "public", "function", "getCorporationMarketOrders", "(", "int", "$", "corporation_id", ")", "{", "return", "DB", "::", "table", "(", "DB", "::", "raw", "(", "'corporation_orders as a'", ")", ")", "->", "select", "(", "DB", "::", "raw", "(", "'\n ...
Return the Market Orders for a Corporation. @param int $corporation_id @param bool $get @return \Illuminate\Support\Collection
[ "Return", "the", "Market", "Orders", "for", "a", "Corporation", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Market.php#L41-L94
45,723
eveseat/services
src/Repositories/Corporation/Assets.php
Assets.getCorporationAssets
public function getCorporationAssets(int $corporation_id): Collection { return CorporationAsset::with('content', 'type') ->select(DB::raw(' -- -- Select All Fields -- *, -- -- Start the location lookup -- CASE when corporation_assets.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=corporation_assets.location_id-6000000) when corporation_assets.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=corporation_assets.location_id-6000001) when corporation_assets.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=corporation_assets.location_id-6000000) when corporation_assets.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=corporation_assets.location_id) when corporation_assets.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=corporation_assets.location_id) when corporation_assets.location_id BETWEEN 61000000 AND 61001146 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=corporation_assets.location_id) when corporation_assets.location_id > 61001146 then (SELECT name FROM `universe_structures` AS c WHERE c.structure_id = corporation_assets.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID=corporation_assets.location_id) end AS location_name')) ->whereIn('location_flag', [ // These locations look like they are top-level. Even though 'OfficeFolder' is // top level, lets just flatten it anyways. 'AssetSafety', 'OfficeFolder', 'Impounded', 'CorpDeliveries', ]) ->where('corporation_assets.corporation_id', $corporation_id) ->get(); }
php
public function getCorporationAssets(int $corporation_id): Collection { return CorporationAsset::with('content', 'type') ->select(DB::raw(' -- -- Select All Fields -- *, -- -- Start the location lookup -- CASE when corporation_assets.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=corporation_assets.location_id-6000000) when corporation_assets.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=corporation_assets.location_id-6000001) when corporation_assets.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=corporation_assets.location_id-6000000) when corporation_assets.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=corporation_assets.location_id) when corporation_assets.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=corporation_assets.location_id) when corporation_assets.location_id BETWEEN 61000000 AND 61001146 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=corporation_assets.location_id) when corporation_assets.location_id > 61001146 then (SELECT name FROM `universe_structures` AS c WHERE c.structure_id = corporation_assets.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID=corporation_assets.location_id) end AS location_name')) ->whereIn('location_flag', [ // These locations look like they are top-level. Even though 'OfficeFolder' is // top level, lets just flatten it anyways. 'AssetSafety', 'OfficeFolder', 'Impounded', 'CorpDeliveries', ]) ->where('corporation_assets.corporation_id', $corporation_id) ->get(); }
[ "public", "function", "getCorporationAssets", "(", "int", "$", "corporation_id", ")", ":", "Collection", "{", "return", "CorporationAsset", "::", "with", "(", "'content'", ",", "'type'", ")", "->", "select", "(", "DB", "::", "raw", "(", "'\n --\n ...
Return the assets list for a Corporation. @param int $corporation_id @return \Illuminate\Support\Collection
[ "Return", "the", "assets", "list", "for", "a", "Corporation", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Assets.php#L43-L92
45,724
eveseat/services
src/Repositories/Corporation/Assets.php
Assets.getCorporationAssetByLocation
public function getCorporationAssetByLocation(int $corporation_id): Collection { return Locations::leftJoin('corporation_asset_lists', 'corporation_locations.itemID', '=', 'corporation_asset_lists.itemID') ->leftJoin( 'invTypes', 'corporation_asset_lists.typeID', '=', 'invTypes.typeID') ->where('corporation_locations.corporationID', $corporation_id) ->get() ->groupBy('mapID'); // <--- :O That is so sexy <3 }
php
public function getCorporationAssetByLocation(int $corporation_id): Collection { return Locations::leftJoin('corporation_asset_lists', 'corporation_locations.itemID', '=', 'corporation_asset_lists.itemID') ->leftJoin( 'invTypes', 'corporation_asset_lists.typeID', '=', 'invTypes.typeID') ->where('corporation_locations.corporationID', $corporation_id) ->get() ->groupBy('mapID'); // <--- :O That is so sexy <3 }
[ "public", "function", "getCorporationAssetByLocation", "(", "int", "$", "corporation_id", ")", ":", "Collection", "{", "return", "Locations", "::", "leftJoin", "(", "'corporation_asset_lists'", ",", "'corporation_locations.itemID'", ",", "'='", ",", "'corporation_asset_li...
Returns a corporation assets grouped by location. Only assets in space will appear here as assets that are in stations don't have 'locations' entries. @param int $corporation_id @return \Illuminate\Support\Collection
[ "Returns", "a", "corporation", "assets", "grouped", "by", "location", ".", "Only", "assets", "in", "space", "will", "appear", "here", "as", "assets", "that", "are", "in", "stations", "don", "t", "have", "locations", "entries", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Assets.php#L103-L116
45,725
eveseat/services
src/Jobs/Maintenance.php
Maintenance.cleanup_tables
public function cleanup_tables() { logger()->info('Performing table maintenance'); // Prune the failed jobs table FailedJob::where('id', '<', (FailedJob::max('id') - 100))->delete(); // Prune the server statuses older than a week. ServerStatus::where('created_at', '<', carbon('now')->subWeek(1))->delete(); // Prune ESI statuses older than a week EsiStatus::where('created_at', '<', carbon('now')->subWeek(1))->delete(); // Remove groups with no users Group::doesntHave('users')->delete(); }
php
public function cleanup_tables() { logger()->info('Performing table maintenance'); // Prune the failed jobs table FailedJob::where('id', '<', (FailedJob::max('id') - 100))->delete(); // Prune the server statuses older than a week. ServerStatus::where('created_at', '<', carbon('now')->subWeek(1))->delete(); // Prune ESI statuses older than a week EsiStatus::where('created_at', '<', carbon('now')->subWeek(1))->delete(); // Remove groups with no users Group::doesntHave('users')->delete(); }
[ "public", "function", "cleanup_tables", "(", ")", "{", "logger", "(", ")", "->", "info", "(", "'Performing table maintenance'", ")", ";", "// Prune the failed jobs table", "FailedJob", "::", "where", "(", "'id'", ",", "'<'", ",", "(", "FailedJob", "::", "max", ...
Partially truncates tables that typically contain a lot of data.
[ "Partially", "truncates", "tables", "that", "typically", "contain", "a", "lot", "of", "data", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Jobs/Maintenance.php#L70-L86
45,726
eveseat/services
src/Jobs/Maintenance.php
Maintenance.cleanup_stale_data
public function cleanup_stale_data() { logger()->info('Performing stale data maintenance'); // First cleanup characters. CharacterInfo::whereNotIn('character_id', function ($query) { $query->select('id') ->from((new User)->getTable()); })->each(function ($character) { logger()->info('Cleaning up character: ' . $character->name); $character->delete(); }); // Next, cleanup corporations CorporationInfo::whereNotIn('corporation_id', function ($query) { // Filter out corporations that we have characters for. $query->select('corporation_id') ->from((new CharacterInfo)->getTable()) ->whereIn('character_id', function ($sub_query) { // Ensure that its characters with roles. Otherwise // the corporation info is meaningless anyways. $sub_query->select('character_id') ->from((new CharacterRole)->getTable()); }); })->each(function ($corporation) { dump('Cleaning up corporation: ' . $corporation->name); logger()->info('Cleaning up corporation: ' . $corporation->name); $corporation->delete(); }); }
php
public function cleanup_stale_data() { logger()->info('Performing stale data maintenance'); // First cleanup characters. CharacterInfo::whereNotIn('character_id', function ($query) { $query->select('id') ->from((new User)->getTable()); })->each(function ($character) { logger()->info('Cleaning up character: ' . $character->name); $character->delete(); }); // Next, cleanup corporations CorporationInfo::whereNotIn('corporation_id', function ($query) { // Filter out corporations that we have characters for. $query->select('corporation_id') ->from((new CharacterInfo)->getTable()) ->whereIn('character_id', function ($sub_query) { // Ensure that its characters with roles. Otherwise // the corporation info is meaningless anyways. $sub_query->select('character_id') ->from((new CharacterRole)->getTable()); }); })->each(function ($corporation) { dump('Cleaning up corporation: ' . $corporation->name); logger()->info('Cleaning up corporation: ' . $corporation->name); $corporation->delete(); }); }
[ "public", "function", "cleanup_stale_data", "(", ")", "{", "logger", "(", ")", "->", "info", "(", "'Performing stale data maintenance'", ")", ";", "// First cleanup characters.", "CharacterInfo", "::", "whereNotIn", "(", "'character_id'", ",", "function", "(", "$", ...
Cleans up stale data that relate to characters and corporations that no longer have valid users.
[ "Cleans", "up", "stale", "data", "that", "relate", "to", "characters", "and", "corporations", "that", "no", "longer", "have", "valid", "users", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Jobs/Maintenance.php#L92-L132
45,727
eveseat/services
src/Repositories/Character/Calendar.php
Calendar.getCharacterUpcomingCalendarEvents
public function getCharacterUpcomingCalendarEvents(int $character_id): Collection { return CharacterCalendarEvent::with('detail', 'attendees') ->where('character_id', $character_id) ->whereDate('event_date', '>', carbon()->toDateTimeString()) ->get(); }
php
public function getCharacterUpcomingCalendarEvents(int $character_id): Collection { return CharacterCalendarEvent::with('detail', 'attendees') ->where('character_id', $character_id) ->whereDate('event_date', '>', carbon()->toDateTimeString()) ->get(); }
[ "public", "function", "getCharacterUpcomingCalendarEvents", "(", "int", "$", "character_id", ")", ":", "Collection", "{", "return", "CharacterCalendarEvent", "::", "with", "(", "'detail'", ",", "'attendees'", ")", "->", "where", "(", "'character_id'", ",", "$", "c...
Get Calendar events for a specific character. @param int $character_id @return \Illuminate\Support\Collection
[ "Get", "Calendar", "events", "for", "a", "specific", "character", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Calendar.php#L41-L48
45,728
eveseat/services
src/Repositories/Character/Market.php
Market.getCharacterMarketOrders
public function getCharacterMarketOrders(Collection $character_ids) : Builder { return DB::table(DB::raw('character_orders as a')) ->select(DB::raw( ' -- -- Select All -- *, -- -- Start stationName Lookup -- CASE when a.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000000) when a.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000001) when a.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id-6000000) when a.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id) when a.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id) when a.location_id >= 61000000 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID = a.location_id) end AS stationName')) ->join( 'invTypes', 'a.type_id', '=', 'invTypes.typeID') ->whereIn('a.character_id', $character_ids); }
php
public function getCharacterMarketOrders(Collection $character_ids) : Builder { return DB::table(DB::raw('character_orders as a')) ->select(DB::raw( ' -- -- Select All -- *, -- -- Start stationName Lookup -- CASE when a.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000000) when a.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id-6000001) when a.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id-6000000) when a.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id) when a.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.location_id) when a.location_id >= 61000000 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID = a.location_id) end AS stationName')) ->join( 'invTypes', 'a.type_id', '=', 'invTypes.typeID') ->whereIn('a.character_id', $character_ids); }
[ "public", "function", "getCharacterMarketOrders", "(", "Collection", "$", "character_ids", ")", ":", "Builder", "{", "return", "DB", "::", "table", "(", "DB", "::", "raw", "(", "'character_orders as a'", ")", ")", "->", "select", "(", "DB", "::", "raw", "(",...
Return a characters market orders. @param \Illuminate\Support\Collection $character_ids @return \Illuminate\Database\Query\Builder
[ "Return", "a", "characters", "market", "orders", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Market.php#L42-L87
45,729
eveseat/services
src/Repositories/Character/Standings.php
Standings.getCharacterStandings
public function getCharacterStandings(int $character_id): Collection { return CharacterStanding::where('character_id', $character_id) ->leftJoin('chrFactions', 'from_id', '=', 'factionID') ->orderBy('from_type') ->get(); }
php
public function getCharacterStandings(int $character_id): Collection { return CharacterStanding::where('character_id', $character_id) ->leftJoin('chrFactions', 'from_id', '=', 'factionID') ->orderBy('from_type') ->get(); }
[ "public", "function", "getCharacterStandings", "(", "int", "$", "character_id", ")", ":", "Collection", "{", "return", "CharacterStanding", "::", "where", "(", "'character_id'", ",", "$", "character_id", ")", "->", "leftJoin", "(", "'chrFactions'", ",", "'from_id'...
Return the standings for a character. @param int $character_id @return \Illuminate\Support\Collection
[ "Return", "the", "standings", "for", "a", "character", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Standings.php#L41-L48
45,730
eveseat/services
src/Repositories/Character/Wallet.php
Wallet.getCharacterWalletTransactions
public function getCharacterWalletTransactions(Collection $character_ids) : Builder { return CharacterWalletTransaction::with('client', 'type') ->select(DB::raw(' *, CASE when character_wallet_transactions.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=character_wallet_transactions.location_id-6000000) when character_wallet_transactions.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=character_wallet_transactions.location_id-6000001) when character_wallet_transactions.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=character_wallet_transactions.location_id-6000000) when character_wallet_transactions.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=character_wallet_transactions.location_id) when character_wallet_transactions.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=character_wallet_transactions.location_id) when character_wallet_transactions.location_id BETWEEN 61000000 AND 61001146 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=character_wallet_transactions.location_id) when character_wallet_transactions.location_id > 61001146 then (SELECT name FROM `universe_structures` AS c WHERE c.structure_id = character_wallet_transactions.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID=character_wallet_transactions.location_id) end AS locationName' )) ->whereIn('character_id', $character_ids->toArray()); }
php
public function getCharacterWalletTransactions(Collection $character_ids) : Builder { return CharacterWalletTransaction::with('client', 'type') ->select(DB::raw(' *, CASE when character_wallet_transactions.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=character_wallet_transactions.location_id-6000000) when character_wallet_transactions.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=character_wallet_transactions.location_id-6000001) when character_wallet_transactions.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=character_wallet_transactions.location_id-6000000) when character_wallet_transactions.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=character_wallet_transactions.location_id) when character_wallet_transactions.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=character_wallet_transactions.location_id) when character_wallet_transactions.location_id BETWEEN 61000000 AND 61001146 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=character_wallet_transactions.location_id) when character_wallet_transactions.location_id > 61001146 then (SELECT name FROM `universe_structures` AS c WHERE c.structure_id = character_wallet_transactions.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID=character_wallet_transactions.location_id) end AS locationName' )) ->whereIn('character_id', $character_ids->toArray()); }
[ "public", "function", "getCharacterWalletTransactions", "(", "Collection", "$", "character_ids", ")", ":", "Builder", "{", "return", "CharacterWalletTransaction", "::", "with", "(", "'client'", ",", "'type'", ")", "->", "select", "(", "DB", "::", "raw", "(", "'\...
Retrieve Wallet Transaction Entries for a Character. @param \Illuminate\Support\Collection $character_ids @return \Illuminate\Database\Eloquent\Builder
[ "Retrieve", "Wallet", "Transaction", "Entries", "for", "a", "Character", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Wallet.php#L59-L95
45,731
eveseat/services
src/Repositories/Character/Mail.php
Mail.getAllCharacterNewestMail
public function getAllCharacterNewestMail(int $limit = 10): Collection { $user = auth()->user(); $messages = MailHeader::select('mail_id', 'from', 'character_id', 'subject'); // If the user is a super user, return all if (! $user->hasSuperUser()) { $messages = $messages->where(function ($query) use ($user) { $characters = []; // get all user characters affiliation, including those whose are owned by himself foreach ($user->getAffiliationMap()['char'] as $characterID => $permissions) { // check for both character wildcard and character mail permission in order to grant the access if (in_array('character.*', $permissions, true) || in_array('character.mail', $permissions, true) ) $characters[] = $characterID; } // Add the collected characterID on previous task to mail records filter $query->whereIn('character_id', $characters) ->orWhereIn('from', $characters); }); } return $messages->orderBy('timestamp', 'desc') ->limit($limit) ->get(); }
php
public function getAllCharacterNewestMail(int $limit = 10): Collection { $user = auth()->user(); $messages = MailHeader::select('mail_id', 'from', 'character_id', 'subject'); // If the user is a super user, return all if (! $user->hasSuperUser()) { $messages = $messages->where(function ($query) use ($user) { $characters = []; // get all user characters affiliation, including those whose are owned by himself foreach ($user->getAffiliationMap()['char'] as $characterID => $permissions) { // check for both character wildcard and character mail permission in order to grant the access if (in_array('character.*', $permissions, true) || in_array('character.mail', $permissions, true) ) $characters[] = $characterID; } // Add the collected characterID on previous task to mail records filter $query->whereIn('character_id', $characters) ->orWhereIn('from', $characters); }); } return $messages->orderBy('timestamp', 'desc') ->limit($limit) ->get(); }
[ "public", "function", "getAllCharacterNewestMail", "(", "int", "$", "limit", "=", "10", ")", ":", "Collection", "{", "$", "user", "=", "auth", "(", ")", "->", "user", "(", ")", ";", "$", "messages", "=", "MailHeader", "::", "select", "(", "'mail_id'", ...
Return only the last X amount of mail for affiliation related characters. @param int $limit @return \Illuminate\Support\Collection
[ "Return", "only", "the", "last", "X", "amount", "of", "mail", "for", "affiliation", "related", "characters", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Mail.php#L42-L76
45,732
eveseat/services
src/Repositories/Character/Mail.php
Mail.getCharacterMailMessage
public function getCharacterMailMessage(int $character_id, int $message_id): MailHeader { return MailHeader::where('character_id', $character_id) ->where('mail_id', $message_id) ->orderBy('timestamp', 'desc') ->first(); }
php
public function getCharacterMailMessage(int $character_id, int $message_id): MailHeader { return MailHeader::where('character_id', $character_id) ->where('mail_id', $message_id) ->orderBy('timestamp', 'desc') ->first(); }
[ "public", "function", "getCharacterMailMessage", "(", "int", "$", "character_id", ",", "int", "$", "message_id", ")", ":", "MailHeader", "{", "return", "MailHeader", "::", "where", "(", "'character_id'", ",", "$", "character_id", ")", "->", "where", "(", "'mai...
Retrieve a specific message for a character. @param int $character_id @param int $message_id @return \Seat\Eveapi\Models\Mail\MailHeader
[ "Retrieve", "a", "specific", "message", "for", "a", "character", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Mail.php#L102-L109
45,733
eveseat/services
src/Repositories/Character/Mail.php
Mail.getCharacterMailTimeline
public function getCharacterMailTimeline(int $message_id = null) { // Get the User for permissions and affiliation // checks $user = auth()->user(); $messages = MailHeader::with('recipients', 'body'); // If a user is not a super user, only return their own mail and those // which they are affiliated to to receive. if (! $user->hasSuperUser()) { $messages = $messages->where(function ($query) use ($user) { // If the user has any affiliations and can // list those characters, add them if ($user->has('character.mail', false)) $query = $query->whereIn('character_id', array_keys($user->getAffiliationMap()['char'])); // Add mail owned by *this* character $query->orWhere('character_id', $user->id); }); } // Filter by messageID if its set if (! is_null($message_id)) return $messages->where('mail_id', $message_id) ->first(); return $messages->orderBy('timestamp', 'desc') ->groupBy('mail_id') ->paginate(25); }
php
public function getCharacterMailTimeline(int $message_id = null) { // Get the User for permissions and affiliation // checks $user = auth()->user(); $messages = MailHeader::with('recipients', 'body'); // If a user is not a super user, only return their own mail and those // which they are affiliated to to receive. if (! $user->hasSuperUser()) { $messages = $messages->where(function ($query) use ($user) { // If the user has any affiliations and can // list those characters, add them if ($user->has('character.mail', false)) $query = $query->whereIn('character_id', array_keys($user->getAffiliationMap()['char'])); // Add mail owned by *this* character $query->orWhere('character_id', $user->id); }); } // Filter by messageID if its set if (! is_null($message_id)) return $messages->where('mail_id', $message_id) ->first(); return $messages->orderBy('timestamp', 'desc') ->groupBy('mail_id') ->paginate(25); }
[ "public", "function", "getCharacterMailTimeline", "(", "int", "$", "message_id", "=", "null", ")", "{", "// Get the User for permissions and affiliation", "// checks", "$", "user", "=", "auth", "(", ")", "->", "user", "(", ")", ";", "$", "messages", "=", "MailHe...
Get the mail timeline for all of the characters a logged in user has access to. Either by owning the api key with the characters, or having the correct affiliation & role. Supplying the $message_id will return only that mail. @param int $message_id @return mixed
[ "Get", "the", "mail", "timeline", "for", "all", "of", "the", "characters", "a", "logged", "in", "user", "has", "access", "to", ".", "Either", "by", "owning", "the", "api", "key", "with", "the", "characters", "or", "having", "the", "correct", "affiliation",...
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Mail.php#L124-L156
45,734
eveseat/services
src/Image/Eve.php
Eve.detect_type
public function detect_type($id) { if ($id > 90000000 && $id < 98000000) return 'character'; elseif (($id > 98000000 && $id < 99000000) || ($id > 1000000 && $id < 2000000)) return 'corporation'; elseif (($id > 99000000 && $id < 100000000) || ($id > 0 && $id < 1000000)) return 'alliance'; return 'character'; }
php
public function detect_type($id) { if ($id > 90000000 && $id < 98000000) return 'character'; elseif (($id > 98000000 && $id < 99000000) || ($id > 1000000 && $id < 2000000)) return 'corporation'; elseif (($id > 99000000 && $id < 100000000) || ($id > 0 && $id < 1000000)) return 'alliance'; return 'character'; }
[ "public", "function", "detect_type", "(", "$", "id", ")", "{", "if", "(", "$", "id", ">", "90000000", "&&", "$", "id", "<", "98000000", ")", "return", "'character'", ";", "elseif", "(", "(", "$", "id", ">", "98000000", "&&", "$", "id", "<", "990000...
Attempt to detect the image type based on the range in which an integer falls. @param $id @return string
[ "Attempt", "to", "detect", "the", "image", "type", "based", "on", "the", "range", "in", "which", "an", "integer", "falls", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Image/Eve.php#L131-L144
45,735
eveseat/services
src/Repositories/Character/JumpClone.php
JumpClone.getCharacterJumpClones
public function getCharacterJumpClones(int $character_id): Collection { return DB::table(DB::raw( 'character_jump_clones as a')) ->select(DB::raw(' *, CASE when a.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=a.location_id-6000000) when a.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=a.location_id-6000001) when a.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=a.location_id-6000000) when a.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=a.location_id) when a.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=a.location_id) when a.location_id>=61000000 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=a.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID=a.location_id) end AS location,a.location_id AS locID')) ->where('a.character_id', $character_id) ->get(); }
php
public function getCharacterJumpClones(int $character_id): Collection { return DB::table(DB::raw( 'character_jump_clones as a')) ->select(DB::raw(' *, CASE when a.location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=a.location_id-6000000) when a.location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=a.location_id-6000001) when a.location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=a.location_id-6000000) when a.location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=a.location_id) when a.location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID=a.location_id) when a.location_id>=61000000 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id=a.location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID=a.location_id) end AS location,a.location_id AS locID')) ->where('a.character_id', $character_id) ->get(); }
[ "public", "function", "getCharacterJumpClones", "(", "int", "$", "character_id", ")", ":", "Collection", "{", "return", "DB", "::", "table", "(", "DB", "::", "raw", "(", "'character_jump_clones as a'", ")", ")", "->", "select", "(", "DB", "::", "raw", "(", ...
Get jump clones and jump clone locations for a character. @param int $character_id @return \Illuminate\Support\Collection
[ "Get", "jump", "clones", "and", "jump", "clone", "locations", "for", "a", "character", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/JumpClone.php#L42-L75
45,736
eveseat/services
src/Repositories/Corporation/Starbases.php
Starbases.getCorporationStarbases
public function getCorporationStarbases(int $corporation_id, int $starbase_id = null) { return CorporationStarbase::where('corporation_id', $corporation_id)->get(); }
php
public function getCorporationStarbases(int $corporation_id, int $starbase_id = null) { return CorporationStarbase::where('corporation_id', $corporation_id)->get(); }
[ "public", "function", "getCorporationStarbases", "(", "int", "$", "corporation_id", ",", "int", "$", "starbase_id", "=", "null", ")", "{", "return", "CorporationStarbase", "::", "where", "(", "'corporation_id'", ",", "$", "corporation_id", ")", "->", "get", "(",...
Return a list of starbases for a Corporation. If a starbaseID is provided, then only data for that starbase is returned. @param int $corporation_id @param int $starbase_id @return Collection
[ "Return", "a", "list", "of", "starbases", "for", "a", "Corporation", ".", "If", "a", "starbaseID", "is", "provided", "then", "only", "data", "for", "that", "starbase", "is", "returned", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Starbases.php#L45-L49
45,737
eveseat/services
src/Repositories/Character/Contracts.php
Contracts.getCharacterContracts
public function getCharacterContracts(Collection $character_ids) : Builder { return DB::table(DB::raw('contract_details as a')) ->select(DB::raw( ' -- -- All Columns -- *, -- -- Start Location Lookup -- CASE when a.start_location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.start_location_id-6000000) when a.start_location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.start_location_id-6000001) when a.start_location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.start_location_id-6000000) when a.start_location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.start_location_id) when a.start_location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.start_location_id) when a.start_location_id >= 61000000 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.start_location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID = a.start_location_id) end AS startlocation, -- -- End Location Lookup -- CASE when a.end_location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.end_location_id-6000000) when a.end_location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.end_location_id-6000001) when a.end_location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.end_location_id-6000000) when a.end_location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.end_location_id) when a.end_location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.end_location_id) when a.end_location_id >= 61000000 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.end_location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID = a.end_location_id) end AS endlocation ')) ->join('character_contracts', 'character_contracts.contract_id', '=', 'a.contract_id') ->whereIn('character_contracts.character_id', $character_ids->toArray()); }
php
public function getCharacterContracts(Collection $character_ids) : Builder { return DB::table(DB::raw('contract_details as a')) ->select(DB::raw( ' -- -- All Columns -- *, -- -- Start Location Lookup -- CASE when a.start_location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.start_location_id-6000000) when a.start_location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.start_location_id-6000001) when a.start_location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.start_location_id-6000000) when a.start_location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.start_location_id) when a.start_location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.start_location_id) when a.start_location_id >= 61000000 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.start_location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID = a.start_location_id) end AS startlocation, -- -- End Location Lookup -- CASE when a.end_location_id BETWEEN 66015148 AND 66015151 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.end_location_id-6000000) when a.end_location_id BETWEEN 66000000 AND 66014933 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.end_location_id-6000001) when a.end_location_id BETWEEN 66014934 AND 67999999 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.end_location_id-6000000) when a.end_location_id BETWEEN 60014861 AND 60014928 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.end_location_id) when a.end_location_id BETWEEN 60000000 AND 61000000 then (SELECT s.stationName FROM staStations AS s WHERE s.stationID = a.end_location_id) when a.end_location_id >= 61000000 then (SELECT d.name FROM `sovereignty_structures` AS c JOIN universe_stations d ON c.structure_id = d.station_id WHERE c.structure_id = a.end_location_id) else (SELECT m.itemName FROM mapDenormalize AS m WHERE m.itemID = a.end_location_id) end AS endlocation ')) ->join('character_contracts', 'character_contracts.contract_id', '=', 'a.contract_id') ->whereIn('character_contracts.character_id', $character_ids->toArray()); }
[ "public", "function", "getCharacterContracts", "(", "Collection", "$", "character_ids", ")", ":", "Builder", "{", "return", "DB", "::", "table", "(", "DB", "::", "raw", "(", "'contract_details as a'", ")", ")", "->", "select", "(", "DB", "::", "raw", "(", ...
Return Contract Information for a character. @param \Illuminate\Support\Collection $character_ids @return \Illuminate\Database\Query\Builder
[ "Return", "Contract", "Information", "for", "a", "character", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Contracts.php#L43-L114
45,738
eveseat/services
src/Repositories/Character/Research.php
Research.getCharacterResearchAgents
public function getCharacterResearchAgents(int $character_id): Collection { return CharacterAgentResearch::join( 'invNames', 'character_agent_researches.agent_id', '=', 'invNames.itemID') ->join( 'invTypes', 'character_agent_researches.skill_type_id', '=', 'invTypes.typeID') ->where('character_id', $character_id) ->get(); }
php
public function getCharacterResearchAgents(int $character_id): Collection { return CharacterAgentResearch::join( 'invNames', 'character_agent_researches.agent_id', '=', 'invNames.itemID') ->join( 'invTypes', 'character_agent_researches.skill_type_id', '=', 'invTypes.typeID') ->where('character_id', $character_id) ->get(); }
[ "public", "function", "getCharacterResearchAgents", "(", "int", "$", "character_id", ")", ":", "Collection", "{", "return", "CharacterAgentResearch", "::", "join", "(", "'invNames'", ",", "'character_agent_researches.agent_id'", ",", "'='", ",", "'invNames.itemID'", ")"...
Return a characters research info. @param int $character_id @return \Illuminate\Support\Collection
[ "Return", "a", "characters", "research", "info", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Character/Research.php#L41-L54
45,739
eveseat/services
src/Repositories/Configuration/UserRespository.php
UserRespository.getUserGroupCharacters
public function getUserGroupCharacters(Group $group = null): Collection { if (! $group) return collect(); return Group::with('users')->find($group->id)->users; }
php
public function getUserGroupCharacters(Group $group = null): Collection { if (! $group) return collect(); return Group::with('users')->find($group->id)->users; }
[ "public", "function", "getUserGroupCharacters", "(", "Group", "$", "group", "=", "null", ")", ":", "Collection", "{", "if", "(", "!", "$", "group", ")", "return", "collect", "(", ")", ";", "return", "Group", "::", "with", "(", "'users'", ")", "->", "fi...
Return the characters that are part of a group. @param \Seat\Web\Models\Group $group @return \Illuminate\Support\Collection
[ "Return", "the", "characters", "that", "are", "part", "of", "a", "group", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Configuration/UserRespository.php#L110-L117
45,740
eveseat/services
src/Repositories/Corporation/Divisions.php
Divisions.getCorporationDivisions
public function getCorporationDivisions(int $corporation_id): Collection { return CorporationDivision::where('corporation_id', $corporation_id) ->where('type', 'hangar') ->orderBy('division') ->get(); }
php
public function getCorporationDivisions(int $corporation_id): Collection { return CorporationDivision::where('corporation_id', $corporation_id) ->where('type', 'hangar') ->orderBy('division') ->get(); }
[ "public", "function", "getCorporationDivisions", "(", "int", "$", "corporation_id", ")", ":", "Collection", "{", "return", "CorporationDivision", "::", "where", "(", "'corporation_id'", ",", "$", "corporation_id", ")", "->", "where", "(", "'type'", ",", "'hangar'"...
Return the Divisions for a Corporation. @param int $corporation_id @return \Illuminate\Support\Collection
[ "Return", "the", "Divisions", "for", "a", "Corporation", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Divisions.php#L41-L48
45,741
eveseat/services
src/Repositories/Corporation/Wallet.php
Wallet.getCorporationWalletDivisions
public function getCorporationWalletDivisions(int $corporation_id): Collection { return CorporationDivision::where('corporation_id', $corporation_id) ->where('type', 'wallet') ->orderBy('division') ->get(); }
php
public function getCorporationWalletDivisions(int $corporation_id): Collection { return CorporationDivision::where('corporation_id', $corporation_id) ->where('type', 'wallet') ->orderBy('division') ->get(); }
[ "public", "function", "getCorporationWalletDivisions", "(", "int", "$", "corporation_id", ")", ":", "Collection", "{", "return", "CorporationDivision", "::", "where", "(", "'corporation_id'", ",", "$", "corporation_id", ")", "->", "where", "(", "'type'", ",", "'wa...
Return the Corporation Wallet Divisions for a Corporation. @param $corporation_id @return mixed
[ "Return", "the", "Corporation", "Wallet", "Divisions", "for", "a", "Corporation", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Wallet.php#L44-L51
45,742
eveseat/services
src/Repositories/Corporation/Wallet.php
Wallet.getCorporationWalletJournal
public function getCorporationWalletJournal(int $corporation_id, int $division_id) : Builder { return CorporationWalletJournal::with('first_party', 'second_party') ->where('corporation_id', $corporation_id) ->where('division', $division_id); }
php
public function getCorporationWalletJournal(int $corporation_id, int $division_id) : Builder { return CorporationWalletJournal::with('first_party', 'second_party') ->where('corporation_id', $corporation_id) ->where('division', $division_id); }
[ "public", "function", "getCorporationWalletJournal", "(", "int", "$", "corporation_id", ",", "int", "$", "division_id", ")", ":", "Builder", "{", "return", "CorporationWalletJournal", "::", "with", "(", "'first_party'", ",", "'second_party'", ")", "->", "where", "...
Return a Wallet Journal for a Corporation. @param int $corporation_id @return \Illuminate\Database\Eloquent\Builder
[ "Return", "a", "Wallet", "Journal", "for", "a", "Corporation", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Wallet.php#L76-L83
45,743
eveseat/services
src/Repositories/Corporation/Wallet.php
Wallet.getCorporationWalletTransactions
public function getCorporationWalletTransactions( int $corporation_id, bool $get = true, int $chunk = 50) { $transactions = CorporationWalletTransaction::where('corporation_id', $corporation_id); if ($get) return $transactions->orderBy('date', 'desc') ->paginate($chunk); return $transactions; }
php
public function getCorporationWalletTransactions( int $corporation_id, bool $get = true, int $chunk = 50) { $transactions = CorporationWalletTransaction::where('corporation_id', $corporation_id); if ($get) return $transactions->orderBy('date', 'desc') ->paginate($chunk); return $transactions; }
[ "public", "function", "getCorporationWalletTransactions", "(", "int", "$", "corporation_id", ",", "bool", "$", "get", "=", "true", ",", "int", "$", "chunk", "=", "50", ")", "{", "$", "transactions", "=", "CorporationWalletTransaction", "::", "where", "(", "'co...
Return Wallet Transactions for a Corporation. @param int $corporation_id @param bool $get @param int $chunk @return mixed
[ "Return", "Wallet", "Transactions", "for", "a", "Corporation", "." ]
89562547b16d1a59f49bb0fe12426ce8d6133ee6
https://github.com/eveseat/services/blob/89562547b16d1a59f49bb0fe12426ce8d6133ee6/src/Repositories/Corporation/Wallet.php#L94-L105
45,744
php-http/guzzle5-adapter
src/Client.php
Client.createRequest
private function createRequest(RequestInterface $request) { $options = [ 'exceptions' => false, 'allow_redirects' => false, ]; $options['version'] = $request->getProtocolVersion(); $options['headers'] = $request->getHeaders(); $body = (string) $request->getBody(); $options['body'] = '' === $body ? null : $body; return $this->client->createRequest( $request->getMethod(), (string) $request->getUri(), $options ); }
php
private function createRequest(RequestInterface $request) { $options = [ 'exceptions' => false, 'allow_redirects' => false, ]; $options['version'] = $request->getProtocolVersion(); $options['headers'] = $request->getHeaders(); $body = (string) $request->getBody(); $options['body'] = '' === $body ? null : $body; return $this->client->createRequest( $request->getMethod(), (string) $request->getUri(), $options ); }
[ "private", "function", "createRequest", "(", "RequestInterface", "$", "request", ")", "{", "$", "options", "=", "[", "'exceptions'", "=>", "false", ",", "'allow_redirects'", "=>", "false", ",", "]", ";", "$", "options", "[", "'version'", "]", "=", "$", "re...
Converts a PSR request into a Guzzle request. @param RequestInterface $request @return GuzzleRequest
[ "Converts", "a", "PSR", "request", "into", "a", "Guzzle", "request", "." ]
cce48360b1f8a3467bd94e853e6107aa4532008e
https://github.com/php-http/guzzle5-adapter/blob/cce48360b1f8a3467bd94e853e6107aa4532008e/src/Client.php#L66-L83
45,745
php-http/guzzle5-adapter
src/Client.php
Client.createResponse
private function createResponse(GuzzleResponse $response) { $body = $response->getBody(); return $this->responseFactory->createResponse( $response->getStatusCode(), null, $response->getHeaders(), isset($body) ? $body->detach() : null, $response->getProtocolVersion() ); }
php
private function createResponse(GuzzleResponse $response) { $body = $response->getBody(); return $this->responseFactory->createResponse( $response->getStatusCode(), null, $response->getHeaders(), isset($body) ? $body->detach() : null, $response->getProtocolVersion() ); }
[ "private", "function", "createResponse", "(", "GuzzleResponse", "$", "response", ")", "{", "$", "body", "=", "$", "response", "->", "getBody", "(", ")", ";", "return", "$", "this", "->", "responseFactory", "->", "createResponse", "(", "$", "response", "->", ...
Converts a Guzzle response into a PSR response. @param GuzzleResponse $response @return ResponseInterface
[ "Converts", "a", "Guzzle", "response", "into", "a", "PSR", "response", "." ]
cce48360b1f8a3467bd94e853e6107aa4532008e
https://github.com/php-http/guzzle5-adapter/blob/cce48360b1f8a3467bd94e853e6107aa4532008e/src/Client.php#L92-L103
45,746
Nosto/nosto-php-sdk
src/Result/Graphql/ResultSetBuilder.php
ResultSetBuilder.fromHttpResponse
public static function fromHttpResponse(HttpResponse $httpResponse) { $result = json_decode($httpResponse->getResult()); $primaryData = self::parsePrimaryData($result); $resultSet = new ResultSet(); foreach ($primaryData as $primaryDataItem) { if ($primaryDataItem instanceof \stdClass) { $primaryDataItem = ArrayHelper::stdClassToArray($primaryDataItem); } $item = new ResultItem($primaryDataItem); $resultSet->append($item); } return $resultSet; }
php
public static function fromHttpResponse(HttpResponse $httpResponse) { $result = json_decode($httpResponse->getResult()); $primaryData = self::parsePrimaryData($result); $resultSet = new ResultSet(); foreach ($primaryData as $primaryDataItem) { if ($primaryDataItem instanceof \stdClass) { $primaryDataItem = ArrayHelper::stdClassToArray($primaryDataItem); } $item = new ResultItem($primaryDataItem); $resultSet->append($item); } return $resultSet; }
[ "public", "static", "function", "fromHttpResponse", "(", "HttpResponse", "$", "httpResponse", ")", "{", "$", "result", "=", "json_decode", "(", "$", "httpResponse", "->", "getResult", "(", ")", ")", ";", "$", "primaryData", "=", "self", "::", "parsePrimaryData...
Builds a result set from HttpResponse @param HttpResponse $httpResponse @return ResultSet @throws NostoException
[ "Builds", "a", "result", "set", "from", "HttpResponse" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Result/Graphql/ResultSetBuilder.php#L56-L69
45,747
Nosto/nosto-php-sdk
src/Result/Graphql/ResultSetBuilder.php
ResultSetBuilder.parsePrimaryData
public static function parsePrimaryData(\stdClass $class) { $members = get_object_vars($class); foreach ($members as $varName => $member) { if ($varName == AbstractOperation::GRAPHQL_DATA_KEY) { return $member; } if ($member instanceof \stdClass) { return self::parsePrimaryData($member); } } throw new NostoException( sprintf( 'Could not find primary data field (%s) from response', AbstractOperation::GRAPHQL_DATA_KEY ) ); }
php
public static function parsePrimaryData(\stdClass $class) { $members = get_object_vars($class); foreach ($members as $varName => $member) { if ($varName == AbstractOperation::GRAPHQL_DATA_KEY) { return $member; } if ($member instanceof \stdClass) { return self::parsePrimaryData($member); } } throw new NostoException( sprintf( 'Could not find primary data field (%s) from response', AbstractOperation::GRAPHQL_DATA_KEY ) ); }
[ "public", "static", "function", "parsePrimaryData", "(", "\\", "stdClass", "$", "class", ")", "{", "$", "members", "=", "get_object_vars", "(", "$", "class", ")", ";", "foreach", "(", "$", "members", "as", "$", "varName", "=>", "$", "member", ")", "{", ...
Finds the primary data field from stdClass @param \stdClass $class @return array @throws NostoException
[ "Finds", "the", "primary", "data", "field", "from", "stdClass" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Result/Graphql/ResultSetBuilder.php#L78-L96
45,748
Nosto/nosto-php-sdk
src/Object/Signup/Account.php
Account.validate
protected function validate() { $validator = new ValidationHelper($this); if (!$validator->validate()) { foreach ($validator->getErrors() as $errors) { throw new NostoException(sprintf('Invalid Nosto account. %s', $errors[0])); } } }
php
protected function validate() { $validator = new ValidationHelper($this); if (!$validator->validate()) { foreach ($validator->getErrors() as $errors) { throw new NostoException(sprintf('Invalid Nosto account. %s', $errors[0])); } } }
[ "protected", "function", "validate", "(", ")", "{", "$", "validator", "=", "new", "ValidationHelper", "(", "$", "this", ")", ";", "if", "(", "!", "$", "validator", "->", "validate", "(", ")", ")", "{", "foreach", "(", "$", "validator", "->", "getErrors...
Validates the account attributes. @throws NostoException if any attribute is invalid.
[ "Validates", "the", "account", "attributes", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Object/Signup/Account.php#L78-L86
45,749
Nosto/nosto-php-sdk
src/Operation/OrderConfirm.php
OrderConfirm.send
public function send(OrderInterface $order, $customerId = null) { $request = new ApiRequest(); if (!empty($customerId)) { $request->setPath(ApiRequest::PATH_ORDER_TAGGING); $replaceParams = array('{m}' => $this->account->getName(), '{cid}' => $customerId); } else { $request->setPath(ApiRequest::PATH_UNMATCHED_ORDER_TAGGING); $replaceParams = array('{m}' => $this->account->getName()); } if (is_string($this->activeDomain)) { $request->setActiveDomainHeader($this->activeDomain); } if (is_string($this->account->getName())) { $request->setNostoAccountHeader($this->account->getName()); } $request->setReplaceParams($replaceParams); $response = $request->post($order); return self::checkResponse($request, $response); }
php
public function send(OrderInterface $order, $customerId = null) { $request = new ApiRequest(); if (!empty($customerId)) { $request->setPath(ApiRequest::PATH_ORDER_TAGGING); $replaceParams = array('{m}' => $this->account->getName(), '{cid}' => $customerId); } else { $request->setPath(ApiRequest::PATH_UNMATCHED_ORDER_TAGGING); $replaceParams = array('{m}' => $this->account->getName()); } if (is_string($this->activeDomain)) { $request->setActiveDomainHeader($this->activeDomain); } if (is_string($this->account->getName())) { $request->setNostoAccountHeader($this->account->getName()); } $request->setReplaceParams($replaceParams); $response = $request->post($order); return self::checkResponse($request, $response); }
[ "public", "function", "send", "(", "OrderInterface", "$", "order", ",", "$", "customerId", "=", "null", ")", "{", "$", "request", "=", "new", "ApiRequest", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "customerId", ")", ")", "{", "$", "request",...
Sends the OrderConfirm confirmation to Nosto. @param OrderInterface $order the placed OrderConfirm model. @param string|null $customerId the Nosto customer ID of the user who placed the OrderConfirm. @return true on success. @throws AbstractHttpException
[ "Sends", "the", "OrderConfirm", "confirmation", "to", "Nosto", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Operation/OrderConfirm.php#L73-L92
45,750
Nosto/nosto-php-sdk
src/Operation/CartOperation.php
CartOperation.updateCart
public function updateCart(Update $update, $nostoCustomerId, $accountId) { $request = new ApiRequest(); $request->setContentType(self::CONTENT_TYPE_APPLICATION_JSON); $request->setPath(ApiRequest::PATH_CART_UPDATE); $channelName = 'cartUpdated/' . $accountId . '/' . $nostoCustomerId; $data = array(); $item = array(); $item['channel'] = $channelName; $item['formats'] = array('json-object' => json_decode(SerializationHelper::serialize($update))); $data['items'] = array($item); $updateJson = json_encode($data); $response = $request->postRaw($updateJson); return $this->checkResponse($request, $response); }
php
public function updateCart(Update $update, $nostoCustomerId, $accountId) { $request = new ApiRequest(); $request->setContentType(self::CONTENT_TYPE_APPLICATION_JSON); $request->setPath(ApiRequest::PATH_CART_UPDATE); $channelName = 'cartUpdated/' . $accountId . '/' . $nostoCustomerId; $data = array(); $item = array(); $item['channel'] = $channelName; $item['formats'] = array('json-object' => json_decode(SerializationHelper::serialize($update))); $data['items'] = array($item); $updateJson = json_encode($data); $response = $request->postRaw($updateJson); return $this->checkResponse($request, $response); }
[ "public", "function", "updateCart", "(", "Update", "$", "update", ",", "$", "nostoCustomerId", ",", "$", "accountId", ")", "{", "$", "request", "=", "new", "ApiRequest", "(", ")", ";", "$", "request", "->", "setContentType", "(", "self", "::", "CONTENT_TYP...
Sends a POST request to update the cart @param Update $update the cart changes @param string $nostoCustomerId @param string $accountId merchange id @return bool if the request was successful. @throws AbstractHttpException
[ "Sends", "a", "POST", "request", "to", "update", "the", "cart" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Operation/CartOperation.php#L55-L70
45,751
Nosto/nosto-php-sdk
src/Object/Product/Product.php
Product.setDatePublished
public function setDatePublished($datePublished) { try { $this->datePublished = DateHelper::format($datePublished); } catch (\Exception $e) { throw new NostoException($e->getMessage()); } }
php
public function setDatePublished($datePublished) { try { $this->datePublished = DateHelper::format($datePublished); } catch (\Exception $e) { throw new NostoException($e->getMessage()); } }
[ "public", "function", "setDatePublished", "(", "$", "datePublished", ")", "{", "try", "{", "$", "this", "->", "datePublished", "=", "DateHelper", "::", "format", "(", "$", "datePublished", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{...
Sets the product publication date in the shop in the Y-m-d format. @param $datePublished @throws NostoException
[ "Sets", "the", "product", "publication", "date", "in", "the", "shop", "in", "the", "Y", "-", "m", "-", "d", "format", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Object/Product/Product.php#L641-L648
45,752
Nosto/nosto-php-sdk
src/Object/Product/Product.php
Product.addCustomField
public function addCustomField($attribute, $value) { if ($this->customFields === null) { $this->customFields = array(); } $this->customFields[$attribute] = $value; }
php
public function addCustomField($attribute, $value) { if ($this->customFields === null) { $this->customFields = array(); } $this->customFields[$attribute] = $value; }
[ "public", "function", "addCustomField", "(", "$", "attribute", ",", "$", "value", ")", "{", "if", "(", "$", "this", "->", "customFields", "===", "null", ")", "{", "$", "this", "->", "customFields", "=", "array", "(", ")", ";", "}", "$", "this", "->",...
Add a custom attribute @param $attribute @param $value
[ "Add", "a", "custom", "attribute" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Object/Product/Product.php#L990-L996
45,753
Nosto/nosto-php-sdk
src/Object/Product/Product.php
Product.altImagesToUnique
private function altImagesToUnique() { if ($this->alternateImageUrls->count() === 0) { return; } $images = $this->getAlternateImageUrls(); $resetImages = false; $duplicates = array_count_values($images); foreach ($duplicates as $val => $count) { if ($count > 1) { $resetImages = true; $images = array_unique($images); break; } } $key = array_search($this->getImageUrl(), $images, true); if ($key !== false) { $resetImages = true; unset($images[$key]); } if ($resetImages) { $this->setAlternateImageUrls(array_values($images)); } }
php
private function altImagesToUnique() { if ($this->alternateImageUrls->count() === 0) { return; } $images = $this->getAlternateImageUrls(); $resetImages = false; $duplicates = array_count_values($images); foreach ($duplicates as $val => $count) { if ($count > 1) { $resetImages = true; $images = array_unique($images); break; } } $key = array_search($this->getImageUrl(), $images, true); if ($key !== false) { $resetImages = true; unset($images[$key]); } if ($resetImages) { $this->setAlternateImageUrls(array_values($images)); } }
[ "private", "function", "altImagesToUnique", "(", ")", "{", "if", "(", "$", "this", "->", "alternateImageUrls", "->", "count", "(", ")", "===", "0", ")", "{", "return", ";", "}", "$", "images", "=", "$", "this", "->", "getAlternateImageUrls", "(", ")", ...
Makes the alternative images collection unique and removes the main product image from alt images if present
[ "Makes", "the", "alternative", "images", "collection", "unique", "and", "removes", "the", "main", "product", "image", "from", "alt", "images", "if", "present" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Object/Product/Product.php#L1029-L1052
45,754
Nosto/nosto-php-sdk
src/Helper/CurrencyHelper.php
CurrencyHelper.assertCurrency
private static function assertCurrency($code) { if (!isset(self::$data[$code])) { throw new NostoException(sprintf( 'Currency (%s) must be one of the following ISO 4217 codes: "%s".', $code, implode('", "', array_keys(self::$data)) )); } }
php
private static function assertCurrency($code) { if (!isset(self::$data[$code])) { throw new NostoException(sprintf( 'Currency (%s) must be one of the following ISO 4217 codes: "%s".', $code, implode('", "', array_keys(self::$data)) )); } }
[ "private", "static", "function", "assertCurrency", "(", "$", "code", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "data", "[", "$", "code", "]", ")", ")", "{", "throw", "new", "NostoException", "(", "sprintf", "(", "'Currency (%s) must be o...
Asserts that the currency code is supported. @param string $code the currency code to test. @throws NostoException
[ "Asserts", "that", "the", "currency", "code", "is", "supported", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Helper/CurrencyHelper.php#L1155-L1164
45,755
Nosto/nosto-php-sdk
src/Operation/AbstractOperation.php
AbstractOperation.checkResponse
protected static function checkResponse(HttpRequest $request, HttpResponse $response) { if ($response->getCode() !== 200) { throw ExceptionBuilder::fromHttpRequestAndResponse($request, $response); } return true; }
php
protected static function checkResponse(HttpRequest $request, HttpResponse $response) { if ($response->getCode() !== 200) { throw ExceptionBuilder::fromHttpRequestAndResponse($request, $response); } return true; }
[ "protected", "static", "function", "checkResponse", "(", "HttpRequest", "$", "request", ",", "HttpResponse", "$", "response", ")", "{", "if", "(", "$", "response", "->", "getCode", "(", ")", "!==", "200", ")", "{", "throw", "ExceptionBuilder", "::", "fromHtt...
Helper method to throw an exception when an API or HTTP endpoint responds with a non-200 status code. @param $request HttpRequest the HTTP request @param $response HttpResponse the HTTP response to check @return bool returns true when everything was okay @throws AbstractHttpException
[ "Helper", "method", "to", "throw", "an", "exception", "when", "an", "API", "or", "HTTP", "endpoint", "responds", "with", "a", "non", "-", "200", "status", "code", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Operation/AbstractOperation.php#L75-L81
45,756
Nosto/nosto-php-sdk
src/Helper/ValidationHelper.php
ValidationHelper.validate
public function validate() { $valid = true; foreach ($this->object->validationRules() as $rule) { if (isset($rule[0], $rule[1])) { $properties = $rule[0]; $validator = 'validate' . $rule[1]; if (!method_exists($this, $validator)) { throw new NostoException(sprintf( 'Nosto validator "%s" does not exist.', $validator )); } $params = array_merge(array($properties), array_slice($rule, 2)); $isValid = call_user_func_array(array($this, $validator), $params); if (!$isValid) { $valid = false; } } } return $valid; }
php
public function validate() { $valid = true; foreach ($this->object->validationRules() as $rule) { if (isset($rule[0], $rule[1])) { $properties = $rule[0]; $validator = 'validate' . $rule[1]; if (!method_exists($this, $validator)) { throw new NostoException(sprintf( 'Nosto validator "%s" does not exist.', $validator )); } $params = array_merge(array($properties), array_slice($rule, 2)); $isValid = call_user_func_array(array($this, $validator), $params); if (!$isValid) { $valid = false; } } } return $valid; }
[ "public", "function", "validate", "(", ")", "{", "$", "valid", "=", "true", ";", "foreach", "(", "$", "this", "->", "object", "->", "validationRules", "(", ")", "as", "$", "rule", ")", "{", "if", "(", "isset", "(", "$", "rule", "[", "0", "]", ","...
Validates the `validatable` object based on it's validation rules. @return bool true if the object is valid, false otherwise. @throws NostoException if the rule validator is not found.
[ "Validates", "the", "validatable", "object", "based", "on", "it", "s", "validation", "rules", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Helper/ValidationHelper.php#L74-L96
45,757
Nosto/nosto-php-sdk
src/Helper/ValidationHelper.php
ValidationHelper.validateRequired
protected function validateRequired(array $properties) { $valid = true; foreach ($properties as $property) { $value = $this->getPropertyValue($property); if (empty($value)) { $this->addError($property, sprintf('Property "%s" must not be empty.', $property)); $valid = false; } } return $valid; }
php
protected function validateRequired(array $properties) { $valid = true; foreach ($properties as $property) { $value = $this->getPropertyValue($property); if (empty($value)) { $this->addError($property, sprintf('Property "%s" must not be empty.', $property)); $valid = false; } } return $valid; }
[ "protected", "function", "validateRequired", "(", "array", "$", "properties", ")", "{", "$", "valid", "=", "true", ";", "foreach", "(", "$", "properties", "as", "$", "property", ")", "{", "$", "value", "=", "$", "this", "->", "getPropertyValue", "(", "$"...
Validates that all the given properties are NOT empty in this instance. @param array $properties the list of property names to validate. @return bool true if all are valid, false otherwise. @throws NostoException
[ "Validates", "that", "all", "the", "given", "properties", "are", "NOT", "empty", "in", "this", "instance", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Helper/ValidationHelper.php#L125-L136
45,758
Nosto/nosto-php-sdk
src/Helper/ValidationHelper.php
ValidationHelper.addError
protected function addError($attribute, $message) { if (!isset($this->errors[$attribute])) { $this->errors[$attribute] = array(); } $this->errors[$attribute][] = $message; }
php
protected function addError($attribute, $message) { if (!isset($this->errors[$attribute])) { $this->errors[$attribute] = array(); } $this->errors[$attribute][] = $message; }
[ "protected", "function", "addError", "(", "$", "attribute", ",", "$", "message", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "errors", "[", "$", "attribute", "]", ")", ")", "{", "$", "this", "->", "errors", "[", "$", "attribute", "]"...
Adds a new validation error message for the attribute. @param string $attribute the attribute name. @param string $message the error message.
[ "Adds", "a", "new", "validation", "error", "message", "for", "the", "attribute", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Helper/ValidationHelper.php#L144-L150
45,759
Nosto/nosto-php-sdk
src/Helper/ValidationHelper.php
ValidationHelper.validateIn
protected function validateIn(array $properties, array $values) { $valid = true; $supported = implode('", "', $values); foreach ($properties as $property) { $value = $this->getPropertyValue($property); if (!in_array($value, $values)) { $this->addError( $property, sprintf( 'Property "%s" must be one of the following: "%s".', $property, $supported ) ); $valid = false; } } return $valid; }
php
protected function validateIn(array $properties, array $values) { $valid = true; $supported = implode('", "', $values); foreach ($properties as $property) { $value = $this->getPropertyValue($property); if (!in_array($value, $values)) { $this->addError( $property, sprintf( 'Property "%s" must be one of the following: "%s".', $property, $supported ) ); $valid = false; } } return $valid; }
[ "protected", "function", "validateIn", "(", "array", "$", "properties", ",", "array", "$", "values", ")", "{", "$", "valid", "=", "true", ";", "$", "supported", "=", "implode", "(", "'\", \"'", ",", "$", "values", ")", ";", "foreach", "(", "$", "proper...
Validates that all given properties are IN the list of supplied values. @param array $properties the list of properties to validate. @param array $values the list of valid values the properties must @return bool true if all are valid, false otherwise. @throws NostoException
[ "Validates", "that", "all", "given", "properties", "are", "IN", "the", "list", "of", "supplied", "values", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Helper/ValidationHelper.php#L160-L180
45,760
Nosto/nosto-php-sdk
src/Helper/ValidationHelper.php
ValidationHelper.getPropertyValue
protected function getPropertyValue($property) { $getter = sprintf('get%s', $property); if (!method_exists($this->object, $getter)) { throw new NostoException( sprintf( 'Class %s does not have getter for property %s', get_class($this->object), $property ) ); } return $this->object->$getter(); }
php
protected function getPropertyValue($property) { $getter = sprintf('get%s', $property); if (!method_exists($this->object, $getter)) { throw new NostoException( sprintf( 'Class %s does not have getter for property %s', get_class($this->object), $property ) ); } return $this->object->$getter(); }
[ "protected", "function", "getPropertyValue", "(", "$", "property", ")", "{", "$", "getter", "=", "sprintf", "(", "'get%s'", ",", "$", "property", ")", ";", "if", "(", "!", "method_exists", "(", "$", "this", "->", "object", ",", "$", "getter", ")", ")",...
Gets the value of an attribute Throws an exception if the getter doesn't exist @param $property @return mixed @throws NostoException
[ "Gets", "the", "value", "of", "an", "attribute", "Throws", "an", "exception", "if", "the", "getter", "doesn", "t", "exist" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Helper/ValidationHelper.php#L190-L204
45,761
Nosto/nosto-php-sdk
src/Operation/InitiateSso.php
InitiateSso.get
public function get(UserInterface $user, $platform) { $request = $this->initHttpRequest( $this->account->getApiToken(Token::API_SSO), $this->account->getName() ); $request->setPath(ApiRequest::PATH_SSO_AUTH); $request->setContentType(self::CONTENT_TYPE_APPLICATION_JSON); $request->setReplaceParams(array('{platform}' => $platform)); $response = $request->post($user); if ($response->getCode() !== 200) { throw ExceptionBuilder::fromHttpRequestAndResponse($request, $response); } return $response->getJsonResult()->login_url; }
php
public function get(UserInterface $user, $platform) { $request = $this->initHttpRequest( $this->account->getApiToken(Token::API_SSO), $this->account->getName() ); $request->setPath(ApiRequest::PATH_SSO_AUTH); $request->setContentType(self::CONTENT_TYPE_APPLICATION_JSON); $request->setReplaceParams(array('{platform}' => $platform)); $response = $request->post($user); if ($response->getCode() !== 200) { throw ExceptionBuilder::fromHttpRequestAndResponse($request, $response); } return $response->getJsonResult()->login_url; }
[ "public", "function", "get", "(", "UserInterface", "$", "user", ",", "$", "platform", ")", "{", "$", "request", "=", "$", "this", "->", "initHttpRequest", "(", "$", "this", "->", "account", "->", "getApiToken", "(", "Token", "::", "API_SSO", ")", ",", ...
Sends a POST request to get a single sign-on URL for a store @param UserInterface $user @param $platform @return string the sso URL if the request was successful. @throws NostoException @throws AbstractHttpException
[ "Sends", "a", "POST", "request", "to", "get", "a", "single", "sign", "-", "on", "URL", "for", "a", "store" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Operation/InitiateSso.php#L62-L77
45,762
Nosto/nosto-php-sdk
src/Helper/OAuthHelper.php
OAuthHelper.getAuthorizationUrl
public static function getAuthorizationUrl(OAuthInterface $params) { $oauthBaseUrl = Nosto::getOAuthBaseUrl(); return HttpRequest::buildUri( $oauthBaseUrl . self::PATH_AUTH, array( '{cid}' => $params->getClientId(), '{uri}' => $params->getRedirectUrl(), '{sco}' => implode(' ', $params->getScopes()), '{iso}' => strtolower($params->getLanguageIsoCode()), ) ); }
php
public static function getAuthorizationUrl(OAuthInterface $params) { $oauthBaseUrl = Nosto::getOAuthBaseUrl(); return HttpRequest::buildUri( $oauthBaseUrl . self::PATH_AUTH, array( '{cid}' => $params->getClientId(), '{uri}' => $params->getRedirectUrl(), '{sco}' => implode(' ', $params->getScopes()), '{iso}' => strtolower($params->getLanguageIsoCode()), ) ); }
[ "public", "static", "function", "getAuthorizationUrl", "(", "OAuthInterface", "$", "params", ")", "{", "$", "oauthBaseUrl", "=", "Nosto", "::", "getOAuthBaseUrl", "(", ")", ";", "return", "HttpRequest", "::", "buildUri", "(", "$", "oauthBaseUrl", ".", "self", ...
Returns the authorize url to the oauth2 server. @param OAuthInterface $params @return string the url.
[ "Returns", "the", "authorize", "url", "to", "the", "oauth2", "server", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Helper/OAuthHelper.php#L57-L70
45,763
Nosto/nosto-php-sdk
src/Helper/HtmlMarkupSerializationHelper.php
HtmlMarkupSerializationHelper.encodableClassVariable
public static function encodableClassVariable($class, $variable) { $getter = 'get' . str_replace('_', '', $variable); $setter = 'set' . str_replace('_', '', $variable); if (!method_exists($class, $getter) || !method_exists($class, $setter)) { return false; } return true; }
php
public static function encodableClassVariable($class, $variable) { $getter = 'get' . str_replace('_', '', $variable); $setter = 'set' . str_replace('_', '', $variable); if (!method_exists($class, $getter) || !method_exists($class, $setter)) { return false; } return true; }
[ "public", "static", "function", "encodableClassVariable", "(", "$", "class", ",", "$", "variable", ")", "{", "$", "getter", "=", "'get'", ".", "str_replace", "(", "'_'", ",", "''", ",", "$", "variable", ")", ";", "$", "setter", "=", "'set'", ".", "str_...
Checks if a class variable can be encoded. In practice checks that a getter and a setter for the property is found from the class. @param $class @param $variable @return bool
[ "Checks", "if", "a", "class", "variable", "can", "be", "encoded", ".", "In", "practice", "checks", "that", "a", "getter", "and", "a", "setter", "for", "the", "property", "is", "found", "from", "the", "class", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Helper/HtmlMarkupSerializationHelper.php#L193-L202
45,764
Nosto/nosto-php-sdk
src/Request/Http/Adapter/Adapter.php
Adapter.init
protected function init(array $options = array()) { foreach ($options as $key => $value) { if (property_exists($this, $key)) { $this->{$key} = $value; } } }
php
protected function init(array $options = array()) { foreach ($options as $key => $value) { if (property_exists($this, $key)) { $this->{$key} = $value; } } }
[ "protected", "function", "init", "(", "array", "$", "options", "=", "array", "(", ")", ")", "{", "foreach", "(", "$", "options", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "property_exists", "(", "$", "this", ",", "$", "key", ")", ...
Initializes the request options. @param array $options the options.
[ "Initializes", "the", "request", "options", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/Adapter/Adapter.php#L125-L132
45,765
Nosto/nosto-php-sdk
src/Request/Http/HttpResponse.php
HttpResponse.getCode
public function getCode() { if (is_null($this->code)) { $code = 0; if (!empty($this->headers)) { foreach ($this->headers as $header) { $matches = array(); preg_match('|HTTP/\d(\.\d)?\s+(\d+)(\s+.*)?|', $header, $matches); if (isset($matches[2])) { $code = (int)$matches[2]; } } } $this->code = $code; } return $this->code; }
php
public function getCode() { if (is_null($this->code)) { $code = 0; if (!empty($this->headers)) { foreach ($this->headers as $header) { $matches = array(); preg_match('|HTTP/\d(\.\d)?\s+(\d+)(\s+.*)?|', $header, $matches); if (isset($matches[2])) { $code = (int)$matches[2]; } } } $this->code = $code; } return $this->code; }
[ "public", "function", "getCode", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "code", ")", ")", "{", "$", "code", "=", "0", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "headers", ")", ")", "{", "foreach", "(", "$", "...
Returns the `last` http response code. @return int the http code or 0 if not set.
[ "Returns", "the", "last", "http", "response", "code", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpResponse.php#L132-L148
45,766
Nosto/nosto-php-sdk
src/Request/Http/HttpResponse.php
HttpResponse.getXRequestId
public function getXRequestId() { if (is_null($this->xRequestId)) { if (!empty($this->headers)) { foreach ($this->headers as $header) { $position = strpos(strtolower($header), self::HEADER_PREFIX_X_REQUEST_ID); if ($position === 0) { $this->xRequestId = substr($header, strlen(self::HEADER_PREFIX_X_REQUEST_ID)); break; } } } } return $this->xRequestId; }
php
public function getXRequestId() { if (is_null($this->xRequestId)) { if (!empty($this->headers)) { foreach ($this->headers as $header) { $position = strpos(strtolower($header), self::HEADER_PREFIX_X_REQUEST_ID); if ($position === 0) { $this->xRequestId = substr($header, strlen(self::HEADER_PREFIX_X_REQUEST_ID)); break; } } } } return $this->xRequestId; }
[ "public", "function", "getXRequestId", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "xRequestId", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "headers", ")", ")", "{", "foreach", "(", "$", "this", "->", "headers"...
Get the nosto request id reply from nosto backend @return string|null
[ "Get", "the", "nosto", "request", "id", "reply", "from", "nosto", "backend" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpResponse.php#L155-L170
45,767
Nosto/nosto-php-sdk
src/Helper/SerializationHelper.php
SerializationHelper.toArray
private static function toArray($object) { $json = array(); $props = self::getProperties($object); foreach ($props as $key => $value) { $check_references = explode("_", $key); $getter = ""; if (count($check_references) > 0) { foreach ($check_references as $reference) { $getter .= ucfirst($reference); } } else { $getter = ucfirst($key); } $getter = "get" . $getter; if (!method_exists($object, $getter)) { continue; } $key = self::toSnakeCase($key); $value = $object->$getter(); if (self::isNull($value)) { continue; } if ($value instanceof \Iterator) { $value = iterator_to_array($value); } if (is_object($value)) { $json[$key] = self::toArray($value); } else { if (is_array($value)) { $json[$key] = array(); if (ArrayHelper::isAssoc($value)) { foreach ($value as $k => $anObject) { if (is_object($anObject)) { $json[$key][$k] = self::toArray($anObject); } else { $json[$key][$k] = $anObject; } } } else { foreach ($value as $anObject) { if (is_object($anObject)) { $json[$key][] = self::toArray($anObject); } else { $json[$key][] = $anObject; } } } } else { $json[$key] = $value; } } } return $json; }
php
private static function toArray($object) { $json = array(); $props = self::getProperties($object); foreach ($props as $key => $value) { $check_references = explode("_", $key); $getter = ""; if (count($check_references) > 0) { foreach ($check_references as $reference) { $getter .= ucfirst($reference); } } else { $getter = ucfirst($key); } $getter = "get" . $getter; if (!method_exists($object, $getter)) { continue; } $key = self::toSnakeCase($key); $value = $object->$getter(); if (self::isNull($value)) { continue; } if ($value instanceof \Iterator) { $value = iterator_to_array($value); } if (is_object($value)) { $json[$key] = self::toArray($value); } else { if (is_array($value)) { $json[$key] = array(); if (ArrayHelper::isAssoc($value)) { foreach ($value as $k => $anObject) { if (is_object($anObject)) { $json[$key][$k] = self::toArray($anObject); } else { $json[$key][$k] = $anObject; } } } else { foreach ($value as $anObject) { if (is_object($anObject)) { $json[$key][] = self::toArray($anObject); } else { $json[$key][] = $anObject; } } } } else { $json[$key] = $value; } } } return $json; }
[ "private", "static", "function", "toArray", "(", "$", "object", ")", "{", "$", "json", "=", "array", "(", ")", ";", "$", "props", "=", "self", "::", "getProperties", "(", "$", "object", ")", ";", "foreach", "(", "$", "props", "as", "$", "key", "=>"...
Serializes the given object to JSON using a snake-case naming convention. Arrays and objects can both be passed normally. @param $object @return array
[ "Serializes", "the", "given", "object", "to", "JSON", "using", "a", "snake", "-", "case", "naming", "convention", ".", "Arrays", "and", "objects", "can", "both", "be", "passed", "normally", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Helper/SerializationHelper.php#L77-L133
45,768
Nosto/nosto-php-sdk
src/Helper/SerializationHelper.php
SerializationHelper.getProperties
public static function getProperties($obj) { $properties = array(); try { $rc = new ReflectionClass($obj); do { $rp = array(); // Note that we will not include any properties in traits $traits = $rc->getTraits(); $skipProperties = array(); if (!empty($traits)) { foreach ($traits as $trait) { foreach ($trait->getProperties() as $traitProperty) { $skipProperties[] = $traitProperty->getName(); } } } /* @var $p \ReflectionProperty */ foreach ($rc->getProperties() as $p) { if (in_array($p->getName(), $skipProperties, true)) { continue; } $p->setAccessible(true); $rp[$p->getName()] = $p->getValue($obj); } $properties = array_merge($rp, $properties); } while ($rc = $rc->getParentClass()); } catch (ReflectionException $e) { // } return $properties; }
php
public static function getProperties($obj) { $properties = array(); try { $rc = new ReflectionClass($obj); do { $rp = array(); // Note that we will not include any properties in traits $traits = $rc->getTraits(); $skipProperties = array(); if (!empty($traits)) { foreach ($traits as $trait) { foreach ($trait->getProperties() as $traitProperty) { $skipProperties[] = $traitProperty->getName(); } } } /* @var $p \ReflectionProperty */ foreach ($rc->getProperties() as $p) { if (in_array($p->getName(), $skipProperties, true)) { continue; } $p->setAccessible(true); $rp[$p->getName()] = $p->getValue($obj); } $properties = array_merge($rp, $properties); } while ($rc = $rc->getParentClass()); } catch (ReflectionException $e) { // } return $properties; }
[ "public", "static", "function", "getProperties", "(", "$", "obj", ")", "{", "$", "properties", "=", "array", "(", ")", ";", "try", "{", "$", "rc", "=", "new", "ReflectionClass", "(", "$", "obj", ")", ";", "do", "{", "$", "rp", "=", "array", "(", ...
Recursively lists all the properties of the given class by traversing up the class hierarchy @param $obj object the object whose properties to list @return array the array of the keys and properties of the object
[ "Recursively", "lists", "all", "the", "properties", "of", "the", "given", "class", "by", "traversing", "up", "the", "class", "hierarchy" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Helper/SerializationHelper.php#L141-L173
45,769
Nosto/nosto-php-sdk
src/Operation/OAuth/AuthorizationCode.php
AuthorizationCode.authenticate
public function authenticate($code) { if (empty($code)) { throw new NostoException('Invalid authentication token'); } $request = new HttpRequest(); $request->setUrl(Nosto::getOAuthBaseUrl() . self::PATH_TOKEN); $request->setReplaceParams( array( '{cid}' => $this->clientId, '{sec}' => $this->clientSecret, '{uri}' => $this->redirectUrl, '{cod}' => $code ) ); $response = $request->get(); $result = $response->getJsonResult(true); if ($response->getCode() !== 200) { throw ExceptionBuilder::fromHttpRequestAndResponse($request, $response); } if (empty($result['access_token'])) { throw new NostoException('No "access_token" returned after authenticating with code'); } if (empty($result['merchant_name'])) { throw new NostoException('No "merchant_name" returned after authenticating with code'); } return NostoOAuthToken::create($result); }
php
public function authenticate($code) { if (empty($code)) { throw new NostoException('Invalid authentication token'); } $request = new HttpRequest(); $request->setUrl(Nosto::getOAuthBaseUrl() . self::PATH_TOKEN); $request->setReplaceParams( array( '{cid}' => $this->clientId, '{sec}' => $this->clientSecret, '{uri}' => $this->redirectUrl, '{cod}' => $code ) ); $response = $request->get(); $result = $response->getJsonResult(true); if ($response->getCode() !== 200) { throw ExceptionBuilder::fromHttpRequestAndResponse($request, $response); } if (empty($result['access_token'])) { throw new NostoException('No "access_token" returned after authenticating with code'); } if (empty($result['merchant_name'])) { throw new NostoException('No "merchant_name" returned after authenticating with code'); } return NostoOAuthToken::create($result); }
[ "public", "function", "authenticate", "(", "$", "code", ")", "{", "if", "(", "empty", "(", "$", "code", ")", ")", "{", "throw", "new", "NostoException", "(", "'Invalid authentication token'", ")", ";", "}", "$", "request", "=", "new", "HttpRequest", "(", ...
Authenticates the application with the given code to receive an access token. @param string $code code sent by the authorization server to exchange for an access token. @return NostoOAuthToken @throws NostoException
[ "Authenticates", "the", "application", "with", "the", "given", "code", "to", "receive", "an", "access", "token", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Operation/OAuth/AuthorizationCode.php#L98-L128
45,770
Nosto/nosto-php-sdk
src/Object/NostoOAuthToken.php
NostoOAuthToken.create
public static function create(array $data) { $token = new self(); foreach ($data as $key => $value) { $key = self::underscore2CamelCase($key); if (property_exists($token, $key)) { $token->{$key} = $value; } } return $token; }
php
public static function create(array $data) { $token = new self(); foreach ($data as $key => $value) { $key = self::underscore2CamelCase($key); if (property_exists($token, $key)) { $token->{$key} = $value; } } return $token; }
[ "public", "static", "function", "create", "(", "array", "$", "data", ")", "{", "$", "token", "=", "new", "self", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "key", "=", "self", "::", "underscor...
Creates a new token instance and populates it with the given data. @param array $data the data to put in the token. @return NostoOAuthToken
[ "Creates", "a", "new", "token", "instance", "and", "populates", "it", "with", "the", "given", "data", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Object/NostoOAuthToken.php#L67-L77
45,771
Nosto/nosto-php-sdk
src/Object/Order/Order.php
Order.setCreatedAt
public function setCreatedAt($createdAt) { if ($createdAt instanceof \DateTime || (is_object($createdAt) && method_exists($createdAt, 'format'))) { $this->createdAt = $createdAt->format('Y-m-d H:i:s'); } else { $this->createdAt = $createdAt; } }
php
public function setCreatedAt($createdAt) { if ($createdAt instanceof \DateTime || (is_object($createdAt) && method_exists($createdAt, 'format'))) { $this->createdAt = $createdAt->format('Y-m-d H:i:s'); } else { $this->createdAt = $createdAt; } }
[ "public", "function", "setCreatedAt", "(", "$", "createdAt", ")", "{", "if", "(", "$", "createdAt", "instanceof", "\\", "DateTime", "||", "(", "is_object", "(", "$", "createdAt", ")", "&&", "method_exists", "(", "$", "createdAt", ",", "'format'", ")", ")",...
Sets the date when the OrderConfirm was placed in the format Y-m-d @param \DateTimeInterface|\DateTime|string $createdAt the created date.
[ "Sets", "the", "date", "when", "the", "OrderConfirm", "was", "placed", "in", "the", "format", "Y", "-", "m", "-", "d" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Object/Order/Order.php#L195-L203
45,772
Nosto/nosto-php-sdk
src/Object/Order/Order.php
Order.setOrderStatus
public function setOrderStatus(StatusInterface $orderStatus) { $this->orderStatusCode = $orderStatus->getCode(); $this->orderStatusLabel = $orderStatus->getLabel(); }
php
public function setOrderStatus(StatusInterface $orderStatus) { $this->orderStatusCode = $orderStatus->getCode(); $this->orderStatusLabel = $orderStatus->getLabel(); }
[ "public", "function", "setOrderStatus", "(", "StatusInterface", "$", "orderStatus", ")", "{", "$", "this", "->", "orderStatusCode", "=", "$", "orderStatus", "->", "getCode", "(", ")", ";", "$", "this", "->", "orderStatusLabel", "=", "$", "orderStatus", "->", ...
Sets the latest OrderConfirm status for the OrderConfirm @param StatusInterface $orderStatus the OrderConfirm status
[ "Sets", "the", "latest", "OrderConfirm", "status", "for", "the", "OrderConfirm" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Object/Order/Order.php#L264-L268
45,773
Nosto/nosto-php-sdk
src/Exception/Builder.php
Builder.fromHttpRequestAndResponse
public static function fromHttpRequestAndResponse( HttpRequest $request, HttpResponse $response ) { $message = ''; $jsonResponse = $response->getJsonResult(); $errors = self::parseErrorsFromResponse($response); if (isset($jsonResponse->type, $jsonResponse->message)) { $message .= $jsonResponse->message; if (!empty($errors)) { $message .= ' | ' . $errors; } return new ApiResponseException( $message, $response->getCode(), null, $request, $response ); } if ($response->getMessage()) { $message .= $response->getMessage(); } if (!empty($errors)) { $message .= ' | ' . $errors; } return new HttpResponseException( $message, $response->getCode(), null, $request, $response ); }
php
public static function fromHttpRequestAndResponse( HttpRequest $request, HttpResponse $response ) { $message = ''; $jsonResponse = $response->getJsonResult(); $errors = self::parseErrorsFromResponse($response); if (isset($jsonResponse->type, $jsonResponse->message)) { $message .= $jsonResponse->message; if (!empty($errors)) { $message .= ' | ' . $errors; } return new ApiResponseException( $message, $response->getCode(), null, $request, $response ); } if ($response->getMessage()) { $message .= $response->getMessage(); } if (!empty($errors)) { $message .= ' | ' . $errors; } return new HttpResponseException( $message, $response->getCode(), null, $request, $response ); }
[ "public", "static", "function", "fromHttpRequestAndResponse", "(", "HttpRequest", "$", "request", ",", "HttpResponse", "$", "response", ")", "{", "$", "message", "=", "''", ";", "$", "jsonResponse", "=", "$", "response", "->", "getJsonResult", "(", ")", ";", ...
Return HttpException exception with info about both the request and response. @param HttpRequest $request @param HttpResponse $response @return AbstractHttpException|HttpResponseException
[ "Return", "HttpException", "exception", "with", "info", "about", "both", "the", "request", "and", "response", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Exception/Builder.php#L56-L91
45,774
Nosto/nosto-php-sdk
src/Exception/Builder.php
Builder.parseErrorsFromResponse
public static function parseErrorsFromResponse(HttpResponse $response) { $json = $response->getJsonResult(); $errorStr = ''; if (isset($json->errors) && is_array($json->errors) && !empty($json->errors) ) { foreach ($json->errors as $stdClassError) { if (isset($stdClassError->errors)) { $errorStr .= $stdClassError->errors; } if (isset($stdClassError->product_id)) { $errorStr .= sprintf('(product #%s)', $stdClassError->product_id); } } } return $errorStr; }
php
public static function parseErrorsFromResponse(HttpResponse $response) { $json = $response->getJsonResult(); $errorStr = ''; if (isset($json->errors) && is_array($json->errors) && !empty($json->errors) ) { foreach ($json->errors as $stdClassError) { if (isset($stdClassError->errors)) { $errorStr .= $stdClassError->errors; } if (isset($stdClassError->product_id)) { $errorStr .= sprintf('(product #%s)', $stdClassError->product_id); } } } return $errorStr; }
[ "public", "static", "function", "parseErrorsFromResponse", "(", "HttpResponse", "$", "response", ")", "{", "$", "json", "=", "$", "response", "->", "getJsonResult", "(", ")", ";", "$", "errorStr", "=", "''", ";", "if", "(", "isset", "(", "$", "json", "->...
Parses errors from HttpResponse @param HttpResponse $response @return string
[ "Parses", "errors", "from", "HttpResponse" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Exception/Builder.php#L98-L117
45,775
Nosto/nosto-php-sdk
src/Operation/SyncRates.php
SyncRates.update
public function update(ExchangeRateCollection $collection) { $request = $this->initApiRequest( $this->account->getApiToken(Token::API_EXCHANGE_RATES), $this->account->getName(), $this->activeDomain ); $request->setPath(ApiRequest::PATH_CURRENCY_EXCHANGE_RATE); $response = $request->post($collection); return self::checkResponse($request, $response); }
php
public function update(ExchangeRateCollection $collection) { $request = $this->initApiRequest( $this->account->getApiToken(Token::API_EXCHANGE_RATES), $this->account->getName(), $this->activeDomain ); $request->setPath(ApiRequest::PATH_CURRENCY_EXCHANGE_RATE); $response = $request->post($collection); return self::checkResponse($request, $response); }
[ "public", "function", "update", "(", "ExchangeRateCollection", "$", "collection", ")", "{", "$", "request", "=", "$", "this", "->", "initApiRequest", "(", "$", "this", "->", "account", "->", "getApiToken", "(", "Token", "::", "API_EXCHANGE_RATES", ")", ",", ...
Updates exchange rates to Nosto @param ExchangeRateCollection $collection the collection of exchange rates to update @return bool returns true when the operation was a success @throws NostoException @throws AbstractHttpException
[ "Updates", "exchange", "rates", "to", "Nosto" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Operation/SyncRates.php#L69-L79
45,776
Nosto/nosto-php-sdk
src/Request/Api/Token.php
Token.parseTokens
public static function parseTokens(array $tokens, $prefix = '', $postfix = '') { $parsedTokens = array(); foreach (self::$tokenNames as $name) { $key = $prefix . $name . $postfix; if (isset($tokens[$key])) { $parsedTokens[$name] = new self($name, $tokens[$key]); } } return $parsedTokens; }
php
public static function parseTokens(array $tokens, $prefix = '', $postfix = '') { $parsedTokens = array(); foreach (self::$tokenNames as $name) { $key = $prefix . $name . $postfix; if (isset($tokens[$key])) { $parsedTokens[$name] = new self($name, $tokens[$key]); } } return $parsedTokens; }
[ "public", "static", "function", "parseTokens", "(", "array", "$", "tokens", ",", "$", "prefix", "=", "''", ",", "$", "postfix", "=", "''", ")", "{", "$", "parsedTokens", "=", "array", "(", ")", ";", "foreach", "(", "self", "::", "$", "tokenNames", "a...
Parses a list of token name=>value pairs and creates token instances of them. @param array $tokens the list of token name=>value pairs. @param string $prefix optional prefix for the token name in the list. @param string $postfix optional postfix for the token name in the list. @return Token[] a list of token instances.
[ "Parses", "a", "list", "of", "token", "name", "=", ">", "value", "pairs", "and", "creates", "token", "instances", "of", "them", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Api/Token.php#L115-L125
45,777
Nosto/nosto-php-sdk
src/Util/Memory.php
Memory.getRealConsumption
public static function getRealConsumption($mb = true) { $mem = memory_get_usage(true); if ($mb === true) { $mem = round($mem/self::MB_DIVIDER, 2); } return $mem; }
php
public static function getRealConsumption($mb = true) { $mem = memory_get_usage(true); if ($mb === true) { $mem = round($mem/self::MB_DIVIDER, 2); } return $mem; }
[ "public", "static", "function", "getRealConsumption", "(", "$", "mb", "=", "true", ")", "{", "$", "mem", "=", "memory_get_usage", "(", "true", ")", ";", "if", "(", "$", "mb", "===", "true", ")", "{", "$", "mem", "=", "round", "(", "$", "mem", "/", ...
Returns the runtime memory consumption for the whole PHP @param bool $mb (if true the memory consumption is returned in megabytes) @return float|int
[ "Returns", "the", "runtime", "memory", "consumption", "for", "the", "whole", "PHP" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Util/Memory.php#L59-L67
45,778
Nosto/nosto-php-sdk
src/Util/Memory.php
Memory.getConsumption
public static function getConsumption($mb = true) { $mem = memory_get_usage(false); if ($mb === true) { $mem = round($mem/self::MB_DIVIDER, 2); } return $mem; }
php
public static function getConsumption($mb = true) { $mem = memory_get_usage(false); if ($mb === true) { $mem = round($mem/self::MB_DIVIDER, 2); } return $mem; }
[ "public", "static", "function", "getConsumption", "(", "$", "mb", "=", "true", ")", "{", "$", "mem", "=", "memory_get_usage", "(", "false", ")", ";", "if", "(", "$", "mb", "===", "true", ")", "{", "$", "mem", "=", "round", "(", "$", "mem", "/", "...
Returns the runtime memory consumption for the current PHP script @param bool $mb (if true the memory consumption is returned in megabytes) @return float|int
[ "Returns", "the", "runtime", "memory", "consumption", "for", "the", "current", "PHP", "script" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Util/Memory.php#L75-L83
45,779
Nosto/nosto-php-sdk
src/Operation/MarketingPermission.php
MarketingPermission.update
public function update($email, $hasPermission) { $request = $this->initApiRequest( $this->account->getApiToken(Token::API_EMAIL), $this->account->getName(), $this->activeDomain ); $request->setPath(ApiRequest::PATH_MARKETING_PERMISSION); $replaceParams = array('{email}' => $email, '{state}' => $hasPermission ? 'true' : 'false'); $request->setReplaceParams($replaceParams); $response = $request->postRaw(''); return self::checkResponse($request, $response); }
php
public function update($email, $hasPermission) { $request = $this->initApiRequest( $this->account->getApiToken(Token::API_EMAIL), $this->account->getName(), $this->activeDomain ); $request->setPath(ApiRequest::PATH_MARKETING_PERMISSION); $replaceParams = array('{email}' => $email, '{state}' => $hasPermission ? 'true' : 'false'); $request->setReplaceParams($replaceParams); $response = $request->postRaw(''); return self::checkResponse($request, $response); }
[ "public", "function", "update", "(", "$", "email", ",", "$", "hasPermission", ")", "{", "$", "request", "=", "$", "this", "->", "initApiRequest", "(", "$", "this", "->", "account", "->", "getApiToken", "(", "Token", "::", "API_EMAIL", ")", ",", "$", "t...
Update customer marketing permission @param string $email @param bool $hasPermission @return bool
[ "Update", "customer", "marketing", "permission" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Operation/MarketingPermission.php#L64-L78
45,780
Nosto/nosto-php-sdk
src/Operation/Recommendation/AbstractOperation.php
AbstractOperation.execute
public function execute() { $request = $this->initGraphqlRequest(); $response = $request->postRaw( $this->buildPayload() ); if ($response->getCode() !== 200) { throw ExceptionBuilder::fromHttpRequestAndResponse($request, $response); } return ResultSetBuilder::fromHttpResponse($response); }
php
public function execute() { $request = $this->initGraphqlRequest(); $response = $request->postRaw( $this->buildPayload() ); if ($response->getCode() !== 200) { throw ExceptionBuilder::fromHttpRequestAndResponse($request, $response); } return ResultSetBuilder::fromHttpResponse($response); }
[ "public", "function", "execute", "(", ")", "{", "$", "request", "=", "$", "this", "->", "initGraphqlRequest", "(", ")", ";", "$", "response", "=", "$", "request", "->", "postRaw", "(", "$", "this", "->", "buildPayload", "(", ")", ")", ";", "if", "(",...
Returns the result @return ResultSet @throws AbstractHttpException @throws NostoException @throws HttpResponseException
[ "Returns", "the", "result" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Operation/Recommendation/AbstractOperation.php#L112-L123
45,781
Nosto/nosto-php-sdk
src/Mixins/HtmlEncoderTrait.php
HtmlEncoderTrait.varsToEncode
public function varsToEncode() { if ($this->isAutoEncodeAll() === true) { $allClassVariables = array(); $vars = SerializationHelper::getProperties($this); foreach ($vars as $classVar => $val) { if (HtmlMarkupSerializationHelper::encodableClassVariable($this, $classVar)) { $allClassVariables[] = $classVar; } } return $allClassVariables; } else { return $this->varsToEncode; } }
php
public function varsToEncode() { if ($this->isAutoEncodeAll() === true) { $allClassVariables = array(); $vars = SerializationHelper::getProperties($this); foreach ($vars as $classVar => $val) { if (HtmlMarkupSerializationHelper::encodableClassVariable($this, $classVar)) { $allClassVariables[] = $classVar; } } return $allClassVariables; } else { return $this->varsToEncode; } }
[ "public", "function", "varsToEncode", "(", ")", "{", "if", "(", "$", "this", "->", "isAutoEncodeAll", "(", ")", "===", "true", ")", "{", "$", "allClassVariables", "=", "array", "(", ")", ";", "$", "vars", "=", "SerializationHelper", "::", "getProperties", ...
Returns the class variables to encode @return array
[ "Returns", "the", "class", "variables", "to", "encode" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Mixins/HtmlEncoderTrait.php#L62-L76
45,782
Nosto/nosto-php-sdk
src/Request/Http/HttpRequest.php
HttpRequest.replaceQueryParamInUrl
public static function replaceQueryParamInUrl($param, $value, $url) { $parsedUrl = self::parseUrl($url); $queryString = isset($parsedUrl['query']) ? $parsedUrl['query'] : ''; $queryString = self::replaceQueryParam($param, $value, $queryString); $parsedUrl['query'] = $queryString; return self::buildUrl($parsedUrl); }
php
public static function replaceQueryParamInUrl($param, $value, $url) { $parsedUrl = self::parseUrl($url); $queryString = isset($parsedUrl['query']) ? $parsedUrl['query'] : ''; $queryString = self::replaceQueryParam($param, $value, $queryString); $parsedUrl['query'] = $queryString; return self::buildUrl($parsedUrl); }
[ "public", "static", "function", "replaceQueryParamInUrl", "(", "$", "param", ",", "$", "value", ",", "$", "url", ")", "{", "$", "parsedUrl", "=", "self", "::", "parseUrl", "(", "$", "url", ")", ";", "$", "queryString", "=", "isset", "(", "$", "parsedUr...
Replaces or adds a query parameter to a url. @param string $param the query param name to replace. @param mixed $value the query param value to replace. @param string $url the url. @return string the updated url.
[ "Replaces", "or", "adds", "a", "query", "parameter", "to", "a", "url", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpRequest.php#L144-L151
45,783
Nosto/nosto-php-sdk
src/Request/Http/HttpRequest.php
HttpRequest.replaceQueryParam
public static function replaceQueryParam($param, $value, $queryString) { $parsedQuery = self::parseQueryString($queryString); $parsedQuery[$param] = $value; return http_build_query($parsedQuery); }
php
public static function replaceQueryParam($param, $value, $queryString) { $parsedQuery = self::parseQueryString($queryString); $parsedQuery[$param] = $value; return http_build_query($parsedQuery); }
[ "public", "static", "function", "replaceQueryParam", "(", "$", "param", ",", "$", "value", ",", "$", "queryString", ")", "{", "$", "parsedQuery", "=", "self", "::", "parseQueryString", "(", "$", "queryString", ")", ";", "$", "parsedQuery", "[", "$", "param...
Replaces a parameter in a query string with given value. @param string $param the query param name to replace. @param mixed $value the query param value to replace. @param string $queryString the query string. @return string the updated query string.
[ "Replaces", "a", "parameter", "in", "a", "query", "string", "with", "given", "value", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpRequest.php#L173-L178
45,784
Nosto/nosto-php-sdk
src/Request/Http/HttpRequest.php
HttpRequest.buildUrl
public static function buildUrl(array $parts) { $scheme = isset($parts['scheme']) ? $parts['scheme'] . '://' : ''; $host = isset($parts['host']) ? $parts['host'] : ''; $port = isset($parts['port']) ? ':' . $parts['port'] : ''; $user = isset($parts['user']) ? $parts['user'] : ''; $pass = isset($parts['pass']) ? ':' . $parts['pass'] : ''; $pass = ($user || $pass) ? "$pass@" : ''; $path = isset($parts['path']) ? $parts['path'] : ''; $query = isset($parts['query']) ? '?' . $parts['query'] : ''; $fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : ''; return $scheme . $user . $pass . $host . $port . $path . $query . $fragment; }
php
public static function buildUrl(array $parts) { $scheme = isset($parts['scheme']) ? $parts['scheme'] . '://' : ''; $host = isset($parts['host']) ? $parts['host'] : ''; $port = isset($parts['port']) ? ':' . $parts['port'] : ''; $user = isset($parts['user']) ? $parts['user'] : ''; $pass = isset($parts['pass']) ? ':' . $parts['pass'] : ''; $pass = ($user || $pass) ? "$pass@" : ''; $path = isset($parts['path']) ? $parts['path'] : ''; $query = isset($parts['query']) ? '?' . $parts['query'] : ''; $fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : ''; return $scheme . $user . $pass . $host . $port . $path . $query . $fragment; }
[ "public", "static", "function", "buildUrl", "(", "array", "$", "parts", ")", "{", "$", "scheme", "=", "isset", "(", "$", "parts", "[", "'scheme'", "]", ")", "?", "$", "parts", "[", "'scheme'", "]", ".", "'://'", ":", "''", ";", "$", "host", "=", ...
Builds a url based on given parts. @see http://php.net/manual/en/function.parse-url.php @param array $parts part(s) of an URL in form of a string or associative array like parseUrl() returns. @return string
[ "Builds", "a", "url", "based", "on", "given", "parts", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpRequest.php#L203-L215
45,785
Nosto/nosto-php-sdk
src/Request/Http/HttpRequest.php
HttpRequest.replaceQueryParamsInUrl
public static function replaceQueryParamsInUrl(array $queryParams, $url) { if (empty($queryParams)) { return $url; } $parsedUrl = self::parseUrl($url); $queryString = isset($parsedUrl['query']) ? $parsedUrl['query'] : ''; foreach ($queryParams as $param => $value) { $queryString = self::replaceQueryParam($param, $value, $queryString); } $parsedUrl['query'] = $queryString; return self::buildUrl($parsedUrl); }
php
public static function replaceQueryParamsInUrl(array $queryParams, $url) { if (empty($queryParams)) { return $url; } $parsedUrl = self::parseUrl($url); $queryString = isset($parsedUrl['query']) ? $parsedUrl['query'] : ''; foreach ($queryParams as $param => $value) { $queryString = self::replaceQueryParam($param, $value, $queryString); } $parsedUrl['query'] = $queryString; return self::buildUrl($parsedUrl); }
[ "public", "static", "function", "replaceQueryParamsInUrl", "(", "array", "$", "queryParams", ",", "$", "url", ")", "{", "if", "(", "empty", "(", "$", "queryParams", ")", ")", "{", "return", "$", "url", ";", "}", "$", "parsedUrl", "=", "self", "::", "pa...
Replaces or adds a query parameters to a url. @param array $queryParams the query params to replace. @param string $url the url. @return string the updated url.
[ "Replaces", "or", "adds", "a", "query", "parameters", "to", "a", "url", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpRequest.php#L224-L236
45,786
Nosto/nosto-php-sdk
src/Request/Http/HttpRequest.php
HttpRequest.buildUserAgent
public static function buildUserAgent($platformName, $platformVersion, $pluginVersion) { self::$userAgent = sprintf( 'Nosto %s / %s %s', $pluginVersion, $platformName, $platformVersion ); }
php
public static function buildUserAgent($platformName, $platformVersion, $pluginVersion) { self::$userAgent = sprintf( 'Nosto %s / %s %s', $pluginVersion, $platformName, $platformVersion ); }
[ "public", "static", "function", "buildUserAgent", "(", "$", "platformName", ",", "$", "platformVersion", ",", "$", "pluginVersion", ")", "{", "self", "::", "$", "userAgent", "=", "sprintf", "(", "'Nosto %s / %s %s'", ",", "$", "pluginVersion", ",", "$", "platf...
Builds the custom-user agent by using the platform's name and version with the plugin version @param string $platformName the name of the platform using the SDK @param string $platformVersion the version of the platform using the SDK @param string $pluginVersion the version of the plugin using the SDK
[ "Builds", "the", "custom", "-", "user", "agent", "by", "using", "the", "platform", "s", "name", "and", "version", "with", "the", "plugin", "version" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpRequest.php#L246-L254
45,787
Nosto/nosto-php-sdk
src/Request/Http/HttpRequest.php
HttpRequest.setAuth
public function setAuth($type, $value) { switch ($type) { case self::AUTH_BASIC: // The use of base64 encoding for authorization headers follow the RFC 2617 standard for http // authentication (https://www.ietf.org/rfc/rfc2617.txt). $this->addHeader( self::HEADER_AUTHORIZATION, 'Basic ' . base64_encode(implode(':', $value)) ); break; case self::AUTH_BEARER: $this->addHeader(self::HEADER_AUTHORIZATION, 'Bearer ' . $value); break; default: throw new NostoException('Unsupported auth type.'); } }
php
public function setAuth($type, $value) { switch ($type) { case self::AUTH_BASIC: // The use of base64 encoding for authorization headers follow the RFC 2617 standard for http // authentication (https://www.ietf.org/rfc/rfc2617.txt). $this->addHeader( self::HEADER_AUTHORIZATION, 'Basic ' . base64_encode(implode(':', $value)) ); break; case self::AUTH_BEARER: $this->addHeader(self::HEADER_AUTHORIZATION, 'Bearer ' . $value); break; default: throw new NostoException('Unsupported auth type.'); } }
[ "public", "function", "setAuth", "(", "$", "type", ",", "$", "value", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "self", "::", "AUTH_BASIC", ":", "// The use of base64 encoding for authorization headers follow the RFC 2617 standard for http", "// authentica...
Setter for the request authentication header. @param string $type the auth type (use AUTH_ constants). @param mixed $value the auth header value, format depending on the auth type. @throws NostoException if an incorrect auth type is given.
[ "Setter", "for", "the", "request", "authentication", "header", "." ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpRequest.php#L352-L371
45,788
Nosto/nosto-php-sdk
src/Request/Http/HttpRequest.php
HttpRequest.postRaw
public function postRaw($data) { $this->content = $data; $url = $this->url; if (!empty($this->replaceParams)) { $url = self::buildUri($url, $this->replaceParams); } $this->adapter->setResponseTimeout($this->getResponseTimeout()); $this->adapter->setConnectTimeout($this->getConnectTimeout()); return $this->adapter->post( $url, array( self::HEADERS => $this->headers, self::CONTENT => $this->content, ) ); }
php
public function postRaw($data) { $this->content = $data; $url = $this->url; if (!empty($this->replaceParams)) { $url = self::buildUri($url, $this->replaceParams); } $this->adapter->setResponseTimeout($this->getResponseTimeout()); $this->adapter->setConnectTimeout($this->getConnectTimeout()); return $this->adapter->post( $url, array( self::HEADERS => $this->headers, self::CONTENT => $this->content, ) ); }
[ "public", "function", "postRaw", "(", "$", "data", ")", "{", "$", "this", "->", "content", "=", "$", "data", ";", "$", "url", "=", "$", "this", "->", "url", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "replaceParams", ")", ")", "{", "...
Makes a POST request with the raw data @param string $data @return HttpResponse the response as returned by the endpoint
[ "Makes", "a", "POST", "request", "with", "the", "raw", "data" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpRequest.php#L411-L428
45,789
Nosto/nosto-php-sdk
src/Request/Http/HttpRequest.php
HttpRequest.put
public function put($content) { $this->content = SerializationHelper::serialize($content); $url = $this->url; if (!empty($this->replaceParams)) { $url = self::buildUri($url, $this->replaceParams); } $this->adapter->setResponseTimeout($this->getResponseTimeout()); $this->adapter->setConnectTimeout($this->getConnectTimeout()); return $this->adapter->put( $url, array( self::HEADERS => $this->headers, self::CONTENT => $this->content, ) ); }
php
public function put($content) { $this->content = SerializationHelper::serialize($content); $url = $this->url; if (!empty($this->replaceParams)) { $url = self::buildUri($url, $this->replaceParams); } $this->adapter->setResponseTimeout($this->getResponseTimeout()); $this->adapter->setConnectTimeout($this->getConnectTimeout()); return $this->adapter->put( $url, array( self::HEADERS => $this->headers, self::CONTENT => $this->content, ) ); }
[ "public", "function", "put", "(", "$", "content", ")", "{", "$", "this", "->", "content", "=", "SerializationHelper", "::", "serialize", "(", "$", "content", ")", ";", "$", "url", "=", "$", "this", "->", "url", ";", "if", "(", "!", "empty", "(", "$...
Makes a PUT request with the specified content to the configured endpoint @param mixed $content the object to be serialized to JSON and sent @return HttpResponse the response as returned by the endpoint
[ "Makes", "a", "PUT", "request", "with", "the", "specified", "content", "to", "the", "configured", "endpoint" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpRequest.php#L463-L480
45,790
Nosto/nosto-php-sdk
src/Request/Http/HttpRequest.php
HttpRequest.get
public function get() { $url = $this->url; if (!empty($this->replaceParams)) { $url = self::buildUri($url, $this->replaceParams); } if (!empty($this->queryParams)) { $url .= '?' . http_build_query($this->queryParams); } $this->adapter->setResponseTimeout($this->getResponseTimeout()); $this->adapter->setConnectTimeout($this->getConnectTimeout()); return $this->adapter->get( $url, array( self::HEADERS => $this->headers, ) ); }
php
public function get() { $url = $this->url; if (!empty($this->replaceParams)) { $url = self::buildUri($url, $this->replaceParams); } if (!empty($this->queryParams)) { $url .= '?' . http_build_query($this->queryParams); } $this->adapter->setResponseTimeout($this->getResponseTimeout()); $this->adapter->setConnectTimeout($this->getConnectTimeout()); return $this->adapter->get( $url, array( self::HEADERS => $this->headers, ) ); }
[ "public", "function", "get", "(", ")", "{", "$", "url", "=", "$", "this", "->", "url", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "replaceParams", ")", ")", "{", "$", "url", "=", "self", "::", "buildUri", "(", "$", "url", ",", "$", ...
Makes a GET request with the specified content to the configured endpoint @return HttpResponse the response as returned by the endpoint
[ "Makes", "a", "GET", "request", "with", "the", "specified", "content", "to", "the", "configured", "endpoint" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpRequest.php#L487-L505
45,791
Nosto/nosto-php-sdk
src/Request/Http/HttpRequest.php
HttpRequest.delete
public function delete() { $url = $this->url; if (!empty($this->replaceParams)) { $url = self::buildUri($url, $this->replaceParams); } $this->adapter->setResponseTimeout($this->getResponseTimeout()); $this->adapter->setConnectTimeout($this->getConnectTimeout()); return $this->adapter->delete( $url, array( self::HEADERS => $this->headers, ) ); }
php
public function delete() { $url = $this->url; if (!empty($this->replaceParams)) { $url = self::buildUri($url, $this->replaceParams); } $this->adapter->setResponseTimeout($this->getResponseTimeout()); $this->adapter->setConnectTimeout($this->getConnectTimeout()); return $this->adapter->delete( $url, array( self::HEADERS => $this->headers, ) ); }
[ "public", "function", "delete", "(", ")", "{", "$", "url", "=", "$", "this", "->", "url", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "replaceParams", ")", ")", "{", "$", "url", "=", "self", "::", "buildUri", "(", "$", "url", ",", "$"...
Makes a DELETE request with the specified content to the configured endpoint @return HttpResponse the response as returned by the endpoint
[ "Makes", "a", "DELETE", "request", "with", "the", "specified", "content", "to", "the", "configured", "endpoint" ]
cbee56de27e613c9c594814476e53886e6fd7f38
https://github.com/Nosto/nosto-php-sdk/blob/cbee56de27e613c9c594814476e53886e6fd7f38/src/Request/Http/HttpRequest.php#L512-L527
45,792
bestit/PHP_CodeSniffer
src/Standards/BestIt/Sniffs/Formatting/AlphabeticClassContentSniff.php
AlphabeticClassContentSniff.checkAndRegisterSortingProblems
private function checkAndRegisterSortingProblems(array $foundContentsOrg, array $foundContentsSorted): void { $checkIndex = 0; foreach ($foundContentsOrg as $foundContentPos => $foundContent) { if ($foundContentsSorted[$checkIndex++] !== $foundContent) { $this->file->getBaseFile()->addWarning( self::MESSAGE_SORT_ALPHABETICALLY, $foundContentPos, static::CODE_SORT_ALPHABETICALLY ); } } }
php
private function checkAndRegisterSortingProblems(array $foundContentsOrg, array $foundContentsSorted): void { $checkIndex = 0; foreach ($foundContentsOrg as $foundContentPos => $foundContent) { if ($foundContentsSorted[$checkIndex++] !== $foundContent) { $this->file->getBaseFile()->addWarning( self::MESSAGE_SORT_ALPHABETICALLY, $foundContentPos, static::CODE_SORT_ALPHABETICALLY ); } } }
[ "private", "function", "checkAndRegisterSortingProblems", "(", "array", "$", "foundContentsOrg", ",", "array", "$", "foundContentsSorted", ")", ":", "void", "{", "$", "checkIndex", "=", "0", ";", "foreach", "(", "$", "foundContentsOrg", "as", "$", "foundContentPos...
Checks the sorting of both arrays and registered warnings, if a token is not on the correct position. @param array $foundContentsOrg The original contents with their position. @param array $foundContentsSorted The sorted contents without their position as array key. @return void
[ "Checks", "the", "sorting", "of", "both", "arrays", "and", "registered", "warnings", "if", "a", "token", "is", "not", "on", "the", "correct", "position", "." ]
a80e1f24642858a0ad20301661037c321128d021
https://github.com/bestit/PHP_CodeSniffer/blob/a80e1f24642858a0ad20301661037c321128d021/src/Standards/BestIt/Sniffs/Formatting/AlphabeticClassContentSniff.php#L46-L59
45,793
bestit/PHP_CodeSniffer
src/Standards/BestIt/Sniffs/Formatting/AlphabeticClassContentSniff.php
AlphabeticClassContentSniff.checkAndRegisterSortingProblemsOfTypes
private function checkAndRegisterSortingProblemsOfTypes(int $token): void { $foundContentsOrg = $this->getContentsOfTokenType($token); $foundContentsSorted = $this->sortTokensWithoutPos($foundContentsOrg); $this->checkAndRegisterSortingProblems($foundContentsOrg, $foundContentsSorted); }
php
private function checkAndRegisterSortingProblemsOfTypes(int $token): void { $foundContentsOrg = $this->getContentsOfTokenType($token); $foundContentsSorted = $this->sortTokensWithoutPos($foundContentsOrg); $this->checkAndRegisterSortingProblems($foundContentsOrg, $foundContentsSorted); }
[ "private", "function", "checkAndRegisterSortingProblemsOfTypes", "(", "int", "$", "token", ")", ":", "void", "{", "$", "foundContentsOrg", "=", "$", "this", "->", "getContentsOfTokenType", "(", "$", "token", ")", ";", "$", "foundContentsSorted", "=", "$", "this"...
Loads every content for the token type and checks their sorting. @param int $token @return void
[ "Loads", "every", "content", "for", "the", "token", "type", "and", "checks", "their", "sorting", "." ]
a80e1f24642858a0ad20301661037c321128d021
https://github.com/bestit/PHP_CodeSniffer/blob/a80e1f24642858a0ad20301661037c321128d021/src/Standards/BestIt/Sniffs/Formatting/AlphabeticClassContentSniff.php#L68-L75
45,794
bestit/PHP_CodeSniffer
src/Standards/BestIt/Sniffs/Formatting/AlphabeticClassContentSniff.php
AlphabeticClassContentSniff.getContentsOfTokenType
private function getContentsOfTokenType(int $token): array { $helper = new PropertyHelper($this->file); $tokenPoss = TokenHelper::findNextAll( $this->file->getBaseFile(), [$token], $this->stackPos + 1, $this->token['scope_closer'] ); $foundContentsOrg = []; foreach ($tokenPoss as $tokenPos) { $tokenContentPos = $tokenPos; if (($token === T_VARIABLE) && (!$helper->isProperty($tokenPos))) { continue; } if ($token !== T_VARIABLE) { $tokenContentPos = $this->file->findNext([T_STRING], $tokenPos); } $foundContentsOrg[$tokenContentPos] = $this->tokens[$tokenContentPos]['content']; } return $foundContentsOrg; }
php
private function getContentsOfTokenType(int $token): array { $helper = new PropertyHelper($this->file); $tokenPoss = TokenHelper::findNextAll( $this->file->getBaseFile(), [$token], $this->stackPos + 1, $this->token['scope_closer'] ); $foundContentsOrg = []; foreach ($tokenPoss as $tokenPos) { $tokenContentPos = $tokenPos; if (($token === T_VARIABLE) && (!$helper->isProperty($tokenPos))) { continue; } if ($token !== T_VARIABLE) { $tokenContentPos = $this->file->findNext([T_STRING], $tokenPos); } $foundContentsOrg[$tokenContentPos] = $this->tokens[$tokenContentPos]['content']; } return $foundContentsOrg; }
[ "private", "function", "getContentsOfTokenType", "(", "int", "$", "token", ")", ":", "array", "{", "$", "helper", "=", "new", "PropertyHelper", "(", "$", "this", "->", "file", ")", ";", "$", "tokenPoss", "=", "TokenHelper", "::", "findNextAll", "(", "$", ...
Returns the contents of the token type. @param int $token The contents with their position as array key. @return array
[ "Returns", "the", "contents", "of", "the", "token", "type", "." ]
a80e1f24642858a0ad20301661037c321128d021
https://github.com/bestit/PHP_CodeSniffer/blob/a80e1f24642858a0ad20301661037c321128d021/src/Standards/BestIt/Sniffs/Formatting/AlphabeticClassContentSniff.php#L84-L111
45,795
joomla-framework/ldap
src/LdapClient.php
LdapClient.anonymous_bind
public function anonymous_bind() { if (!$this->isConnected()) { if (!$this->connect()) { return false; } } $this->isBound = ldap_bind($this->resource); return $this->isBound; }
php
public function anonymous_bind() { if (!$this->isConnected()) { if (!$this->connect()) { return false; } } $this->isBound = ldap_bind($this->resource); return $this->isBound; }
[ "public", "function", "anonymous_bind", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isConnected", "(", ")", ")", "{", "if", "(", "!", "$", "this", "->", "connect", "(", ")", ")", "{", "return", "false", ";", "}", "}", "$", "this", "->", ...
Anonymously binds to LDAP directory @return boolean @since 1.0
[ "Anonymously", "binds", "to", "LDAP", "directory" ]
2b81fb2bb0a95b66d8aa1e3a4b6875990f5adf46
https://github.com/joomla-framework/ldap/blob/2b81fb2bb0a95b66d8aa1e3a4b6875990f5adf46/src/LdapClient.php#L296-L309
45,796
joomla-framework/ldap
src/LdapClient.php
LdapClient.unbind
public function unbind() { if ($this->isBound && $this->resource && \is_resource($this->resource)) { return ldap_unbind($this->resource); } return true; }
php
public function unbind() { if ($this->isBound && $this->resource && \is_resource($this->resource)) { return ldap_unbind($this->resource); } return true; }
[ "public", "function", "unbind", "(", ")", "{", "if", "(", "$", "this", "->", "isBound", "&&", "$", "this", "->", "resource", "&&", "\\", "is_resource", "(", "$", "this", "->", "resource", ")", ")", "{", "return", "ldap_unbind", "(", "$", "this", "->"...
Unbinds from the LDAP directory @return boolean @since 1.3.0
[ "Unbinds", "from", "the", "LDAP", "directory" ]
2b81fb2bb0a95b66d8aa1e3a4b6875990f5adf46
https://github.com/joomla-framework/ldap/blob/2b81fb2bb0a95b66d8aa1e3a4b6875990f5adf46/src/LdapClient.php#L356-L364
45,797
joomla-framework/ldap
src/LdapClient.php
LdapClient.simple_search
public function simple_search($search) { $results = explode(';', $search); foreach ($results as $key => $result) { $results[$key] = '(' . $result . ')'; } return $this->search($results); }
php
public function simple_search($search) { $results = explode(';', $search); foreach ($results as $key => $result) { $results[$key] = '(' . $result . ')'; } return $this->search($results); }
[ "public", "function", "simple_search", "(", "$", "search", ")", "{", "$", "results", "=", "explode", "(", "';'", ",", "$", "search", ")", ";", "foreach", "(", "$", "results", "as", "$", "key", "=>", "$", "result", ")", "{", "$", "results", "[", "$"...
Perform an LDAP search using comma separated search strings @param string $search search string of search values @return array Search results @since 1.0
[ "Perform", "an", "LDAP", "search", "using", "comma", "separated", "search", "strings" ]
2b81fb2bb0a95b66d8aa1e3a4b6875990f5adf46
https://github.com/joomla-framework/ldap/blob/2b81fb2bb0a95b66d8aa1e3a4b6875990f5adf46/src/LdapClient.php#L375-L385
45,798
joomla-framework/ldap
src/LdapClient.php
LdapClient.replace
public function replace($dn, $attribute) { if (!$this->isBound || !$this->isConnected()) { return false; } return ldap_mod_replace($this->resource, $dn, $attribute); }
php
public function replace($dn, $attribute) { if (!$this->isBound || !$this->isConnected()) { return false; } return ldap_mod_replace($this->resource, $dn, $attribute); }
[ "public", "function", "replace", "(", "$", "dn", ",", "$", "attribute", ")", "{", "if", "(", "!", "$", "this", "->", "isBound", "||", "!", "$", "this", "->", "isConnected", "(", ")", ")", "{", "return", "false", ";", "}", "return", "ldap_mod_replace"...
Replace attribute values with new ones @param string $dn The DN which contains the attribute you want to replace @param string $attribute The attribute values you want to replace @return boolean @since 1.0
[ "Replace", "attribute", "values", "with", "new", "ones" ]
2b81fb2bb0a95b66d8aa1e3a4b6875990f5adf46
https://github.com/joomla-framework/ldap/blob/2b81fb2bb0a95b66d8aa1e3a4b6875990f5adf46/src/LdapClient.php#L471-L479
45,799
joomla-framework/ldap
src/LdapClient.php
LdapClient.modify
public function modify($dn, $attribute) { if (!$this->isBound || !$this->isConnected()) { return false; } return ldap_modify($this->resource, $dn, $attribute); }
php
public function modify($dn, $attribute) { if (!$this->isBound || !$this->isConnected()) { return false; } return ldap_modify($this->resource, $dn, $attribute); }
[ "public", "function", "modify", "(", "$", "dn", ",", "$", "attribute", ")", "{", "if", "(", "!", "$", "this", "->", "isBound", "||", "!", "$", "this", "->", "isConnected", "(", ")", ")", "{", "return", "false", ";", "}", "return", "ldap_modify", "(...
Modify an LDAP entry @param string $dn The DN which contains the attribute you want to modify @param string $attribute The attribute values you want to modify @return boolean @since 1.0
[ "Modify", "an", "LDAP", "entry" ]
2b81fb2bb0a95b66d8aa1e3a4b6875990f5adf46
https://github.com/joomla-framework/ldap/blob/2b81fb2bb0a95b66d8aa1e3a4b6875990f5adf46/src/LdapClient.php#L491-L499