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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
220,900 | CachetHQ/Cachet | app/Bus/Handlers/Commands/IncidentUpdate/UpdateIncidentUpdateCommandHandler.php | UpdateIncidentUpdateCommandHandler.handle | public function handle(UpdateIncidentUpdateCommand $command)
{
$command->update->update($this->filter($command));
event(new IncidentUpdateWasUpdatedEvent($this->auth->user(), $command->update));
return $command->update;
} | php | public function handle(UpdateIncidentUpdateCommand $command)
{
$command->update->update($this->filter($command));
event(new IncidentUpdateWasUpdatedEvent($this->auth->user(), $command->update));
return $command->update;
} | [
"public",
"function",
"handle",
"(",
"UpdateIncidentUpdateCommand",
"$",
"command",
")",
"{",
"$",
"command",
"->",
"update",
"->",
"update",
"(",
"$",
"this",
"->",
"filter",
"(",
"$",
"command",
")",
")",
";",
"event",
"(",
"new",
"IncidentUpdateWasUpdated... | Handle the update incident update command.
@param \CachetHQ\Cachet\Bus\Commands\IncidentUpdate\UpdateIncidentUpdateCommand $command
@return \CachetHQ\Cachet\Models\IncidentUpdate | [
"Handle",
"the",
"update",
"incident",
"update",
"command",
"."
] | ae35e1f9d0ce643ca2dbc544fa4172861ee56288 | https://github.com/CachetHQ/Cachet/blob/ae35e1f9d0ce643ca2dbc544fa4172861ee56288/app/Bus/Handlers/Commands/IncidentUpdate/UpdateIncidentUpdateCommandHandler.php#L51-L58 |
220,901 | CachetHQ/Cachet | app/Bus/Handlers/Commands/Subscriber/UnsubscribeSubscriptionCommandHandler.php | UnsubscribeSubscriptionCommandHandler.handle | public function handle(UnsubscribeSubscriptionCommand $command)
{
$subscription = $command->subscription;
event(new SubscriberHasUnsubscribedEvent($subscription->subscriber));
$subscription->delete();
} | php | public function handle(UnsubscribeSubscriptionCommand $command)
{
$subscription = $command->subscription;
event(new SubscriberHasUnsubscribedEvent($subscription->subscriber));
$subscription->delete();
} | [
"public",
"function",
"handle",
"(",
"UnsubscribeSubscriptionCommand",
"$",
"command",
")",
"{",
"$",
"subscription",
"=",
"$",
"command",
"->",
"subscription",
";",
"event",
"(",
"new",
"SubscriberHasUnsubscribedEvent",
"(",
"$",
"subscription",
"->",
"subscriber",... | Handle the unsubscribe subscription command.
@param \CachetHQ\Cachet\Bus\Commands\Subscriber\UnsubscribeSubscriptionCommand $command
@return void | [
"Handle",
"the",
"unsubscribe",
"subscription",
"command",
"."
] | ae35e1f9d0ce643ca2dbc544fa4172861ee56288 | https://github.com/CachetHQ/Cachet/blob/ae35e1f9d0ce643ca2dbc544fa4172861ee56288/app/Bus/Handlers/Commands/Subscriber/UnsubscribeSubscriptionCommandHandler.php#L27-L34 |
220,902 | CachetHQ/Cachet | app/Http/Controllers/Dashboard/UserController.php | UserController.postUser | public function postUser()
{
$userData = array_filter(Binput::only(['username', 'email', 'password', 'google2fa']));
$enable2FA = (bool) Arr::pull($userData, 'google2fa');
// Let's enable/disable auth
if ($enable2FA && !Auth::user()->hasTwoFactor) {
event(new UserEnable... | php | public function postUser()
{
$userData = array_filter(Binput::only(['username', 'email', 'password', 'google2fa']));
$enable2FA = (bool) Arr::pull($userData, 'google2fa');
// Let's enable/disable auth
if ($enable2FA && !Auth::user()->hasTwoFactor) {
event(new UserEnable... | [
"public",
"function",
"postUser",
"(",
")",
"{",
"$",
"userData",
"=",
"array_filter",
"(",
"Binput",
"::",
"only",
"(",
"[",
"'username'",
",",
"'email'",
",",
"'password'",
",",
"'google2fa'",
"]",
")",
")",
";",
"$",
"enable2FA",
"=",
"(",
"bool",
"... | Updates the current user.
@return \Illuminate\View\View | [
"Updates",
"the",
"current",
"user",
"."
] | ae35e1f9d0ce643ca2dbc544fa4172861ee56288 | https://github.com/CachetHQ/Cachet/blob/ae35e1f9d0ce643ca2dbc544fa4172861ee56288/app/Http/Controllers/Dashboard/UserController.php#L44-L70 |
220,903 | CachetHQ/Cachet | app/Http/Controllers/Dashboard/UserController.php | UserController.regenerateApiKey | public function regenerateApiKey(User $user)
{
$user->api_key = User::generateApiKey();
$user->save();
event(new UserRegeneratedApiTokenEvent($user));
return cachet_redirect('dashboard.user');
} | php | public function regenerateApiKey(User $user)
{
$user->api_key = User::generateApiKey();
$user->save();
event(new UserRegeneratedApiTokenEvent($user));
return cachet_redirect('dashboard.user');
} | [
"public",
"function",
"regenerateApiKey",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"user",
"->",
"api_key",
"=",
"User",
"::",
"generateApiKey",
"(",
")",
";",
"$",
"user",
"->",
"save",
"(",
")",
";",
"event",
"(",
"new",
"UserRegeneratedApiTokenEvent",
... | Regenerates the users API key.
@param \CachetHQ\Cachet\Models\User $user
@return \Illuminate\View\View | [
"Regenerates",
"the",
"users",
"API",
"key",
"."
] | ae35e1f9d0ce643ca2dbc544fa4172861ee56288 | https://github.com/CachetHQ/Cachet/blob/ae35e1f9d0ce643ca2dbc544fa4172861ee56288/app/Http/Controllers/Dashboard/UserController.php#L79-L87 |
220,904 | CachetHQ/Cachet | app/Http/Controllers/SignupController.php | SignupController.getSignup | public function getSignup($code = null)
{
if ($code === null) {
throw new NotFoundHttpException();
}
$invite = Invite::where('code', '=', $code)->first();
if (!$invite || $invite->is_claimed) {
throw new BadRequestHttpException();
}
return V... | php | public function getSignup($code = null)
{
if ($code === null) {
throw new NotFoundHttpException();
}
$invite = Invite::where('code', '=', $code)->first();
if (!$invite || $invite->is_claimed) {
throw new BadRequestHttpException();
}
return V... | [
"public",
"function",
"getSignup",
"(",
"$",
"code",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"code",
"===",
"null",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
")",
";",
"}",
"$",
"invite",
"=",
"Invite",
"::",
"where",
"(",
"'code'",
",",... | Handle the signup with invite.
@param string|null $code
@return \Illuminate\View\View | [
"Handle",
"the",
"signup",
"with",
"invite",
"."
] | ae35e1f9d0ce643ca2dbc544fa4172861ee56288 | https://github.com/CachetHQ/Cachet/blob/ae35e1f9d0ce643ca2dbc544fa4172861ee56288/app/Http/Controllers/SignupController.php#L34-L50 |
220,905 | CachetHQ/Cachet | app/Http/Controllers/SignupController.php | SignupController.postSignup | public function postSignup($code = null)
{
if ($code === null) {
throw new NotFoundHttpException();
}
$invite = Invite::where('code', '=', $code)->first();
if (!$invite || $invite->is_claimed) {
throw new BadRequestHttpException();
}
try {
... | php | public function postSignup($code = null)
{
if ($code === null) {
throw new NotFoundHttpException();
}
$invite = Invite::where('code', '=', $code)->first();
if (!$invite || $invite->is_claimed) {
throw new BadRequestHttpException();
}
try {
... | [
"public",
"function",
"postSignup",
"(",
"$",
"code",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"code",
"===",
"null",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
")",
";",
"}",
"$",
"invite",
"=",
"Invite",
"::",
"where",
"(",
"'code'",
","... | Handle a signup request.
@param string|null $code
@return \Illuminate\View\View | [
"Handle",
"a",
"signup",
"request",
"."
] | ae35e1f9d0ce643ca2dbc544fa4172861ee56288 | https://github.com/CachetHQ/Cachet/blob/ae35e1f9d0ce643ca2dbc544fa4172861ee56288/app/Http/Controllers/SignupController.php#L59-L89 |
220,906 | CachetHQ/Cachet | app/Http/Controllers/Api/SubscriberController.php | SubscriberController.index | public function index()
{
$subscribers = Subscriber::paginate(Binput::get('per_page', 20));
return $this->paginator($subscribers, Request::instance());
} | php | public function index()
{
$subscribers = Subscriber::paginate(Binput::get('per_page', 20));
return $this->paginator($subscribers, Request::instance());
} | [
"public",
"function",
"index",
"(",
")",
"{",
"$",
"subscribers",
"=",
"Subscriber",
"::",
"paginate",
"(",
"Binput",
"::",
"get",
"(",
"'per_page'",
",",
"20",
")",
")",
";",
"return",
"$",
"this",
"->",
"paginator",
"(",
"$",
"subscribers",
",",
"Req... | Get all subscribers.
@return \Illuminate\Http\JsonResponse | [
"Get",
"all",
"subscribers",
"."
] | ae35e1f9d0ce643ca2dbc544fa4172861ee56288 | https://github.com/CachetHQ/Cachet/blob/ae35e1f9d0ce643ca2dbc544fa4172861ee56288/app/Http/Controllers/Api/SubscriberController.php#L36-L41 |
220,907 | tymondesigns/jwt-auth | src/Http/Parser/RouteParams.php | RouteParams.parse | public function parse(Request $request)
{
$route = $request->route();
// Route may not be an instance of Illuminate\Routing\Route
// (it's an array in Lumen <5.2) or not exist at all
// (if the request was never dispatched)
if (is_callable([$route, 'parameter'])) {
... | php | public function parse(Request $request)
{
$route = $request->route();
// Route may not be an instance of Illuminate\Routing\Route
// (it's an array in Lumen <5.2) or not exist at all
// (if the request was never dispatched)
if (is_callable([$route, 'parameter'])) {
... | [
"public",
"function",
"parse",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"route",
"=",
"$",
"request",
"->",
"route",
"(",
")",
";",
"// Route may not be an instance of Illuminate\\Routing\\Route",
"// (it's an array in Lumen <5.2) or not exist at all",
"// (if the req... | Try to get the token from the route parameters.
@param \Illuminate\Http\Request $request
@return null|string | [
"Try",
"to",
"get",
"the",
"token",
"from",
"the",
"route",
"parameters",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Http/Parser/RouteParams.php#L28-L38 |
220,908 | tymondesigns/jwt-auth | src/Providers/Storage/Illuminate.php | Illuminate.add | public function add($key, $value, $minutes)
{
// If the laravel version is 5.8 or higher then convert minutes to seconds.
if ($this->laravelVersion !== null
&& is_int($minutes)
&& version_compare($this->laravelVersion, '5.8', '>=')
) {
$minutes = $minutes ... | php | public function add($key, $value, $minutes)
{
// If the laravel version is 5.8 or higher then convert minutes to seconds.
if ($this->laravelVersion !== null
&& is_int($minutes)
&& version_compare($this->laravelVersion, '5.8', '>=')
) {
$minutes = $minutes ... | [
"public",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"minutes",
")",
"{",
"// If the laravel version is 5.8 or higher then convert minutes to seconds.",
"if",
"(",
"$",
"this",
"->",
"laravelVersion",
"!==",
"null",
"&&",
"is_int",
"(",
"$",
... | Add a new item into storage.
@param string $key
@param mixed $value
@param int $minutes
@return void | [
"Add",
"a",
"new",
"item",
"into",
"storage",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Providers/Storage/Illuminate.php#L66-L77 |
220,909 | tymondesigns/jwt-auth | src/Providers/Storage/Illuminate.php | Illuminate.cache | protected function cache()
{
if ($this->supportsTags === null) {
$this->determineTagSupport();
}
if ($this->supportsTags) {
return $this->cache->tags($this->tag);
}
return $this->cache;
} | php | protected function cache()
{
if ($this->supportsTags === null) {
$this->determineTagSupport();
}
if ($this->supportsTags) {
return $this->cache->tags($this->tag);
}
return $this->cache;
} | [
"protected",
"function",
"cache",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"supportsTags",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"determineTagSupport",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"supportsTags",
")",
"{",
"return",
"$... | Return the cache instance with tags attached.
@return \Illuminate\Contracts\Cache\Repository | [
"Return",
"the",
"cache",
"instance",
"with",
"tags",
"attached",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Providers/Storage/Illuminate.php#L131-L142 |
220,910 | tymondesigns/jwt-auth | src/Providers/Auth/Sentinel.php | Sentinel.byId | public function byId($id)
{
if ($user = $this->sentinel->getUserRepository()->findById($id)) {
$this->sentinel->setUser($user);
return true;
}
return false;
} | php | public function byId($id)
{
if ($user = $this->sentinel->getUserRepository()->findById($id)) {
$this->sentinel->setUser($user);
return true;
}
return false;
} | [
"public",
"function",
"byId",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"user",
"=",
"$",
"this",
"->",
"sentinel",
"->",
"getUserRepository",
"(",
")",
"->",
"findById",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"sentinel",
"->",
"setUser"... | Authenticate a user via the id.
@param mixed $id
@return bool | [
"Authenticate",
"a",
"user",
"via",
"the",
"id",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Providers/Auth/Sentinel.php#L57-L66 |
220,911 | tymondesigns/jwt-auth | src/Payload.php | Payload.matches | public function matches(array $values, $strict = false)
{
if (empty($values)) {
return false;
}
$claims = $this->getClaims();
foreach ($values as $key => $value) {
if (! $claims->has($key) || ! $claims->get($key)->matches($value, $strict)) {
... | php | public function matches(array $values, $strict = false)
{
if (empty($values)) {
return false;
}
$claims = $this->getClaims();
foreach ($values as $key => $value) {
if (! $claims->has($key) || ! $claims->get($key)->matches($value, $strict)) {
... | [
"public",
"function",
"matches",
"(",
"array",
"$",
"values",
",",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"values",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"claims",
"=",
"$",
"this",
"->",
"getClaims",
"(",
... | Checks if a payload matches some expected values.
@param array $values
@param bool $strict
@return bool | [
"Checks",
"if",
"a",
"payload",
"matches",
"some",
"expected",
"values",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Payload.php#L67-L82 |
220,912 | tymondesigns/jwt-auth | src/Claims/Collection.php | Collection.getByClaimName | public function getByClaimName($name, callable $callback = null, $default = null)
{
return $this->filter(function (Claim $claim) use ($name) {
return $claim->getName() === $name;
})->first($callback, $default);
} | php | public function getByClaimName($name, callable $callback = null, $default = null)
{
return $this->filter(function (Claim $claim) use ($name) {
return $claim->getName() === $name;
})->first($callback, $default);
} | [
"public",
"function",
"getByClaimName",
"(",
"$",
"name",
",",
"callable",
"$",
"callback",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"filter",
"(",
"function",
"(",
"Claim",
"$",
"claim",
")",
"use",
"(",
... | Get a Claim instance by it's unique name.
@param string $name
@param callable $callback
@param mixed $default
@return \Tymon\JWTAuth\Claims\Claim | [
"Get",
"a",
"Claim",
"instance",
"by",
"it",
"s",
"unique",
"name",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Claims/Collection.php#L40-L45 |
220,913 | tymondesigns/jwt-auth | src/Claims/Collection.php | Collection.validate | public function validate($context = 'payload')
{
$args = func_get_args();
array_shift($args);
$this->each(function ($claim) use ($context, $args) {
call_user_func_array(
[$claim, 'validate'.Str::ucfirst($context)],
$args
);
});... | php | public function validate($context = 'payload')
{
$args = func_get_args();
array_shift($args);
$this->each(function ($claim) use ($context, $args) {
call_user_func_array(
[$claim, 'validate'.Str::ucfirst($context)],
$args
);
});... | [
"public",
"function",
"validate",
"(",
"$",
"context",
"=",
"'payload'",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(",
"$",
"args",
")",
";",
"$",
"this",
"->",
"each",
"(",
"function",
"(",
"$",
"claim",
")",
"use",... | Validate each claim under a given context.
@param string $context
@return $this | [
"Validate",
"each",
"claim",
"under",
"a",
"given",
"context",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Claims/Collection.php#L54-L67 |
220,914 | tymondesigns/jwt-auth | src/Claims/Collection.php | Collection.sanitizeClaims | private function sanitizeClaims($items)
{
$claims = [];
foreach ($items as $key => $value) {
if (! is_string($key) && $value instanceof Claim) {
$key = $value->getName();
}
$claims[$key] = $value;
}
return $claims;
} | php | private function sanitizeClaims($items)
{
$claims = [];
foreach ($items as $key => $value) {
if (! is_string($key) && $value instanceof Claim) {
$key = $value->getName();
}
$claims[$key] = $value;
}
return $claims;
} | [
"private",
"function",
"sanitizeClaims",
"(",
"$",
"items",
")",
"{",
"$",
"claims",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
"&&",
"$",
... | Ensure that the given claims array is keyed by the claim name.
@param mixed $items
@return array | [
"Ensure",
"that",
"the",
"given",
"claims",
"array",
"is",
"keyed",
"by",
"the",
"claim",
"name",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Claims/Collection.php#L108-L120 |
220,915 | tymondesigns/jwt-auth | src/Blacklist.php | Blacklist.has | public function has(Payload $payload)
{
$val = $this->storage->get($this->getKey($payload));
// exit early if the token was blacklisted forever,
if ($val === 'forever') {
return true;
}
// check whether the expiry + grace has past
return ! empty($val) &&... | php | public function has(Payload $payload)
{
$val = $this->storage->get($this->getKey($payload));
// exit early if the token was blacklisted forever,
if ($val === 'forever') {
return true;
}
// check whether the expiry + grace has past
return ! empty($val) &&... | [
"public",
"function",
"has",
"(",
"Payload",
"$",
"payload",
")",
"{",
"$",
"val",
"=",
"$",
"this",
"->",
"storage",
"->",
"get",
"(",
"$",
"this",
"->",
"getKey",
"(",
"$",
"payload",
")",
")",
";",
"// exit early if the token was blacklisted forever,",
... | Determine whether the token has been blacklisted.
@param \Tymon\JWTAuth\Payload $payload
@return bool | [
"Determine",
"whether",
"the",
"token",
"has",
"been",
"blacklisted",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Blacklist.php#L127-L138 |
220,916 | tymondesigns/jwt-auth | src/Support/Utils.php | Utils.isPast | public static function isPast($timestamp, $leeway = 0)
{
$timestamp = static::timestamp($timestamp);
return $leeway > 0
? $timestamp->addSeconds($leeway)->isPast()
: $timestamp->isPast();
} | php | public static function isPast($timestamp, $leeway = 0)
{
$timestamp = static::timestamp($timestamp);
return $leeway > 0
? $timestamp->addSeconds($leeway)->isPast()
: $timestamp->isPast();
} | [
"public",
"static",
"function",
"isPast",
"(",
"$",
"timestamp",
",",
"$",
"leeway",
"=",
"0",
")",
"{",
"$",
"timestamp",
"=",
"static",
"::",
"timestamp",
"(",
"$",
"timestamp",
")",
";",
"return",
"$",
"leeway",
">",
"0",
"?",
"$",
"timestamp",
"-... | Checks if a timestamp is in the past.
@param int $timestamp
@param int $leeway
@return bool | [
"Checks",
"if",
"a",
"timestamp",
"is",
"in",
"the",
"past",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Support/Utils.php#L48-L55 |
220,917 | tymondesigns/jwt-auth | src/Support/Utils.php | Utils.isFuture | public static function isFuture($timestamp, $leeway = 0)
{
$timestamp = static::timestamp($timestamp);
return $leeway > 0
? $timestamp->subSeconds($leeway)->isFuture()
: $timestamp->isFuture();
} | php | public static function isFuture($timestamp, $leeway = 0)
{
$timestamp = static::timestamp($timestamp);
return $leeway > 0
? $timestamp->subSeconds($leeway)->isFuture()
: $timestamp->isFuture();
} | [
"public",
"static",
"function",
"isFuture",
"(",
"$",
"timestamp",
",",
"$",
"leeway",
"=",
"0",
")",
"{",
"$",
"timestamp",
"=",
"static",
"::",
"timestamp",
"(",
"$",
"timestamp",
")",
";",
"return",
"$",
"leeway",
">",
"0",
"?",
"$",
"timestamp",
... | Checks if a timestamp is in the future.
@param int $timestamp
@param int $leeway
@return bool | [
"Checks",
"if",
"a",
"timestamp",
"is",
"in",
"the",
"future",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Support/Utils.php#L65-L72 |
220,918 | tymondesigns/jwt-auth | src/JWTAuth.php | JWTAuth.attempt | public function attempt(array $credentials)
{
if (! $this->auth->byCredentials($credentials)) {
return false;
}
return $this->fromUser($this->user());
} | php | public function attempt(array $credentials)
{
if (! $this->auth->byCredentials($credentials)) {
return false;
}
return $this->fromUser($this->user());
} | [
"public",
"function",
"attempt",
"(",
"array",
"$",
"credentials",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"auth",
"->",
"byCredentials",
"(",
"$",
"credentials",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"fromUser",... | Attempt to authenticate the user and return the token.
@param array $credentials
@return false|string | [
"Attempt",
"to",
"authenticate",
"the",
"user",
"and",
"return",
"the",
"token",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/JWTAuth.php#L48-L55 |
220,919 | tymondesigns/jwt-auth | src/Factory.php | Factory.addClaims | protected function addClaims(array $claims)
{
foreach ($claims as $name => $value) {
$this->addClaim($name, $value);
}
return $this;
} | php | protected function addClaims(array $claims)
{
foreach ($claims as $name => $value) {
$this->addClaim($name, $value);
}
return $this;
} | [
"protected",
"function",
"addClaims",
"(",
"array",
"$",
"claims",
")",
"{",
"foreach",
"(",
"$",
"claims",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"addClaim",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"return"... | Add an array of claims to the Payload.
@param array $claims
@return $this | [
"Add",
"an",
"array",
"of",
"claims",
"to",
"the",
"Payload",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Factory.php#L109-L116 |
220,920 | tymondesigns/jwt-auth | src/JWT.php | JWT.fromSubject | public function fromSubject(JWTSubject $subject)
{
$payload = $this->makePayload($subject);
return $this->manager->encode($payload)->get();
} | php | public function fromSubject(JWTSubject $subject)
{
$payload = $this->makePayload($subject);
return $this->manager->encode($payload)->get();
} | [
"public",
"function",
"fromSubject",
"(",
"JWTSubject",
"$",
"subject",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"makePayload",
"(",
"$",
"subject",
")",
";",
"return",
"$",
"this",
"->",
"manager",
"->",
"encode",
"(",
"$",
"payload",
")",
"-... | Generate a token for a given subject.
@param \Tymon\JWTAuth\Contracts\JWTSubject $subject
@return string | [
"Generate",
"a",
"token",
"for",
"a",
"given",
"subject",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/JWT.php#L74-L79 |
220,921 | tymondesigns/jwt-auth | src/JWT.php | JWT.getClaimsForSubject | protected function getClaimsForSubject(JWTSubject $subject)
{
return array_merge([
'sub' => $subject->getJWTIdentifier(),
], $this->lockSubject ? ['prv' => $this->hashSubjectModel($subject)] : []);
} | php | protected function getClaimsForSubject(JWTSubject $subject)
{
return array_merge([
'sub' => $subject->getJWTIdentifier(),
], $this->lockSubject ? ['prv' => $this->hashSubjectModel($subject)] : []);
} | [
"protected",
"function",
"getClaimsForSubject",
"(",
"JWTSubject",
"$",
"subject",
")",
"{",
"return",
"array_merge",
"(",
"[",
"'sub'",
"=>",
"$",
"subject",
"->",
"getJWTIdentifier",
"(",
")",
",",
"]",
",",
"$",
"this",
"->",
"lockSubject",
"?",
"[",
"'... | Get the claims associated with a given subject.
@param \Tymon\JWTAuth\Contracts\JWTSubject $subject
@return array | [
"Get",
"the",
"claims",
"associated",
"with",
"a",
"given",
"subject",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/JWT.php#L260-L265 |
220,922 | tymondesigns/jwt-auth | src/JWT.php | JWT.checkSubjectModel | public function checkSubjectModel($model)
{
if (($prv = $this->payload()->get('prv')) === null) {
return true;
}
return $this->hashSubjectModel($model) === $prv;
} | php | public function checkSubjectModel($model)
{
if (($prv = $this->payload()->get('prv')) === null) {
return true;
}
return $this->hashSubjectModel($model) === $prv;
} | [
"public",
"function",
"checkSubjectModel",
"(",
"$",
"model",
")",
"{",
"if",
"(",
"(",
"$",
"prv",
"=",
"$",
"this",
"->",
"payload",
"(",
")",
"->",
"get",
"(",
"'prv'",
")",
")",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"return",
"... | Check if the subject model matches the one saved in the token.
@param string|object $model
@return bool | [
"Check",
"if",
"the",
"subject",
"model",
"matches",
"the",
"one",
"saved",
"in",
"the",
"token",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/JWT.php#L286-L293 |
220,923 | tymondesigns/jwt-auth | src/Http/Parser/Cookies.php | Cookies.parse | public function parse(Request $request)
{
if ($this->decrypt && $request->hasCookie($this->key)) {
return Crypt::decrypt($request->cookie($this->key));
}
return $request->cookie($this->key);
} | php | public function parse(Request $request)
{
if ($this->decrypt && $request->hasCookie($this->key)) {
return Crypt::decrypt($request->cookie($this->key));
}
return $request->cookie($this->key);
} | [
"public",
"function",
"parse",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"decrypt",
"&&",
"$",
"request",
"->",
"hasCookie",
"(",
"$",
"this",
"->",
"key",
")",
")",
"{",
"return",
"Crypt",
"::",
"decrypt",
"(",
"$",
"... | Try to parse the token from the request cookies.
@param \Illuminate\Http\Request $request
@return null|string | [
"Try",
"to",
"parse",
"the",
"token",
"from",
"the",
"request",
"cookies",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Http/Parser/Cookies.php#L41-L48 |
220,924 | tymondesigns/jwt-auth | src/Http/Middleware/BaseMiddleware.php | BaseMiddleware.setAuthenticationHeader | protected function setAuthenticationHeader($response, $token = null)
{
$token = $token ?: $this->auth->refresh();
$response->headers->set('Authorization', 'Bearer '.$token);
return $response;
} | php | protected function setAuthenticationHeader($response, $token = null)
{
$token = $token ?: $this->auth->refresh();
$response->headers->set('Authorization', 'Bearer '.$token);
return $response;
} | [
"protected",
"function",
"setAuthenticationHeader",
"(",
"$",
"response",
",",
"$",
"token",
"=",
"null",
")",
"{",
"$",
"token",
"=",
"$",
"token",
"?",
":",
"$",
"this",
"->",
"auth",
"->",
"refresh",
"(",
")",
";",
"$",
"response",
"->",
"headers",
... | Set the authentication header.
@param \Illuminate\Http\Response|\Illuminate\Http\JsonResponse $response
@param string|null $token
@return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse | [
"Set",
"the",
"authentication",
"header",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Http/Middleware/BaseMiddleware.php#L86-L92 |
220,925 | tymondesigns/jwt-auth | src/Providers/JWT/Lcobucci.php | Lcobucci.getSigner | protected function getSigner()
{
if (! array_key_exists($this->algo, $this->signers)) {
throw new JWTException('The given algorithm could not be found');
}
return new $this->signers[$this->algo];
} | php | protected function getSigner()
{
if (! array_key_exists($this->algo, $this->signers)) {
throw new JWTException('The given algorithm could not be found');
}
return new $this->signers[$this->algo];
} | [
"protected",
"function",
"getSigner",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"this",
"->",
"algo",
",",
"$",
"this",
"->",
"signers",
")",
")",
"{",
"throw",
"new",
"JWTException",
"(",
"'The given algorithm could not be found'",
")",
"... | Get the signer instance.
@throws \Tymon\JWTAuth\Exceptions\JWTException
@return \Lcobucci\JWT\Signer | [
"Get",
"the",
"signer",
"instance",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Providers/JWT/Lcobucci.php#L152-L159 |
220,926 | tymondesigns/jwt-auth | src/Claims/DatetimeTrait.php | DatetimeTrait.setValue | public function setValue($value)
{
if ($value instanceof DateInterval) {
$value = Utils::now()->add($value);
}
if ($value instanceof DateTimeInterface) {
$value = $value->getTimestamp();
}
return parent::setValue($value);
} | php | public function setValue($value)
{
if ($value instanceof DateInterval) {
$value = Utils::now()->add($value);
}
if ($value instanceof DateTimeInterface) {
$value = $value->getTimestamp();
}
return parent::setValue($value);
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"DateInterval",
")",
"{",
"$",
"value",
"=",
"Utils",
"::",
"now",
"(",
")",
"->",
"add",
"(",
"$",
"value",
")",
";",
"}",
"if",
"(",
"$",
"val... | Set the claim value, and call a validate method.
@param mixed $value
@throws \Tymon\JWTAuth\Exceptions\InvalidClaimException
@return $this | [
"Set",
"the",
"claim",
"value",
"and",
"call",
"a",
"validate",
"method",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Claims/DatetimeTrait.php#L37-L48 |
220,927 | tymondesigns/jwt-auth | src/JWTGuard.php | JWTGuard.logout | public function logout($forceForever = false)
{
$this->requireToken()->invalidate($forceForever);
$this->user = null;
$this->jwt->unsetToken();
} | php | public function logout($forceForever = false)
{
$this->requireToken()->invalidate($forceForever);
$this->user = null;
$this->jwt->unsetToken();
} | [
"public",
"function",
"logout",
"(",
"$",
"forceForever",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"requireToken",
"(",
")",
"->",
"invalidate",
"(",
"$",
"forceForever",
")",
";",
"$",
"this",
"->",
"user",
"=",
"null",
";",
"$",
"this",
"->",
"jw... | Logout the user, thus invalidating the token.
@param bool $forceForever
@return void | [
"Logout",
"the",
"user",
"thus",
"invalidating",
"the",
"token",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/JWTGuard.php#L155-L161 |
220,928 | tymondesigns/jwt-auth | src/JWTGuard.php | JWTGuard.refresh | public function refresh($forceForever = false, $resetClaims = false)
{
return $this->requireToken()->refresh($forceForever, $resetClaims);
} | php | public function refresh($forceForever = false, $resetClaims = false)
{
return $this->requireToken()->refresh($forceForever, $resetClaims);
} | [
"public",
"function",
"refresh",
"(",
"$",
"forceForever",
"=",
"false",
",",
"$",
"resetClaims",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"requireToken",
"(",
")",
"->",
"refresh",
"(",
"$",
"forceForever",
",",
"$",
"resetClaims",
")",
";",... | Refresh the token.
@param bool $forceForever
@param bool $resetClaims
@return string | [
"Refresh",
"the",
"token",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/JWTGuard.php#L171-L174 |
220,929 | tymondesigns/jwt-auth | src/JWTGuard.php | JWTGuard.validateSubject | protected function validateSubject()
{
// If the provider doesn't have the necessary method
// to get the underlying model name then allow.
if (! method_exists($this->provider, 'getModel')) {
return true;
}
return $this->jwt->checkSubjectModel($this->provider->ge... | php | protected function validateSubject()
{
// If the provider doesn't have the necessary method
// to get the underlying model name then allow.
if (! method_exists($this->provider, 'getModel')) {
return true;
}
return $this->jwt->checkSubjectModel($this->provider->ge... | [
"protected",
"function",
"validateSubject",
"(",
")",
"{",
"// If the provider doesn't have the necessary method",
"// to get the underlying model name then allow.",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
"->",
"provider",
",",
"'getModel'",
")",
")",
"{",
"re... | Ensure the JWTSubject matches what is in the token.
@return bool | [
"Ensure",
"the",
"JWTSubject",
"matches",
"what",
"is",
"in",
"the",
"token",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/JWTGuard.php#L398-L407 |
220,930 | tymondesigns/jwt-auth | src/Providers/AbstractServiceProvider.php | AbstractServiceProvider.extendAuthGuard | protected function extendAuthGuard()
{
$this->app['auth']->extend('jwt', function ($app, $name, array $config) {
$guard = new JWTGuard(
$app['tymon.jwt'],
$app['auth']->createUserProvider($config['provider']),
$app['request']
);
... | php | protected function extendAuthGuard()
{
$this->app['auth']->extend('jwt', function ($app, $name, array $config) {
$guard = new JWTGuard(
$app['tymon.jwt'],
$app['auth']->createUserProvider($config['provider']),
$app['request']
);
... | [
"protected",
"function",
"extendAuthGuard",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"[",
"'auth'",
"]",
"->",
"extend",
"(",
"'jwt'",
",",
"function",
"(",
"$",
"app",
",",
"$",
"name",
",",
"array",
"$",
"config",
")",
"{",
"$",
"guard",
"=",
"ne... | Extend Laravel's Auth.
@return void | [
"Extend",
"Laravel",
"s",
"Auth",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Providers/AbstractServiceProvider.php#L96-L109 |
220,931 | tymondesigns/jwt-auth | src/Providers/AbstractServiceProvider.php | AbstractServiceProvider.registerJWT | protected function registerJWT()
{
$this->app->singleton('tymon.jwt', function ($app) {
return (new JWT(
$app['tymon.jwt.manager'],
$app['tymon.jwt.parser']
))->lockSubject($this->config('lock_subject'));
});
} | php | protected function registerJWT()
{
$this->app->singleton('tymon.jwt', function ($app) {
return (new JWT(
$app['tymon.jwt.manager'],
$app['tymon.jwt.parser']
))->lockSubject($this->config('lock_subject'));
});
} | [
"protected",
"function",
"registerJWT",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'tymon.jwt'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"(",
"new",
"JWT",
"(",
"$",
"app",
"[",
"'tymon.jwt.manager'",
"]",
",",
"$",... | Register the bindings for the main JWT class.
@return void | [
"Register",
"the",
"bindings",
"for",
"the",
"main",
"JWT",
"class",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Providers/AbstractServiceProvider.php#L254-L262 |
220,932 | tymondesigns/jwt-auth | src/Providers/AbstractServiceProvider.php | AbstractServiceProvider.registerPayloadValidator | protected function registerPayloadValidator()
{
$this->app->singleton('tymon.jwt.validators.payload', function () {
return (new PayloadValidator)
->setRefreshTTL($this->config('refresh_ttl'))
->setRequiredClaims($this->config('required_claims'));
});
} | php | protected function registerPayloadValidator()
{
$this->app->singleton('tymon.jwt.validators.payload', function () {
return (new PayloadValidator)
->setRefreshTTL($this->config('refresh_ttl'))
->setRequiredClaims($this->config('required_claims'));
});
} | [
"protected",
"function",
"registerPayloadValidator",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'tymon.jwt.validators.payload'",
",",
"function",
"(",
")",
"{",
"return",
"(",
"new",
"PayloadValidator",
")",
"->",
"setRefreshTTL",
"(",
"$"... | Register the bindings for the payload validator.
@return void | [
"Register",
"the",
"bindings",
"for",
"the",
"payload",
"validator",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Providers/AbstractServiceProvider.php#L300-L307 |
220,933 | tymondesigns/jwt-auth | src/Providers/AbstractServiceProvider.php | AbstractServiceProvider.getConfigInstance | protected function getConfigInstance($key)
{
$instance = $this->config($key);
if (is_string($instance)) {
return $this->app->make($instance);
}
return $instance;
} | php | protected function getConfigInstance($key)
{
$instance = $this->config($key);
if (is_string($instance)) {
return $this->app->make($instance);
}
return $instance;
} | [
"protected",
"function",
"getConfigInstance",
"(",
"$",
"key",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"config",
"(",
"$",
"key",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"instance",
")",
")",
"{",
"return",
"$",
"this",
"->",
"app",
... | Get an instantiable configuration instance.
@param string $key
@return mixed | [
"Get",
"an",
"instantiable",
"configuration",
"instance",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Providers/AbstractServiceProvider.php#L372-L381 |
220,934 | tymondesigns/jwt-auth | src/Claims/Claim.php | Claim.matches | public function matches($value, $strict = true)
{
return $strict ? $this->value === $value : $this->value == $value;
} | php | public function matches($value, $strict = true)
{
return $strict ? $this->value === $value : $this->value == $value;
} | [
"public",
"function",
"matches",
"(",
"$",
"value",
",",
"$",
"strict",
"=",
"true",
")",
"{",
"return",
"$",
"strict",
"?",
"$",
"this",
"->",
"value",
"===",
"$",
"value",
":",
"$",
"this",
"->",
"value",
"==",
"$",
"value",
";",
"}"
] | Checks if the value matches the claim.
@param mixed $value
@param bool $strict
@return bool | [
"Checks",
"if",
"the",
"value",
"matches",
"the",
"claim",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Claims/Claim.php#L137-L140 |
220,935 | tymondesigns/jwt-auth | src/Http/Parser/AuthHeaders.php | AuthHeaders.parse | public function parse(Request $request)
{
$header = $request->headers->get($this->header) ?: $this->fromAltHeaders($request);
if ($header && preg_match('/'.$this->prefix.'\s*(\S+)\b/i', $header, $matches)) {
return $matches[1];
}
} | php | public function parse(Request $request)
{
$header = $request->headers->get($this->header) ?: $this->fromAltHeaders($request);
if ($header && preg_match('/'.$this->prefix.'\s*(\S+)\b/i', $header, $matches)) {
return $matches[1];
}
} | [
"public",
"function",
"parse",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"header",
"=",
"$",
"request",
"->",
"headers",
"->",
"get",
"(",
"$",
"this",
"->",
"header",
")",
"?",
":",
"$",
"this",
"->",
"fromAltHeaders",
"(",
"$",
"request",
")",... | Try to parse the token from the request header.
@param \Illuminate\Http\Request $request
@return null|string | [
"Try",
"to",
"parse",
"the",
"token",
"from",
"the",
"request",
"header",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Http/Parser/AuthHeaders.php#L52-L59 |
220,936 | tymondesigns/jwt-auth | src/Manager.php | Manager.buildRefreshClaims | protected function buildRefreshClaims(Payload $payload)
{
// assign the payload values as variables for use later
extract($payload->toArray());
// persist the relevant claims
return array_merge(
$this->customClaims,
compact($this->persistentClaims, 'sub', 'ia... | php | protected function buildRefreshClaims(Payload $payload)
{
// assign the payload values as variables for use later
extract($payload->toArray());
// persist the relevant claims
return array_merge(
$this->customClaims,
compact($this->persistentClaims, 'sub', 'ia... | [
"protected",
"function",
"buildRefreshClaims",
"(",
"Payload",
"$",
"payload",
")",
"{",
"// assign the payload values as variables for use later",
"extract",
"(",
"$",
"payload",
"->",
"toArray",
"(",
")",
")",
";",
"// persist the relevant claims",
"return",
"array_merg... | Build the claims to go into the refreshed token.
@param \Tymon\JWTAuth\Payload $payload
@return array | [
"Build",
"the",
"claims",
"to",
"go",
"into",
"the",
"refreshed",
"token",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Manager.php#L170-L180 |
220,937 | tymondesigns/jwt-auth | src/Http/Parser/Parser.php | Parser.parseToken | public function parseToken()
{
foreach ($this->chain as $parser) {
if ($response = $parser->parse($this->request)) {
return $response;
}
}
} | php | public function parseToken()
{
foreach ($this->chain as $parser) {
if ($response = $parser->parse($this->request)) {
return $response;
}
}
} | [
"public",
"function",
"parseToken",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"chain",
"as",
"$",
"parser",
")",
"{",
"if",
"(",
"$",
"response",
"=",
"$",
"parser",
"->",
"parse",
"(",
"$",
"this",
"->",
"request",
")",
")",
"{",
"return",... | Iterate through the parsers and attempt to retrieve
a value, otherwise return null.
@return string|null | [
"Iterate",
"through",
"the",
"parsers",
"and",
"attempt",
"to",
"retrieve",
"a",
"value",
"otherwise",
"return",
"null",
"."
] | 63698d304554e5d0bc3eb481cc260a9fc900e151 | https://github.com/tymondesigns/jwt-auth/blob/63698d304554e5d0bc3eb481cc260a9fc900e151/src/Http/Parser/Parser.php#L88-L95 |
220,938 | Crinsane/LaravelShoppingcart | src/CanBeBought.php | CanBeBought.getBuyableDescription | public function getBuyableDescription($options = null)
{
if(property_exists($this, 'name')) return $this->name;
if(property_exists($this, 'title')) return $this->title;
if(property_exists($this, 'description')) return $this->description;
return null;
} | php | public function getBuyableDescription($options = null)
{
if(property_exists($this, 'name')) return $this->name;
if(property_exists($this, 'title')) return $this->title;
if(property_exists($this, 'description')) return $this->description;
return null;
} | [
"public",
"function",
"getBuyableDescription",
"(",
"$",
"options",
"=",
"null",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"'name'",
")",
")",
"return",
"$",
"this",
"->",
"name",
";",
"if",
"(",
"property_exists",
"(",
"$",
"this",
... | Get the description or title of the Buyable item.
@return string | [
"Get",
"the",
"description",
"or",
"title",
"of",
"the",
"Buyable",
"item",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/CanBeBought.php#L23-L30 |
220,939 | Crinsane/LaravelShoppingcart | src/CartItem.php | CartItem.price | public function price($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->price, $decimals, $decimalPoint, $thousandSeperator);
} | php | public function price($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->price, $decimals, $decimalPoint, $thousandSeperator);
} | [
"public",
"function",
"price",
"(",
"$",
"decimals",
"=",
"null",
",",
"$",
"decimalPoint",
"=",
"null",
",",
"$",
"thousandSeperator",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"numberFormat",
"(",
"$",
"this",
"->",
"price",
",",
"$",
"deci... | Returns the formatted price without TAX.
@param int $decimals
@param string $decimalPoint
@param string $thousandSeperator
@return string | [
"Returns",
"the",
"formatted",
"price",
"without",
"TAX",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/CartItem.php#L102-L105 |
220,940 | Crinsane/LaravelShoppingcart | src/CartItem.php | CartItem.priceTax | public function priceTax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->priceTax, $decimals, $decimalPoint, $thousandSeperator);
} | php | public function priceTax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->priceTax, $decimals, $decimalPoint, $thousandSeperator);
} | [
"public",
"function",
"priceTax",
"(",
"$",
"decimals",
"=",
"null",
",",
"$",
"decimalPoint",
"=",
"null",
",",
"$",
"thousandSeperator",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"numberFormat",
"(",
"$",
"this",
"->",
"priceTax",
",",
"$",
... | Returns the formatted price with TAX.
@param int $decimals
@param string $decimalPoint
@param string $thousandSeperator
@return string | [
"Returns",
"the",
"formatted",
"price",
"with",
"TAX",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/CartItem.php#L115-L118 |
220,941 | Crinsane/LaravelShoppingcart | src/CartItem.php | CartItem.subtotal | public function subtotal($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->subtotal, $decimals, $decimalPoint, $thousandSeperator);
} | php | public function subtotal($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->subtotal, $decimals, $decimalPoint, $thousandSeperator);
} | [
"public",
"function",
"subtotal",
"(",
"$",
"decimals",
"=",
"null",
",",
"$",
"decimalPoint",
"=",
"null",
",",
"$",
"thousandSeperator",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"numberFormat",
"(",
"$",
"this",
"->",
"subtotal",
",",
"$",
... | Returns the formatted subtotal.
Subtotal is price for whole CartItem without TAX
@param int $decimals
@param string $decimalPoint
@param string $thousandSeperator
@return string | [
"Returns",
"the",
"formatted",
"subtotal",
".",
"Subtotal",
"is",
"price",
"for",
"whole",
"CartItem",
"without",
"TAX"
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/CartItem.php#L129-L132 |
220,942 | Crinsane/LaravelShoppingcart | src/CartItem.php | CartItem.total | public function total($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->total, $decimals, $decimalPoint, $thousandSeperator);
} | php | public function total($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->total, $decimals, $decimalPoint, $thousandSeperator);
} | [
"public",
"function",
"total",
"(",
"$",
"decimals",
"=",
"null",
",",
"$",
"decimalPoint",
"=",
"null",
",",
"$",
"thousandSeperator",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"numberFormat",
"(",
"$",
"this",
"->",
"total",
",",
"$",
"deci... | Returns the formatted total.
Total is price for whole CartItem with TAX
@param int $decimals
@param string $decimalPoint
@param string $thousandSeperator
@return string | [
"Returns",
"the",
"formatted",
"total",
".",
"Total",
"is",
"price",
"for",
"whole",
"CartItem",
"with",
"TAX"
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/CartItem.php#L143-L146 |
220,943 | Crinsane/LaravelShoppingcart | src/CartItem.php | CartItem.setQuantity | public function setQuantity($qty)
{
if(empty($qty) || ! is_numeric($qty))
throw new \InvalidArgumentException('Please supply a valid quantity.');
$this->qty = $qty;
} | php | public function setQuantity($qty)
{
if(empty($qty) || ! is_numeric($qty))
throw new \InvalidArgumentException('Please supply a valid quantity.');
$this->qty = $qty;
} | [
"public",
"function",
"setQuantity",
"(",
"$",
"qty",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"qty",
")",
"||",
"!",
"is_numeric",
"(",
"$",
"qty",
")",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Please supply a valid quantity.'",
")",
"... | Set the quantity for this cart item.
@param int|float $qty | [
"Set",
"the",
"quantity",
"for",
"this",
"cart",
"item",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/CartItem.php#L179-L185 |
220,944 | Crinsane/LaravelShoppingcart | src/CartItem.php | CartItem.updateFromBuyable | public function updateFromBuyable(Buyable $item)
{
$this->id = $item->getBuyableIdentifier($this->options);
$this->name = $item->getBuyableDescription($this->options);
$this->price = $item->getBuyablePrice($this->options);
$this->priceTax = $this->price + $this->tax;
... | php | public function updateFromBuyable(Buyable $item)
{
$this->id = $item->getBuyableIdentifier($this->options);
$this->name = $item->getBuyableDescription($this->options);
$this->price = $item->getBuyablePrice($this->options);
$this->priceTax = $this->price + $this->tax;
... | [
"public",
"function",
"updateFromBuyable",
"(",
"Buyable",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"$",
"item",
"->",
"getBuyableIdentifier",
"(",
"$",
"this",
"->",
"options",
")",
";",
"$",
"this",
"->",
"name",
"=",
"$",
"item",
"->",
... | Update the cart item from a Buyable.
@param \Gloudemans\Shoppingcart\Contracts\Buyable $item
@return void | [
"Update",
"the",
"cart",
"item",
"from",
"a",
"Buyable",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/CartItem.php#L193-L199 |
220,945 | Crinsane/LaravelShoppingcart | src/CartItem.php | CartItem.updateFromArray | public function updateFromArray(array $attributes)
{
$this->id = array_get($attributes, 'id', $this->id);
$this->qty = array_get($attributes, 'qty', $this->qty);
$this->name = array_get($attributes, 'name', $this->name);
$this->price = array_get($attributes, 'price'... | php | public function updateFromArray(array $attributes)
{
$this->id = array_get($attributes, 'id', $this->id);
$this->qty = array_get($attributes, 'qty', $this->qty);
$this->name = array_get($attributes, 'name', $this->name);
$this->price = array_get($attributes, 'price'... | [
"public",
"function",
"updateFromArray",
"(",
"array",
"$",
"attributes",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"array_get",
"(",
"$",
"attributes",
",",
"'id'",
",",
"$",
"this",
"->",
"id",
")",
";",
"$",
"this",
"->",
"qty",
"=",
"array_get",
"(... | Update the cart item from an array.
@param array $attributes
@return void | [
"Update",
"the",
"cart",
"item",
"from",
"an",
"array",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/CartItem.php#L207-L217 |
220,946 | Crinsane/LaravelShoppingcart | src/CartItem.php | CartItem.numberFormat | private function numberFormat($value, $decimals, $decimalPoint, $thousandSeperator)
{
if (is_null($decimals)){
$decimals = is_null(config('cart.format.decimals')) ? 2 : config('cart.format.decimals');
}
if (is_null($decimalPoint)){
$decimalPoint = is_null(config('car... | php | private function numberFormat($value, $decimals, $decimalPoint, $thousandSeperator)
{
if (is_null($decimals)){
$decimals = is_null(config('cart.format.decimals')) ? 2 : config('cart.format.decimals');
}
if (is_null($decimalPoint)){
$decimalPoint = is_null(config('car... | [
"private",
"function",
"numberFormat",
"(",
"$",
"value",
",",
"$",
"decimals",
",",
"$",
"decimalPoint",
",",
"$",
"thousandSeperator",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"decimals",
")",
")",
"{",
"$",
"decimals",
"=",
"is_null",
"(",
"config",
... | Get the formatted number.
@param float $value
@param int $decimals
@param string $decimalPoint
@param string $thousandSeperator
@return string | [
"Get",
"the",
"formatted",
"number",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/CartItem.php#L376-L391 |
220,947 | Crinsane/LaravelShoppingcart | src/Cart.php | Cart.instance | public function instance($instance = null)
{
$instance = $instance ?: self::DEFAULT_INSTANCE;
$this->instance = sprintf('%s.%s', 'cart', $instance);
return $this;
} | php | public function instance($instance = null)
{
$instance = $instance ?: self::DEFAULT_INSTANCE;
$this->instance = sprintf('%s.%s', 'cart', $instance);
return $this;
} | [
"public",
"function",
"instance",
"(",
"$",
"instance",
"=",
"null",
")",
"{",
"$",
"instance",
"=",
"$",
"instance",
"?",
":",
"self",
"::",
"DEFAULT_INSTANCE",
";",
"$",
"this",
"->",
"instance",
"=",
"sprintf",
"(",
"'%s.%s'",
",",
"'cart'",
",",
"$... | Set the current cart instance.
@param string|null $instance
@return \Gloudemans\Shoppingcart\Cart | [
"Set",
"the",
"current",
"cart",
"instance",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/Cart.php#L60-L67 |
220,948 | Crinsane/LaravelShoppingcart | src/Cart.php | Cart.remove | public function remove($rowId)
{
$cartItem = $this->get($rowId);
$content = $this->getContent();
$content->pull($cartItem->rowId);
$this->events->fire('cart.removed', $cartItem);
$this->session->put($this->instance, $content);
} | php | public function remove($rowId)
{
$cartItem = $this->get($rowId);
$content = $this->getContent();
$content->pull($cartItem->rowId);
$this->events->fire('cart.removed', $cartItem);
$this->session->put($this->instance, $content);
} | [
"public",
"function",
"remove",
"(",
"$",
"rowId",
")",
"{",
"$",
"cartItem",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"rowId",
")",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"getContent",
"(",
")",
";",
"$",
"content",
"->",
"pull",
"(",
"$",... | Remove the cart item with the given rowId from the cart.
@param string $rowId
@return void | [
"Remove",
"the",
"cart",
"item",
"with",
"the",
"given",
"rowId",
"from",
"the",
"cart",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/Cart.php#L164-L175 |
220,949 | Crinsane/LaravelShoppingcart | src/Cart.php | Cart.content | public function content()
{
if (is_null($this->session->get($this->instance))) {
return new Collection([]);
}
return $this->session->get($this->instance);
} | php | public function content()
{
if (is_null($this->session->get($this->instance))) {
return new Collection([]);
}
return $this->session->get($this->instance);
} | [
"public",
"function",
"content",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"$",
"this",
"->",
"instance",
")",
")",
")",
"{",
"return",
"new",
"Collection",
"(",
"[",
"]",
")",
";",
"}",
"return",
"... | Get the content of the cart.
@return \Illuminate\Support\Collection | [
"Get",
"the",
"content",
"of",
"the",
"cart",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/Cart.php#L208-L215 |
220,950 | Crinsane/LaravelShoppingcart | src/Cart.php | Cart.associate | public function associate($rowId, $model)
{
if(is_string($model) && ! class_exists($model)) {
throw new UnknownModelException("The supplied model {$model} does not exist.");
}
$cartItem = $this->get($rowId);
$cartItem->associate($model);
$content = $this->getCo... | php | public function associate($rowId, $model)
{
if(is_string($model) && ! class_exists($model)) {
throw new UnknownModelException("The supplied model {$model} does not exist.");
}
$cartItem = $this->get($rowId);
$cartItem->associate($model);
$content = $this->getCo... | [
"public",
"function",
"associate",
"(",
"$",
"rowId",
",",
"$",
"model",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"model",
")",
"&&",
"!",
"class_exists",
"(",
"$",
"model",
")",
")",
"{",
"throw",
"new",
"UnknownModelException",
"(",
"\"The supplied ... | Associate the cart item with the given rowId with the given model.
@param string $rowId
@param mixed $model
@return void | [
"Associate",
"the",
"cart",
"item",
"with",
"the",
"given",
"rowId",
"with",
"the",
"given",
"model",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/Cart.php#L306-L321 |
220,951 | Crinsane/LaravelShoppingcart | src/Cart.php | Cart.setTax | public function setTax($rowId, $taxRate)
{
$cartItem = $this->get($rowId);
$cartItem->setTaxRate($taxRate);
$content = $this->getContent();
$content->put($cartItem->rowId, $cartItem);
$this->session->put($this->instance, $content);
} | php | public function setTax($rowId, $taxRate)
{
$cartItem = $this->get($rowId);
$cartItem->setTaxRate($taxRate);
$content = $this->getContent();
$content->put($cartItem->rowId, $cartItem);
$this->session->put($this->instance, $content);
} | [
"public",
"function",
"setTax",
"(",
"$",
"rowId",
",",
"$",
"taxRate",
")",
"{",
"$",
"cartItem",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"rowId",
")",
";",
"$",
"cartItem",
"->",
"setTaxRate",
"(",
"$",
"taxRate",
")",
";",
"$",
"content",
"=",
... | Set the tax rate for the cart item with the given rowId.
@param string $rowId
@param int|float $taxRate
@return void | [
"Set",
"the",
"tax",
"rate",
"for",
"the",
"cart",
"item",
"with",
"the",
"given",
"rowId",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/Cart.php#L330-L341 |
220,952 | Crinsane/LaravelShoppingcart | src/Cart.php | Cart.store | public function store($identifier)
{
$content = $this->getContent();
if ($this->storedCartWithIdentifierExists($identifier)) {
throw new CartAlreadyStoredException("A cart with identifier {$identifier} was already stored.");
}
$this->getConnection()->table($this->getTab... | php | public function store($identifier)
{
$content = $this->getContent();
if ($this->storedCartWithIdentifierExists($identifier)) {
throw new CartAlreadyStoredException("A cart with identifier {$identifier} was already stored.");
}
$this->getConnection()->table($this->getTab... | [
"public",
"function",
"store",
"(",
"$",
"identifier",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"storedCartWithIdentifierExists",
"(",
"$",
"identifier",
")",
")",
"{",
"throw",
"new",
... | Store an the current instance of the cart.
@param mixed $identifier
@return void | [
"Store",
"an",
"the",
"current",
"instance",
"of",
"the",
"cart",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/Cart.php#L349-L364 |
220,953 | Crinsane/LaravelShoppingcart | src/Cart.php | Cart.restore | public function restore($identifier)
{
if( ! $this->storedCartWithIdentifierExists($identifier)) {
return;
}
$stored = $this->getConnection()->table($this->getTableName())
->where('identifier', $identifier)->first();
$storedContent = unserialize($stored->con... | php | public function restore($identifier)
{
if( ! $this->storedCartWithIdentifierExists($identifier)) {
return;
}
$stored = $this->getConnection()->table($this->getTableName())
->where('identifier', $identifier)->first();
$storedContent = unserialize($stored->con... | [
"public",
"function",
"restore",
"(",
"$",
"identifier",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"storedCartWithIdentifierExists",
"(",
"$",
"identifier",
")",
")",
"{",
"return",
";",
"}",
"$",
"stored",
"=",
"$",
"this",
"->",
"getConnection",
"("... | Restore the cart with the given identifier.
@param mixed $identifier
@return void | [
"Restore",
"the",
"cart",
"with",
"the",
"given",
"identifier",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/Cart.php#L372-L401 |
220,954 | Crinsane/LaravelShoppingcart | src/Cart.php | Cart.getContent | protected function getContent()
{
$content = $this->session->has($this->instance)
? $this->session->get($this->instance)
: new Collection;
return $content;
} | php | protected function getContent()
{
$content = $this->session->has($this->instance)
? $this->session->get($this->instance)
: new Collection;
return $content;
} | [
"protected",
"function",
"getContent",
"(",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"session",
"->",
"has",
"(",
"$",
"this",
"->",
"instance",
")",
"?",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"$",
"this",
"->",
"instance",
")",
... | Get the carts content, if there is no cart content set yet, return a new empty Collection
@return \Illuminate\Support\Collection | [
"Get",
"the",
"carts",
"content",
"if",
"there",
"is",
"no",
"cart",
"content",
"set",
"yet",
"return",
"a",
"new",
"empty",
"Collection"
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/Cart.php#L431-L438 |
220,955 | Crinsane/LaravelShoppingcart | src/Cart.php | Cart.createCartItem | private function createCartItem($id, $name, $qty, $price, array $options)
{
if ($id instanceof Buyable) {
$cartItem = CartItem::fromBuyable($id, $qty ?: []);
$cartItem->setQuantity($name ?: 1);
$cartItem->associate($id);
} elseif (is_array($id)) {
$car... | php | private function createCartItem($id, $name, $qty, $price, array $options)
{
if ($id instanceof Buyable) {
$cartItem = CartItem::fromBuyable($id, $qty ?: []);
$cartItem->setQuantity($name ?: 1);
$cartItem->associate($id);
} elseif (is_array($id)) {
$car... | [
"private",
"function",
"createCartItem",
"(",
"$",
"id",
",",
"$",
"name",
",",
"$",
"qty",
",",
"$",
"price",
",",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"id",
"instanceof",
"Buyable",
")",
"{",
"$",
"cartItem",
"=",
"CartItem",
"::",
... | Create a new CartItem from the supplied attributes.
@param mixed $id
@param mixed $name
@param int|float $qty
@param float $price
@param array $options
@return \Gloudemans\Shoppingcart\CartItem | [
"Create",
"a",
"new",
"CartItem",
"from",
"the",
"supplied",
"attributes",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/Cart.php#L450-L467 |
220,956 | Crinsane/LaravelShoppingcart | src/Cart.php | Cart.isMulti | private function isMulti($item)
{
if ( ! is_array($item)) return false;
return is_array(head($item)) || head($item) instanceof Buyable;
} | php | private function isMulti($item)
{
if ( ! is_array($item)) return false;
return is_array(head($item)) || head($item) instanceof Buyable;
} | [
"private",
"function",
"isMulti",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"item",
")",
")",
"return",
"false",
";",
"return",
"is_array",
"(",
"head",
"(",
"$",
"item",
")",
")",
"||",
"head",
"(",
"$",
"item",
")",
"ins... | Check if the item is a multidimensional array or an array of Buyables.
@param mixed $item
@return bool | [
"Check",
"if",
"the",
"item",
"is",
"a",
"multidimensional",
"array",
"or",
"an",
"array",
"of",
"Buyables",
"."
] | f460ab7312cce32cb428cf39a500a2d16600b1d6 | https://github.com/Crinsane/LaravelShoppingcart/blob/f460ab7312cce32cb428cf39a500a2d16600b1d6/src/Cart.php#L475-L480 |
220,957 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.prepareFieldsFromTable | public function prepareFieldsFromTable()
{
foreach ($this->columns as $column) {
$type = $column->getType()->getName();
switch ($type) {
case 'integer':
$field = $this->generateIntFieldInput($column, 'integer');
break;
... | php | public function prepareFieldsFromTable()
{
foreach ($this->columns as $column) {
$type = $column->getType()->getName();
switch ($type) {
case 'integer':
$field = $this->generateIntFieldInput($column, 'integer');
break;
... | [
"public",
"function",
"prepareFieldsFromTable",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"{",
"$",
"type",
"=",
"$",
"column",
"->",
"getType",
"(",
")",
"->",
"getName",
"(",
")",
";",
"switch",
"(",
"$"... | Prepares array of GeneratorField from table columns. | [
"Prepares",
"array",
"of",
"GeneratorField",
"from",
"table",
"columns",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L92-L155 |
220,958 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.getPrimaryKeyOfTable | public static function getPrimaryKeyOfTable($tableName)
{
$schema = DB::getDoctrineSchemaManager();
$column = $schema->listTableDetails($tableName)->getPrimaryKey();
return $column ? $column->getColumns()[0] : '';
} | php | public static function getPrimaryKeyOfTable($tableName)
{
$schema = DB::getDoctrineSchemaManager();
$column = $schema->listTableDetails($tableName)->getPrimaryKey();
return $column ? $column->getColumns()[0] : '';
} | [
"public",
"static",
"function",
"getPrimaryKeyOfTable",
"(",
"$",
"tableName",
")",
"{",
"$",
"schema",
"=",
"DB",
"::",
"getDoctrineSchemaManager",
"(",
")",
";",
"$",
"column",
"=",
"$",
"schema",
"->",
"listTableDetails",
"(",
"$",
"tableName",
")",
"->",... | Get primary key of given table.
@param string $tableName
@return string|null The column name of the (simple) primary key | [
"Get",
"primary",
"key",
"of",
"given",
"table",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L164-L170 |
220,959 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.getTimestampFieldNames | public static function getTimestampFieldNames()
{
if (!config('infyom.laravel_generator.timestamps.enabled', true)) {
return [];
}
$createdAtName = config('infyom.laravel_generator.timestamps.created_at', 'created_at');
$updatedAtName = config('infyom.laravel_generator.t... | php | public static function getTimestampFieldNames()
{
if (!config('infyom.laravel_generator.timestamps.enabled', true)) {
return [];
}
$createdAtName = config('infyom.laravel_generator.timestamps.created_at', 'created_at');
$updatedAtName = config('infyom.laravel_generator.t... | [
"public",
"static",
"function",
"getTimestampFieldNames",
"(",
")",
"{",
"if",
"(",
"!",
"config",
"(",
"'infyom.laravel_generator.timestamps.enabled'",
",",
"true",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"createdAtName",
"=",
"config",
"(",
"'infyo... | Get timestamp columns from config.
@return array the set of [created_at column name, updated_at column name] | [
"Get",
"timestamp",
"columns",
"from",
"config",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L177-L188 |
220,960 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.generateIntFieldInput | private function generateIntFieldInput($column, $dbType)
{
$field = new GeneratorField();
$field->name = $column->getName();
$field->parseDBType($dbType);
$field->htmlType = 'number';
if ($column->getAutoincrement()) {
$field->dbInput .= ',true';
} else {... | php | private function generateIntFieldInput($column, $dbType)
{
$field = new GeneratorField();
$field->name = $column->getName();
$field->parseDBType($dbType);
$field->htmlType = 'number';
if ($column->getAutoincrement()) {
$field->dbInput .= ',true';
} else {... | [
"private",
"function",
"generateIntFieldInput",
"(",
"$",
"column",
",",
"$",
"dbType",
")",
"{",
"$",
"field",
"=",
"new",
"GeneratorField",
"(",
")",
";",
"$",
"field",
"->",
"name",
"=",
"$",
"column",
"->",
"getName",
"(",
")",
";",
"$",
"field",
... | Generates integer text field for database.
@param string $dbType
@param \Doctrine\DBAL\Schema\Column $column
@return GeneratorField | [
"Generates",
"integer",
"text",
"field",
"for",
"database",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L198-L216 |
220,961 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.checkForPrimary | private function checkForPrimary(GeneratorField $field)
{
if ($field->name == $this->primaryKey) {
$field->isPrimary = true;
$field->isFillable = false;
$field->isSearchable = false;
$field->inIndex = false;
$field->inForm = false;
}
... | php | private function checkForPrimary(GeneratorField $field)
{
if ($field->name == $this->primaryKey) {
$field->isPrimary = true;
$field->isFillable = false;
$field->isSearchable = false;
$field->inIndex = false;
$field->inForm = false;
}
... | [
"private",
"function",
"checkForPrimary",
"(",
"GeneratorField",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"->",
"name",
"==",
"$",
"this",
"->",
"primaryKey",
")",
"{",
"$",
"field",
"->",
"isPrimary",
"=",
"true",
";",
"$",
"field",
"->",
"isF... | Check if key is primary key and sets field options.
@param GeneratorField $field
@return GeneratorField | [
"Check",
"if",
"key",
"is",
"primary",
"key",
"and",
"sets",
"field",
"options",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L225-L236 |
220,962 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.generateField | private function generateField($column, $dbType, $htmlType)
{
$field = new GeneratorField();
$field->name = $column->getName();
$field->parseDBType($dbType);
$field->parseHtmlInput($htmlType);
return $this->checkForPrimary($field);
} | php | private function generateField($column, $dbType, $htmlType)
{
$field = new GeneratorField();
$field->name = $column->getName();
$field->parseDBType($dbType);
$field->parseHtmlInput($htmlType);
return $this->checkForPrimary($field);
} | [
"private",
"function",
"generateField",
"(",
"$",
"column",
",",
"$",
"dbType",
",",
"$",
"htmlType",
")",
"{",
"$",
"field",
"=",
"new",
"GeneratorField",
"(",
")",
";",
"$",
"field",
"->",
"name",
"=",
"$",
"column",
"->",
"getName",
"(",
")",
";",... | Generates field.
@param \Doctrine\DBAL\Schema\Column $column
@param $dbType
@param $htmlType
@return GeneratorField | [
"Generates",
"field",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L247-L255 |
220,963 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.generateNumberInput | private function generateNumberInput($column, $dbType)
{
$field = new GeneratorField();
$field->name = $column->getName();
$field->parseDBType($dbType.','.$column->getPrecision().','.$column->getScale());
$field->htmlType = 'number';
return $this->checkForPrimary($field);
... | php | private function generateNumberInput($column, $dbType)
{
$field = new GeneratorField();
$field->name = $column->getName();
$field->parseDBType($dbType.','.$column->getPrecision().','.$column->getScale());
$field->htmlType = 'number';
return $this->checkForPrimary($field);
... | [
"private",
"function",
"generateNumberInput",
"(",
"$",
"column",
",",
"$",
"dbType",
")",
"{",
"$",
"field",
"=",
"new",
"GeneratorField",
"(",
")",
";",
"$",
"field",
"->",
"name",
"=",
"$",
"column",
"->",
"getName",
"(",
")",
";",
"$",
"field",
"... | Generates number field.
@param \Doctrine\DBAL\Schema\Column $column
@param string $dbType
@return GeneratorField | [
"Generates",
"number",
"field",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L265-L273 |
220,964 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.prepareForeignKeys | public function prepareForeignKeys()
{
$tables = $this->schemaManager->listTables();
$fields = [];
foreach ($tables as $table) {
$primaryKey = $table->getPrimaryKey();
if ($primaryKey) {
$primaryKey = $primaryKey->getColumns()[0];
}
... | php | public function prepareForeignKeys()
{
$tables = $this->schemaManager->listTables();
$fields = [];
foreach ($tables as $table) {
$primaryKey = $table->getPrimaryKey();
if ($primaryKey) {
$primaryKey = $primaryKey->getColumns()[0];
}
... | [
"public",
"function",
"prepareForeignKeys",
"(",
")",
"{",
"$",
"tables",
"=",
"$",
"this",
"->",
"schemaManager",
"->",
"listTables",
"(",
")",
";",
"$",
"fields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"tables",
"as",
"$",
"table",
")",
"{",
"$",... | Prepares foreign keys from table with required details.
@return GeneratorTable[] | [
"Prepares",
"foreign",
"keys",
"from",
"table",
"with",
"required",
"details",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L289-L322 |
220,965 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.checkForRelations | private function checkForRelations($tables)
{
// get Model table name and table details from tables list
$modelTableName = $this->tableName;
$modelTable = $tables[$modelTableName];
unset($tables[$modelTableName]);
$this->relations = [];
// detects many to one rules ... | php | private function checkForRelations($tables)
{
// get Model table name and table details from tables list
$modelTableName = $this->tableName;
$modelTable = $tables[$modelTableName];
unset($tables[$modelTableName]);
$this->relations = [];
// detects many to one rules ... | [
"private",
"function",
"checkForRelations",
"(",
"$",
"tables",
")",
"{",
"// get Model table name and table details from tables list",
"$",
"modelTableName",
"=",
"$",
"this",
"->",
"tableName",
";",
"$",
"modelTable",
"=",
"$",
"tables",
"[",
"$",
"modelTableName",
... | Prepares relations array from table foreign keys.
@param GeneratorTable[] $tables | [
"Prepares",
"relations",
"array",
"from",
"table",
"foreign",
"keys",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L329-L381 |
220,966 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.isManyToMany | private function isManyToMany($tables, $tableName, $modelTable, $modelTableName)
{
// get table details
$table = $tables[$tableName];
$isAnyKeyOnModelTable = false;
// many to many model table name
$manyToManyTable = '';
$foreignKeys = $table->foreignKeys;
... | php | private function isManyToMany($tables, $tableName, $modelTable, $modelTableName)
{
// get table details
$table = $tables[$tableName];
$isAnyKeyOnModelTable = false;
// many to many model table name
$manyToManyTable = '';
$foreignKeys = $table->foreignKeys;
... | [
"private",
"function",
"isManyToMany",
"(",
"$",
"tables",
",",
"$",
"tableName",
",",
"$",
"modelTable",
",",
"$",
"modelTableName",
")",
"{",
"// get table details",
"$",
"table",
"=",
"$",
"tables",
"[",
"$",
"tableName",
"]",
";",
"$",
"isAnyKeyOnModelTa... | Detects many to many relationship
If table has only two foreign keys
Both foreign keys are primary key in foreign table
Also one is from model table and one is from diff table.
@param GeneratorTable[] $tables
@param string $tableName
@param GeneratorTable $modelTable
@param string $modelTableName... | [
"Detects",
"many",
"to",
"many",
"relationship",
"If",
"table",
"has",
"only",
"two",
"foreign",
"keys",
"Both",
"foreign",
"keys",
"are",
"primary",
"key",
"in",
"foreign",
"table",
"Also",
"one",
"is",
"from",
"model",
"table",
"and",
"one",
"is",
"from"... | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L396-L449 |
220,967 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.isOneToOne | private function isOneToOne($primaryKey, $foreignKey, $modelTablePrimary)
{
if ($foreignKey->foreignField == $modelTablePrimary) {
if ($foreignKey->localField == $primaryKey) {
return true;
}
}
return false;
} | php | private function isOneToOne($primaryKey, $foreignKey, $modelTablePrimary)
{
if ($foreignKey->foreignField == $modelTablePrimary) {
if ($foreignKey->localField == $primaryKey) {
return true;
}
}
return false;
} | [
"private",
"function",
"isOneToOne",
"(",
"$",
"primaryKey",
",",
"$",
"foreignKey",
",",
"$",
"modelTablePrimary",
")",
"{",
"if",
"(",
"$",
"foreignKey",
"->",
"foreignField",
"==",
"$",
"modelTablePrimary",
")",
"{",
"if",
"(",
"$",
"foreignKey",
"->",
... | Detects if one to one relationship is there
If foreign key of table is primary key of foreign table
Also foreign key field is primary key of this table.
@param string $primaryKey
@param GeneratorForeignKey $foreignKey
@param string $modelTablePrimary
@return bool | [
"Detects",
"if",
"one",
"to",
"one",
"relationship",
"is",
"there",
"If",
"foreign",
"key",
"of",
"table",
"is",
"primary",
"key",
"of",
"foreign",
"table",
"Also",
"foreign",
"key",
"field",
"is",
"primary",
"key",
"of",
"this",
"table",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L462-L471 |
220,968 | InfyOmLabs/laravel-generator | src/Utils/TableFieldsGenerator.php | TableFieldsGenerator.isOneToMany | private function isOneToMany($primaryKey, $foreignKey, $modelTablePrimary)
{
if ($foreignKey->foreignField == $modelTablePrimary) {
if ($foreignKey->localField != $primaryKey) {
return true;
}
}
return false;
} | php | private function isOneToMany($primaryKey, $foreignKey, $modelTablePrimary)
{
if ($foreignKey->foreignField == $modelTablePrimary) {
if ($foreignKey->localField != $primaryKey) {
return true;
}
}
return false;
} | [
"private",
"function",
"isOneToMany",
"(",
"$",
"primaryKey",
",",
"$",
"foreignKey",
",",
"$",
"modelTablePrimary",
")",
"{",
"if",
"(",
"$",
"foreignKey",
"->",
"foreignField",
"==",
"$",
"modelTablePrimary",
")",
"{",
"if",
"(",
"$",
"foreignKey",
"->",
... | Detects if one to many relationship is there
If foreign key of table is primary key of foreign table
Also foreign key field is not primary key of this table.
@param string $primaryKey
@param GeneratorForeignKey $foreignKey
@param string $modelTablePrimary
@return bool | [
"Detects",
"if",
"one",
"to",
"many",
"relationship",
"is",
"there",
"If",
"foreign",
"key",
"of",
"table",
"is",
"primary",
"key",
"of",
"foreign",
"table",
"Also",
"foreign",
"key",
"field",
"is",
"not",
"primary",
"key",
"of",
"this",
"table",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Utils/TableFieldsGenerator.php#L484-L493 |
220,969 | InfyOmLabs/laravel-generator | src/Criteria/LimitOffsetCriteria.php | LimitOffsetCriteria.apply | public function apply($model, \Prettus\Repository\Contracts\RepositoryInterface $repository)
{
$limit = $this->request->get('limit', null);
$offset = $this->request->get('offset', null);
if ($limit) {
$model = $model->limit($limit);
}
if ($offset && $limit) {
... | php | public function apply($model, \Prettus\Repository\Contracts\RepositoryInterface $repository)
{
$limit = $this->request->get('limit', null);
$offset = $this->request->get('offset', null);
if ($limit) {
$model = $model->limit($limit);
}
if ($offset && $limit) {
... | [
"public",
"function",
"apply",
"(",
"$",
"model",
",",
"\\",
"Prettus",
"\\",
"Repository",
"\\",
"Contracts",
"\\",
"RepositoryInterface",
"$",
"repository",
")",
"{",
"$",
"limit",
"=",
"$",
"this",
"->",
"request",
"->",
"get",
"(",
"'limit'",
",",
"n... | Apply criteria in query repository.
@param $model
@param \Prettus\Repository\Contracts\RepositoryInterface $repository
@return mixed | [
"Apply",
"criteria",
"in",
"query",
"repository",
"."
] | 2dc3d4d62f735e3216fcda242f70c9e073154312 | https://github.com/InfyOmLabs/laravel-generator/blob/2dc3d4d62f735e3216fcda242f70c9e073154312/src/Criteria/LimitOffsetCriteria.php#L28-L42 |
220,970 | barryvdh/laravel-ide-helper | src/Generator.php | Generator.generate | public function generate($format = 'php')
{
// Check if the generator for this format exists
$method = 'generate'.ucfirst($format).'Helper';
if (method_exists($this, $method)) {
return $this->$method();
}
return $this->generatePhpHelper();
} | php | public function generate($format = 'php')
{
// Check if the generator for this format exists
$method = 'generate'.ucfirst($format).'Helper';
if (method_exists($this, $method)) {
return $this->$method();
}
return $this->generatePhpHelper();
} | [
"public",
"function",
"generate",
"(",
"$",
"format",
"=",
"'php'",
")",
"{",
"// Check if the generator for this format exists",
"$",
"method",
"=",
"'generate'",
".",
"ucfirst",
"(",
"$",
"format",
")",
".",
"'Helper'",
";",
"if",
"(",
"method_exists",
"(",
... | Generate the helper file contents;
@param string $format The format to generate the helper in (php/json)
@return string; | [
"Generate",
"the",
"helper",
"file",
"contents",
";"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Generator.php#L69-L78 |
220,971 | barryvdh/laravel-ide-helper | src/Generator.php | Generator.getValidAliases | protected function getValidAliases()
{
$aliases = new Collection();
// Get all aliases
foreach ($this->getAliases() as $name => $facade) {
// Skip the Redis facade, if not available (otherwise Fatal PHP Error)
if ($facade == 'Illuminate\Support\Facades\Redis' && $nam... | php | protected function getValidAliases()
{
$aliases = new Collection();
// Get all aliases
foreach ($this->getAliases() as $name => $facade) {
// Skip the Redis facade, if not available (otherwise Fatal PHP Error)
if ($facade == 'Illuminate\Support\Facades\Redis' && $nam... | [
"protected",
"function",
"getValidAliases",
"(",
")",
"{",
"$",
"aliases",
"=",
"new",
"Collection",
"(",
")",
";",
"// Get all aliases",
"foreach",
"(",
"$",
"this",
"->",
"getAliases",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"facade",
")",
"{",
"// Ski... | Find all aliases that are valid for us to render
@return Collection | [
"Find",
"all",
"aliases",
"that",
"are",
"valid",
"for",
"us",
"to",
"render"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Generator.php#L194-L218 |
220,972 | barryvdh/laravel-ide-helper | src/Alias.php | Alias.addClass | public function addClass($classes)
{
$classes = (array)$classes;
foreach ($classes as $class) {
if (class_exists($class) || interface_exists($class)) {
$this->classes[] = $class;
} else {
echo "Class not exists: $class\r\n";
}
... | php | public function addClass($classes)
{
$classes = (array)$classes;
foreach ($classes as $class) {
if (class_exists($class) || interface_exists($class)) {
$this->classes[] = $class;
} else {
echo "Class not exists: $class\r\n";
}
... | [
"public",
"function",
"addClass",
"(",
"$",
"classes",
")",
"{",
"$",
"classes",
"=",
"(",
"array",
")",
"$",
"classes",
";",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"class",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"class",
")",
"||",
"in... | Add one or more classes to analyze
@param array|string $classes | [
"Add",
"one",
"or",
"more",
"classes",
"to",
"analyze"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Alias.php#L91-L101 |
220,973 | barryvdh/laravel-ide-helper | src/Alias.php | Alias.getMethods | public function getMethods()
{
if (count($this->methods) > 0) {
return $this->methods;
}
$this->addMagicMethods();
$this->detectMethods();
return $this->methods;
} | php | public function getMethods()
{
if (count($this->methods) > 0) {
return $this->methods;
}
$this->addMagicMethods();
$this->detectMethods();
return $this->methods;
} | [
"public",
"function",
"getMethods",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"methods",
")",
">",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"methods",
";",
"}",
"$",
"this",
"->",
"addMagicMethods",
"(",
")",
";",
"$",
"this",
... | Get the methods found by this Alias
@return array|Method[] | [
"Get",
"the",
"methods",
"found",
"by",
"this",
"Alias"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Alias.php#L184-L193 |
220,974 | barryvdh/laravel-ide-helper | src/Alias.php | Alias.detectNamespace | protected function detectNamespace()
{
if (strpos($this->alias, '\\')) {
$nsParts = explode('\\', $this->alias);
$this->short = array_pop($nsParts);
$this->namespace = implode('\\', $nsParts);
} else {
$this->short = $this->alias;
}
} | php | protected function detectNamespace()
{
if (strpos($this->alias, '\\')) {
$nsParts = explode('\\', $this->alias);
$this->short = array_pop($nsParts);
$this->namespace = implode('\\', $nsParts);
} else {
$this->short = $this->alias;
}
} | [
"protected",
"function",
"detectNamespace",
"(",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"this",
"->",
"alias",
",",
"'\\\\'",
")",
")",
"{",
"$",
"nsParts",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"this",
"->",
"alias",
")",
";",
"$",
"this",
"-... | Detect the namespace | [
"Detect",
"the",
"namespace"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Alias.php#L222-L231 |
220,975 | barryvdh/laravel-ide-helper | src/Alias.php | Alias.detectExtendsNamespace | protected function detectExtendsNamespace()
{
if (strpos($this->extends, '\\') !== false) {
$nsParts = explode('\\', $this->extends);
$this->extendsClass = array_pop($nsParts);
$this->extendsNamespace = implode('\\', $nsParts);
}
} | php | protected function detectExtendsNamespace()
{
if (strpos($this->extends, '\\') !== false) {
$nsParts = explode('\\', $this->extends);
$this->extendsClass = array_pop($nsParts);
$this->extendsNamespace = implode('\\', $nsParts);
}
} | [
"protected",
"function",
"detectExtendsNamespace",
"(",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"this",
"->",
"extends",
",",
"'\\\\'",
")",
"!==",
"false",
")",
"{",
"$",
"nsParts",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"this",
"->",
"extends",
")... | Detect the extends namespace | [
"Detect",
"the",
"extends",
"namespace"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Alias.php#L236-L243 |
220,976 | barryvdh/laravel-ide-helper | src/Alias.php | Alias.detectClassType | protected function detectClassType()
{
//Some classes extend the facade
if (interface_exists($this->facade)) {
$this->classType = 'interface';
$this->extends = $this->facade;
} else {
$this->classType = 'class';
if (class_exists($this->facade))... | php | protected function detectClassType()
{
//Some classes extend the facade
if (interface_exists($this->facade)) {
$this->classType = 'interface';
$this->extends = $this->facade;
} else {
$this->classType = 'class';
if (class_exists($this->facade))... | [
"protected",
"function",
"detectClassType",
"(",
")",
"{",
"//Some classes extend the facade",
"if",
"(",
"interface_exists",
"(",
"$",
"this",
"->",
"facade",
")",
")",
"{",
"$",
"this",
"->",
"classType",
"=",
"'interface'",
";",
"$",
"this",
"->",
"extends"... | Detect the class type | [
"Detect",
"the",
"class",
"type"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Alias.php#L248-L260 |
220,977 | barryvdh/laravel-ide-helper | src/Alias.php | Alias.detectRoot | protected function detectRoot()
{
$facade = $this->facade;
try {
//If possible, get the facade root
if (method_exists($facade, 'getFacadeRoot')) {
$root = get_class($facade::getFacadeRoot());
} else {
$root = $facade;
}... | php | protected function detectRoot()
{
$facade = $this->facade;
try {
//If possible, get the facade root
if (method_exists($facade, 'getFacadeRoot')) {
$root = get_class($facade::getFacadeRoot());
} else {
$root = $facade;
}... | [
"protected",
"function",
"detectRoot",
"(",
")",
"{",
"$",
"facade",
"=",
"$",
"this",
"->",
"facade",
";",
"try",
"{",
"//If possible, get the facade root",
"if",
"(",
"method_exists",
"(",
"$",
"facade",
",",
"'getFacadeRoot'",
")",
")",
"{",
"$",
"root",
... | Get the real root of a facade
@return bool|string | [
"Get",
"the",
"real",
"root",
"of",
"a",
"facade"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Alias.php#L267-L296 |
220,978 | barryvdh/laravel-ide-helper | src/Alias.php | Alias.addMagicMethods | protected function addMagicMethods()
{
foreach ($this->magicMethods as $magic => $real) {
list($className, $name) = explode('::', $real);
if (!class_exists($className) && !interface_exists($className)) {
continue;
}
$method = new \ReflectionMet... | php | protected function addMagicMethods()
{
foreach ($this->magicMethods as $magic => $real) {
list($className, $name) = explode('::', $real);
if (!class_exists($className) && !interface_exists($className)) {
continue;
}
$method = new \ReflectionMet... | [
"protected",
"function",
"addMagicMethods",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"magicMethods",
"as",
"$",
"magic",
"=>",
"$",
"real",
")",
"{",
"list",
"(",
"$",
"className",
",",
"$",
"name",
")",
"=",
"explode",
"(",
"'::'",
",",
"$"... | Add magic methods, as defined in the configuration files | [
"Add",
"magic",
"methods",
"as",
"defined",
"in",
"the",
"configuration",
"files"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Alias.php#L315-L332 |
220,979 | barryvdh/laravel-ide-helper | src/Alias.php | Alias.detectMethods | protected function detectMethods()
{
foreach ($this->classes as $class) {
$reflection = new \ReflectionClass($class);
$methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
if ($methods) {
foreach ($methods as $method) {
if... | php | protected function detectMethods()
{
foreach ($this->classes as $class) {
$reflection = new \ReflectionClass($class);
$methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
if ($methods) {
foreach ($methods as $method) {
if... | [
"protected",
"function",
"detectMethods",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"classes",
"as",
"$",
"class",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"$",
"methods",
"=",
"$",
"reflect... | Get the methods for one or multiple classes.
@return string | [
"Get",
"the",
"methods",
"for",
"one",
"or",
"multiple",
"classes",
"."
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Alias.php#L339-L385 |
220,980 | barryvdh/laravel-ide-helper | src/Alias.php | Alias.removeDuplicateMethodsFromPhpDoc | protected function removeDuplicateMethodsFromPhpDoc()
{
$methodNames = array_map(function (Method $method) {
return $method->getName();
}, $this->getMethods());
foreach ($this->phpdoc->getTags() as $tag) {
if ($tag instanceof MethodTag && in_array($tag->getMethodName... | php | protected function removeDuplicateMethodsFromPhpDoc()
{
$methodNames = array_map(function (Method $method) {
return $method->getName();
}, $this->getMethods());
foreach ($this->phpdoc->getTags() as $tag) {
if ($tag instanceof MethodTag && in_array($tag->getMethodName... | [
"protected",
"function",
"removeDuplicateMethodsFromPhpDoc",
"(",
")",
"{",
"$",
"methodNames",
"=",
"array_map",
"(",
"function",
"(",
"Method",
"$",
"method",
")",
"{",
"return",
"$",
"method",
"->",
"getName",
"(",
")",
";",
"}",
",",
"$",
"this",
"->",... | Removes method tags from the doc comment that already appear as functions inside the class.
This prevents duplicate function errors in the IDE.
@return void | [
"Removes",
"method",
"tags",
"from",
"the",
"doc",
"comment",
"that",
"already",
"appear",
"as",
"functions",
"inside",
"the",
"class",
".",
"This",
"prevents",
"duplicate",
"function",
"errors",
"in",
"the",
"IDE",
"."
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Alias.php#L440-L451 |
220,981 | barryvdh/laravel-ide-helper | src/Method.php | Method.normalizeDescription | protected function normalizeDescription(DocBlock $phpdoc)
{
//Get the short + long description from the DocBlock
$description = $phpdoc->getText();
//Loop through parents/interfaces, to fill in {@inheritdoc}
if (strpos($description, '{@inheritdoc}') !== false) {
$inherit... | php | protected function normalizeDescription(DocBlock $phpdoc)
{
//Get the short + long description from the DocBlock
$description = $phpdoc->getText();
//Loop through parents/interfaces, to fill in {@inheritdoc}
if (strpos($description, '{@inheritdoc}') !== false) {
$inherit... | [
"protected",
"function",
"normalizeDescription",
"(",
"DocBlock",
"$",
"phpdoc",
")",
"{",
"//Get the short + long description from the DocBlock",
"$",
"description",
"=",
"$",
"phpdoc",
"->",
"getText",
"(",
")",
";",
"//Loop through parents/interfaces, to fill in {@inheritd... | Get the description and get the inherited docs.
@param DocBlock $phpdoc | [
"Get",
"the",
"description",
"and",
"get",
"the",
"inherited",
"docs",
"."
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Method.php#L193-L219 |
220,982 | barryvdh/laravel-ide-helper | src/Method.php | Method.normalizeParams | protected function normalizeParams(DocBlock $phpdoc)
{
//Get the return type and adjust them for beter autocomplete
$paramTags = $phpdoc->getTagsByName('param');
if ($paramTags) {
/** @var ParamTag $tag */
foreach ($paramTags as $tag) {
// Convert the ... | php | protected function normalizeParams(DocBlock $phpdoc)
{
//Get the return type and adjust them for beter autocomplete
$paramTags = $phpdoc->getTagsByName('param');
if ($paramTags) {
/** @var ParamTag $tag */
foreach ($paramTags as $tag) {
// Convert the ... | [
"protected",
"function",
"normalizeParams",
"(",
"DocBlock",
"$",
"phpdoc",
")",
"{",
"//Get the return type and adjust them for beter autocomplete",
"$",
"paramTags",
"=",
"$",
"phpdoc",
"->",
"getTagsByName",
"(",
"'param'",
")",
";",
"if",
"(",
"$",
"paramTags",
... | Normalize the parameters
@param DocBlock $phpdoc | [
"Normalize",
"the",
"parameters"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Method.php#L226-L242 |
220,983 | barryvdh/laravel-ide-helper | src/Method.php | Method.convertKeywords | protected function convertKeywords($string)
{
$string = str_replace('\Closure', 'Closure', $string);
$string = str_replace('Closure', '\Closure', $string);
$string = str_replace('dynamic', 'mixed', $string);
return $string;
} | php | protected function convertKeywords($string)
{
$string = str_replace('\Closure', 'Closure', $string);
$string = str_replace('Closure', '\Closure', $string);
$string = str_replace('dynamic', 'mixed', $string);
return $string;
} | [
"protected",
"function",
"convertKeywords",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"str_replace",
"(",
"'\\Closure'",
",",
"'Closure'",
",",
"$",
"string",
")",
";",
"$",
"string",
"=",
"str_replace",
"(",
"'Closure'",
",",
"'\\Closure'",
",",
"... | Convert keywwords that are incorrect.
@param string $string
@return string | [
"Convert",
"keywwords",
"that",
"are",
"incorrect",
"."
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Method.php#L282-L289 |
220,984 | barryvdh/laravel-ide-helper | src/Method.php | Method.getParameters | public function getParameters($method)
{
//Loop through the default values for paremeters, and make the correct output string
$params = array();
$paramsWithDefault = array();
foreach ($method->getParameters() as $param) {
$paramStr = '$' . $param->getName();
$... | php | public function getParameters($method)
{
//Loop through the default values for paremeters, and make the correct output string
$params = array();
$paramsWithDefault = array();
foreach ($method->getParameters() as $param) {
$paramStr = '$' . $param->getName();
$... | [
"public",
"function",
"getParameters",
"(",
"$",
"method",
")",
"{",
"//Loop through the default values for paremeters, and make the correct output string",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"paramsWithDefault",
"=",
"array",
"(",
")",
";",
"foreach",
"... | Get the parameters and format them correctly
@param \ReflectionMethod $method
@return array | [
"Get",
"the",
"parameters",
"and",
"format",
"them",
"correctly"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Method.php#L311-L341 |
220,985 | barryvdh/laravel-ide-helper | src/Console/MetaCommand.php | MetaCommand.getAbstracts | protected function getAbstracts()
{
$abstracts = $this->laravel->getBindings();
// Return the abstract names only
$keys = array_keys($abstracts);
sort($keys);
return $keys;
} | php | protected function getAbstracts()
{
$abstracts = $this->laravel->getBindings();
// Return the abstract names only
$keys = array_keys($abstracts);
sort($keys);
return $keys;
} | [
"protected",
"function",
"getAbstracts",
"(",
")",
"{",
"$",
"abstracts",
"=",
"$",
"this",
"->",
"laravel",
"->",
"getBindings",
"(",
")",
";",
"// Return the abstract names only",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"abstracts",
")",
";",
"sort",
"("... | Get a list of abstracts from the Laravel Application.
@return array | [
"Get",
"a",
"list",
"of",
"abstracts",
"from",
"the",
"Laravel",
"Application",
"."
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Console/MetaCommand.php#L120-L130 |
220,986 | barryvdh/laravel-ide-helper | src/Console/ModelsCommand.php | ModelsCommand.getTypeOverride | protected function getTypeOverride($type)
{
$typeOverrides = $this->laravel['config']->get('ide-helper.type_overrides', array());
return isset($typeOverrides[$type]) ? $typeOverrides[$type] : $type;
} | php | protected function getTypeOverride($type)
{
$typeOverrides = $this->laravel['config']->get('ide-helper.type_overrides', array());
return isset($typeOverrides[$type]) ? $typeOverrides[$type] : $type;
} | [
"protected",
"function",
"getTypeOverride",
"(",
"$",
"type",
")",
"{",
"$",
"typeOverrides",
"=",
"$",
"this",
"->",
"laravel",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'ide-helper.type_overrides'",
",",
"array",
"(",
")",
")",
";",
"return",
"isset",
"("... | Returns the overide type for the give type.
@param string $type
@return string | [
"Returns",
"the",
"overide",
"type",
"for",
"the",
"give",
"type",
"."
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Console/ModelsCommand.php#L315-L320 |
220,987 | barryvdh/laravel-ide-helper | src/Console/ModelsCommand.php | ModelsCommand.getPropertiesFromTable | protected function getPropertiesFromTable($model)
{
$table = $model->getConnection()->getTablePrefix() . $model->getTable();
$schema = $model->getConnection()->getDoctrineSchemaManager($table);
$databasePlatform = $schema->getDatabasePlatform();
$databasePlatform->registerDoctrineTyp... | php | protected function getPropertiesFromTable($model)
{
$table = $model->getConnection()->getTablePrefix() . $model->getTable();
$schema = $model->getConnection()->getDoctrineSchemaManager($table);
$databasePlatform = $schema->getDatabasePlatform();
$databasePlatform->registerDoctrineTyp... | [
"protected",
"function",
"getPropertiesFromTable",
"(",
"$",
"model",
")",
"{",
"$",
"table",
"=",
"$",
"model",
"->",
"getConnection",
"(",
")",
"->",
"getTablePrefix",
"(",
")",
".",
"$",
"model",
"->",
"getTable",
"(",
")",
";",
"$",
"schema",
"=",
... | Load the properties from the database table.
@param \Illuminate\Database\Eloquent\Model $model | [
"Load",
"the",
"properties",
"from",
"the",
"database",
"table",
"."
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Console/ModelsCommand.php#L327-L404 |
220,988 | barryvdh/laravel-ide-helper | src/Console/ModelsCommand.php | ModelsCommand.isRelationForeignKeyNullable | private function isRelationForeignKeyNullable(Relation $relation)
{
$reflectionObj = new \ReflectionObject($relation);
if (!$reflectionObj->hasProperty('foreignKey')) {
return false;
}
$fkProp = $reflectionObj->getProperty('foreignKey');
$fkProp->setAccessible(tru... | php | private function isRelationForeignKeyNullable(Relation $relation)
{
$reflectionObj = new \ReflectionObject($relation);
if (!$reflectionObj->hasProperty('foreignKey')) {
return false;
}
$fkProp = $reflectionObj->getProperty('foreignKey');
$fkProp->setAccessible(tru... | [
"private",
"function",
"isRelationForeignKeyNullable",
"(",
"Relation",
"$",
"relation",
")",
"{",
"$",
"reflectionObj",
"=",
"new",
"\\",
"ReflectionObject",
"(",
"$",
"relation",
")",
";",
"if",
"(",
"!",
"$",
"reflectionObj",
"->",
"hasProperty",
"(",
"'for... | Check if the foreign key of the relation is nullable
@param Relation $relation
@return bool | [
"Check",
"if",
"the",
"foreign",
"key",
"of",
"the",
"relation",
"is",
"nullable"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Console/ModelsCommand.php#L548-L558 |
220,989 | barryvdh/laravel-ide-helper | src/Console/ModelsCommand.php | ModelsCommand.getReturnTypeFromDocBlock | protected function getReturnTypeFromDocBlock(\ReflectionMethod $reflection)
{
$type = null;
$phpdoc = new DocBlock($reflection);
if ($phpdoc->hasTag('return')) {
$type = $phpdoc->getTagsByName('return')[0]->getType();
}
return $type;
} | php | protected function getReturnTypeFromDocBlock(\ReflectionMethod $reflection)
{
$type = null;
$phpdoc = new DocBlock($reflection);
if ($phpdoc->hasTag('return')) {
$type = $phpdoc->getTagsByName('return')[0]->getType();
}
return $type;
} | [
"protected",
"function",
"getReturnTypeFromDocBlock",
"(",
"\\",
"ReflectionMethod",
"$",
"reflection",
")",
"{",
"$",
"type",
"=",
"null",
";",
"$",
"phpdoc",
"=",
"new",
"DocBlock",
"(",
"$",
"reflection",
")",
";",
"if",
"(",
"$",
"phpdoc",
"->",
"hasTa... | Get method return type based on it DocBlock comment
@param \ReflectionMethod $reflection
@return null|string | [
"Get",
"method",
"return",
"type",
"based",
"on",
"it",
"DocBlock",
"comment"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Console/ModelsCommand.php#L777-L787 |
220,990 | barryvdh/laravel-ide-helper | src/Console/ModelsCommand.php | ModelsCommand.getSoftDeleteMethods | protected function getSoftDeleteMethods($model)
{
$traits = class_uses(get_class($model), true);
if (in_array('Illuminate\\Database\\Eloquent\\SoftDeletes', $traits)) {
$this->setMethod('forceDelete', 'bool|null', []);
$this->setMethod('restore', 'bool|null', []);
... | php | protected function getSoftDeleteMethods($model)
{
$traits = class_uses(get_class($model), true);
if (in_array('Illuminate\\Database\\Eloquent\\SoftDeletes', $traits)) {
$this->setMethod('forceDelete', 'bool|null', []);
$this->setMethod('restore', 'bool|null', []);
... | [
"protected",
"function",
"getSoftDeleteMethods",
"(",
"$",
"model",
")",
"{",
"$",
"traits",
"=",
"class_uses",
"(",
"get_class",
"(",
"$",
"model",
")",
",",
"true",
")",
";",
"if",
"(",
"in_array",
"(",
"'Illuminate\\\\Database\\\\Eloquent\\\\SoftDeletes'",
",... | Generates methods provided by the SoftDeletes trait
@param \Illuminate\Database\Eloquent\Model $model | [
"Generates",
"methods",
"provided",
"by",
"the",
"SoftDeletes",
"trait"
] | 87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe | https://github.com/barryvdh/laravel-ide-helper/blob/87ebe458e9b5787e6b65b9c4b62df9c2b13be7fe/src/Console/ModelsCommand.php#L793-L804 |
220,991 | aimeos/aimeos-laravel | src/Aimeos/Shop/Base/View.php | View.addNumber | protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config, $locale )
{
$pattern = $config->get( 'client/html/common/format/pattern' );
$helper = new \Aimeos\MW\View\Helper\Number\Locale( $view, $locale, $pattern );
$view->addHelper( 'number', $helper );
return $view;
} | php | protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config, $locale )
{
$pattern = $config->get( 'client/html/common/format/pattern' );
$helper = new \Aimeos\MW\View\Helper\Number\Locale( $view, $locale, $pattern );
$view->addHelper( 'number', $helper );
return $view;
} | [
"protected",
"function",
"addNumber",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
",",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"Config",
"\\",
"Iface",
"$",
"config",
",",
"$",
"locale",
")",
"{",
"$",
"pattern",
"=",
"$",
... | Adds the "number" helper to the view object
@param \Aimeos\MW\View\Iface $view View object
@param \Aimeos\MW\Config\Iface $config Configuration object
@param string|null $locale Code of the current language or null for no translation
@return \Aimeos\MW\View\Iface Modified view object | [
"Adds",
"the",
"number",
"helper",
"to",
"the",
"view",
"object"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Base/View.php#L161-L169 |
220,992 | aimeos/aimeos-laravel | src/Aimeos/Shop/Controller/JqadmController.php | JqadmController.exportAction | public function exportAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, ['admin', 'editor']] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->export() ) == '' ) {
return $cntl->getView()->response();
}
return $this->getHtml( $html );
} | php | public function exportAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, ['admin', 'editor']] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->export() ) == '' ) {
return $cntl->getView()->response();
}
return $this->getHtml( $html );
} | [
"public",
"function",
"exportAction",
"(",
")",
"{",
"if",
"(",
"config",
"(",
"'shop.authorize'",
",",
"true",
")",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"'admin'",
",",
"[",
"JqadmController",
"::",
"class",
",",
"[",
"'admin'",
",",
"'editor'... | Exports the data for a resource object
@return string Generated output | [
"Exports",
"the",
"data",
"for",
"a",
"resource",
"object"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Controller/JqadmController.php#L143-L156 |
220,993 | aimeos/aimeos-laravel | src/Aimeos/Shop/Controller/JqadmController.php | JqadmController.getHtml | protected function getHtml( $content )
{
$site = Route::input( 'site', Input::get( 'site', 'default' ) );
return View::make( 'shop::jqadm.index', array( 'content' => $content, 'site' => $site ) );
} | php | protected function getHtml( $content )
{
$site = Route::input( 'site', Input::get( 'site', 'default' ) );
return View::make( 'shop::jqadm.index', array( 'content' => $content, 'site' => $site ) );
} | [
"protected",
"function",
"getHtml",
"(",
"$",
"content",
")",
"{",
"$",
"site",
"=",
"Route",
"::",
"input",
"(",
"'site'",
",",
"Input",
"::",
"get",
"(",
"'site'",
",",
"'default'",
")",
")",
";",
"return",
"View",
"::",
"make",
"(",
"'shop::jqadm.in... | Returns the generated HTML code
@param string $content Content from admin client
@return \Illuminate\Contracts\View\View View for rendering the output | [
"Returns",
"the",
"generated",
"HTML",
"code"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Controller/JqadmController.php#L258-L262 |
220,994 | aimeos/aimeos-laravel | src/Aimeos/Shop/Base/Shop.php | Shop.get | public function get( $name )
{
if( !isset( $this->objects[$name] ) )
{
$client = \Aimeos\Client\Html::create( $this->context, $name );
$client->setView( clone $this->view );
$client->process();
$this->objects[$name] = $client;
}
return $this->objects[$name];
} | php | public function get( $name )
{
if( !isset( $this->objects[$name] ) )
{
$client = \Aimeos\Client\Html::create( $this->context, $name );
$client->setView( clone $this->view );
$client->process();
$this->objects[$name] = $client;
}
return $this->objects[$name];
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"client",
"=",
"\\",
"Aimeos",
"\\",
"Client",
"\\",
"Html",
"::",
"create",
"(",
"$... | Returns the HTML client for the given name
@param string $name Name of the shop component
@return \Aimeos\Client\Html\Iface HTML client | [
"Returns",
"the",
"HTML",
"client",
"for",
"the",
"given",
"name"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Base/Shop.php#L63-L75 |
220,995 | aimeos/aimeos-laravel | src/Aimeos/Shop/Command/AccountCommand.php | AccountCommand.addListItem | protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid )
{
$manager = \Aimeos\MShop::create( $context, 'customer/lists' );
$search = $manager->createSearch();
$expr = array(
$search->compare( '==', 'customer.lists.parentid', $userid ),
$search->compare( '==', 'custome... | php | protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid )
{
$manager = \Aimeos\MShop::create( $context, 'customer/lists' );
$search = $manager->createSearch();
$expr = array(
$search->compare( '==', 'customer.lists.parentid', $userid ),
$search->compare( '==', 'custome... | [
"protected",
"function",
"addListItem",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"$",
"userid",
",",
"$",
"groupid",
")",
"{",
"$",
"manager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
"crea... | Associates the user to the group by their given IDs
@param \Aimeos\MShop\Context\Item\Iface $context Aimeos context object
@param string $userid Unique user ID
@param string $groupid Unique group ID | [
"Associates",
"the",
"user",
"to",
"the",
"group",
"by",
"their",
"given",
"IDs"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Command/AccountCommand.php#L80-L105 |
220,996 | aimeos/aimeos-laravel | src/Aimeos/Shop/Command/AccountCommand.php | AccountCommand.createCustomerItem | protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password )
{
$manager = \Aimeos\MShop::create( $context, 'customer' );
try {
$item = $manager->findItem( $email );
} catch( \Aimeos\MShop\Exception $e ) {
$item = $manager->createItem();
}
$item->setCode( $emai... | php | protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password )
{
$manager = \Aimeos\MShop::create( $context, 'customer' );
try {
$item = $manager->findItem( $email );
} catch( \Aimeos\MShop\Exception $e ) {
$item = $manager->createItem();
}
$item->setCode( $emai... | [
"protected",
"function",
"createCustomerItem",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"$",
"email",
",",
"$",
"password",
")",
"{",
"$",
"manager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
... | Returns the customer item for the given e-mail and set its password
If the customer doesn't exist yet, it will be created.
@param \Aimeos\MShop\Context\Item\Iface $context Aimeos context object
@param string $email Unique e-mail address
@param string $password New user password
@return \Aimeos\MShop\Customer\Item\Ifa... | [
"Returns",
"the",
"customer",
"item",
"for",
"the",
"given",
"e",
"-",
"mail",
"and",
"set",
"its",
"password"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Command/AccountCommand.php#L161-L180 |
220,997 | aimeos/aimeos-laravel | src/Aimeos/Shop/Command/AccountCommand.php | AccountCommand.getGroupItem | protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code )
{
$manager = \Aimeos\MShop::create( $context, 'customer/group' );
try
{
$item = $manager->findItem( $code );
}
catch( \Aimeos\MShop\Exception $e )
{
$item = $manager->createItem();
$item->setLabel( $code );
$it... | php | protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code )
{
$manager = \Aimeos\MShop::create( $context, 'customer/group' );
try
{
$item = $manager->findItem( $code );
}
catch( \Aimeos\MShop\Exception $e )
{
$item = $manager->createItem();
$item->setLabel( $code );
$it... | [
"protected",
"function",
"getGroupItem",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"$",
"code",
")",
"{",
"$",
"manager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
"create",
"(",
"$",
"contex... | Returns the customer group item for the given code
@param \Aimeos\MShop\Context\Item\Iface $context Aimeos context object
@param string $code Unique customer group code
@return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object | [
"Returns",
"the",
"customer",
"group",
"item",
"for",
"the",
"given",
"code"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Command/AccountCommand.php#L204-L222 |
220,998 | aimeos/aimeos-laravel | src/Aimeos/Shop/Command/SetupCommand.php | SetupCommand.getDbConfig | protected function getDbConfig( \Aimeos\MW\Config\Iface $conf )
{
$dbconfig = $conf->get( 'resource', array() );
foreach( $dbconfig as $rname => $dbconf )
{
if( strncmp( $rname, 'db', 2 ) !== 0 ) {
unset( $dbconfig[$rname] );
}
}
return $dbconfig;
} | php | protected function getDbConfig( \Aimeos\MW\Config\Iface $conf )
{
$dbconfig = $conf->get( 'resource', array() );
foreach( $dbconfig as $rname => $dbconf )
{
if( strncmp( $rname, 'db', 2 ) !== 0 ) {
unset( $dbconfig[$rname] );
}
}
return $dbconfig;
} | [
"protected",
"function",
"getDbConfig",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"Config",
"\\",
"Iface",
"$",
"conf",
")",
"{",
"$",
"dbconfig",
"=",
"$",
"conf",
"->",
"get",
"(",
"'resource'",
",",
"array",
"(",
")",
")",
";",
"foreach",
"(",
"$",
... | Returns the database configuration from the config object.
@param \Aimeos\MW\Config\Iface $conf Config object
@return array Multi-dimensional associative list of database configuration parameters | [
"Returns",
"the",
"database",
"configuration",
"from",
"the",
"config",
"object",
"."
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Command/SetupCommand.php#L98-L110 |
220,999 | aimeos/aimeos-laravel | src/Aimeos/Shop/Base/Context.php | Context.addGroups | protected function addGroups( \Aimeos\MShop\Context\Item\Iface $context )
{
if( ( $userid = Auth::id() ) !== null )
{
$context->setGroupIds( function() use ( $context, $userid )
{
$manager = \Aimeos\MShop::create( $context, 'customer' );
return $manager->getItem( $userid, array( 'customer/group' ) )-... | php | protected function addGroups( \Aimeos\MShop\Context\Item\Iface $context )
{
if( ( $userid = Auth::id() ) !== null )
{
$context->setGroupIds( function() use ( $context, $userid )
{
$manager = \Aimeos\MShop::create( $context, 'customer' );
return $manager->getItem( $userid, array( 'customer/group' ) )-... | [
"protected",
"function",
"addGroups",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
")",
"{",
"if",
"(",
"(",
"$",
"userid",
"=",
"Auth",
"::",
"id",
"(",
")",
")",
"!==",
"null",
")",
"{",
"$",
... | Adds the group IDs if available
@param \Aimeos\MShop\Context\Item\Iface $context Context object
@return \Aimeos\MShop\Context\Item\Iface Modified context object | [
"Adds",
"the",
"group",
"IDs",
"if",
"available"
] | d407e5ca95433fa3e900df8dbc9ab1ea74df1afe | https://github.com/aimeos/aimeos-laravel/blob/d407e5ca95433fa3e900df8dbc9ab1ea74df1afe/src/Aimeos/Shop/Base/Context.php#L259-L271 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.