_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q9900
DoctrinePersistenceRepository.flush
train
public function flush(PersistableInterface $persistable, $forget = true) { if ($forget) { $this->forget(); } $code = $this->check(); $entityManager = $this->getEntityManager(); $queryBuilder = $entityManager->createQueryBuilder(); $queryBuilder ->delete($this->entityName(), 'p')
php
{ "resource": "" }
q9901
Packager_Phar.Run
train
public function Run () { parent::PreRun(); list($jobMethod, $params) = $this->completeJobAndParams();
php
{ "resource": "" }
q9902
CurrentExecution.loadPicture
train
public function loadPicture($image, $worker = NULL) { if($this->pictureLoader) { return $this->pictureLoader->loadPicture($image, $this, $worker); }
php
{ "resource": "" }
q9903
CurrentExecution.save
train
public function save(Picture $picture) { $pictureFile = $this->getPath($picture);
php
{ "resource": "" }
q9904
CurrentExecution.isFileActual
train
protected function isFileActual($file, Picture $picture) { if(file_exists($file)) { if(@filemtime($file) === @filemtime($picture->getImage())) { return TRUE;
php
{ "resource": "" }
q9905
CurrentExecution.setFallbackImage
train
public function setFallbackImage($fallbackImage) { $fallbackImagePath = realpath($fallbackImage); if(file_exists($fallbackImagePath) && is_readable($fallbackImagePath)) { $this->fallbackImage = $fallbackImagePath;
php
{ "resource": "" }
q9906
CurrentExecution.getTemplateQuery
train
public function getTemplateQuery($template) { if(isset($this->template[$template])) {
php
{ "resource": "" }
q9907
CurrentExecution.unifyPath
train
protected function unifyPath($path, $slash = DIRECTORY_SEPARATOR) { return preg_replace('/\\'.
php
{ "resource": "" }
q9908
Promise.settle
train
protected function settle(PromiseInterface $promise) { $handlers = $this->handlers; $this->result = $promise; $this->handlers = [];
php
{ "resource": "" }
q9909
Promise.getResult
train
protected function getResult() { while ($this->result instanceof Promise && null !== $this->result->result) {
php
{ "resource": "" }
q9910
Promise.mutate
train
protected function mutate(callable $resolver = null) { if ($resolver === null) { return; } try { $resolver( function ($value = null) { $this->resolve($value); }, function ($reason = null) { $this->reject($reason); },
php
{ "resource": "" }
q9911
Lexer.getNext
train
public function getNext() { if ($this->currentToken !== null || strlen($this->currentInput) > 0) { $this->parseNextToken();
php
{ "resource": "" }
q9912
Lexer.scanNextType
train
private function scanNextType($string) { foreach ($this->patterns as $type => $pattern) { if (preg_match('/^(' . $pattern . ')/sS', $string, $matches) === 1) {
php
{ "resource": "" }
q9913
Lexer.getAnyType
train
private function getAnyType($string) { $anyString = ''; do { $anyString .= $string[0]; $string = substr($string, 1); $typeInfo = $this->scanNextType($string); // ignore all until markup reached
php
{ "resource": "" }
q9914
MaintenanceComponent.beforeFilter
train
public function beforeFilter() { if (defined('PHPUNIT_TESTSUITE')) { return; } $maintenancePage = Environment::read('MAINTENANCE_PAGE_REDIRECT_URL'); $currentUrl = $this->_controller->getRequest()->here; $accessibleUrls = explode('|', Environment::read('MAINTENANCE_ACCESSIBLE_URLS')); $accessibleUrls[] = $maintenancePage; if (!self::isMaintenanceActive()) { // if maintenance is not active but maintenance page is requested -> redirect to default page if (in_array($currentUrl, $accessibleUrls) && substr($maintenancePage, -strlen($currentUrl)) === $currentUrl) { $maintenanceBasePage = Environment::read('MAINTENANCE_BASE_URL'); return $this->_controller->redirect($maintenanceBasePage); } return; } $cookieName = Environment::read('MAINTENANCE_COOKIE_NAME'); $cookieExists = ($this->_controller->Cookie->read($cookieName) !== null); if ($cookieExists) { return; } $headerActive = Environment::read('MAINTENANCE_HEADER_ACTIVE'); $headerName = Environment::read('MAINTENANCE_HEADER_NAME'); $headerValue = Environment::read('MAINTENANCE_HEADER_VALUE'); $successUrl = Environment::read('MAINTENANCE_PASSWORD_SUCCESS_URL'); if ($headerActive && !empty($this->_controller->request->getHeader($headerName)) && $this->_controller->request->getHeader($headerName) === $headerValue ) { $this->_controller->Cookie->write($cookieName, true); return $this->_controller->redirect($successUrl); } $passwordUrl = Environment::read('MAINTENANCE_PASSWORD_URL'); $accessibleUrls[] = $passwordUrl; if (!in_array($currentUrl, $accessibleUrls)) {
php
{ "resource": "" }
q9915
XDB_R.Get
train
function Get($key) { // check the file description if (!$this->fd) { trigger_error("XDB:Get(), null db handler.", E_USER_WARNING); return false; }
php
{ "resource": "" }
q9916
Provider.root
train
public function root() { $category = $this->createModel(); $category = $category->whereExists(function($query) { $query->select(\DB::raw(1))
php
{ "resource": "" }
q9917
eZMultiuploadHandler.exec
train
static function exec( $method, &$result ) { $ini = eZINI::instance( 'ezmultiupload.ini' ); $handlers = $ini->variable( 'MultiUploadSettings', 'MultiuploadHandlers' ); if ( !$handlers ) return false; foreach ( $handlers as $hanlder )
php
{ "resource": "" }
q9918
ShoppingCartFactory.findOrMakeCart
train
public function findOrMakeCart() { $cookies = $this->cookiesSupported(); $session = $this->getSession(); $classname = self::config()->model; $cart = null; $write = false; $member = Security::getCurrentUser(); if ($cookies) { $cart_id = Cookie::get(self::COOKIE_NAME); } else { $cart_id = $session->get(self::COOKIE_NAME); } // Try to get a cart from the the DB if (isset($cart_id)) { $cart = $classname::get()->find('AccessKey', $cart_id); }
php
{ "resource": "" }
q9919
ShoppingCartFactory.cleanOld
train
public function cleanOld() { $siteconfig = SiteConfig::current_site_config(); $date = $siteconfig->dbobject("LastEstimateClean"); $request = Injector::inst()->get(HTTPRequest::class); if (!$date || ($date && !$date->IsToday())) { $task = Injector::inst()->create(CleanExpiredEstimatesTask::class);
php
{ "resource": "" }
q9920
ShoppingCartFactory.cookiesSupported
train
public function cookiesSupported() { Cookie::set(self::TEST_COOKIE, 1); $cookie = Cookie::get(self::TEST_COOKIE);
php
{ "resource": "" }
q9921
ShoppingCartFactory.addItem
train
public function addItem($item, $customisations = []) { $cart = $this->getCurrent(); $stock_item = $item->FindStockItem(); $added = false; if (!$item instanceof LineItem) { throw new ValidationException(_t( "ShoppingCart.WrongItemClass", "Item needs to be of class {class}", ["class" => LineItem::class] )); } // Start off by writing our item object (if it is // not in the DB) if (!$item->exists()) { $item->write(); } if (!is_array($customisations)) { $customisations = [$customisations]; } // Find any item customisation associations $custom_association = null; $custom_associations = array_merge( $item->hasMany(), $item->manyMany() ); // Define association of item to customisations foreach ($custom_associations as $key => $value) { $class = $value::create(); if ($class instanceof LineItemCustomisation) { $custom_association = $key; break; } } // Map any customisations to the current item if (isset($custom_association)) { $item->write(); foreach ($customisations as $customisation) { if ($customisation instanceof LineItemCustomisation) { if (!$customisation->exists()) { $customisation->write(); } $item->{$custom_association}()->add($customisation); } } } // Ensure we update the item key $item->write(); // If the current cart isn't in the DB, save it if (!$cart->exists()) { $this->save(); }
php
{ "resource": "" }
q9922
ShoppingCartFactory.removeItem
train
public function removeItem($item) { if (!$item instanceof LineItem) { throw new ValidationException(_t( "ShoppingCart.WrongItemClass", "Item needs to be of class {class}",
php
{ "resource": "" }
q9923
ShoppingCartFactory.delete
train
public function delete() { $cookies = $this->cookiesSupported(); $cart = $this->getCurrent(); // Only delete the cart if it has been written to the DB if ($cart->exists()) { $cart->delete(); }
php
{ "resource": "" }
q9924
Collection.parse
train
public function parse(AbstractStream $stream) { if (!($this->dataSet instanceof DataSet)) { $this->dataSet = new DataSet; } $this->rewind(); do { $field = $this->current(); $field->setDataSet($this->getDataSet()); if ($field instanceof Conditional) { $field = $field->resolveField(); } if ($field instanceof self) { $this->dataSet->push($this->key()); $field->parse($stream);
php
{ "resource": "" }
q9925
Collection.initFromArray
train
private function initFromArray(array $fieldArray = []) { foreach ($fieldArray as
php
{ "resource": "" }
q9926
AssetTrait.addFile
train
public function addFile($file, $type = '', $locale = null, $filename = null, $keepOriginal = false): void { if ($file instanceof Traversable || is_array($file)) { $this->addFiles($file, $type, $locale, $keepOriginal); } else { $locale = $this->normalizeLocaleString($locale);
php
{ "resource": "" }
q9927
AssetTrait.addFiles
train
public function addFiles($files, $type = '', $locale = null, $keepOriginal = false): void { $files = (array) $files; $locale = $this->normalizeLocaleString($locale); if (is_string(array_values($files)[0])) {
php
{ "resource": "" }
q9928
AssetTrait.replaceAsset
train
public function replaceAsset($replace, $with) { $old = $this->assets()->findOrFail($replace); $this->assets()->detach($old->id); $old->delete();
php
{ "resource": "" }
q9929
RegisterUser.collectInput
train
protected function collectInput() { $password = $this->generateRandomPassword(); return [ 'name' => $this->argument('name') ? $this->argument('name') : '', 'email' =>
php
{ "resource": "" }
q9930
RegisterUser.registerUser
train
protected function registerUser(array $input) { $this->dispatch(new RegisterUserJob(array_get($input, 'name'),
php
{ "resource": "" }
q9931
Reporter.exampleFailed
train
public function exampleFailed(Example $example) { $this->failures[] = $example; $event = new ExampleFailEvent($example);
php
{ "resource": "" }
q9932
Reporter.examplePassed
train
public function examplePassed(Example $example) { $this->passes[] = $example; $event = new ExamplePassEvent($example);
php
{ "resource": "" }
q9933
Reporter.examplePending
train
public function examplePending(Example $example) { $this->pending[] = $example; $event = new ExamplePendEvent($example);
php
{ "resource": "" }
q9934
Reporter.exampleSkipped
train
public function exampleSkipped(Example $example) { $this->skipped[] = $example; $event = new ExampleSkipEvent($example);
php
{ "resource": "" }
q9935
OptimizationLoader.optimize
train
public static function optimize(string $key, string $typeName, string $optimizedType):
php
{ "resource": "" }
q9936
OptimizationLoader.autoload
train
public static function autoload(string $typeName): bool { static $enabled; if (\defined('KOOLKODE_ASYNC_OPTIMIZATIONS')) { if ($enabled === null) { $enabled = \array_map('trim', \explode(',', \strtolower(\KOOLKODE_ASYNC_OPTIMIZATIONS))); } if (isset(self::$replacements[$typeName])) { foreach ($enabled as $key) {
php
{ "resource": "" }
q9937
EloquentHistoryRepository.add
train
public function add($for, $for_id, $user_id, $action, $data = '') { $history = new $this->model; $history->for = $for; $history->for_id = $for_id; $history->user_id = $user_id;
php
{ "resource": "" }
q9938
EloquentHistoryRepository.get
train
public function get($for, $for_id, $limit = false) { return $this->model->whereFor($for)->whereForId
php
{ "resource": "" }
q9939
BaseAggregateInspectionRenderer.expandAggregateInspectionData
train
protected function expandAggregateInspectionData(InspectionInterface $inspection) { if ($inspection instanceof AggregateInspection) { return array_map( function (InspectionInterface $inspection) { return [
php
{ "resource": "" }
q9940
BootListener.handleEncodePropertyValueFromWidget
train
public function handleEncodePropertyValueFromWidget(EncodePropertyValueFromWidgetEvent $event) { $attribute = $this->getSupportedAttribute($event); if (!$attribute) { return; }
php
{ "resource": "" }
q9941
BootListener.handleDecodePropertyValueForWidgetEvent
train
public function handleDecodePropertyValueForWidgetEvent(DecodePropertyValueForWidgetEvent $event) { $attribute = $this->getSupportedAttribute($event); if (!$attribute) { return; } $dispatcher = $event->getEnvironment()->getEventDispatcher(); $value = $event->getValue(); if (\is_numeric($value)) {
php
{ "resource": "" }
q9942
BootListener.getSupportedAttribute
train
private function getSupportedAttribute($event) { $model = $event->getModel(); // Not a metamodel model. if (!$model instanceof Model) { return null; } $property = $event->getProperty();
php
{ "resource": "" }
q9943
AbstractResultHydrator.hydrateItem
train
protected function hydrateItem($objectClass, array $item) { $object = $this->createObjectToHydrate($objectClass); if (0 == count($item)) { return $object; }
php
{ "resource": "" }
q9944
Locations.add
train
public function add($location): bool { if ($this->hasLocation($location)) { return false;
php
{ "resource": "" }
q9945
Locations.hasLocation
train
public function hasLocation(Location $location): bool { return $this->exists(function
php
{ "resource": "" }
q9946
Markdown.AsHTML
train
public function AsHTML($useGFM=false) { if($this->parsedHTML!==false) { return $this->parsedHTML; } //Setup renderer $renderer=$this->getRenderer(); $supported=$renderer->isSupported(); if($supported!==true) { $class_name=get_class($renderer); user_error("Renderer $class_name is not supported on this system: $supported"); } if($renderer instanceof GithubMarkdownRenderer) { $beforeUseGFM=GithubMarkdownRenderer::getUseGFM(); GithubMarkdownRenderer::setUseGFM($useGFM); } //Init cache stuff $cacheKey=md5('Markdown_'.$this->tableName.'_'.$this->name.':'.$this->value); $cache=SS_Cache::factory('Markdown'); $cachedHTML=$cache->load($cacheKey); //Check cache, if it's good use it instead if($cachedHTML!==false) { $this->parsedHTML=$cachedHTML; return $this->parsedHTML; } //If empty save time by not attempting to render if(empty($this->value)) { return $this->value;
php
{ "resource": "" }
q9947
Markdown.setRenderer
train
public static function setRenderer($renderer) { if(ClassInfo::classImplements($renderer, 'IMarkdownRenderer')) { self::$renderer=$renderer; }else {
php
{ "resource": "" }
q9948
Markdown.getRenderer
train
private function getRenderer() { if(!is_object($this->renderInst)) {
php
{ "resource": "" }
q9949
Descriptors.getDescriptor
train
public function getDescriptor(string $classNamespace): ?Descriptor { if (!$this->isEmpty()) { /** @var Descriptor $descriptor */ foreach ($this as $rootNamespace => $descriptor) { $rootNamespace = $descriptor->getRootNamespace(); $doubleSlashed = str_replace('\\', '\\\\', $rootNamespace);
php
{ "resource": "" }
q9950
Descriptors.getDescriptorByName
train
public function getDescriptorByName(string $bundleName): ?Descriptor { if (!$this->isEmpty()) { /** @var Descriptor $descriptor */ foreach ($this as $rootNamespace => $descriptor) { $name = $descriptor->getName();
php
{ "resource": "" }
q9951
Descriptors.fromArray
train
public static function fromArray(array $data): Descriptors { $descriptors = new static(); if (!empty($data)) { foreach ($data as $descriptorData) { $descriptor = Descriptor::fromArray($descriptorData);
php
{ "resource": "" }
q9952
MarkdownEditor.FieldHolder
train
public function FieldHolder($properties=array()) { $this->extraClasses['stacked']='stacked'; Requirements::css(MARKDOWN_MODULE_BASE.'/css/MarkdownEditor.css'); Requirements::javascript(MARKDOWN_MODULE_BASE.'/javascript/external/ace/ace.js'); Requirements::javascript(MARKDOWN_MODULE_BASE.'/javascript/external/ace/mode-markdown.js'); Requirements::javascript(MARKDOWN_MODULE_BASE.'/javascript/external/ace/theme-textmate.js');
php
{ "resource": "" }
q9953
DSpecApplication.getDefaultInputDefinition
train
protected function getDefaultInputDefinition() { return new InputDefinition(array( new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message.'), new InputOption('--verbose', '-v', InputOption::VALUE_NONE, 'Increase verbosity of messages.'), new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.'),
php
{ "resource": "" }
q9954
FeatureTypeI18n.getFeatureType
train
public function getFeatureType(ConnectionInterface $con = null) { if ($this->aFeatureType === null && ($this->id !== null)) { $this->aFeatureType = ChildFeatureTypeQuery::create()->findPk($this->id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in
php
{ "resource": "" }
q9955
LoggerHelper.replaceBinaryStrings
train
public static function replaceBinaryStrings($message) { $lines = explode("\r\n", $message); foreach ($lines as &$line) { if (!mb_check_encoding($line, 'utf-8')) { $line = '<'
php
{ "resource": "" }
q9956
UserToken.getTokenForUser
train
public function getTokenForUser(User $user, int $validForSeconds = null, array $additionalData = []): string { $tokenData = [ 'user_id' => $user->id, 'generated' => time(), 'validForSeconds' => $validForSeconds, 'additionalData' => $additionalData,
php
{ "resource": "" }
q9957
UserToken.isTokenValid
train
public function isTokenValid(string $token): bool { $tokenData = $this->decryptToken($token); return is_array($tokenData) && isset( $tokenData['user_id'],
php
{ "resource": "" }
q9958
UserToken.isTokenExpired
train
public function isTokenExpired(string $token): bool { if (!$this->isTokenValid($token)) { throw new \InvalidArgumentException('This token is
php
{ "resource": "" }
q9959
UserToken.getUserIdFromToken
train
public function getUserIdFromToken(string $token): string { if (!$this->isTokenValid($token)) { throw new \InvalidArgumentException('This token is invalid');
php
{ "resource": "" }
q9960
UserToken.decryptToken
train
public function decryptToken(string $token) { $tokenData = false; $encrypted = base64_decode($token); if ($encrypted) {
php
{ "resource": "" }
q9961
ConfigSitemapListener.getUrlFromConfiguration
train
protected function getUrlFromConfiguration($routeName, $configuration, $item = null) { foreach ($configuration['route_parameters'] as $key=>$parameter) { $configuration['route_parameters'][$key] = $this->getItemParameter($item, $parameter); } $url = $this->router->generate($routeName, $configuration['route_parameters']); $urlObject = new Url( $url, (isset($configuration['last_mod']) ? $this->getItemParameter($item, $configuration['last_mod']) : null),
php
{ "resource": "" }
q9962
RequestService.storeRefererUrl
train
public function storeRefererUrl(string $url): RequestService {
php
{ "resource": "" }
q9963
RequestService.storeRefererUrlFromRequest
train
public function storeRefererUrlFromRequest(Request $request): RequestService { $url = $this->getRefererUrl($request); /* * No referer? * Nothing to do
php
{ "resource": "" }
q9964
RequestService.fetchRefererUrl
train
public function fetchRefererUrl(): string { $url = $this->session->get($this->refererUrlKey, '');
php
{ "resource": "" }
q9965
Assert.isAttachment
train
public static function isAttachment(WP_Post $post, string $message = null): void { $postType = $post->post_type; 'attachment' === $postType or static::reportInvalidArgument(
php
{ "resource": "" }
q9966
BaseExtension.getFileLoader
train
private function getFileLoader(ContainerBuilder $container, FileLocator $locator, string $fileType): ?FileLoader { $loader = null; switch ($fileType) { case ConfigurationFileType::YAML: $loader = new YamlFileLoader($container, $locator);
php
{ "resource": "" }
q9967
BaseExtension.loadParameters
train
private function loadParameters(array $mergedConfig, ContainerBuilder $container): BaseExtension { /* * No configuration? * Nothing to do */ if (empty($mergedConfig)) { return $this; } // Getting the keys or paths on which building names of parameters should stop $keysToStop = $this->getKeysToStopLoadingParametersOn(); $globalKeysToStop = $this->getGlobalKeysToStopLoadingParametersOn(); // Merging standard with global keys and paths $keysToStop = Arrays::makeArray($keysToStop); $globalKeysToStop = Arrays::makeArray($globalKeysToStop); $stopIfMatchedBy = array_merge($keysToStop, $globalKeysToStop); // Let's get the last elements' paths and load values into container $parameters = Arrays::getLastElementsPaths($mergedConfig, '.', '', $stopIfMatchedBy); /** @var ConfigurationInterface $configuration */ $configuration = $this->getConfiguration($mergedConfig, $container);
php
{ "resource": "" }
q9968
SessionController.create
train
public function create() { try { $this->dispatch(new AttemptRememberingUser()); return redirect()->intended($this->config->get('authentication.login.redirectUri')); }
php
{ "resource": "" }
q9969
SessionController.store
train
public function store(Request $request) { try { $this->dispatch(new AttemptUserLogin($request->get('email'), $request->get('password'), $request->get('remember'))); return redirect()->intended($this->config->get('authentication.login.redirectUri')); } catch (LoginFailed $e) { return redirect()->back()->withInput()->withErrors([
php
{ "resource": "" }
q9970
SessionController.destroy
train
public function destroy() { try { $this->dispatch(new PerformUserLogout()); return redirect($this->config->get('authentication.logout.redirectUri')); } catch (SessionHasExpired $e) {
php
{ "resource": "" }
q9971
ArrayLoader.loadSource
train
private function loadSource(Model\Source $sourceModel, array $sourceData) { $sourceModel ->setId($sourceData['id']) ->setMethod(new Model\Method($sourceData['class'], $sourceData['method'], $sourceData['args'])) ->setLazyLoading($sourceData['lazyLoading']) ->setSupplySeveralFields($sourceData['supplySeveralFields']) ->setOnFail($sourceData['onFail']) ->setExceptionClass($sourceData['exceptionClass']) ->setBadReturnValue($sourceData['badReturnValue']) ->setFallbackSourceId($sourceData['fallbackSourceId']) ->setDepends($sourceData['depends']) ; if (isset($sourceData['preprocessor']['method'])) { $sourceModel->addPreprocessor( new Model\Method( $sourceData['preprocessor']['class'], $sourceData['preprocessor']['method'], $sourceData['preprocessor']['args'] ) ); } elseif (isset($sourceData['preprocessors'])) { foreach ($sourceData['preprocessors'] as $preprocessor) { $sourceModel->addPreprocessor( new Model\Method( $preprocessor['class'], $preprocessor['method'], $preprocessor['args'] ) ); } } if (isset($sourceData['processor']['method'])) { $sourceModel->addProcessor(
php
{ "resource": "" }
q9972
FeatureTypeAvMetaQuery.filterByFeatureAvId
train
public function filterByFeatureAvId($featureAvId = null, $comparison = null) { if (is_array($featureAvId)) { $useMinMax = false; if (isset($featureAvId['min'])) { $this->addUsingAlias(FeatureTypeAvMetaTableMap::FEATURE_AV_ID, $featureAvId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($featureAvId['max'])) { $this->addUsingAlias(FeatureTypeAvMetaTableMap::FEATURE_AV_ID, $featureAvId['max'], Criteria::LESS_EQUAL); $useMinMax = true;
php
{ "resource": "" }
q9973
FeatureTypeAvMetaQuery.filterByFeatureFeatureTypeId
train
public function filterByFeatureFeatureTypeId($featureFeatureTypeId = null, $comparison = null) { if (is_array($featureFeatureTypeId)) { $useMinMax = false; if (isset($featureFeatureTypeId['min'])) { $this->addUsingAlias(FeatureTypeAvMetaTableMap::FEATURE_FEATURE_TYPE_ID, $featureFeatureTypeId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($featureFeatureTypeId['max'])) { $this->addUsingAlias(FeatureTypeAvMetaTableMap::FEATURE_FEATURE_TYPE_ID, $featureFeatureTypeId['max'], Criteria::LESS_EQUAL); $useMinMax = true;
php
{ "resource": "" }
q9974
FeatureTypeAvMetaQuery.filterByLocale
train
public function filterByLocale($locale = null, $comparison = null) { if (null === $comparison) { if (is_array($locale)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $locale)) { $locale = str_replace('*', '%',
php
{ "resource": "" }
q9975
FeatureTypeAvMetaQuery.filterByFeatureAv
train
public function filterByFeatureAv($featureAv, $comparison = null) { if ($featureAv instanceof \Thelia\Model\FeatureAv) { return $this ->addUsingAlias(FeatureTypeAvMetaTableMap::FEATURE_AV_ID, $featureAv->getId(), $comparison); } elseif ($featureAv instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this
php
{ "resource": "" }
q9976
FeatureTypeAvMetaQuery.useFeatureAvQuery
train
public function useFeatureAvQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinFeatureAv($relationAlias, $joinType)
php
{ "resource": "" }
q9977
FeatureTypeAvMetaQuery.useFeatureFeatureTypeQuery
train
public function useFeatureFeatureTypeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinFeatureFeatureType($relationAlias, $joinType)
php
{ "resource": "" }
q9978
Loader.createCountry
train
private function createCountry(DOMElement $element) { if ($element->hasAttribute('common_name')) { $short = $element->getAttribute('common_name'); } else { $short = $element->getAttribute('name'); } if ($element->hasAttribute('official_name')) { $long = $element->getAttribute('official_name'); } else { $long = null; } return new Country(
php
{ "resource": "" }
q9979
Loader.getCountry
train
private function getCountry() { if (null === $this->country) {
php
{ "resource": "" }
q9980
Loader.getSubdivision
train
private function getSubdivision() { if (null === $this->subdivision) {
php
{ "resource": "" }
q9981
Loader.loadXml
train
private function loadXml($file) { $internal = libxml_use_internal_errors(true); $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; $doc->validateOnParse = true; if (!@$doc->load($file)) { $errors = libxml_get_errors();
php
{ "resource": "" }
q9982
PasswordController.update
train
public function update(ChangePasswordRequest $request, Guard $auth) { try { $this->dispatch(new ChangePassword($auth->user()->id, $request->get('current_password'), $request->get('new_password')));
php
{ "resource": "" }
q9983
Mediafile.getOrientation
train
private function getOrientation($filename) { $exif = @exif_read_data($filename); if($exif === null) return 0; $rotation = 0; if (!empty($exif['Orientation'])) { switch ($exif['Orientation']) { case 3: $rotation = 180; break;
php
{ "resource": "" }
q9984
AbstractApiClient.sortChannels
train
protected function sortChannels(ArrayCollection $channels) { $channels->map(function ($channel) { $channel->setChildren($this->sortChannels($channel->getChildren())); }); $iterator = $channels->getIterator(); $iterator->uasort(function ($a, $b) {
php
{ "resource": "" }
q9985
BuzzFactory.getOptions
train
private function getOptions(array $config = []): array { $resolver = new OptionsResolver(); $resolver->setDefaults([ 'timeout' => 5, 'verify_peer' => true, 'verify_host' => 2, 'proxy' => null, ]); $resolver->setAllowedTypes('timeout',
php
{ "resource": "" }
q9986
DoctrineUserRepository.validForUpdate
train
public function validForUpdate($user, array $credentials) { if ($user instanceof UserInterface) {
php
{ "resource": "" }
q9987
Guzzle6ApiClientFactory.createHttpClient
train
public function createHttpClient($baseUri, array $middlewares = [], array $options = []) { $stack = HandlerStack::create(); foreach ($middlewares as $middleware) { $stack->push($middleware); } return
php
{ "resource": "" }
q9988
ClassMetadata.getMetadataExtensionClassByMappedField
train
public function getMetadataExtensionClassByMappedField($mappedFieldName) { $prefix = ''; if (null != $data = $this->getDataForField($mappedFieldName, $this->columnDataName)) { switch (true) { case isset($data['fieldMappingExtensionClass']):
php
{ "resource": "" }
q9989
Image.resize
train
public function resize($width, $height) { $newImage = imagecreatetruecolor($width, $height); $this->strategy->handleTransparency($newImage, $this->image); // Now resample the image
php
{ "resource": "" }
q9990
DefaultDoctrineActivationRepository.create
train
public function create(UserInterface $user) { $entity = static::ENTITY_CLASSNAME; $activation = new $entity($user);
php
{ "resource": "" }
q9991
AlgoliaManager.pushToIndices
train
public function pushToIndices(SearchableInterface $searchableModel) { $indices = $this->initIndices($searchableModel); $record = $searchableModel->getAlgoliaRecord();
php
{ "resource": "" }
q9992
AlgoliaManager.pushMultipleToIndices
train
public function pushMultipleToIndices(array $searchableModels) { $algoliaRecords = $this->getAlgoliaRecordsFromSearchableModelArray($searchableModels); $indices = $this->initIndices($searchableModels[0]);
php
{ "resource": "" }
q9993
AlgoliaManager.updateInIndices
train
public function updateInIndices(SearchableInterface $searchableModel) { $indices = $this->initIndices($searchableModel); $record = $searchableModel->getAlgoliaRecord(); $record['objectID'] = $searchableModel->getObjectID();
php
{ "resource": "" }
q9994
AlgoliaManager.updateMultipleInIndices
train
public function updateMultipleInIndices(array $searchableModels) { $algoliaRecords = $this->getAlgoliaRecordsFromSearchableModelArray($searchableModels); $indices = $this->initIndices($searchableModels[0]);
php
{ "resource": "" }
q9995
AlgoliaManager.removeFromIndices
train
public function removeFromIndices(SearchableInterface $searchableModel) { $indices = $indices = $this->initIndices($searchableModel); $objectID = $searchableModel->getObjectID();
php
{ "resource": "" }
q9996
AlgoliaManager.removeMultipleFromIndices
train
public function removeMultipleFromIndices(array $searchableModels) { $algoliaRecords = $this->getAlgoliaRecordsFromSearchableModelArray($searchableModels); $indices = $this->initIndices($searchableModels[0]); $objectIds = \array_map(function ($algoliaRecord) { return $algoliaRecord['objectID']; },
php
{ "resource": "" }
q9997
AlgoliaManager.reindex
train
public function reindex($className) { $this->checkImplementsSearchableInterface($className); $activeRecord = $this->activeRecordFactory->make($className); $records = $this->activeQueryChunker->chunk( $activeRecord->find(), self::CHUNK_SIZE,
php
{ "resource": "" }
q9998
AlgoliaManager.reindexOnly
train
public function reindexOnly(array $searchableModels) { $records = $this->getAlgoliaRecordsFromSearchableModelArray($searchableModels); $indices = $this->initIndices($searchableModels[0]); return $this->processIndices($indices,
php
{ "resource": "" }
q9999
AlgoliaManager.reindexByActiveQuery
train
public function reindexByActiveQuery(ActiveQueryInterface $activeQuery) { $indices = null; $records = $this->activeQueryChunker->chunk( $activeQuery, self::CHUNK_SIZE, function ($activeRecordEntities) use (&$indices) { $records = $this->getAlgoliaRecordsFromSearchableModelArray($activeRecordEntities); // The converting ActiveRecords to Algolia ones already does the type checking // so it's safe to init indices here during the first chunk.
php
{ "resource": "" }