_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q244700
GenericRouter.add
validation
public function add(Route $route): void { if ($route instanceof Route) { $name = $route->getName(); } else { $name = Route::generateNameFromPath($route->getPath()); } $baseRoute = new SymfonyRoute($route->getPath()); $baseRoute->setMethods($route->get...
php
{ "resource": "" }
q244701
GenericRouter.find
validation
public function find(string $method, string $path): Route { $matcher = new UrlMatcher($this->routeCollection, new RequestContext('/', $method)); try { $route = $matcher->match($path); } catch (ResourceNotFoundException $exception) { throw RouterException::noRouteMatch...
php
{ "resource": "" }
q244702
HttpApplication.use
validation
public function use($middleware): void { if (!is_subclass_of($middleware, MiddlewareInterface::class)) { if (!is_callable($middleware)) { throw new ApplicationException(sprintf( 'Middleware must be either class or object that implements `%s`', ...
php
{ "resource": "" }
q244703
HttpApplication.process
validation
public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface { /** @var Route $route */ $route = $this->router->find( $request->getMethod(), $request->getUri()->getPath() ); $controller = $route->getController(); ...
php
{ "resource": "" }
q244704
HttpApplication.handle
validation
public function handle(ServerRequestInterface $request): ResponseInterface { $response = $this->getMiddlewarePipe()->handle($request); return $response; }
php
{ "resource": "" }
q244705
HttpApplication.get
validation
public function get(string $route, callable $controller): void { $this->register($controller, Route::get($route)); }
php
{ "resource": "" }
q244706
HttpApplication.post
validation
public function post(string $route, callable $controller): void { $this->register($controller, Route::post($route)); }
php
{ "resource": "" }
q244707
HttpApplication.put
validation
public function put(string $route, callable $controller): void { $this->register($controller, Route::put($route)); }
php
{ "resource": "" }
q244708
HttpApplication.patch
validation
public function patch(string $route, callable $controller): void { $this->register($controller, Route::patch($route)); }
php
{ "resource": "" }
q244709
HttpApplication.delete
validation
public function delete(string $route, callable $controller): void { $this->register($controller, Route::delete($route)); }
php
{ "resource": "" }
q244710
HttpApplication.options
validation
public function options(string $route, callable $controller): void { $this->register($controller, Route::options($route)); }
php
{ "resource": "" }
q244711
HttpApplication.head
validation
public function head(string $route, callable $controller): void { $this->register($controller, Route::head($route)); }
php
{ "resource": "" }
q244712
Config.merge
validation
public function merge(Config $config): Config { $this->config = array_merge_recursive($this->config, $config->config); return $this; }
php
{ "resource": "" }
q244713
Config.extract
validation
public function extract(string $namespace): Config { $extracted = $this->get($namespace); if (!is_array($extracted)) { throw ConfigException::forExtractionFailure($namespace); } return new self($extracted); }
php
{ "resource": "" }
q244714
Config.set
validation
public function set(string $key, $value): void { $key = explode('.', $key); $last = array_pop($key); $result = &$this->config; foreach ($key as $part) { if (!isset($result[$part]) || !is_array($result[$part])) { $result[$part] = []; } ...
php
{ "resource": "" }
q244715
SetupCommand.handle
validation
public function handle() { if (! $this->token) { $this->error('You must paste your Discord token (App Bot User token) into your `services.php` config file.'); $this->error('View the README for more info: https://github.com/laravel-notification-channels/discord#installation'); ...
php
{ "resource": "" }
q244716
SetupCommand.getGateway
validation
public function getGateway() { $gateway = $this->gateway; try { $response = $this->guzzle->get('https://discordapp.com/api/gateway', [ 'headers' => [ 'Authorization' => 'Bot '.$this->token, ], ]); $gateway = Ar...
php
{ "resource": "" }
q244717
Discord.request
validation
protected function request($verb, $endpoint, array $data) { $url = rtrim($this->baseUrl, '/').'/'.ltrim($endpoint, '/'); try { $response = $this->httpClient->request($verb, $url, [ 'headers' => [ 'Authorization' => 'Bot '.$this->token, ...
php
{ "resource": "" }
q244718
Alert.withLocalizedTitle
validation
public function withLocalizedTitle(Localized $localized): Alert { $cloned = clone $this; $cloned->title = ''; $cloned->titleLocalized = $localized; return $cloned; }
php
{ "resource": "" }
q244719
Alert.withBodyLocalized
validation
public function withBodyLocalized(Localized $localized): Alert { $cloned = clone $this; $cloned->body = ''; $cloned->bodyLocalized = $localized; return $cloned; }
php
{ "resource": "" }
q244720
Alert.withActionLocalized
validation
public function withActionLocalized(Localized $localized): Alert { $cloned = clone $this; $cloned->actionLocalized = $localized; return $cloned; }
php
{ "resource": "" }
q244721
Alert.withLaunchImage
validation
public function withLaunchImage(string $launchImage): Alert { $cloned = clone $this; $cloned->launchImage = $launchImage; return $cloned; }
php
{ "resource": "" }
q244722
Demo.includeConfigurationFile
validation
private static function includeConfigurationFile() { static $included = false; if ($included) { // The configuration file already included return; } $file = __DIR__.'/config.php'; if (!file_exists($file)) { print sprintf( ...
php
{ "resource": "" }
q244723
Aps.withContentAvailable
validation
public function withContentAvailable(bool $contentAvailable): Aps { $cloned = clone $this; $cloned->contentAvailable = $contentAvailable; return $cloned; }
php
{ "resource": "" }
q244724
Aps.withMutableContent
validation
public function withMutableContent(bool $mutableContent): Aps { $cloned = clone $this; $cloned->mutableContent = $mutableContent; return $cloned; }
php
{ "resource": "" }
q244725
Aps.withThreadId
validation
public function withThreadId(string $threadId): Aps { $cloned = clone $this; $cloned->threadId = $threadId; return $cloned; }
php
{ "resource": "" }
q244726
SignatureGeneratorFactory.resolve
validation
public static function resolve(): SignatureGeneratorInterface { self::addDefaultResolvers(); foreach (self::$resolvers as $resolver) { if ($generator = $resolver()) { return $generator; } } throw new \LogicException('Cannot resolve available ...
php
{ "resource": "" }
q244727
SignatureGeneratorFactory.addDefaultResolvers
validation
private static function addDefaultResolvers(): void { static $added = false; if ($added) { return; } $added = true; self::addResolver([__CLASS__, 'tryResolveByWebTokenJwtSystem']); self::addResolver([__CLASS__, 'tryResolveBySpomkyLabsJoseSystem']); ...
php
{ "resource": "" }
q244728
SignatureGeneratorFactory.tryResolveByWebTokenJwtSystem
validation
private static function tryResolveByWebTokenJwtSystem(): ?WebTokenJwtSignatureGenerator { $requiredClasses = [ WebTokenComponentJws::class, WebTokenComponentJwk::class, WebTokenComponentJWKFactory::class, ]; foreach ($requiredClasses as $requiredClass) { ...
php
{ "resource": "" }
q244729
SignatureGeneratorFactory.tryResolveBySpomkyLabsJoseSystem
validation
private static function tryResolveBySpomkyLabsJoseSystem(): ?SpomkyLabsJoseSignatureGenerator { $requiredClasses = [ JWKFactory::class, JWSFactory::class, ]; foreach ($requiredClasses as $requiredClass) { if (!class_exists($requiredClass)) { ...
php
{ "resource": "" }
q244730
ContentJwt.createTemporaryFile
validation
private function createTemporaryFile(): string { $tmpDir = $this->tmpDir; $tmpFileName = md5(uniqid((string) mt_rand(), true)).'.p8'; $tmpFilePath = $tmpDir.'/'.$tmpFileName; $errorCode = $errorMessage = null; set_error_handler(function ($errCode, $errMessage) use (&$erro...
php
{ "resource": "" }
q244731
Payload.withCustomData
validation
public function withCustomData(string $name, $value): Payload { if ($value && !is_array($value) && !is_scalar($value) && !$value instanceof \JsonSerializable) { throw new \InvalidArgumentException(sprintf( 'The custom data value should be a scalar or \JsonSerializable instance, b...
php
{ "resource": "" }
q244732
Request.withHeader
validation
public function withHeader(string $name, string $value): Request { $cloned = clone $this; $cloned->headers[$name] = $value; return $cloned; }
php
{ "resource": "" }
q244733
Request.withHeaders
validation
public function withHeaders(array $headers): Request { $cloned = clone $this; foreach ($headers as $name => $value) { $cloned = $cloned->withHeader($name, $value); } return $cloned; }
php
{ "resource": "" }
q244734
Request.withCertificate
validation
public function withCertificate(string $certificate): Request { $cloned = clone $this; $cloned->certificate = $certificate; return $cloned; }
php
{ "resource": "" }
q244735
Request.withCertificatePassPhrase
validation
public function withCertificatePassPhrase(string $passPhrase): Request { $cloned = clone $this; $cloned->certificatePassPhrase = $passPhrase; return $cloned; }
php
{ "resource": "" }
q244736
HttpProtocolChainVisitor.add
validation
public function add(HttpProtocolVisitorInterface $visitor, int $priority = 0): void { $this->visitors->insert($visitor, $priority); }
php
{ "resource": "" }
q244737
HttpProtocol.doSend
validation
private function doSend(Receiver $receiver, Notification $notification, bool $sandbox): void { $payloadEncoded = $this->payloadEncoder->encode($notification->getPayload()); $uri = $this->uriFactory->create($receiver->getToken(), $sandbox); $request = new Request($uri, $payloadEncoded); ...
php
{ "resource": "" }
q244738
Http20Builder.addDefaultVisitors
validation
public function addDefaultVisitors(): Http20Builder { if ($this->addedDefaultVisitors) { return $this; } $this->addedDefaultVisitors = true; $this->addVisitor(new AddExpirationHeaderVisitor()); $this->addVisitor(new AddPriorityHeaderVisitor()); $this->ad...
php
{ "resource": "" }
q244739
Http20Builder.createChainVisitor
validation
private function createChainVisitor(): HttpProtocolChainVisitor { $chainVisitors = new HttpProtocolChainVisitor(); $visitors = clone $this->visitors; $priority = 0; foreach ($visitors as $visitor) { $chainVisitors->add($visitor, ++$priority); } return $c...
php
{ "resource": "" }
q244740
UriFactory.create
validation
public function create(DeviceToken $deviceToken, bool $sandbox): string { $uri = 'https://api.push.apple.com/3/device/%s'; if ($sandbox) { $uri = 'https://api.development.push.apple.com/3/device/%s'; } return sprintf($uri, $deviceToken); }
php
{ "resource": "" }
q244741
Notification.withApnId
validation
public function withApnId(ApnId $apnId = null): Notification { $cloned = clone $this; $cloned->apnId = $apnId; return $cloned; }
php
{ "resource": "" }
q244742
Notification.withCollapseId
validation
public function withCollapseId(CollapseId $collapseId = null): Notification { $cloned = clone $this; $cloned->collapseId = $collapseId; return $cloned; }
php
{ "resource": "" }
q244743
CurlHttpSender.initializeCurlResource
validation
private function initializeCurlResource(): void { if (!$this->resource) { $this->resource = curl_init(); curl_setopt($this->resource, CURLOPT_RETURNTRANSFER, 1); curl_setopt($this->resource, CURLOPT_POST, 1); curl_setopt($this->resource, CURLOPT_HTTP_VERSION,...
php
{ "resource": "" }
q244744
CurlHttpSender.prepareCurlResourceByRequest
validation
private function prepareCurlResourceByRequest(Request $request): void { curl_setopt($this->resource, CURLOPT_URL, $request->getUrl()); curl_setopt($this->resource, CURLOPT_POSTFIELDS, $request->getContent()); if ($request->getCertificate()) { curl_setopt($this->resource, CURLOPT...
php
{ "resource": "" }
q244745
ExceptionFactory.createByReason
validation
private function createByReason(string $reason, array $json): SendNotificationException { $reason = strtolower($reason); switch ($reason) { case 'badcollapseid': return new BadCollapseIdException(); case 'baddevicetoken': return new BadDevice...
php
{ "resource": "" }
q244746
PayloadEncoder.convertApsToArray
validation
private function convertApsToArray(Aps $aps): array { $data = [ 'alert' => $this->convertAlertToArray($aps->getAlert()), ]; if ($aps->getSound()) { $data['sound'] = $aps->getSound(); } if ($aps->getBadge() !== null) { $data['badge'] = $ap...
php
{ "resource": "" }
q244747
PayloadEncoder.convertAlertToArray
validation
private function convertAlertToArray(Alert $alert): array { $data = []; if ($alert->getBodyLocalized()->getKey()) { $data['loc-key'] = $alert->getBodyLocalized()->getKey(); $data['loc-args'] = $alert->getBodyLocalized()->getArgs(); } else { $data['body'] ...
php
{ "resource": "" }
q244748
FineDiff.doDiff
validation
private function doDiff($from_text, $to_text) { $this->last_edit = false; $this->stackpointer = 0; $this->from_text = $from_text; $this->from_offset = 0; // can't diff without at least one granularity specifier if (empty($this->granularityStack)) { return;...
php
{ "resource": "" }
q244749
FineDiff.doCharDiff
validation
private static function doCharDiff($from_text, $to_text) { $result = array(); $jobs = array(array(0, strlen($from_text), 0, strlen($to_text))); while ($job = array_pop($jobs)) { // get the segments which must be diff'ed list($from_segment_start, $from_segment_end, $to...
php
{ "resource": "" }
q244750
FineDiff.renderToTextFromOpcode
validation
private static function renderToTextFromOpcode($opcode, $from, $from_offset, $from_len) { if ($opcode === 'c' || $opcode === 'i') { echo substr($from, $from_offset, $from_len); } }
php
{ "resource": "" }
q244751
TranslatorRepository.dbValue
validation
public static function dbValue($value, $nullValue = 'NULL') { if ($value === null) { return $nullValue; } if (is_string($value)) { return '\'' . str_replace('\'', '\'\'', $value) . '\''; } if (is_bool($value)) { return $value ? '1' : '0';...
php
{ "resource": "" }
q244752
TranslatorRepository.adjustTranslationTable
validation
protected function adjustTranslationTable($sql) { $adjustedSql = $this->tableRenameNeeded ? str_replace(' ltm_translations ', ' ' . $this->tableName . ' ', $sql) : $sql; return $adjustedSql; }
php
{ "resource": "" }
q244753
TranslatorRepository.getInsertTranslationsElement
validation
public function getInsertTranslationsElement($translation, $timeStamp) { return '(' . self::dbValue($translation->status, Translation::STATUS_SAVED) . ',' . self::dbValue($translation->locale) . ',' . self::dbValue($translation->group) . ',' . self::dbValue($translation->key)...
php
{ "resource": "" }
q244754
Controller.getPublish
validation
public function getPublish($group) { if ($group && $group != '*') { $this->manager->exportTranslations($group); } else { $this->manager->exportAllTranslations(); } $errors = $this->manager->errors(); event(new TranslationsPublished($group, $errors)); ...
php
{ "resource": "" }
q244755
Controller.postMissingKeys
validation
public function postMissingKeys() { $missingKeys = Request::json('missingKeys'); // always on the default connection $this->manager->setConnectionName(''); /* @var $translator \Vsch\TranslationManager\Translator */ $translator = App::make('translator'); $affectedGr...
php
{ "resource": "" }
q244756
Translator.getLocale
validation
public function getLocale() { if (!$this->cookiesLoaded) { $key = $this->cookiePrefix . 'lang_locale'; $queuedCookieLocale = \Cookie::queued($key, null); $locale = getSupportedLocale($queuedCookieLocale != null ? $queuedCookieLocale->getValue() : \Cookie::get($key, '')); ...
php
{ "resource": "" }
q244757
Translator.setLocale
validation
public function setLocale($locale) { if ($this->useCookies) { Cookie::queue($this->cookiePrefix . 'lang_locale', $locale); } parent::setLocale($locale); }
php
{ "resource": "" }
q244758
Translator.getShowUnpublished
validation
public function getShowUnpublished() { if (!$this->cookiesLoaded) { $key = $this->cookiePrefix . 'show_unpublished'; $queuedCookie = \Cookie::queued($key, null); $showUnpublished = $queuedCookie != null ? $queuedCookie->getValue() : \Cookie::get($key, false); ...
php
{ "resource": "" }
q244759
Translator.setShowUnpublished
validation
public function setShowUnpublished($showUnpublished) { if ($this->useCookies) { Cookie::queue($this->cookiePrefix . 'show_unpublished', $showUnpublished); } $this->useDB = $showUnpublished ? 2 : 1; }
php
{ "resource": "" }
q244760
Translator.getWebUITranslations
validation
public function getWebUITranslations() { $TITLE_SAVE_CHANGES = $this->get($this->package . '::messages.title-save-changes'); $TITLE_CANCEL_CHANGES = $this->get($this->package . '::messages.title-cancel-changes'); $TITLE_TRANSLATE = $this->get($this->package . '::messages.title-translate'); ...
php
{ "resource": "" }
q244761
Translator.choice
validation
public function choice($key, $number, array $replace = array(), $locale = null, $useDB = null) { $inplaceEditMode = $this->manager->config('inplace_edit_mode'); if ($this->inPlaceEditing() && $inplaceEditMode == 2) { if (!in_array($key, $this->usedKeys)) { $this->usedKeys...
php
{ "resource": "" }
q244762
Auth.login
validation
public static function login($email, $password, $challenge = '', $code = '') { $requestParams = [ 'includePerms' => 'false', // We don't need these here 'token_type' => 'eg1' ]; if (empty($challenge) && empty($code)) { // Regular login $requestPa...
php
{ "resource": "" }
q244763
Auth.refresh
validation
public static function refresh($refresh_token) { $data = FortniteClient::sendUnrealClientPostRequest(FortniteClient::EPIC_OAUTH_TOKEN_ENDPOINT, [ 'grant_type' => 'refresh_token', 'refresh_token' => $refresh_token, 'includePerms' => "false", // We don't need these here ...
php
{ "resource": "" }
q244764
Items.id
validation
public function id($id) { foreach ($this->items as $item) { if ($item->itemId == $id) return $item; } return null; }
php
{ "resource": "" }
q244765
Stats.fetch
validation
private function fetch($account_id) { if (!$account_id) return null; $data = FortniteClient::sendFortniteGetRequest(FortniteClient::FORTNITE_API . 'stats/accountId/' . $account_id . '/bulk/window/alltime', $this->access_token); // Remove - f...
php
{ "resource": "" }
q244766
Stats.lookup
validation
public function lookup($username) { try { $data = FortniteClient::sendFortniteGetRequest(FortniteClient::FORTNITE_PERSONA_API . 'public/account/lookup?q=' . urlencode($username), $this->access_token); return new self($this->access_t...
php
{ "resource": "" }
q244767
Stats.parseStatItem
validation
private function parseStatItem($stat): array { // // Example stat name: // br_placetop5_ps4_m0_p10 // {type}_{name}_{platform}_{??}_{mode (squads/solo/duo)} // $result = []; $pieces = explode("_", $stat->name); $result[$pieces[2]][$pieces[4]][$pieces[1]] ...
php
{ "resource": "" }
q244768
Profile.fetch
validation
private function fetch() { $data = FortniteClient::sendFortnitePostRequest(FortniteClient::FORTNITE_API . 'game/v2/profile/' . $this->account_id . '/client/QueryProfile?profileId=athena&rvn=-1', $this->access_token, ...
php
{ "resource": "" }
q244769
Profile.getFriends
validation
public function getFriends() { $data = FortniteClient::sendUnrealClientGetRequest(FortniteClient::EPIC_FRIENDS_ENDPOINT . $this->account_id, $this->access_token, true); return $data; }
php
{ "resource": "" }
q244770
FortniteClient.sendUnrealClientGetRequest
validation
public static function sendUnrealClientGetRequest($endpoint, $authorization = self::EPIC_LAUNCHER_AUTHORIZATION, $oauth = false) { $client = new Client(); try { $response = $client->get($endpoint, [ 'headers' => [ 'User-Agent' => self::UNREAL_CLIENT_USER_...
php
{ "resource": "" }
q244771
FortniteClient.sendUnrealClientPostRequest
validation
public static function sendUnrealClientPostRequest($endpoint, $params = null, $authorization = self::EPIC_LAUNCHER_AUTHORIZATION, $oauth = false) { $client = new Client(['http_errors' => false]); try { $response = $client->post($endpoint, [ 'form_params' => $params, ...
php
{ "resource": "" }
q244772
FortniteClient.sendFortniteGetRequest
validation
public static function sendFortniteGetRequest($endpoint, $access_token, $extra_headers = array()) { $client = new Client(); $headers = [ 'User-Agent' => self::FORTNITE_USER_AGENT, 'Authorization' => 'bearer ' . $access_token ]; $headers = array_merge($headers, $...
php
{ "resource": "" }
q244773
FortniteClient.sendFortnitePostRequest
validation
public static function sendFortnitePostRequest($endpoint, $access_token, $params = null) { $client = new Client(); try { $response = $client->post($endpoint, [ 'json' => $params, 'headers' => [ 'User-Agent' => self::FORTNITE_USER_AGENT, ...
php
{ "resource": "" }
q244774
UserDbLdap.findByAttribute
validation
public static function findByAttribute($attribute, $searchValue) { if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) { Yii::beginProfile('Attribute: ' . $attribute . '; Value: ' . $searchValue, static::YII2_PROFILE_NAME . 'findByAttribute'); } $userObject...
php
{ "resource": "" }
q244775
UserDbLdap.createNewUser
validation
public static function createNewUser($username,$individualGroupAssignmentOptions = null) { if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) { Yii::beginProfile('createNewUser', static::YII2_PROFILE_NAME . 'createNewUser'); } $userObjectDb = new static();...
php
{ "resource": "" }
q244776
UserDbLdap.createOrRefreshUser
validation
public static function createOrRefreshUser($username,$individualGroupAssignmentOptions = null) { if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) { Yii::beginProfile('createOrRefreshUser', static::YII2_PROFILE_NAME . 'createOrRefreshUser'); } $userObject...
php
{ "resource": "" }
q244777
UserDbLdap.updateAccountStatus
validation
public function updateAccountStatus() { if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) { Yii::beginProfile('LDAP updateAccountStatus function', static::YII2_PROFILE_NAME . 'updateAccountStatus'); } $ldapUser = $this->queryLdapUserObject(); ...
php
{ "resource": "" }
q244778
UserDbLdap.getGroupsAssignedInLdap
validation
public function getGroupsAssignedInLdap() { if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) { Yii::beginProfile('getGroupsAssignedInLdap', static::YII2_PROFILE_NAME . 'getGroupsAssignedInLdap'); } $ldapUser = $this->queryLdapUserObject(); ...
php
{ "resource": "" }
q244779
UserDbLdap.queryLdapUserObject
validation
public function queryLdapUserObject() { if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) { Yii::beginProfile('queryLdapUserObject', static::YII2_PROFILE_NAME . 'queryLdapUserObject'); } if ($this->ldapUserObject == null) { if ($this->usernam...
php
{ "resource": "" }
q244780
UserDbLdap.getAdldapProvider
validation
public static function getAdldapProvider() { if(static::getExtensionOptions('adldap-providername') != '__USE_DEFAULT_PROVIDER__') { $provider = Yii::$app->ad->getProvider(static::getExtensionOptions('adldap-providername')); } else { $provider = Yii::$app->ad->getDefaultProvid...
php
{ "resource": "" }
q244781
UserDbLdap.getSyncOptions
validation
public static function getSyncOptions($optionName, $individualSyncOptions = null) { //try object specific settings if ($individualSyncOptions != null && is_array($individualSyncOptions) && array_key_exists($optionName, $individualSyncOptions)) { return $...
php
{ "resource": "" }
q244782
UserDbLdap.getGroupAssigmentOptions
validation
public static function getGroupAssigmentOptions($optionName, $individualGroupAssignmentOptions = null) { //try object specific settings if ($individualGroupAssignmentOptions != null && is_array($individualGroupAssignmentOptions) && array_key_exists($optionName, $individualGr...
php
{ "resource": "" }
q244783
UserDbLdap.getExtensionOptions
validation
public static function getExtensionOptions($optionName) { //try yii2 params if (isset(Yii::$app->params['yii2-adldap-extension-Options']) && is_array(Yii::$app->params['yii2-adldap-extension-Options']) && array_key_exists($optionName, Yii::$app->params['yii2-adldap-e...
php
{ "resource": "" }
q244784
LdapController.actionCreateExampleRole
validation
public function actionCreateExampleRole() { $auth = Yii::$app->authManager; // add "permissionDisplayDetailedAbout" permission $displayDetailedAbout = $auth->createPermission('permissionDisplayDetailedAbout'); $displayDetailedAbout->description = 'Permission to display detailed abou...
php
{ "resource": "" }
q244785
GenerateModels.writeable
validation
protected function writeable($file_path) { if ($this->option('force')) { return true; } return ( ! file_exists($file_path) || $this->confirmable($file_path)); }
php
{ "resource": "" }
q244786
GenerateModels.write
validation
protected function write($file, $file_path) { if (! is_dir(dirname($file_path))) { mkdir(dirname($file_path), 0755, true); } file_put_contents( $file_path, file_get_contents( dirname(__FILE__) .DIRECTORY_SEPARATOR ...
php
{ "resource": "" }
q244787
UserGateway.create
validation
public function create($request) { $data = $request->all(); $user = $this->repository->create($data); $event_class = "Acoustep\EntrustGui\Events\\".ucwords($this->getModelName()).'CreatedEvent'; $event = new $event_class; $this->dispatcher->fire($event->setModel($user)); ...
php
{ "resource": "" }
q244788
EntrustGuiServiceProvider.boot
validation
public function boot() { $this->loadViewsFrom(realpath(__DIR__.'/../views'), 'entrust-gui'); $this->setupRoutes($this->app->router); $this->loadTranslationsFrom(realpath(__DIR__.'/../translations'), 'entrust-gui'); // This is for conig $this->publishes( [__DIR_...
php
{ "resource": "" }
q244789
ManyToManyGateway.create
validation
public function create($request) { $model = $this->repository->create($request->all()); $model->{$this->getShortRelationName()}()->sync($request->get($this->getRelationName(), [])); $event_class = "Acoustep\EntrustGui\Events\\".ucwords($this->getModelName()).'CreatedEvent'; $event = ...
php
{ "resource": "" }
q244790
EmojiServiceProvider.registerRepository
validation
protected function registerRepository() { $this->app->singleton(CachingRepository::class, function (Container $app) { $repo = new GitHubRepository( GuzzleFactory::make(), $app->config->get('emoji.token') ); $cache = $app->cache->store($app...
php
{ "resource": "" }
q244791
EmojiServiceProvider.registerParser
validation
protected function registerParser() { $this->app->singleton(EmojiParser::class, function (Container $app) { return new EmojiParser($app->make(RepositoryInterface::class)); }); }
php
{ "resource": "" }
q244792
EmojiParser.parse
validation
public function parse(InlineParserContext $inlineContext) { $cursor = $inlineContext->getCursor(); $previous = $cursor->peek(-1); if ($previous !== null && $previous !== ' ') { return false; } $saved = $cursor->saveState(); $cursor->advance(); ...
php
{ "resource": "" }
q244793
Attribute.boot
validation
protected static function boot() { parent::boot(); if (!isset(static::$attributeMutator)) { if (function_exists('app') && app()->bound('eloquence.mutator')) { static::$attributeMutator = app('eloquence.mutator'); } else { static::$attributeMut...
php
{ "resource": "" }
q244794
Attribute.set
validation
protected function set($key, $value, $group = 'default') { $this->setMetaKey($key); $this->setValue($value); $this->setMetaGroup($group); }
php
{ "resource": "" }
q244795
Attribute.getValue
validation
public function getValue() { if ($this->hasMutator($this->attributes['meta_value'], 'getter', $this->attributes['meta_type'])) { return $this->mutateValue($this->attributes['meta_value'], 'getter'); } return $this->castValue(); }
php
{ "resource": "" }
q244796
Attribute.castValue
validation
protected function castValue() { $value = $this->attributes['meta_value']; $validTypes = ['boolean', 'integer', 'float', 'double', 'array', 'object', 'null']; if (in_array($this->attributes['meta_type'], $validTypes)) { settype($value, $this->attributes['meta_type']); }...
php
{ "resource": "" }
q244797
Attribute.setMetaGroup
validation
public function setMetaGroup($group = null) { if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $group) && $group !== null) { throw new InvalidArgumentException("Provided group [{$group}] is not valid variable name."); } $this->attributes['meta_group'] = $group; ...
php
{ "resource": "" }
q244798
Attribute.setType
validation
protected function setType($value) { $this->attributes['meta_type'] = $this->hasMutator($value, 'setter') ? $this->getMutatedType($value, 'setter') : $this->getValueType($value); }
php
{ "resource": "" }
q244799
Attribute.setValue
validation
public function setValue($value) { $this->setType($value); if ($this->hasMutator($value, 'setter')) { $value = $this->mutateValue($value, 'setter'); } elseif (!$this->isStringable($value) && !is_null($value)) { throw new InvalidTypeException( "Unsuppo...
php
{ "resource": "" }