_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q253300
DeleteForm.setTarget
validation
public function setTarget($value) { if (in_array($value, $this->possibleTargets)) { $this->_target = $value; } else { throw new Exception('Unknown deletion target ' . $value); } }
php
{ "resource": "" }
q253301
DeleteForm.getTargetLabel
validation
public function getTargetLabel() { if (!isset($this->labels[$this->target])) { return ['long' => 'unknown', 'short' => 'unknown']; } return $this->labels[$this->target]; }
php
{ "resource": "" }
q253302
Permission.getPermissionMap
validation
public function getPermissionMap( $forRequestPath, $forRoutePath = "" ){ if(isset($this->loaded[$forRequestPath])){ return $this->loaded[$forRequestPath]; } $database = $this->database; //Get Permission Definitions $permissionsSQLd = NULL; i...
php
{ "resource": "" }
q253303
MigrateCommand.migrate
validation
protected function migrate(Module $module) { $path = str_replace(base_path(), '', (new Migrator($module))->getPath()); if ($this->option('subpath')) { $path = $path . "/" . $this->option("subpath"); } $this->call('migrate', [ '--path' => $path, '...
php
{ "resource": "" }
q253304
WP_Post_Type_Util.can_save_post_meta
validation
public function can_save_post_meta( $post_id, $action, $nonce ) { $is_autosave = wp_is_post_autosave( $post_id ); $is_revision = wp_is_post_revision( $post_id ); $is_valid_nonce = ( isset( $_POST[ $nonce ] ) && wp_verify_nonce( $_POST[ $nonce ], $action ) ); return ! ( $is_autosave || ...
php
{ "resource": "" }
q253305
Session.setFlashBag
validation
public function setFlashBag($sName, $sValue) { if (!isset($_SESSION['flashbag'])) { $_SESSION['flashbag'] = array(); } $_SESSION['flashbag'][$sName] = $sValue; return $this; }
php
{ "resource": "" }
q253306
Session.destroy
validation
public function destroy() { session_start(); $_SESSION = array(); if (ini_get("session.use_cookies")) { $aParams = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $aParams["path"], $aParams["domain"], $aParams["secure"], $aParams["httponly...
php
{ "resource": "" }
q253307
Client.invokeRpcCall
validation
public function invokeRpcCall($method, $arguments = []) { if (!is_null($this->namespace)) { $method = $this->namespace . '.' . $method; } $body = XmlRpcBuilder::createRequest($method, $arguments); $guzzle = new \GuzzleHttp\Client(); $this->getLogger()->info("se...
php
{ "resource": "" }
q253308
Client.fetchProjects
validation
public function fetchProjects() { $response = $this->getResponse('get', 'v2/projects'); $projects = array(); if(is_array($response)) { foreach($response as $data) { $projects[] = $this->hydrator->hydrate(new Project(), $data); } } retu...
php
{ "resource": "" }
q253309
Client.fetchProject
validation
public function fetchProject(Project $project) { $response = $this->getResponse( 'get', sprintf('v2/projects/%s', $project->getProjectKey()) ); return $this->hydrator->hydrate($project, $response); }
php
{ "resource": "" }
q253310
Client.updateProject
validation
public function updateProject(Project $project, $composerJson) { $response = $this->getResponse( 'post', sprintf('v2/projects/%s', $project->getProjectKey()), array(), array('project_file' => $composerJson) ); return $this->hydrator->hydrate(...
php
{ "resource": "" }
q253311
Client.createProject
validation
public function createProject($composerJson) { $response = $this->getResponse('post', 'v2/projects', array(), array('upload' => $composerJson)); return $this->hydrator->hydrate(new Project(), $response); }
php
{ "resource": "" }
q253312
Scheme.getCfgParamsByRanks
validation
private function getCfgParamsByRanks() { /* aliases and tables */ $asParams = 'pbhcp'; $asRank = 'pbhr'; $tblParams = $this->resource->getTableName(CfgParam::ENTITY_NAME); $tblRank = $this->resource->getTableName(Rank::ENTITY_NAME); // FROM prxgt_bon_hyb_cfg_param pbh...
php
{ "resource": "" }
q253313
Scheme.getForcedCustomersIds
validation
private function getForcedCustomersIds() { $mlmIds = array_keys($this->QUALIFIED_CUSTOMERS); $where = ''; foreach ($mlmIds as $one) { /* skip first iteration */ if (strlen($where) > 0) { $where .= ' OR '; } $quoted = $this->conn...
php
{ "resource": "" }
q253314
Scheme.getForcedQualificationCustomers
validation
public function getForcedQualificationCustomers() { if (is_null($this->cacheForcedRanks)) { /* get Customer IDs from DB to map ranks to Mage IDs instead of MLM IDs */ $custIds = $this->getForcedCustomersIds(); /* get all ranks with configuration parameters for all schemes...
php
{ "resource": "" }
q253315
ApiActionsChilds.childIndex
validation
public function childIndex(FilterRequest $filters, $id, $relation) { $id = $this->getRealId($id); $resource = $this->repository->getChilds($id, $relation, $filters); if (! $resource || count($resource) < 1) { // return $this->notFound(); } ...
php
{ "resource": "" }
q253316
ApiActionsChilds.childShow
validation
public function childShow(FilterRequest $filters, $id, $idChild, $relation) { $id = $this->getRealId($id); $idChild = $this->getRealId($idChild); $resource = $this->repository->getChild($id, $relation, $idChild, $filters); if (! $resource) { // return $t...
php
{ "resource": "" }
q253317
ApiActionsChilds.childStore
validation
public function childStore($idParent, FilterRequest $filters, $relation) { $idParent = $this->getRealId($idParent); $resource = $this->repository->storeChild($idParent, $relation, $filters->all()); if (! $resource) { // return $this->notFound(); ...
php
{ "resource": "" }
q253318
ApiActionsChilds.childStoreWithPivot
validation
public function childStoreWithPivot($idParent, $request, $relation) { $idParent = $this->getRealId($idParent); $resource = $this->repository->storeChildAndPivot($idParent, $relation, $request->all()); if (! $resource) { // return $this->notFound(); } ...
php
{ "resource": "" }
q253319
ApiActionsChilds.childAssociate
validation
public function childAssociate($request, $idParent, $idChild, $relation) { $request->request->merge([ 'url' => $request->request->path() ]); $idParent = $this->getRealId($idParent); $idChild = $this->getRealId($idChild); $resourceChild = $this->r...
php
{ "resource": "" }
q253320
ApiActionsChilds.childDissociate
validation
public function childDissociate($request, $idParent, $idChild, $relation) { $idParent = $this->getRealId($idParent); $idChild = $this->getRealId($idChild); if (! $this->repository->detach($idParent, $idChild, $relation)) { // return $this->notFound(); } ...
php
{ "resource": "" }
q253321
ApiActionsChilds.updateChild
validation
public function updateChild($idParent, FilterRequest $filters, $idChild, $relation) { $idParent = $this->getRealId($idParent); $idChild = $this->getRealId($idChild); $resource = $this->repository->updateChild($idParent, $relation, $idChild, $filters->all()); if (! $...
php
{ "resource": "" }
q253322
ApiActionsChilds.deleteChild
validation
public function deleteChild($idParent, FilterRequest $filters, $idChild, $relation) { $idParent = $this->getRealId($idParent); $idChild = $this->getRealId($idChild); $resource = $this->repository->deleteChild($idParent, $relation, $idChild); if ($resource == null) {...
php
{ "resource": "" }
q253323
Content.getMedia
validation
public function getMedia($objectType = 'media', $objectURI = NULL, $objectId = NULL) { //An alias method for getall return $this->getAllMedia($objectType, $objectURI, $objectId); }
php
{ "resource": "" }
q253324
Content.getAllMedia
validation
public function getAllMedia($objectType = 'media', $objectURI = NULL, $objectId = NULL) { //Get the object list of items which have no target for the timeline; //The timeline is for root objects only, any item with a target is the result of an interaction //For instance blah commented on itemta...
php
{ "resource": "" }
q253325
Content.getObject
validation
public function getObject( Entity $subject ) { //1. getActor //Media Object;; //First get the nature of the media object; // if(!is_object($subject)&& !is_a($subject, Entity::class)): // $subjectEntity = Platform\Entity::getInstance(); //An empty entity here because it is impo...
php
{ "resource": "" }
q253326
Content.store
validation
public function store($objectURI = null) { //@TODO determine the user has permission to post; $this->setPropertyValue("media_owner", $this->user->getPropertyValue("user_name_id")); //Determine the target if (!$this->saveObject($objectURI, $this->getObjectType())) { //The...
php
{ "resource": "" }
q253327
Settings.save
validation
public function save() { //do you have permission to execute admin $this->checkPermission("special", "/admin"); $referer = $this->application->input->getReferer(); //$options = $this->application->createInstance( Options::class ); //Check that we have post data; if (!$...
php
{ "resource": "" }
q253328
Container.create
validation
public static function create($validator, $command) { static $cache = []; $cacheKey = $validator; if (isset($cache[$cacheKey])) { $class = $cache[$cacheKey]['class']; $validator = $cache[$cacheKey]['validator']; } else { if (false === strpos($val...
php
{ "resource": "" }
q253329
ResponsePolicy.view
validation
public function view(UserPolicy $user, Response $response) { if ($user->canDo('forum.response.view') && $user->isAdmin()) { return true; } return $response->user_id == user_id() && $response->user_type == user_type(); }
php
{ "resource": "" }
q253330
ResponsePolicy.destroy
validation
public function destroy(UserPolicy $user, Response $response) { return $response->user_id == user_id() && $response->user_type == user_type(); }
php
{ "resource": "" }
q253331
HttpService.then
validation
public function then(callable $success = null, callable $fail = null) { if($this->success && is_callable($success)) { return $success($this->request, $this->request->getStatusCode()); } elseif(is_callable($fail)) { return $fail($this->error); } }
php
{ "resource": "" }
q253332
HttpService.client
validation
public function client() { if(empty($this->authToken)) { throw new NotFoundTokenException('Token not found'); } //dd($this->microService); $this->client = new Client([ 'base_uri' => $this->microService, 'timeout' => $this->timeout, 'he...
php
{ "resource": "" }
q253333
TimestampedPathGenerator.generate
validation
public function generate($name, array $parameters=array(), $updateTrackerName='global', $referenceType = RouterInterface::ABSOLUTE_PATH, $timestampParameterName=null) { if (!$timestampParameterName) { $timestampParameterName = $this->timestampParameterName; } $parameters[$timesta...
php
{ "resource": "" }
q253334
Utils.getDomainUrl
validation
public function getDomainUrl($address, $scheme = false) { $this->urlAddress->setAddress($address); return $this->urlAddress->getDomain($scheme); }
php
{ "resource": "" }
q253335
Utils.getMd5Url
validation
public function getMd5Url($address, $scheme = true, $www = true) { $this->urlAddress->setAddress($address); return $this->urlAddress->getMd5Address($scheme, $www); }
php
{ "resource": "" }
q253336
Utils.shortText
validation
public function shortText($text, $length) { $text = trim($text); $charset = mb_detect_encoding($text); if (mb_strlen($text, $charset) > $length) { $text = mb_substr($text, 0, $length, $charset) . '...'; } else { $text = $text; } return $text;...
php
{ "resource": "" }
q253337
Utils.generateSignCode
validation
public function generateSignCode(array $params, $secret) { ksort($params); if (isset($params[self::SIGN_NAMESPACE])) { unset($params[self::SIGN_NAMESPACE]); } return md5(implode('', $params) . $secret); }
php
{ "resource": "" }
q253338
Utils.checkSignCode
validation
public function checkSignCode(array $params, $secret) { if (false === isset($params[self::SIGN_NAMESPACE])) { return false; } return $params[self::SIGN_NAMESPACE] === $this->generateSignCode($params, $secret); }
php
{ "resource": "" }
q253339
Utils.niceDate
validation
public function niceDate(\DateTime $date) { $now = $this->system->getDate(); if ($now->format('Y-m-d') === $date->format('Y-m-d')) { return $date->format('H:i'); } elseif ($now->format('Y-m') === $date->format('Y-m') && $date->format('d') + 1 == $now->format('d')) { ...
php
{ "resource": "" }
q253340
Utils.priceNetto
validation
public function priceNetto($brutto, $tax) { $tax = round((double) $tax / 100.0, 2); if ($tax < 0.00) { throw new Exception(sprintf('Tax must be greater than or equal to 0, given %s.', $tax)); } if ($tax === 0.00) { return $brutto; } $result ...
php
{ "resource": "" }
q253341
Utils.priceBrutto
validation
public function priceBrutto($netto, $tax) { $tax = round((double) $tax / 100.0, 2); if ($tax < 0.00) { throw new Exception(sprintf('Tax must be greater than or equal to 0, given %s.', $tax)); } if ($tax === 0.00) { return $netto; } ...
php
{ "resource": "" }
q253342
FileField.setAccept
validation
public function setAccept($accept){ $this->setTag('accept',$accept); if($this->getValidator()){ $this->getValidator()->setOption('accept',$accept); } }
php
{ "resource": "" }
q253343
FileField.setMaxSize
validation
public function setMaxSize($maxSize){ $serverMaxSize=$this->getServerMaxSize(); if($maxSize>$serverMaxSize){ throw new FileMaxSizeException($serverMaxSize); } $this->maxSize=$maxSize; if($this->getValidator()){ $this->getValidator()->setOption('maxSize',$maxSize); } }
php
{ "resource": "" }
q253344
FileField.phpSizeToBytes
validation
private function phpSizeToBytes($size){ if (is_numeric( $size)){ return $size; } $suffix = substr($size, -1); $value = substr($size, 0, -1); switch(strtolower($suffix)){ /** @noinspection PhpMissingBreakStatementInspection */ case 'p': $value *= 1024; /** @noinspec...
php
{ "resource": "" }
q253345
CliApp.handleRequest
validation
public function handleRequest(): void { global $argv; if (!is_array($argv) || empty($argv)) { throw new Exception('Invalid value of the cli args array was given.'); } (new CliCtrlResolver($argv))->run(); }
php
{ "resource": "" }
q253346
ErrorDispatcher.exception
validation
public function exception(Exception $exception){ if($this->stopPropagation){ return false; } $this->fireHandlers($exception); $this->stopPropagation=true; return false; }
php
{ "resource": "" }
q253347
ErrorDispatcher.error
validation
public function error($level, $message, $file, $line){ throw new SyntaxException($message,$file,$line,$level); }
php
{ "resource": "" }
q253348
PageList.getPage
validation
public function getPage($name) { if (!isset($this->pages[$name])) { throw new InvalidParameterException("Page not found"); } return $this->pages[$name]; }
php
{ "resource": "" }
q253349
PageList.changePageFromRequest
validation
public function changePageFromRequest($id, $request) { $this->getPage($id); $page = $this->createPageObject(null, null, $request); $this->pages[$id] = $page; $this->persist(); return $page; }
php
{ "resource": "" }
q253350
PageList.renamePage
validation
public function renamePage($id, $newName) { $this->pages[$newName] = $this->getPage($id); unset($this->pages[$id]); $this->persist(); }
php
{ "resource": "" }
q253351
PageList.deletePage
validation
public function deletePage($id) { $this->getPage($id); unset($this->pages[$id]); $this->persist(); }
php
{ "resource": "" }
q253352
PageList.persist
validation
private function persist() { $bootstrap = Bootstrap::getInstance(); $config = $bootstrap->getConfiguration(); $config['pages'] = array(); foreach ($this->pages as $page) { $page->appendConfig($config['pages']); } $bootstrap->setConfiguration($config); ...
php
{ "resource": "" }
q253353
DataSource.getForeignDataModel
validation
public function getForeignDataModel($key) { $config = $this->settings['foreignPullParams']; if (!isset($config['where'])) { $config['where'] = []; } if (!empty($config['where'])) { $config['where'] = ['and', $config['where'], [$this->foreignModel->primaryKey()...
php
{ "resource": "" }
q253354
DataSource.getUnmappedForeignKeys
validation
public function getUnmappedForeignKeys() { $mappedForeign = ArrayHelper::getColumn($this->_map, 'foreignKey'); $u = array_diff(array_keys($this->foreignModel->meta->schema->columns), $mappedForeign); unset($u[$this->foreignPrimaryKeyName]); return $u; }
php
{ "resource": "" }
q253355
DataSource.loadForeignDataItems
validation
protected function loadForeignDataItems() { $this->_foreignDataItems = []; if ($this->lazyForeign) { $primaryKeys = $this->foreignModel->findPrimaryKeys($this->settings['foreignPullParams']); foreach ($primaryKeys as $primaryKey) { $this->createForeignDataItem...
php
{ "resource": "" }
q253356
BaseException.getExceptionTree
validation
public static function getExceptionTree(\Throwable $Throwable){ $exception = get_class($Throwable); // Build the "tree" for($exception_tree[] = $exception; $exception = get_parent_class($exception); $exception_tree[] = $exception){ ; } $exception_tree = array_reverse($exception_tree); if(count($e...
php
{ "resource": "" }
q253357
BaseException.getShortName
validation
public static function getShortName($fqn){ $fqn_parts = explode('\\', $fqn); $final = array_pop($fqn_parts); if(empty($fqn_parts)){ return $final; } $fqn_caps = preg_replace('/[a-z]+/', '', $fqn_parts); return implode('\\', $fqn_caps) . '\\' . $final; }
php
{ "resource": "" }
q253358
BaseException.displayConsoleException
validation
public static function displayConsoleException(\Throwable $Throwable){ ob_start(); echo PHP_EOL . ' '; echo(($Throwable instanceof PHPAssertionFailed) ? 'Assertion Failed' : 'Uncaught ' . self::getShortName( get_class( $Throwable ) )); echo ' <' . basename($Throwable->getFile()) . ':' . ...
php
{ "resource": "" }
q253359
Benri_Controller_Request_Http.getParam
validation
public function getParam($key, $default = null) { $param = parent::getParam($key, $default); if (is_string($param)) { return trim($param); } return $param; }
php
{ "resource": "" }
q253360
Phase1.getCustomersMap
validation
private function getCustomersMap() { /** @var \Praxigento\Downline\Repo\Data\Customer[] $customers */ $customers = $this->daoCustDwnl->get(); $result = $this->hlpTree->mapById($customers, ECustomer::A_CUSTOMER_REF); return $result; }
php
{ "resource": "" }
q253361
RequestLastModifiedCache.onViewCreate
validation
public function onViewCreate(ContentfulViewEvent $e) { $viewMeta = $e->getView()->cfMeta; $updated = $viewMeta['updatedAt']; $this->itemIds[$viewMeta['itemId']] = true; if ($this->lastModifiedContent === null) { $this->...
php
{ "resource": "" }
q253362
RequestLastModifiedCache.getLastModified
validation
public function getLastModified(Request $request) { $minModified = $this->getLastMinModifiedDate(); $optionalLastModified = Option::fromValue($this->cache->fetch($this->getCacheKeyRequest(sha1($request->getUri()), 'lastmodified')), false); if ($optionalLastModified->isEmpty()) { ...
php
{ "resource": "" }
q253363
RequestLastModifiedCache.setLastModified
validation
public function setLastModified(Request $request, \DateTime $lastModified) { $this->cache->save($this->getCacheKeyRequest(sha1($request->getUri()), 'lastmodified'), $lastModified->format('r')); foreach ($this->itemIds as $itemId => $bool) { $key = $this->getC...
php
{ "resource": "" }
q253364
RequestLastModifiedCache.onEntryUpdate
validation
public function onEntryUpdate(ContentfulEntryEvent $e) { $entry = $e->getEntry(); $key = $this->getCacheKeyItem($entry->getId(), 'uri'); $urisForItemOption = Option::fromValue($this->cache->fetch($key), false); if ($urisForItemOption->isEmpty()) { ...
php
{ "resource": "" }
q253365
Site.getLanguages
validation
public function getLanguages() { $languages = array(); /** @var SiteAliasInterface $siteAlias */ foreach ($this->getAliases() as $siteAlias) { $language = $siteAlias->getLanguage(); if (!in_array($language, $languages)) { $languages[] = $language; ...
php
{ "resource": "" }
q253366
Site.getAliasIdForLanguage
validation
public function getAliasIdForLanguage($language) { /** @var ReadSiteAliasInterface $alias */ foreach ($this->aliases as $key => $alias) { if ($alias->getLanguage() == $language) { return $key; } } return null; }
php
{ "resource": "" }
q253367
Type.validate
validation
public function validate(string $sValue = null) : bool { if ($this->_sType == 'DateTime') { if (preg_match('#^[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}#', $sValue)) { return true; } } return false; ...
php
{ "resource": "" }
q253368
CliTask.getSetting
validation
public function getSetting($name, $default = null) { return array_key_exists($name, $this->settings) ? $this->settings[$name] : $default; }
php
{ "resource": "" }
q253369
CliTask.run
validation
public function run(InputInterface $input, OutputInterface $output) { $this->returnCode = static::RETURN_SUCCESS; $this->doPreRun($input, $output); if (!$this->executeDependencies($input, $output)) { // Failed to run dependencies. $this->returnCode = static::RETURN_E...
php
{ "resource": "" }
q253370
Task.failed
validation
public function failed($fail = true) { if (!func_num_args()) { return $this->_failed; } $this->_failed = $fail; return $this; }
php
{ "resource": "" }
q253371
Task.clear
validation
public function clear() { $this->_repeat = 1; $this->_startTime = 0; $this->_duration = 0; $this->_average = 0; $this->_rate = 0; $this->_startMem = 0; $this->_memory = 0; }
php
{ "resource": "" }
q253372
ErrorHandler.handle
validation
public function handle() { $view = $this->application->createInstance("view", [ $this->application->response, $this->application->createInstance("viewengine", [$this->application->response]), $this->application ] ); $v...
php
{ "resource": "" }
q253373
Http.addParams
validation
static public function addParams($url, $params) { $query = parse_url($url, PHP_URL_QUERY); $separator = (Text::isEmpty($query)? "?" : "&"); return Text::concat($separator, $url, http_build_query($params)); }
php
{ "resource": "" }
q253374
SettingsServiceFactory.createService
validation
public function createService(ServiceLocatorInterface $serviceLocator) { $options = $serviceLocator->get('HtSettingsModule\Options\ModuleOptions'); $settingsService = new SettingsService( $options, $serviceLocator->get('HtSettingsModule_SettingsMapper'), $serviceL...
php
{ "resource": "" }
q253375
QuestionResourceController.index
validation
public function index(QuestionRequest $request) { $view = $this->response->theme->listView(); if ($this->response->typeIs('json')) { $function = camel_case('get-' . $view); return $this->repository ->setPresenter(\Litecms\Forum\Repositories\Presenter\Question...
php
{ "resource": "" }
q253376
QuestionResourceController.show
validation
public function show(QuestionRequest $request, Question $question) { if ($question->exists) { $view = 'forum::question.show'; } else { $view = 'forum::question.new'; } return $this->response->title(trans('app.view') . ' ' . trans('forum::question.name')) ...
php
{ "resource": "" }
q253377
QuestionResourceController.edit
validation
public function edit(QuestionRequest $request, Question $question) { return $this->response->title(trans('forum::question.name')) ->view('forum::public.question.newdiscussion') ->data(compact('question')) ->output(); }
php
{ "resource": "" }
q253378
QuestionResourceController.update
validation
public function update(QuestionRequest $request, Question $question) { try { $request = $request->all(); $attributes['title'] = $request['title']; $attributes['question'] = $request['question']; $attributes['category_id'] = $request['category_id']; ...
php
{ "resource": "" }
q253379
QuestionResourceController.destroy
validation
public function destroy(QuestionRequest $request, Question $question) { try { $question->delete(); return $this->response->message(trans('messages.success.deleted', ['Module' => trans('forum::question.name')])) ->code(202) ->status('success') ...
php
{ "resource": "" }
q253380
CustomFieldsGroupRenderingTwig.renderWidget
validation
public function renderWidget(array $fields, $customFielsGroup, $documentType='html', array $params = array()) { $resolvedParams = array_merge($this->defaultParams, $params); return $this->container->get('templating') ->render($resolvedParams['layout'], array( 'cFGro...
php
{ "resource": "" }
q253381
Flash.get
validation
public static function get($key, $fallback = null) { $message = static::provider()->get($key, $fallback); static::provider()->drop($key); return $message; }
php
{ "resource": "" }
q253382
ApiClient.SignupUser
validation
public function SignupUser($moniker, $mailer_id = null) { $endpoint = '/user/signup'; $postdata = array("moniker" => $moniker, "mailer_id" => $mailer_id); return $this->executePostRequest($endpoint, $postdata); }
php
{ "resource": "" }
q253383
Auth.provider
validation
public static function provider(ProviderInterface $provider = null) { if($provider) { static::$provider = $provider; } elseif(!static::$provider) { static::$provider = new Provider\Native(static::$root); } return static::$provider; }
php
{ "resource": "" }
q253384
Auth.user
validation
public static function user() { if(!static::$user and static::$factory) { $id = static::provider()->get('id'); static::$user = call_user_func(static::$factory, $id); } return static::$user; }
php
{ "resource": "" }
q253385
Auth.login
validation
public static function login($rank = 1, $id = null) { static::provider()->set('valid', true); static::provider()->set('rank', $rank); static::provider()->set('id', $id); return static::user(); }
php
{ "resource": "" }
q253386
Config.set
validation
public function set($name, $value = null) { if ($value == null) { return false; } $this->settings[$name] = $value; }
php
{ "resource": "" }
q253387
Config.get
validation
public function get($name) { if ($this->exists($name)) { $value = $this->settings[$name]; /* * NO VA: Si el valor a devolver es una matriz se debe retornar una * instancia de SubSettings para recorrer dicha matriz y asi * sucesivamente hasta recorr...
php
{ "resource": "" }
q253388
Errors.hasException
validation
public function hasException(\Exception $exception) { $class = get_class($exception); $exceptions = $this->getExceptions(); return isset($exceptions[$class]); }
php
{ "resource": "" }
q253389
Errors.getExceptionCode
validation
public function getExceptionCode(\Exception $exception) { $class = get_class($exception); $exceptions = $this->getExceptions(); if (!isset($exceptions[$class])) { throw new \RuntimeException(sprintf( 'Not exist exception "%s" in storage.', $class ...
php
{ "resource": "" }
q253390
Errors.getReservedCodes
validation
public function getReservedCodes() { $reserved = []; /** @var ErrorFactoryInterface|string $factory */ foreach ($this->factories as $factoryClass => $factory) { $reserved[$factoryClass] = $factory->getReservedDiapason(); } return $reserved; }
php
{ "resource": "" }
q253391
Errors.checkReservedCodes
validation
public function checkReservedCodes() { $reserved = $this->getReservedCodes(); // First iterate: check all factory foreach ($reserved as $factoryClass => $reservedForFactory) { // Second iterate: check in each factory foreach ($reserved as $checkInFactory => $reserved...
php
{ "resource": "" }
q253392
Module.getRelatedType
validation
public function getRelatedType($name) { list($relationship, $role) = $this->getRelationship($name); if ($relationship) { return $relationship->roleType($role); } return false; }
php
{ "resource": "" }
q253393
Module.setup
validation
public function setup() { $results = [true]; if (!empty($this->primaryModel) && !empty($this->collectorItem->parents)) { $groups = ['top']; foreach ($groups as $groupName) { $group = Group::getBySystemName($groupName, false); if (empty($group))...
php
{ "resource": "" }
q253394
Module.getPossibleRoles
validation
public function getPossibleRoles() { $roles = []; foreach (Yii::$app->collectors['roles']->getAll() as $roleItem) { $test = true; switch ($roleItem->systemId) { case 'owner': $test = $this->isOwnable; break; } ...
php
{ "resource": "" }
q253395
Module.getRequiredRoles
validation
public function getRequiredRoles() { $roles = []; foreach (Yii::$app->collectors['roles']->getAll() as $roleItem) { $test = false; switch ($roleItem->systemId) { case 'owner': $test = $this->isOwnable; break; } ...
php
{ "resource": "" }
q253396
Module.getInitialRole
validation
public function getInitialRole() { $roles = []; foreach (Yii::$app->collectors['roles']->getAll() as $roleItem) { $test = $roleItem->level < 400; if ($test) { $roles[] = $roleItem->object->primaryKey; } } return $roles; }
php
{ "resource": "" }
q253397
Module.getOwner
validation
public function getOwner() { if (!$this->isOwnable) { return; } $ownerObject = $this->getOwnerObject(); if (is_object($ownerObject)) { return $ownerObject->primaryKey; } return $ownerObject; }
php
{ "resource": "" }
q253398
Module.getObjectTypeModel
validation
public function getObjectTypeModel() { if (!isset($this->_objectTypeModel) && isset(Yii::$app->collectors['types']->tableRegistry[$this->systemId])) { $this->_objectTypeModel = Yii::$app->collectors['types']->tableRegistry[$this->systemId]; } return $this->_objectTypeModel; ...
php
{ "resource": "" }
q253399
Module.getObjectLevel
validation
public function getObjectLevel() { if ($this->isPrimaryType) { return 1; } $parents = $this->collectorItem->parents; if (!empty($parents)) { $maxLevel = 1; foreach ($parents as $rel) { if (get_class($rel->parent) === get_class($this...
php
{ "resource": "" }