_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q5300
View.resolveFullViewPath
train
private function resolveFullViewPath($viewPath) { if (strlen($this->getPartialsDir()) > 0 && strpos($viewPath, $this->getPartialsDir()) === 0) { return $this->resolvePartialPath($viewPath); } if (strpos($viewPath, $this->getLayoutsDir()) === 0) { return $this->resolve...
php
{ "resource": "" }
q5301
View.resolveViewPath
train
private function resolveViewPath($viewPath) { $path = realpath($this->_viewsDir . dirname($viewPath)) . DIRECTORY_SEPARATOR . basename($viewPath); return $path; }
php
{ "resource": "" }
q5302
View.resolvePartialPath
train
private function resolvePartialPath($viewPath) { $tempViewPath = str_replace($this->getPartialsDir(), '', $viewPath); if (strpos($tempViewPath, '../') === 0 || strpos($tempViewPath, '/../') === 0) { return $this->resolveRelativePath($tempViewPath); } else if (strpos($tempViewPat...
php
{ "resource": "" }
q5303
View.resolveLocalPath
train
private function resolveLocalPath($partialPath) { $partialDir = str_replace('./', '', dirname($partialPath)); $partialsDir = realpath(sprintf('%s%s', $this->_viewsDir, $partialDir )) . DIRECTORY_SEPARATOR; return $partialsDir . basename($partialPa...
php
{ "resource": "" }
q5304
View.resolveRelativePath
train
private function resolveRelativePath($partialPath) { $partialsDirPath = realpath(sprintf('%s%s', $this->_viewsDir, dirname($partialPath) )) . DIRECTORY_SEPARATOR; return $partialsDirPath . basename($partialPath); }
php
{ "resource": "" }
q5305
View.render
train
public function render($controllerName, $actionName, $params = null) { if (empty($this->controllerViewPath)) { $this->setControllerViewPath($controllerName); } parent::render($this->controllerViewPath, $actionName, $params); }
php
{ "resource": "" }
q5306
View.setControllerViewPath
train
public function setControllerViewPath($controllerName) { $this->controllerViewPath = str_replace('\\','/',strtolower($controllerName)); $this->controllerFullViewPath = $this->_viewsDir . $this->controllerViewPath; }
php
{ "resource": "" }
q5307
DfOAuthTwoProvider.getUserFromTokenResponse
train
public function getUserFromTokenResponse($response) { $user = $this->mapUserToObject($this->getUserByToken( $token = $this->parseAccessToken($response) )); $this->credentialsResponseBody = $response; if ($user instanceof User) { $user->setAccessTokenResponse...
php
{ "resource": "" }
q5308
Database.getDbConfig
train
private function getDbConfig() { if (file_exists(MODULES_DIR . DS . $this->currentRoute['module'] . '/Config/database.php')) { $dbConfig = require_once MODULES_DIR . DS . $this->currentRoute['module'] . '/Config/database.php'; if (!empty($dbConfig) && is_array($dbConfig)) { ...
php
{ "resource": "" }
q5309
Cache.getInstance
train
public static function getInstance($name) { if (!isset(static::$instances[$name])) { static::$instances[$name] = new CacheInstance(); } return static::$instances[$name]; }
php
{ "resource": "" }
q5310
Moderator.reloadBlacklist
train
public function reloadBlacklist() { $this->cache->flush($this->getCacheKey()); $this->blackListRegex = null; $this->loadBlacklist(); }
php
{ "resource": "" }
q5311
Moderator.check
train
public function check($model) { $moderated = false; foreach ($model->getModerateList() as $id => $moderation) { $rules = explode('|', $moderation); foreach ($rules as $rule) { $action = explode(':', $rule); $options = isset($action[1]) ? $act...
php
{ "resource": "" }
q5312
Moderator.getDriver
train
public function getDriver() { if ($this->driver) { return $this->driver; } // Get driver configuration $config = $this->getConfig('drivers.' . $this->getConfig('driver'), []); // Get driver class $driver = Arr::pull($config, 'class'); // Create ...
php
{ "resource": "" }
q5313
Moderator.loadBlacklist
train
protected function loadBlacklist() { // Check if caching is enabled if ($this->getConfig('cache.enabled', false) === false) { return $this->blackListRegex = $this->createRegex(); } // Get Black list items return $this->blackListRegex = $this->cache->rememberForev...
php
{ "resource": "" }
q5314
Moderator.createRegex
train
protected function createRegex() { // Load list from driver if (empty($list = $this->getDriver()->getList())) { return null; } return sprintf('/\b(%s)\b/i', implode('|', array_map(function ($value) { if (isset($value[0]) && $value[0] == '[') { ...
php
{ "resource": "" }
q5315
Inviqa_SymfonyContainer_Model_StoreConfigCompilerPass.process
train
public function process(ContainerBuilder $container) { $taggedServices = $container->findTaggedServiceIds( self::TAG_NAME ); foreach ($taggedServices as $id => $tag) { $definition = $container->findDefinition($id); $this->processTag($tag, $definition); ...
php
{ "resource": "" }
q5316
DiskCache.path
train
public static function path($filename) { if ($filename[0] != "/") { $filename = static::$path . "/" . $filename; } if (substr($filename, -5) != ".json") { $filename .= ".json"; } $path = pathinfo($filename, PATHINFO_DIRNAME); # Ensure the ca...
php
{ "resource": "" }
q5317
DiskCache.check
train
public static function check($filename) { if (!$filename = static::path($filename)) { return null; } if (!file_exists($filename)) { return null; } return filemtime($filename); }
php
{ "resource": "" }
q5318
DiskCache.get
train
public static function get($filename, $mins = 0) { if (!$cache = static::check($filename)) { return null; } $limit = time() - ($mins * 60); if (!$mins || $cache > $limit) { $filename = static::path($filename); $return = Json::decodeFromFile($file...
php
{ "resource": "" }
q5319
DiskCache.set
train
public static function set($filename, $data) { $data = ["_disk_cache" => $data]; $filename = static::path($filename); Json::encodeToFile($filename, $data); }
php
{ "resource": "" }
q5320
DiskCache.clear
train
public static function clear($filename) { $filename = static::path($filename); if (!file_exists($filename)) { return; } if (!unlink($filename)) { throw new \Exception("Unable to delete file (" . $filename . ")"); } }
php
{ "resource": "" }
q5321
DiskCache.call
train
public static function call($key, callable $func) { $trace = debug_backtrace(); if ($function = $trace[1]["function"]) { $key = $function . "_" . $key; if ($class = $trace[1]["class"]) { $key = str_replace("\\", "_", $class) . "_" . $key; } ...
php
{ "resource": "" }
q5322
PackageImporter.cleanupPackages
train
public function cleanupPackages(Storage $storage, callable $callback = null) { $count = 0; $storageNode = $storage->node(); $query = new FlowQuery([$storageNode]); $query = $query->find('[instanceof Neos.MarketPlace:Package]'); $upstreamPackages = $this->getProcessedPackages(...
php
{ "resource": "" }
q5323
PackageImporter.cleanupVendors
train
public function cleanupVendors(Storage $storage, callable $callback = null) { $count = 0; $storageNode = $storage->node(); $query = new FlowQuery([$storageNode]); $query = $query->find('[instanceof Neos.MarketPlace:Vendor]'); foreach ($query as $vendor) { /** @var...
php
{ "resource": "" }
q5324
Renderer.filterResponse
train
private function filterResponse(Response $response, Request $request, int $type): string { $event = new FilterResponseEvent($this->kernel, $request, $type, $response); $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event); $this->dispatcher->dispatch(KernelEvents::FINISH_REQUEST, new F...
php
{ "resource": "" }
q5325
Renderer.varToString
train
private function varToString($var): string { if (\is_object($var)) { return \sprintf('an object of type %s', \get_class($var)); } if (\is_array($var)) { $a = []; foreach ($var as $k => $v) { $a[] = \sprintf('%s => ...', $k); } ...
php
{ "resource": "" }
q5326
Person.removeElectronicAddress
train
public function removeElectronicAddress(ElectronicAddress $electronicAddress) { $this->electronicAddresses->removeElement($electronicAddress); if ($electronicAddress === $this->primaryElectronicAddress) { $this->primaryElectronicAddress = null; } }
php
{ "resource": "" }
q5327
Person.setElectronicAddresses
train
public function setElectronicAddresses(Collection $electronicAddresses) { if ($this->primaryElectronicAddress !== null && !$this->electronicAddresses->contains($this->primaryElectronicAddress)) { $this->primaryElectronicAddress = null; } $this->electronicAddresses = $electronicAd...
php
{ "resource": "" }
q5328
ExecuteQuery.fetch
train
public function fetch(Input $input) { return $this->bus->handle( $this->messageCreator->create($this->query, $input) ); }
php
{ "resource": "" }
q5329
ExceptionListener.beforeException
train
public function beforeException() { /** * @param \Phalcon\Events\Event $event * @param \Phalcon\Dispatcher $dispatcher * @param \Exception $exception * @return callable */ return function(Event $event, Dispatcher $dispatcher, \Exception $exception) { ...
php
{ "resource": "" }
q5330
Analytics.render
train
public function render() { if (!$this->isEnabled()) { return; } if ($this->isAutomatic()) { $this->addItem("ga('send', '" . self::TYPE_PAGEVIEW . "');"); } if ($this->isAnonymised()) { $this->addItem("ga('set', 'anonymizeIp', true);"); } if ($this->application->environment() === 'dev') { $...
php
{ "resource": "" }
q5331
Analytics.trackPage
train
public function trackPage($page = null, $title = null, $type = self::TYPE_PAGEVIEW) { if (!defined('self::TYPE_'. strtoupper($type))) { throw new AnalyticsArgumentException('Type variable can\'t be of this type.'); } $item = "ga('send', 'pageview');"; if ($page !== null || $title !== null) { $page = ($...
php
{ "resource": "" }
q5332
Analytics.trackEvent
train
public function trackEvent($category, $action, $label = null, $value = null) { $item = "ga('send', 'event', '{$category}', '{$action}'" . ($label !== null ? ", '{$label}'" : '') . ($value !== null && is_numeric($value) ? ", {$value}" : '') . ");"; $this->addItem($item); }
php
{ "resource": "" }
q5333
Analytics.trackTransaction
train
public function trackTransaction($id, array $options = []) { $options['id'] = $id; $this->trackEcommerce(self::ECOMMERCE_TRANSACTION, $options); }
php
{ "resource": "" }
q5334
Analytics.trackItem
train
public function trackItem($id, $name, array $options = []) { $options['id'] = $id; $options['name'] = $name; $this->trackEcommerce(self::ECOMMERCE_ITEM, $options); }
php
{ "resource": "" }
q5335
Analytics.trackMetric
train
public function trackMetric($category, array $options = []) { $item = "ga('send', 'event', '{$category}'"; if (!empty($options)) { $item .= ", 'action', { "; foreach ($options as $key => $value) { $item .= "'{$key}': {$value}, "; } $item = rtrim($item, ', ') . " }"; } $item .= ");"; $this...
php
{ "resource": "" }
q5336
Analytics.trackException
train
public function trackException($description = null, $fatal = false) { $item = "ga('send', '" . self::TYPE_EXCEPTION . "'"; if ($description !== null && is_bool($fatal)) { $item .= ", { " . "'exDescription': '{$description}', " . "'exFatal': " . ($fatal ? 'true' : 'false') . " }"; } $item .= ")...
php
{ "resource": "" }
q5337
RegisterFiltersTrait.registerFilters
train
public function registerFilters () { foreach (glob($this->getFiltersDirectoryPath() . '*.php') as $file) { $filterName = pathinfo($file, PATHINFO_FILENAME); $this->registerFilter(lcfirst($filterName)); } }
php
{ "resource": "" }
q5338
BaseOAuthService.handleLogin
train
public function handleLogin($request) { /** @var RedirectResponse $response */ $response = $this->provider->redirect(); $traitsUsed = class_uses($this->provider); $traitTwo = DfOAuthTwoProvider::class; $traitOne = DfOAuthOneProvider::class; if (isset($traitsUsed[$trai...
php
{ "resource": "" }
q5339
BaseOAuthService.handleOAuthCallback
train
public function handleOAuthCallback() { $provider = $this->getProvider(); /** @var OAuthUserContract $user */ $user = $provider->user(); return $this->loginOAuthUser($user); }
php
{ "resource": "" }
q5340
BaseOAuthService.loginOAuthUser
train
public function loginOAuthUser(OAuthUserContract $user) { /** @noinspection PhpUndefinedFieldInspection */ $responseBody = $user->accessTokenResponseBody; /** @noinspection PhpUndefinedFieldInspection */ $token = $user->token; $dfUser = $this->createShadowOAuthUser($user); ...
php
{ "resource": "" }
q5341
BaseOAuthService.createShadowOAuthUser
train
public function createShadowOAuthUser(OAuthUserContract $OAuthUser) { $fullName = $OAuthUser->getName(); @list($firstName, $lastName) = explode(' ', $fullName); $email = $OAuthUser->getEmail(); $serviceName = $this->getName(); $providerName = $this->getProviderName(); ...
php
{ "resource": "" }
q5342
ReadNestedAttributeTrait.traverseObject
train
private function traverseObject($obj, $keys) { if (empty($keys)) { return $obj; } $key = current($keys); if (is_array($obj) && isset($obj[$key])) { return $this->traverseObject($obj[$key], array_slice($keys, 1)); } else if (is_object($obj) && isset($o...
php
{ "resource": "" }
q5343
TaskListener.beforeHandleTask
train
public function beforeHandleTask($argv) { return function(Event $event, Console $console, Dispatcher $dispatcher) use ($argv) { //parse parameters $parsedOptions = OptionParser::parse($argv); $dispatcher->setParams(array( 'activeTask' => isset($parsedOpt...
php
{ "resource": "" }
q5344
Router.findPattern
train
private function findPattern($matches) { switch ($matches[1]) { case ':num': $replacement = '([0-9]'; break; case ':alpha': $replacement = '([a-zA-Z]'; break; case ':any': $replacement = '([^\/]';...
php
{ "resource": "" }
q5345
MappingHelperTrait.toMappedArray
train
public function toMappedArray() { $values = $this->toArray(); $mappedValues = []; foreach ($values as $key => $value) { $mappedValues[$key] = $this->readMapped($key); } return $mappedValues; }
php
{ "resource": "" }
q5346
MappingHelperTrait.readMapped
train
public function readMapped($name) { if (!$this->hasMapping($name) && isset($this->mappings[$name])) { $this->addMapping($name, $this->mappings[$name]); } $value = $this->readAttribute($name); $value = $this->resolveMapping($name, $value); return $value; }
php
{ "resource": "" }
q5347
Dict.value
train
public static function value(array $data, $key, $default = null) { $value = static::valueIfSet($data, $key, $default); if ($value) { return $value; } else { return $default; } }
php
{ "resource": "" }
q5348
SqlUserRepository.exist
train
private function exist(User $aUser) { $count = $this->execute( 'SELECT COUNT(*) FROM user WHERE id = :id', [':id' => $aUser->id()->id()] )->fetchColumn(); return (int) $count === 1; }
php
{ "resource": "" }
q5349
SqlUserRepository.insert
train
private function insert(User $aUser) { $sql = 'INSERT INTO user ( id, confirmation_token_token, confirmation_token_created_on, created_on, email, invitation_token_token, invitation_token_created_on, last_login, ...
php
{ "resource": "" }
q5350
SqlUserRepository.execute
train
private function execute($aSql, array $parameters) { $statement = $this->pdo->prepare($aSql); $statement->execute($parameters); return $statement; }
php
{ "resource": "" }
q5351
SqlUserRepository.buildUser
train
private function buildUser($row) { $createdOn = new \DateTimeImmutable($row['created_on']); $updatedOn = new \DateTimeImmutable($row['updated_on']); $lastLogin = null === $row['last_login'] ? null : new \DateTimeImmutable($row['last_login']); $confirmationTok...
php
{ "resource": "" }
q5352
Searcher.setFields
train
public function setFields(array $models) { try { // need to return << true $this->validator->verify($models, [ 'isArray', 'isNotEmpty', 'isExists' ], 'where'); } catch(ExceptionFactory $e) { echo $e->getMessage(); } ...
php
{ "resource": "" }
q5353
Searcher.setThreshold
train
public function setThreshold($threshold) { // need to return << true if (is_array($threshold) === true) { $threshold = array_map('intval', array_splice($threshold, 0, 2)); } else { $threshold = intval($threshold); } $this->validator->verify($...
php
{ "resource": "" }
q5354
Searcher.setQuery
train
public function setQuery($query = null) { try { // need to return << true $this->validator->verify($query, ['isNotNull', 'isAcceptLength']); if (false === $this->exact) { $this->query = ['query' => '%' . $query . '%']; } else { ...
php
{ "resource": "" }
q5355
Searcher.run
train
final public function run($hydratorset = null, $callback = null) { try { // call to get result $result = (new Builder($this))->loop($hydratorset, $callback); return $result; } catch (ExceptionFactory $e) { echo $e->getMessage(); } }
php
{ "resource": "" }
q5356
ApiController.soapServerAction
train
public function soapServerAction() { try { $apiModel = $this->_getModelName($this->obj); //parametry WSDL $wsdlParams = [ 'module' => 'cms', 'controller' => 'api', 'action' => 'wsdl', 'obj' => $this->obj, ...
php
{ "resource": "" }
q5357
File._checkAndCopyFile
train
protected static function _checkAndCopyFile(\Mmi\Http\RequestFile $file, $allowedTypes = []) { //pomijanie plików typu bmp (bitmapy windows - nieobsługiwane w PHP) if ($file->type == 'image/x-ms-bmp' || $file->type == 'image/tiff') { $file->type = 'application/octet-stream'; } ...
php
{ "resource": "" }
q5358
File.move
train
public static function move($srcObject, $srcId, $destObject, $destId) { $i = 0; //przenoszenie plików foreach (CmsFileQuery::byObject($srcObject, $srcId)->find() as $file) { //nowy obiekt i id $file->object = $destObject; $file->objectId = $destId; ...
php
{ "resource": "" }
q5359
File.copy
train
public static function copy($srcObject, $srcId, $destObject, $destId) { $i = 0; //kopiowanie plików foreach (CmsFileQuery::byObject($srcObject, $srcId)->find() as $file) { try { //tworzenie kopii $copy = new \Mmi\Http\RequestFile([ ...
php
{ "resource": "" }
q5360
File._updateRecordFromRequestFile
train
protected static function _updateRecordFromRequestFile(\Mmi\Http\RequestFile $file, \Cms\Orm\CmsFileRecord $record) { //typ zasobu $record->mimeType = $file->type; //klasa zasobu $class = explode('/', $file->type); $record->class = $class[0]; //oryginalna nazwa pliku ...
php
{ "resource": "" }
q5361
RegistrationController.setContainer
train
public function setContainer(ContainerInterface $container = NULL) { parent::setContainer($container); if(!$this->container->getParameter('fom_user.selfregister')) throw new AccessDeniedHttpException(); }
php
{ "resource": "" }
q5362
TaskGettextScanner.extract
train
public function extract($path, $regex = null) { $directory = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS); $iterator = new RecursiveIteratorIterator($directory); if ($regex) { $iterator = new RegexIterator($iterator, $regex); } $this->ite...
php
{ "resource": "" }
q5363
TaskGettextScanner.scan
train
private function scan(Translations $translations) { foreach ($this->iterator as $each) { foreach ($each as $file) { if ($file === null || !$file->isFile()) { continue; } $target = $file->getPathname(); if (($fn...
php
{ "resource": "" }
q5364
TaskGettextScanner.getFunctionName
train
private function getFunctionName($prefix, $file, $suffix, $key = 0) { if (preg_match(self::getRegex(), strtolower($file), $matches)) { $format = self::$suffixes[$matches[1]]; if (is_array($format)) { $format = $format[$key]; } return sprintf(...
php
{ "resource": "" }
q5365
TaskGettextScanner.getRegex
train
private static function getRegex() { if (self::$regex === null) { self::$regex = '/('.str_replace('.', '\\.', implode('|', array_keys(self::$suffixes))).')$/'; } return self::$regex; }
php
{ "resource": "" }
q5366
UserHelper.setPassword
train
public function setPassword(User $user, $password) { $encoder = $this->container->get('security.encoder_factory') ->getEncoder($user); $salt = $this->createSalt(); $encryptedPassword = $encoder->encodePassword($password, $salt); $user ->setPassword($encrypt...
php
{ "resource": "" }
q5367
UserHelper.createSalt
train
private function createSalt($max = 15) { $characterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $i = 0; $salt = ""; do { $salt .= $characterList{mt_rand(0,strlen($characterList)-1)}; $i++; } while ($i < $max); retur...
php
{ "resource": "" }
q5368
UserHelper.giveOwnRights
train
public function giveOwnRights($user) { $aclProvider = $this->container->get('security.acl.provider'); $maskBuilder = new MaskBuilder(); $usid = UserSecurityIdentity::fromAccount($user); $uoid = ObjectIdentity::fromDomainObject($user); foreach($this->container->getParameter("fom_...
php
{ "resource": "" }
q5369
MongodbController.modelCommand
train
public function modelCommand($input, $modelName, $optimized = false) { if (strpos($modelName, '\\') === false) { $modelName = 'App\\Models\\' . ucfirst($modelName); } $fieldTypes = $this->_inferFieldTypes([$input]); $model = $this->_renderModel($fieldTypes, $modelName, '...
php
{ "resource": "" }
q5370
MongodbController.modelsCommand
train
public function modelsCommand($services = [], $namespace = 'App\Models', $optimized = false, $sample = 1000, $db = []) { if (strpos($namespace, '\\') === false) { $namespace = 'App\\' . ucfirst($namespace) . '\\Models'; } foreach ($this->_getServices($services) as $service) { ...
php
{ "resource": "" }
q5371
MongodbController.csvCommand
train
public function csvCommand($services = [], $collection_pattern = '', $bom = false) { foreach ($this->_getServices($services) as $service) { /** * @var \ManaPHP\Mongodb $mongodb */ $mongodb = $this->_di->getShared($service); $defaultDb = $mongodb-...
php
{ "resource": "" }
q5372
MongodbController.listCommand
train
public function listCommand($services = [], $collection_pattern = '', $field = '', $db = []) { foreach ($this->_getServices($services) as $service) { /** * @var \ManaPHP\Mongodb $mongodb */ $mongodb = $this->_di->getShared($service); $defaultDb ...
php
{ "resource": "" }
q5373
Filter.addDefinition
train
public function addDefinition($type, $value, $field) { $definition = new \stdClass(); $definition->type = $type; $definition->value = $value; $definition->field = $field; $this->_filter[] = $definition; }
php
{ "resource": "" }
q5374
Model.rise
train
public function rise(array $params, $line, $filename) { $this->invoke = [ 'MODEL_DOES_NOT_EXISTS' => function ($params, $filename, $line) { // set message for not existing column $this->message = "Model `" . $params[1] . "` not exists. File: " . $filename . " Lin...
php
{ "resource": "" }
q5375
RoleAjax.postDeleteRole
train
public function postDeleteRole() { $response = (object)array( 'method' => 'deleterole', 'success' => false, 'status' => 200, 'error_code' => 0, 'error_message' => '' ); // decode json data $data = json...
php
{ "resource": "" }
q5376
Flash.output
train
public function output($remove = true) { $context = $this->_context; foreach ($context->messages as $message) { echo $message; } if ($remove) { $context->messages = []; } }
php
{ "resource": "" }
q5377
TextController.editAction
train
public function editAction() { $form = new \CmsAdmin\Form\Text(new \Cms\Orm\CmsTextRecord($this->id)); $this->view->textForm = $form; //brak wysłanych danych if (!$form->isMine()) { return; } //zapisany if ($form->isSaved()) { $this->ge...
php
{ "resource": "" }
q5378
Youtube.getThumbnailUrl
train
public function getThumbnailUrl(Tube $video) { if (0 === strlen($this->thumbnailSize)) { return false; } return sprintf('http://img.youtube.com/vi/%s/%s.jpg', $video->id, $this->thumbnailSize); }
php
{ "resource": "" }
q5379
ClassMetadata.getPropertyValue
train
public function getPropertyValue($user, $property = self::LOGIN_PROPERTY, $strict = false) { if ($this->checkProperty($property, $strict)) { $oid = spl_object_hash($user); if (null !== $cacheHit = $this->resolveCache($oid, $property)) { return $cacheHit; }...
php
{ "resource": "" }
q5380
ClassMetadata.getPropertyName
train
public function getPropertyName($property = self::LOGIN_PROPERTY, $strict = false) { if ($this->checkProperty($property, $strict)) { if (is_string($this->properties[$property])) { return $this->properties[$property]; } if (isset($this->lazyPropertyNameCach...
php
{ "resource": "" }
q5381
ClassMetadata.modifyProperty
train
public function modifyProperty($user, $newValue, $property = self::LOGIN_PROPERTY) { $this->checkProperty($property, true); $propertyObject = $this->properties[$property]; if (is_string($propertyObject)) { $this->properties[$property] = $propertyObject = new ReflectionProperty($...
php
{ "resource": "" }
q5382
ClassMetadata.checkProperty
train
private function checkProperty($property = self::LOGIN_PROPERTY, $strict = false) { if (!isset($this->properties[$property])) { if ($strict) { throw new \LogicException(sprintf( 'Cannot get property "%s"!', $property )); ...
php
{ "resource": "" }
q5383
ClassMetadata.resolveCache
train
private function resolveCache($oid, $property) { if (isset($this->lazyValueCache[$oid])) { if (isset($this->lazyValueCache[$oid][$property])) { return $this->lazyValueCache[$oid][$property]; } return; } $this->lazyValueCache[$oid] = array...
php
{ "resource": "" }
q5384
RepositoryGeneratorServiceProvider.registerMakeCommand
train
protected function registerMakeCommand() { $this->app->singleton('command.repository.make', function ($app) { $prefix = $app['config']['repository.prefix']; $suffix = $app['config']['repository.suffix']; $contract = $app['config']['repository.contract']; $name...
php
{ "resource": "" }
q5385
Response.setCookie
train
public function setCookie($name, $value, $expire = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) { $context = $this->_context; if ($expire > 0) { $current = time(); if ($expire < $current) { $expire += $current; } } ...
php
{ "resource": "" }
q5386
Response.setStatus
train
public function setStatus($code, $text = null) { $context = $this->_context; $context->status_code = (int)$code; $context->status_text = $text ?: $this->getStatusText($code); return $this; }
php
{ "resource": "" }
q5387
Response.setHeader
train
public function setHeader($name, $value) { $context = $this->_context; $context->headers[$name] = $value; return $this; }
php
{ "resource": "" }
q5388
Response.redirect
train
public function redirect($location, $temporarily = true) { if ($temporarily) { $this->setStatus(302, 'Temporarily Moved'); } else { $this->setStatus(301, 'Permanently Moved'); } $this->setHeader('Location', $this->url->get($location)); throw new Abor...
php
{ "resource": "" }
q5389
Response.setContent
train
public function setContent($content) { $context = $this->_context; $context->content = (string)$content; return $this; }
php
{ "resource": "" }
q5390
Response.setJsonContent
train
public function setJsonContent($content) { $context = $this->_context; $this->setHeader('Content-Type', 'application/json; charset=utf-8'); if (is_array($content)) { if (!isset($content['code'])) { $content = ['code' => 0, 'message' => '', 'data' => $content]; ...
php
{ "resource": "" }
q5391
FileGarbageCollectorCommand._checkForFile
train
protected function _checkForFile($directory, $file) { //szukamy tylko plików w przedziale 33 - 37 znaków if (strlen($file) < 33 || strlen($file) > 37) { echo $file . "\n"; return; } //brak pliku w plikach CMS if (null === $fr = (new \Cms\Orm\CmsFileQue...
php
{ "resource": "" }
q5392
FiddlerController.webCommand
train
public function webCommand($id = '', $ip = '') { $options = []; if ($id) { $options['id'] = $id; } if ($ip) { $options['ip'] = $ip; } $this->fiddlerPlugin->subscribeWeb($options); }
php
{ "resource": "" }
q5393
FiddlerController.cliCommand
train
public function cliCommand($id = '') { $options = []; if ($id) { $options['id'] = $id; } $this->fiddlerPlugin->subscribeCli($options); }
php
{ "resource": "" }
q5394
Parser.register_node_class
train
function register_node_class( $s, $class ){ if( ! class_exists($class) ){ $s = $this->token_name( $s ); throw new Exception( "If you want to register class `$class' for symbol `$s' you should include it first" ); } $this->node_classes[$s] = $class; }
php
{ "resource": "" }
q5395
Parser.create_node
train
function create_node( $s ){ if( isset($this->node_classes[$s]) ){ // custom node class $class = $this->node_classes[$s]; } else { // vanilla flavour node $class = $this->default_node_class; } return new $class( $s ); }
php
{ "resource": "" }
q5396
Parser.token_name
train
function token_name ( $t ){ $t = self::token_to_symbol( $t ); if( ! is_int($t) ){ return $t; } return $this->Lex->name( $t ); }
php
{ "resource": "" }
q5397
Parser.current_token
train
protected function current_token(){ if( !isset($this->tok) ){ $this->tok = current( $this->input ); $this->t = self::token_to_symbol( $this->tok ); } return $this->tok; }
php
{ "resource": "" }
q5398
Parser.next_token
train
protected function next_token(){ $this->tok = next( $this->input ); $this->t = self::token_to_symbol( $this->tok ); return $this->tok; }
php
{ "resource": "" }
q5399
Parser.prev_token
train
protected function prev_token(){ $this->tok = prev( $this->input ); $this->t = self::token_to_symbol( $this->tok ); return $this->tok; }
php
{ "resource": "" }