_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q10000
AlgoliaManager.clearIndices
train
public function clearIndices($className) { $this->checkImplementsSearchableInterface($className); /** @var SearchableInterface $activeRecord */ $activeRecord = $this->activeRecordFactory->make($className); $indices = $indices = $this->initIndices($activeRecord); return $this...
php
{ "resource": "" }
q10001
AlgoliaManager.initIndices
train
private function initIndices(SearchableInterface $searchableModel) { $indexNames = $searchableModel->getIndices(); return \array_map(function ($indexName) { if ($this->env !== null) { $indexName = $this->env . '_' . $indexName; } return $this->in...
php
{ "resource": "" }
q10002
AlgoliaManager.getAlgoliaRecordsFromSearchableModelArray
train
private function getAlgoliaRecordsFromSearchableModelArray(array $searchableModels) { if (empty($searchableModels)) { throw new \InvalidArgumentException('The given array should not be empty'); } // Use the first element of the array to define what kind of models we are indexing...
php
{ "resource": "" }
q10003
AlgoliaManager.reindexAtomically
train
private function reindexAtomically(Index $index, array $algoliaRecords) { $temporaryIndexName = 'tmp_' . $index->indexName; $temporaryIndex = $this->initIndex($temporaryIndexName); $temporaryIndex->addObjects($algoliaRecords); $settings = $index->getSettings(); // Temporar...
php
{ "resource": "" }
q10004
AlgoliaManager.processIndices
train
private function processIndices($indices, callable $callback) { $response = []; foreach ($indices as $index) { $response[$index->indexName] = \call_user_func($callback, $index); } return $response; }
php
{ "resource": "" }
q10005
ProcessBuilder.withDir
train
public function withDir(string $dir): self { $builder = clone $this; $builder->dir = $dir; return $builder; }
php
{ "resource": "" }
q10006
ProcessBuilder.withEnv
train
public function withEnv(string $name, string $value): self { $builder = clone $this; $builder->env[$name] = $value; return $builder; }
php
{ "resource": "" }
q10007
ProcessBuilder.start
train
public function start(Context $context, array $args = []): Promise { $factory = $context->lookup(ProcessFactory::class); if ($factory === null) { throw new \RuntimeException('Cannot launch an async process without a process factory'); } $options = []; ...
php
{ "resource": "" }
q10008
ProcessBuilder.run
train
public function run(Context $context, array $args, ?callable $stdin = null, ?callable $stdout = null, ?callable $stderr = null): Promise { static $discard; static $closer; if ($discard === null) { $discard = static function (Context $context, ReadableStream $stream) { ...
php
{ "resource": "" }
q10009
Character.charCount
train
public static function charCount($char): int { self::handleIncomingChar($char); $stringChar = (string) $char; return mb_ord($stringChar, mb_detect_encoding($stringChar)) > 0xFFFF ? 2 : 1; }
php
{ "resource": "" }
q10010
Character.codePointBefore
train
public static function codePointBefore($chars, int $index, int $start = null): int { if ($start !== null && ($start < 0 || $index <= $start)) { throw new InvalidArgumentException('Start cannot be negative and index must be greater than start!'); } return static::codePointAt($cha...
php
{ "resource": "" }
q10011
Character.compare
train
public static function compare($charA, $charB): int { self::handleIncomingChar($charA, $charB); return (string) $charA <=> (string) $charB; }
php
{ "resource": "" }
q10012
Character.handleIncomingChar
train
private static function handleIncomingChar(...$chars): void { foreach ($chars as $char) { Assert::typeOf(['string', __CLASS__], $char); if (mb_strlen((string) $char) !== 1) { throw new InvalidArgumentException('Only one character can be represented!'); } ...
php
{ "resource": "" }
q10013
Character.isLowerCase
train
public static function isLowerCase($char): bool { self::handleIncomingChar($char); return static::compare($char, static::toLowerCase($char)) === 0; }
php
{ "resource": "" }
q10014
Character.isUpperCase
train
public static function isUpperCase($char): bool { self::handleIncomingChar($char); return static::compare($char, static::toUpperCase($char)) === 0; }
php
{ "resource": "" }
q10015
Character.valueOf
train
public static function valueOf($char): self { if (\is_string($char) || $char instanceof self) { return new static((string) $char); } throw new InvalidArgumentException('Unsupported character type!'); }
php
{ "resource": "" }
q10016
Size.createBySizeName
train
public static function createBySizeName(string $name): self { $registeredImageSizes = get_intermediate_image_sizes(); $additionalImageSizes = wp_get_additional_image_sizes(); Assert::oneOf( $name, $registeredImageSizes, "{$name} size not found on WordPres...
php
{ "resource": "" }
q10017
ProfileController.update
train
public function update(UpdateUserRequest $request) { $this->dispatch(new UpdateUser($this->auth->user()->id, $request->get('name'), $request->get('email'))); return redirect()->route('authentication::profile.show'); }
php
{ "resource": "" }
q10018
AnnotationsReader.target
train
public function target($target, $keyName = null) { $this->target = $target; $this->keyName = $keyName; return $this; }
php
{ "resource": "" }
q10019
AnnotationsReader.read
train
public function read($argument) { // Get Reflection. $reflection = $this->getReflectionFrom($argument); // We have some specific annotations to be read. if ($this->wantsSpecificAnnotation()) { return $this->readSpecificAnnotationFor($reflection); } // We...
php
{ "resource": "" }
q10020
AnnotationsReader.addFilesToRegistry
train
public function addFilesToRegistry($filePaths) { collect((array) $filePaths)->each(function ($filePath) { if (file_exists($filePath)) { AnnotationRegistry::registerFile($filePath); } }); return $this; }
php
{ "resource": "" }
q10021
AnnotationsReader.addNamespacesToRegistry
train
public function addNamespacesToRegistry($namespaces) { collect((array) $namespaces)->each(function ($namespace) { // Get path from namespace. $path = $this->getPathFromNamespace($namespace); if (file_exists($path)) { // Register each annotations file foun...
php
{ "resource": "" }
q10022
AnnotationsReader.readAllAnnotationsFor
train
protected function readAllAnnotationsFor($reflection) { // Construct Method to be used for reading. $methodName = $this->constructReadMethod(); // Read, Collect and return annotations. return collect($this->reader->{$methodName}($reflection)); }
php
{ "resource": "" }
q10023
AnnotationsReader.readSpecificAnnotationFor
train
protected function readSpecificAnnotationFor($reflection) { // Construct Method to be used for reading. $methodName = $this->constructReadMethod(); // Read, Collect and return annotations. return collect($this->reader->{$methodName}($reflection, $this->annotationName)); }
php
{ "resource": "" }
q10024
AnnotationsReader.getReflectionFrom
train
protected function getReflectionFrom($argument) { // Method name to use. $reflectionMethodName = Str::camel('getreflection'.$this->target.'from'); // Return Reflection return $this->{$reflectionMethodName}($argument); }
php
{ "resource": "" }
q10025
AnnotationsReader.getReflectionPropertyFrom
train
protected function getReflectionPropertyFrom($argument) { // No property name is given for targetting. if (is_null($this->keyName)) { throw new InvalidArgumentException('Property name to target is required'); } // Argument is an Object. if (is_object($argument)) ...
php
{ "resource": "" }
q10026
AnnotationsReader.getReflectionMethodFrom
train
protected function getReflectionMethodFrom($argument) { // No method name is given for targetting. if (is_null($this->keyName)) { throw new InvalidArgumentException('Method name to target is required'); } // Argument is an Object. if (is_object($argument)) { ...
php
{ "resource": "" }
q10027
AnnotationsReader.constructReadMethod
train
protected function constructReadMethod() { // Reader methods ends with this. $endsWith = 'annotations'; // We have an annotation name which means // we have to target a specific one. if ($this->wantsSpecificAnnotation()) { $endsWith = 'annotation'; } ...
php
{ "resource": "" }
q10028
SortableBehavior.restoreSorting
train
public function restoreSorting(array $scope = []): void { $records = $this->_table->find() ->select([$this->_table->getPrimaryKey(), $this->getConfig('sortField')]) ->select($this->getConfig('columnScope')) ->order($this->getConfig('defaultOrder')); if (!empty($s...
php
{ "resource": "" }
q10029
SortableBehavior.getNextSortValue
train
public function getNextSortValue(array $scope = []): int { $query = $this->_table->query(); $scope = Hash::merge($this->getConfig('scope'), $scope); if (!empty($scope)) { $query->where($scope); } $query->select([ 'maxSort' => $query->func()->max($this-...
php
{ "resource": "" }
q10030
ConfigInspection.makeArraySerializable
train
private function makeArraySerializable(array $data) { $serializable = []; foreach ($data as $key => $value) { if (is_object($value)) { $serializable[$key] = new ObjectStub($value); continue; } $serializable[$key] = is_array($valu...
php
{ "resource": "" }
q10031
SearchEndpointTrait.createElasticSearchQuery
train
private function createElasticSearchQuery(array $params, $operator = 'AND') { $filteredParams = []; foreach ($params as $name => $value) { if (empty($name) || empty($value)) { continue; } $filteredParams[] = "$name:$value"; } retu...
php
{ "resource": "" }
q10032
SearchEndpointTrait.normalizeSearchChannelsResponse
train
private function normalizeSearchChannelsResponse($response) { $response = json_decode($response, true); if (!is_array($response) || !array_key_exists('result', $response) || !array_key_exists('total', $response)) { throw new Exception('Invalid response from search endpoint'); } ...
php
{ "resource": "" }
q10033
UrlService.createFetch
train
public function createFetch($params, $optParams = []) { if (is_string($params)) { $params = ['url' => $params]; } $params = $this->client->fillParams(['cloudId', 'url'], $params); return $this->build('/f/'.$params['url'], $params, $optParams); }
php
{ "resource": "" }
q10034
UrlService.createFacebook
train
public function createFacebook($params, $optParams = []) { if (is_string($params)) { $params = ['facebookId' => $params]; } $params = $this->client->fillParams(['cloudId', 'facebookId'], $params); return $this->build('/r/facebook/'.$params['facebookId'], $params, $optPar...
php
{ "resource": "" }
q10035
UrlService.createTwitter
train
public function createTwitter($params, $optParams = []) { if (is_string($params)) { $params = ['twitterId' => $params]; } $params = $this->client->fillParams(['cloudId', 'twitterId'], $params); return $this->build('/r/twitter/'.$params['twitterId'], $params, $optParams);...
php
{ "resource": "" }
q10036
UrlService.createYoutube
train
public function createYoutube($params, $optParams = []) { if (is_string($params)) { $params = ['youtubeId' => $params]; } $params = $this->client->fillParams(['cloudId', 'youtubeId'], $params); return $this->build('/r/youtube/'.$params['youtubeId'], $params, $optParams);...
php
{ "resource": "" }
q10037
UrlService.createCloudinary
train
public function createCloudinary($params, $optParams = []) { $params = $this->client->fillParams(['cloudId', 'cloudinaryCloud', 'cloudinaryImage'], $params); return $this->build('/r/cloudinary/'.urlencode($params['cloudinaryCloud'].'/'.$params['cloudinaryImage']), $params, $optParams); }
php
{ "resource": "" }
q10038
UrlService.createWikimedia
train
public function createWikimedia($params, $optParams = []) { if (is_string($params)) { $params = ['wikimediaImage' => $params]; } $params = $this->client->fillParams(['cloudId', 'wikimediaImage'], $params); return $this->build('/r/commons/'.urlencode($params['wikimediaIma...
php
{ "resource": "" }
q10039
UrlService.build
train
private function build($resource, $params, $optParams) { $url = ''; if (isset($optParams['option'])) { $option = (string) $optParams['option']; if (!empty($option)) { $url .= '/o-'.$option; } } if (isset($optParams['transformation']...
php
{ "resource": "" }
q10040
Environment.find
train
function find($logicalPath, $options = array()) { $path = new FileUtils\PathInfo($logicalPath); if ($path->isAbsolute()) { $realPath = $logicalPath; } else { $realPath = $this->loadPaths->find($logicalPath); } if (!is_file($realPath)) { r...
php
{ "resource": "" }
q10041
Environment.logicalPath
train
function logicalPath($absolutePath) { foreach ($this->loadPaths->paths() as $lp) { $absoluteLoadPath = realpath($lp); if (strpos($absolutePath, $absoluteLoadPath) === 0) { return ltrim(substr($absolutePath, strlen($absoluteLoadPath)), '/'); } } ...
php
{ "resource": "" }
q10042
Environment.setJsCompressor
train
function setJsCompressor($compressor) { if (!isset($this->compressors[$compressor])) { throw new \InvalidArgumentException(sprintf('Undefined compressor "%s"', $compressor)); } $js = $this->contentType('.js'); if ($this->jsCompressor !== null) { $this->bundl...
php
{ "resource": "" }
q10043
Environment.setCssCompressor
train
function setCssCompressor($compressor) { if (!isset($this->compressors[$compressor])) { throw new \InvalidArgumentException(sprintf('Undefined compressor "%s"', $compressor)); } $css = $this->contentType('.css'); if ($this->cssCompressor !== null) { $this->b...
php
{ "resource": "" }
q10044
ActiveQueryChunker.chunk
train
public function chunk(ActiveQueryInterface $query, $size, callable $callback) { $pageNumber = 1; $records = $this->paginateRecords($query, $pageNumber, $size)->all(); $results = []; while (count($records) > 0) { // On each chunk, pass the records to the callback and then...
php
{ "resource": "" }
q10045
ActiveQueryChunker.paginateRecords
train
private function paginateRecords(ActiveQueryInterface $query, $pageNumber, $count) { $offset = ($pageNumber - 1) * $count; $limit = $count; return $query->offset($offset)->limit($limit); }
php
{ "resource": "" }
q10046
PasswordResetController.store
train
public function store(SendPasswordResetLinkRequest $request) { $this->dispatch(new SendPasswordResetLink($request->get('email'))); return redirect()->route('authentication::password-reset.create')->withErrors([ 'authentication::password-reset.created' => trans('authentication::password-...
php
{ "resource": "" }
q10047
PasswordResetController.edit
train
public function edit($token, PasswordResetRepository $resets) { if ($resets->exists($token)) { return view('authentication::password-reset.edit')->with('token', $token); } else { return redirect()->route('authentication::password-reset.create')->withErrors([ '...
php
{ "resource": "" }
q10048
PasswordResetController.update
train
public function update(ResetPasswordRequest $request) { try { $this->dispatch(new ResetPassword($request->get('token'), $request->get('email'), $request->get('password'))); return redirect()->route('authentication::session.create')->withErrors([ 'authentication::pass...
php
{ "resource": "" }
q10049
ApplicationService.getVersion
train
private function getVersion(): ?Version { // Oops, unknown/empty path of a file who contains version if (empty($this->versionFilePath)) { throw EmptyVersionFilePathException::create(); } // Oops, not readable/accessible file who contains version if (!is_readable(...
php
{ "resource": "" }
q10050
ApplicationService.createDescriptor
train
private function createDescriptor(string $name, string $description): void { $version = $this->getVersion(); $this->descriptor = new Descriptor($name, $description, $version); }
php
{ "resource": "" }
q10051
RobotsFileController.indexAction
train
public function indexAction(Request $request) { $hosts = $this->getParameter('jantao_dev_sitemap.hosts'); $webDir = rtrim($this->getParameter('jantao_dev_sitemap.web_dir'), '/'); if (!empty($hosts)) { $host = $request->getHttpHost(); if (strpos($host, ':') !== false) ...
php
{ "resource": "" }
q10052
SecurityContextConfiguration.setPrefix
train
public function setPrefix($prefix) { if ($prefix != '') { $prefix = rtrim($prefix, '_').'_'; } $this->prefix = $prefix; return $this; }
php
{ "resource": "" }
q10053
SectionTwigExtension.section
train
public function section(string $section): SectionTwigExtension { $this->options[ReadOptions::SECTION] = $section; return $this; }
php
{ "resource": "" }
q10054
SectionTwigExtension.limit
train
public function limit(int $limit): SectionTwigExtension { $this->options[ReadOptions::LIMIT] = $limit; return $this; }
php
{ "resource": "" }
q10055
SectionTwigExtension.offset
train
public function offset(int $offset): SectionTwigExtension { $this->options[ReadOptions::OFFSET] = $offset; return $this; }
php
{ "resource": "" }
q10056
SectionTwigExtension.sort
train
public function sort(string $sort): SectionTwigExtension { $this->options[ReadOptions::SORT] = $sort; return $this; }
php
{ "resource": "" }
q10057
SectionTwigExtension.before
train
public function before(string $before): SectionTwigExtension { $this->options[ReadOptions::BEFORE] = new \DateTime($before); return $this; }
php
{ "resource": "" }
q10058
SectionTwigExtension.after
train
public function after(string $after): SectionTwigExtension { $this->options[ReadOptions::AFTER] = new \DateTime($after); return $this; }
php
{ "resource": "" }
q10059
SectionTwigExtension.locale
train
public function locale(string $locale): SectionTwigExtension { $this->options[ReadOptions::LOCALE] = $locale; return $this; }
php
{ "resource": "" }
q10060
SectionTwigExtension.id
train
public function id(int $id): SectionTwigExtension { $this->throwNotFound = true; $this->options[ReadOptions::ID] = $id; return $this; }
php
{ "resource": "" }
q10061
SectionTwigExtension.slug
train
public function slug(string $slug): SectionTwigExtension { $this->throwNotFound = true; $this->options[ReadOptions::SLUG] = $slug; return $this; }
php
{ "resource": "" }
q10062
SectionTwigExtension.search
train
public function search(string $searchQuery): SectionTwigExtension { $this->options[ReadOptions::SEARCH] = $searchQuery; return $this; }
php
{ "resource": "" }
q10063
FilesystemLocation.getURI
train
public function getURI(array $criteria) { $uris = $this->getURIs($criteria); return $uris->count() > 0 ? $uris->first() : false; }
php
{ "resource": "" }
q10064
FilesystemLocation.getURIs
train
public function getURIs(array $criteria): URIs { $uris = new URIs(); foreach ($this->extensions as $extension) { $finder = new Finder(); try { $finder->files() ->name($this->getNamePattern($criteria, $extension)) ->in(...
php
{ "resource": "" }
q10065
FilesystemLocation.getNamePattern
train
protected function getNamePattern(array $criteria, string $extension): string { $names = []; $names[] = array_map(function ($criterion) use ($extension) { $uriExtension = URIHelper::containsExtension($criterion); if (! empty($extension)) { $extension = ltrim(...
php
{ "resource": "" }
q10066
FilesystemLocation.getPathPattern
train
protected function getPathPattern(string $relativePath): string { if (empty($relativePath)) { return $this->path; } return rtrim($this->path,'/') . '/' . ltrim($relativePath, '/'); }
php
{ "resource": "" }
q10067
FilesystemLocation.getRelativePath
train
protected function getRelativePath($criteria): string { $criterion = current($criteria); $components = explode('/', $criterion); if (count($components) < 2) { return ''; } return implode('/', array_slice($components, 0, -1)); }
php
{ "resource": "" }
q10068
FilesystemLocation.validateExtensions
train
protected function validateExtensions($extensions): Extensions { if (empty($extensions)) { $extensions = new Extensions(['']); } if (! $extensions instanceof Extensions) { $extensions = new Extensions((array)$extensions); } return $extensions; }
php
{ "resource": "" }
q10069
Resize.resizeImagick
train
private function resizeImagick(Imagick $imagick, Picture $picture) { if(!$this->resizeSmaller && $this->height > $imagick->getImageHeight() && $this->width > $imagick->getImageWidth()) { return; } if($this->resizeMode === $this::MODE_CROP) { $imagick-...
php
{ "resource": "" }
q10070
PromiseResolution.resolve
train
protected function resolve($value = null): void { if (~$this->state & AbstractPromise::PENDING) { return; } if ($value instanceof Promise) { $value->when(function (?\Throwable $e, $v = null): void { if ($e === null) { $this...
php
{ "resource": "" }
q10071
PromiseResolution.fail
train
protected function fail(\Throwable $error): void { if (~$this->state & AbstractPromise::PENDING) { return; } $callbacks = $this->result; $this->state ^= AbstractPromise::PENDING | AbstractPromise::FAILED; $this->result = $error; ...
php
{ "resource": "" }
q10072
WaitConditionLoop.popAndRunBusyCallback
train
private function popAndRunBusyCallback() { if ( $this->busyCallbacks ) { reset( $this->busyCallbacks ); $key = key( $this->busyCallbacks ); /** @var callable $workCallback */ $workCallback =& $this->busyCallbacks[$key]; try { $workCallback(); } catch ( \Exception $e ) { $workCallback = funct...
php
{ "resource": "" }
q10073
GithubMarkdownRenderer.getRenderedHTML
train
public function getRenderedHTML($value) { //Build object to send $sendObj=new stdClass(); $sendObj->text=$value; $sendObj->mode=(self::$useGFM ? 'gmf':'markdown'); $content=json_encode($sendObj); //Build headers $headers=array("Content-type: application/json...
php
{ "resource": "" }
q10074
GithubMarkdownRenderer.useBasicAuth
train
public function useBasicAuth($username=false, $password=false) { self::$useBasicAuth=($username!==false && $password!==false); self::$username=$username; self::$password=$password; }
php
{ "resource": "" }
q10075
PromiseTrait.doReject
train
public static function doReject($promiseOrValue = null) { if (!$promiseOrValue instanceof PromiseInterface) { return new PromiseRejected($promiseOrValue); } return self::doResolve($promiseOrValue)->then(function($value) { return new PromiseRejected($value); ...
php
{ "resource": "" }
q10076
PromiseTrait.doCancel
train
public static function doCancel($promiseOrValue = null) { if (!$promiseOrValue instanceof PromiseInterface) { return new PromiseCancelled($promiseOrValue); } return self::doResolve($promiseOrValue) ->then( function($value) { ...
php
{ "resource": "" }
q10077
PromiseTrait.race
train
public static function race($promisesOrValues) { $cancellationQueue = new CancellationQueue(); return new Promise(function($resolve, $reject, $cancel) use($promisesOrValues, $cancellationQueue) { self::doResolve($promisesOrValues) ->done(function($array) use($resolve, $r...
php
{ "resource": "" }
q10078
PasswordReset.generate
train
public static function generate(Authenticatable $user) { return new static([ 'email' => $user->email, 'token' => hash_hmac('sha256', Str::random(40), config('app.key')), 'created_at' => Carbon::now(), ]); }
php
{ "resource": "" }
q10079
EngineResolver.register
train
public function register(callable $factory, $priority = 0): self { array_unshift($this->engines, [$factory, $priority]); $this->cache = null; $sorted = false; while (!$sorted) { $sorted = true; for ($i = 0, $l = count($this->engines) - 1; $i < $l; $i++) { ...
php
{ "resource": "" }
q10080
EngineResolver.resolve
train
public function resolve(string $path): IEngine { if ($this->cache === null) { $this->cache = []; foreach ($this->engines as $engine) { $this->cache[] = $engine[0]($this->renderer); } } foreach ($this->cache as $engine) { if ($e...
php
{ "resource": "" }
q10081
FeatureTypeQuery.filterByHasFeatureAvValue
train
public function filterByHasFeatureAvValue($hasFeatureAvValue = null, $comparison = null) { if (is_array($hasFeatureAvValue)) { $useMinMax = false; if (isset($hasFeatureAvValue['min'])) { $this->addUsingAlias(FeatureTypeTableMap::HAS_FEATURE_AV_VALUE, $hasFeatureAvValu...
php
{ "resource": "" }
q10082
FeatureTypeQuery.filterByIsMultilingualFeatureAvValue
train
public function filterByIsMultilingualFeatureAvValue($isMultilingualFeatureAvValue = null, $comparison = null) { if (is_array($isMultilingualFeatureAvValue)) { $useMinMax = false; if (isset($isMultilingualFeatureAvValue['min'])) { $this->addUsingAlias(FeatureTypeTable...
php
{ "resource": "" }
q10083
FeatureTypeQuery.filterByCssClass
train
public function filterByCssClass($cssClass = null, $comparison = null) { if (null === $comparison) { if (is_array($cssClass)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $cssClass)) { $cssClass = str_replace('*', '%', $cssClass); ...
php
{ "resource": "" }
q10084
FeatureTypeQuery.filterByInputType
train
public function filterByInputType($inputType = null, $comparison = null) { if (null === $comparison) { if (is_array($inputType)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $inputType)) { $inputType = str_replace('*', '%', $inputType...
php
{ "resource": "" }
q10085
FeatureTypeQuery.filterByMax
train
public function filterByMax($max = null, $comparison = null) { if (is_array($max)) { $useMinMax = false; if (isset($max['min'])) { $this->addUsingAlias(FeatureTypeTableMap::MAX, $max['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } ...
php
{ "resource": "" }
q10086
FeatureTypeQuery.filterByMin
train
public function filterByMin($min = null, $comparison = null) { if (is_array($min)) { $useMinMax = false; if (isset($min['min'])) { $this->addUsingAlias(FeatureTypeTableMap::MIN, $min['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } ...
php
{ "resource": "" }
q10087
FeatureTypeQuery.filterByStep
train
public function filterByStep($step = null, $comparison = null) { if (is_array($step)) { $useMinMax = false; if (isset($step['min'])) { $this->addUsingAlias(FeatureTypeTableMap::STEP, $step['min'], Criteria::GREATER_EQUAL); $useMinMax = true; ...
php
{ "resource": "" }
q10088
FeatureTypeQuery.filterByImageMaxWidth
train
public function filterByImageMaxWidth($imageMaxWidth = null, $comparison = null) { if (is_array($imageMaxWidth)) { $useMinMax = false; if (isset($imageMaxWidth['min'])) { $this->addUsingAlias(FeatureTypeTableMap::IMAGE_MAX_WIDTH, $imageMaxWidth['min'], Criteria::GREAT...
php
{ "resource": "" }
q10089
FeatureTypeQuery.filterByImageMaxHeight
train
public function filterByImageMaxHeight($imageMaxHeight = null, $comparison = null) { if (is_array($imageMaxHeight)) { $useMinMax = false; if (isset($imageMaxHeight['min'])) { $this->addUsingAlias(FeatureTypeTableMap::IMAGE_MAX_HEIGHT, $imageMaxHeight['min'], Criteria:...
php
{ "resource": "" }
q10090
FeatureTypeQuery.filterByFeatureTypeI18n
train
public function filterByFeatureTypeI18n($featureTypeI18n, $comparison = null) { if ($featureTypeI18n instanceof \FeatureType\Model\FeatureTypeI18n) { return $this ->addUsingAlias(FeatureTypeTableMap::ID, $featureTypeI18n->getId(), $comparison); } elseif ($featureTypeI18n ...
php
{ "resource": "" }
q10091
FeatureTypeQuery.useFeatureTypeI18nQuery
train
public function useFeatureTypeI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') { return $this ->joinFeatureTypeI18n($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'FeatureTypeI18n', '\FeatureType\Model\FeatureTypeI18nQuery'); }
php
{ "resource": "" }
q10092
Arrays.fill
train
public function fill($newValue): self { foreach ($this->values as $index => $value) { $this->values[$index] = $newValue; } return $this; }
php
{ "resource": "" }
q10093
Picture.loadImageResource
train
protected function loadImageResource() { if(empty($this->resource)) { if((is_null($this->worker) || $this->worker === $this::WORKER_IMAGICK) && $this->imagickAvailable()) { $this->resource = $this->createImagick($this->image); } elseif(...
php
{ "resource": "" }
q10094
Picture.convertResource
train
protected function convertResource($convertTo) { $this->tmpImage[] = $tmpImage = tempnam(sys_get_temp_dir(), 'picture'); if($this->isGd()) { imagepng($this->resource, $tmpImage, 0); } else { $this->resource->writeImage($tmpImage); } ...
php
{ "resource": "" }
q10095
Picture.setResource
train
public function setResource($resource) { if($this->getWorker($resource) === $this->getWorker($this->resource)) { $this->resource = $resource; } $this->tmpImage[] = $tmpImage = tempnam(sys_get_temp_dir(), 'picture'); if($this->getWorker($resource) === $this::WORK...
php
{ "resource": "" }
q10096
Picture.normalizeGdResource
train
protected function normalizeGdResource($resource) { if(imageistruecolor($resource)) { imagesavealpha($resource, TRUE); return $resource; } $width = imagesx($resource); $height = imagesy($resource); $trueColor = imagecreatetruecolor($width, ...
php
{ "resource": "" }
q10097
Picture.getGdResource
train
protected function getGdResource($imageFile) { $imageInfo = getimagesize($imageFile); switch($imageInfo['mime']) { case 'image/jpg': case 'image/jpeg': return $this->normalizeGdResource(imagecreatefromjpeg($imageFile)); case 'image/gif': ...
php
{ "resource": "" }
q10098
Picture.getImageQuery
train
public function getImageQuery() { $command = ''; foreach($this->effect as $effect) { if($effect instanceof PictureEffect) { $command .= $effect->__toString() . '&'; } } $command .= 'Quality;' . $this->quality . '&'; ...
php
{ "resource": "" }
q10099
Picture.effect
train
public function effect($effect) { $args = array_slice(func_get_args(), 1); if($effect instanceof PictureEffect) { $this->effect[] = $effect; } else { $effectClass = "Palette\\Effect\\" . $effect; if(class_exists($effectClass)) ...
php
{ "resource": "" }