_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q10100 | Picture.resize | train | public function resize($width, $height = NULL, $resizeMode = NULL)
{
if(!$height)
{
$height = $width;
}
| php | {
"resource": ""
} |
q10101 | Picture.setProgressive | train | public function setProgressive($progressive = TRUE)
{
if(is_bool($progressive))
{
$this->progressive = $progressive;
}
else
{
| php | {
"resource": ""
} |
q10102 | Picture.save | train | public function save($file = NULL)
{
if(is_null($file) && $this->storage)
{
$this->storage->save($this);
}
elseif(!is_null($file))
{
$this->savePicture($file);
| php | {
"resource": ""
} |
q10103 | Picture.output | train | public function output()
{
$imageFile = $this->storage->getPath($this);
if(file_exists($imageFile))
{
header('Content-Type: image');
header('Content-Length: ' . | php | {
"resource": ""
} |
q10104 | Picture.getUrl | train | public function getUrl()
{
if($this->storage)
{
$this->save();
| php | {
"resource": ""
} |
q10105 | Picture.getDimensions | train | public function getDimensions()
{
$imageDimension = getimagesize($this->image);
$width = $imageDimension[0];
$height = $imageDimension[1];
foreach($this->effect as $effect)
{
| php | {
"resource": ""
} |
q10106 | Transformation.perspective | train | public function perspective($dx1, $dy1, $dx2, $dy2, $dx3, $dy3, $dx4, $dy4, $sx1 = null, $sy1 = null, $sx2 = null, $sy2 = null, $sx3 = null, $sy3 = null, $sx4 = null, $sy4 = null)
{
if (!is_null($sx1) || !is_null($sy1) || !is_null($sx2) || !is_null($sy2) || !is_null($sx3) || !is_null($sy3) || !is_null($sx4) || !is_null($sy4)) {
$params = [$sx1, $sy1, $dx1, $dy1, $sx2, $sy2, $dx2, $dy2, $sx3, $sy3, $dx3, $dy3, $sx4, | php | {
"resource": ""
} |
q10107 | Transformation.border | train | public function border($top, $right = null, $bottom = null, $left = | php | {
"resource": ""
} |
q10108 | Transformation.round | train | public function round($topLeft, $topRight = null, $bottomRight = null, $bottomLeft | php | {
"resource": ""
} |
q10109 | Transformation.jpegoptim | train | public function jpegoptim($quality = null)
{
return $quality === null ? $this->addItem('q', | php | {
"resource": ""
} |
q10110 | Transformation.addItem | train | private function addItem()
{
$args = func_get_args();
if (in_array($args[0], self::$appendableTransformations)) {
$i = $this->findLastTransformation($args[0]);
if ($i !== false) {
$this->items[$i]['rendered'] .= ','.implode(':', array_slice($args, 1));
return $this;
}
}
if ($args[0] != '/' && $this->itemCount && in_array($this->items[$this->itemCount - 1]['type'], self::$forcedLastTransformations)) {
$lastTransformation = array_pop($this->items);
}
| php | {
"resource": ""
} |
q10111 | Transformation.render | train | private function render()
{
$transformation = implode('_', array_column($this->items, 'rendered'));
$transformation = preg_replace('#(_?/_?)+#isu', '/', $transformation);
| php | {
"resource": ""
} |
q10112 | Socket.stopHeartbeat | train | private function stopHeartbeat()
{
if ($this->hTimer !== null)
{
| php | {
"resource": ""
} |
q10113 | Socket.clearConnectionPool | train | private function clearConnectionPool()
{
$deleted = $this->connectionPool->removeInvalid();
foreach ($deleted as $deletedid)
| php | {
"resource": ""
} |
q10114 | Socket.startTimeRegister | train | private function startTimeRegister()
{
if ($this->rTimer === null && $this->flags['enableHeartbeat'] === true && $this->flags['enableTimeRegister'] === true)
{
$proxy = $this;
$this->rTimer = $this->loop->addPeriodicTimer(($this->options['timeRegisterInterval']/1000), function() use($proxy) {
| php | {
"resource": ""
} |
q10115 | Socket.stopTimeRegister | train | private function stopTimeRegister()
{
if ($this->rTimer !== null)
{
$this->rTimer->cancel();
| php | {
"resource": ""
} |
q10116 | Enum.read | train | public function read(AbstractStream $stream)
{
$key = parent::read($stream);
$values = $this->getValues();
if (array_key_exists($key, $values)) {
$value = $values[$key];
} else {
$value = $this->getDefault();
}
if ($value === null) {
throw new InvalidKeyException(
"Value '{$key}' does | php | {
"resource": ""
} |
q10117 | Shareable.all | train | public function all()
{
$defaultButtons = Config::get('shareable::default_buttons', array());
$buttons = array();
$output = ''; | php | {
"resource": ""
} |
q10118 | StrictPasswordBehavior.buildValidator | train | public function buildValidator(Event $event, Validator $validator, string | php | {
"resource": ""
} |
q10119 | StrictPasswordBehavior.validationStrictPassword | train | public function validationStrictPassword(Validator $validator): Validator
{
$validator
->add('password', [
'minLength' => [
'rule' => ['minLength', $this->getConfig('minPasswordLength')],
'last' => true,
'message' => __d('ck_tools', 'validation.user.password_min_length'),
],
])
->add('password', 'passwordFormat', [
'rule' => function ($value, $context) {
return $this->validFormat($value, $context);
},
'message' => __d('ck_tools', 'validation.user.password_invalid_format'),
])
->add('password', 'passwordNoUserName', [
'rule' => function ($value, $context) {
return $this->checkForUserName($value, $context);
},
'message' | php | {
"resource": ""
} |
q10120 | StrictPasswordBehavior.checkForUserName | train | public function checkForUserName(string $value, array $context): bool
{
// return true if config is not set
if (empty($this->getConfig('noUserName'))) {
return true;
}
// Get Config
$firstNameField = $this->getConfig('userNameFields.firstname');
$lastNameField = $this->getConfig('userNameFields.lastname');
// No Usernames in Context
if (empty($context['data'][$firstNameField]) || empty($context['data'][$lastNameField])) {
if (!empty($context['data']['id'])) {
$user = $this->_table->get($context['data']['id']);
$firstname = $user->$firstNameField;
$lastname = $user->$lastNameField;
} else {
// no name to check
return true;
}
} else {
| php | {
"resource": ""
} |
q10121 | StrictPasswordBehavior.checkLastPasswords | train | public function checkLastPasswords(string $value, array $context): bool
{
// return true if config is not set
if (empty($this->getConfig('oldPasswordCount'))) {
return true;
}
// ignore on new user
if (empty($context['data']['id'])) {
return true;
}
$user = $this->_table->get($context['data']['id']);
| php | {
"resource": ""
} |
q10122 | StrictPasswordBehavior.beforeSave | train | public function beforeSave(Event $event, EntityInterface $entity): bool
{
if (empty($this->getConfig('oldPasswordCount')) || !is_numeric($this->getConfig('oldPasswordCount'))) {
return true;
}
if (!is_array($entity->last_passwords)) {
$entity->last_passwords = [];
| php | {
"resource": ""
} |
q10123 | RemoteProcessFactory.spawnProcess | train | protected static function spawnProcess(string $cmd, array $spec, ?array & $pipes, ?string $dir = null, ?array $env = null, bool $bypassShell = false)
{
| php | {
"resource": ""
} |
q10124 | UserController.store | train | public function store(StoreUserRequest $request, Repository $config)
{
$this->dispatch(new RegisterUser($request->get('name'), | php | {
"resource": ""
} |
q10125 | DatatablesEnabledControllerTrait.listAction | train | public function listAction(Request $request)
{
$manager = $this->getEntityManager();
$total_count = $manager->getTotalCount($request);
$filtered_count = $manager->getFilteredCount($request);
$entities = $manager->getEntities($request);
return array_merge(
$this->getExtraTemplateParameters($request), | php | {
"resource": ""
} |
q10126 | DatatablesEnabledControllerTrait.getFilter | train | protected function getFilter(Request $request)
{
if ($filter_type = $this->getEntityManager()->getFilterType($request)) | php | {
"resource": ""
} |
q10127 | TypeAwareTrait.getTypeDescription | train | public static function getTypeDescription(?string $type): ?string
{
$descriptions = self::typeDescriptions();
| php | {
"resource": ""
} |
q10128 | IterableResultHydrator.hydrate | train | public function hydrate($objectClass, array $data, $indexOfBy = false)
{
$this->objectClass = $objectClass;
if (0 == count($data)) {
yield $this->createObjectToHydrate($this->objectClass);
} elseif (! is_array(current($data))) {
| php | {
"resource": ""
} |
q10129 | Busy.done | train | public function done()
{
if ($this->watcher) {
if ($this->watcher->count > 0) | php | {
"resource": ""
} |
q10130 | DoctrineSectionManager.restoreFromHistory | train | public function restoreFromHistory(SectionInterface $sectionFromHistory): SectionInterface
{
/** @var SectionInterface $activeSection */
$activeSection = $this->readByHandle($sectionFromHistory->getHandle()); // 1
/** @var SectionInterface $newSectionHistory */
$newSectionHistory = $this->copySectionDataToSectionHistoryEntity($activeSection); // 2
$newSectionHistory->setVersioned(new \DateTime()); // 3
$version = $this->getHighestVersion($newSectionHistory->getHandle());
| php | {
"resource": ""
} |
q10131 | DoctrineSectionManager.updateByConfig | train | public function updateByConfig(
SectionConfig $sectionConfig,
SectionInterface $section,
bool $history = false
): SectionInterface {
if ($history) {
/** @var SectionInterface $sectionHistory */
$sectionHistory = $this->copySectionDataToSectionHistoryEntity($section); // 1
$sectionHistory->setVersioned(new \DateTime()); // 2
$this->sectionHistoryManager->create($sectionHistory); // 2
$version = $this->getHighestVersion($section->getHandle());
$section->setVersion(1 + $version->toInt()); // 3
}
$section->removeFields(); // 4
$fields = $this->fieldManager->readByHandles($sectionConfig->getFields()); // 5
| php | {
"resource": ""
} |
q10132 | Coanda.loadModules | train | public function loadModules()
{
$core_modules = [
'CoandaCMS\Coanda\Pages\PagesModuleProvider',
'CoandaCMS\Coanda\Media\MediaModuleProvider',
'CoandaCMS\Coanda\Users\UsersModuleProvider',
'CoandaCMS\Coanda\Layout\LayoutModuleProvider',
'CoandaCMS\Coanda\Urls\UrlModuleProvider',
'CoandaCMS\Coanda\History\HistoryModuleProvider'
];
$enabled_modules = $this->config->get('coanda::coanda.enabled_modules');
$modules = | php | {
"resource": ""
} |
q10133 | Coanda.filters | train | public function filters()
{
Route::filter('admin_auth', function()
{
if (!App::make('coanda')->isLoggedIn())
{
Session::put('pre_auth_path', Request::path());
| php | {
"resource": ""
} |
q10134 | Coanda.routes | train | public function routes()
{
Route::group(array('prefix' => $this->config->get('coanda::coanda.admin_path')), function()
{
// All module admin routes should be wrapper in the auth filter
Route::group(array('before' => 'admin_auth'), function()
{
foreach ($this->modules as $module)
{
$module->adminRoutes();
}
});
// We will put the main admin controller outside the group so it can handle its own filters
Route::controller('/', 'CoandaCMS\Coanda\Controllers\AdminController');
| php | {
"resource": ""
} |
q10135 | Coanda.bindings | train | public function bindings($app)
{
$app->bind('CoandaCMS\Coanda\Urls\Repositories\UrlRepositoryInterface', 'CoandaCMS\Coanda\Urls\Repositories\Eloquent\EloquentUrlRepository');
$search_provider = $this->config->get('coanda::coanda.search_provider');
if (class_exists($search_provider))
{
$app->bind('CoandaCMS\Coanda\Search\CoandaSearchProvider', $search_provider);
}
else | php | {
"resource": ""
} |
q10136 | Lexer.updateOptions | train | public function updateOptions()
{
if ($onLex = $this->getOption('on_lex')) {
$this->attach(LexerEvent::LEX, $onLex);
}
if ($onLex = $this->getOption('on_lex_end')) {
$this->attach(LexerEvent::END_LEX, $onLex);
}
if ($onToken = | php | {
"resource": ""
} |
q10137 | Lexer.prependScanner | train | public function prependScanner($name, $scanner)
{
$this->filterScanner($scanner);
$scanners = [
$name => $scanner,
];
foreach ($this->getScanners() as $scannerName => $classNameOrInstance) {
if ($scannerName !== $name) {
| php | {
"resource": ""
} |
q10138 | Lexer.addScanner | train | public function addScanner($name, $scanner)
{
$this->filterScanner($scanner);
| php | {
"resource": ""
} |
q10139 | Lexer.lex | train | public function lex($input, $path = null)
{
$stateClassName = $this->getOption('lexer_state_class_name');
$lexEvent = new LexEvent($input, $path, $stateClassName, [
'encoding' => $this->getOption('encoding'),
'indent_style' => $this->getOption('indent_style'),
'indent_width' => $this->getOption('indent_width'),
'allow_mixed_indent' => $this->getOption('allow_mixed_indent'),
'multiline_markup_enabled' => $this->getOption('multiline_markup_enabled'),
'level' => $this->getOption('level'),
]);
$this->trigger($lexEvent);
$input = $lexEvent->getInput();
$path = $lexEvent->getPath();
$stateClassName = $lexEvent->getStateClassName();
$stateOptions = $lexEvent->getStateOptions();
$stateOptions['path'] = $path;
$stateOptions['keyword_names'] = array_keys($this->getOption('keywords') ?: []);
if (!is_a($stateClassName, State::class, true)) {
throw new \InvalidArgumentException(
'lexer_state_class_name needs to be a valid '.State::class.' sub class, '.
$stateClassName.' given'
);
}
//Put together our initial | php | {
"resource": ""
} |
q10140 | Message.addQuestion | train | public function addQuestion(string $host, int $type, int $class = self::CLASS_IN): void
{
| php | {
"resource": ""
} |
q10141 | Message.addAnswer | train | public function addAnswer(string $host, int $type, int $class, string $data, int $ttl): void
{
$this->answers[] = [
'host' => $host,
'type' => $type,
| php | {
"resource": ""
} |
q10142 | Message.encodeHeader | train | protected function encodeHeader(): string
{
return \pack('n*', ...[
$this->id,
$this->getFlags(),
\count($this->questions),
| php | {
"resource": ""
} |
q10143 | Message.encodeLabel | train | protected function encodeLabel(string $label): string
{
$encoded = '';
foreach (\explode('.', $label) as $part) {
$encoded | php | {
"resource": ""
} |
q10144 | Message.encodeQuestion | train | protected function encodeQuestion(array $question): string
{
$encoded = $this->encodeLabel($question['host']);
$encoded | php | {
"resource": ""
} |
q10145 | Message.encodeAnswer | train | protected function encodeAnswer(array $answer): string
{
$encoded = $this->encodeLabel($answer['host']);
switch ($answer['type']) {
case self::TYPE_A:
case self::TYPE_AAAA:
$data = \inet_pton($answer['data']);
break;
case self::TYPE_CNAME:
$data = $this->encodeLabel($answer['data']);
break;
| php | {
"resource": ""
} |
q10146 | ShoppingCart.emptycart | train | public function emptycart()
{
ShoppingCartFactory::create()->delete();
$form = $this->CartForm();
$form->sessionMessage(_t(
| php | {
"resource": ""
} |
q10147 | ShoppingCart.checkout | train | public function checkout()
{
if (!class_exists($this->config()->checkout_class)) {
return $this->httpError(404);
}
$checkout = Injector::inst()
| php | {
"resource": ""
} |
q10148 | DateService.getFormat | train | public function getFormat(string $dateLength): string
{
// Oops, unknown length of date
if (false === (new DateLength())->isCorrectType($dateLength)) {
throw UnknownDateLengthException::createException($dateLength);
}
$format = '';
switch ($dateLength) {
case DateLength::DATE:
$format = $this->dateFormat;
break;
| php | {
"resource": ""
} |
q10149 | DateService.formatDate | train | public function formatDate(\DateTimeInterface $dateTime, string $dateLength): string | php | {
"resource": ""
} |
q10150 | Success.success | train | public function success(int $statusCode, string $message, $data = null): JsonResponse
{
$this->setStatusCode($statusCode);
$this->setMessage($message);
$this->setData($data);
$content['message'] = $this->getMessage();
if (null !== $this->getCode()) {
$content['code'] = $this->getCode();
}
$content['status_code'] = $this->getStatusCode();
if (null !== $this->getData() && $this->getErrors() !== $this->getData()) {
$content['data'] = $this->getData();
}
| php | {
"resource": ""
} |
q10151 | HierarchyBuilder.explodeChildren | train | private function explodeChildren($id, array $childrenMap)
{
if (! isset($childrenMap[$id])) {
return [];
}
// Indexing items by their value
$indexed = [];
foreach ($childrenMap[$id] as $childName) {
$indexed[$childName] = $childName;
}
| php | {
"resource": ""
} |
q10152 | Hydrator.doHydrate | train | protected function doHydrate(array $data, $object)
{
$previousHydrationContext = $this->currentHydrationContext;
$this->currentHydrationContext = new CurrentHydrationContext($data, $object);
foreach ($this->metadata->getMappedFieldNames() as $mappedFieldName) {
$defaultValue = $this->metadata->getFieldDefaultValue($mappedFieldName);
if (null !== $defaultValue) {
$this->resolveValue($defaultValue, $object);
$this->memberAccessStrategy->setValue($defaultValue, $object, $mappedFieldName);
}
}
if (! $this->metadata->hasCustomHydrator()) {
$this->executeMethods($object, $this->metadata->getPreHydrateListeners());
foreach ($data as $originalFieldName => $value) {
$mappedFieldName = $this->metadata->getMappedFieldName($originalFieldName);
if (null === $mappedFieldName) {
//It's possible that a raw field name has no corresponding field name
//because a raw field can be a value object part.
continue;
}
if (! $this->metadata->hasSource($mappedFieldName)) {
//Classical hydration.
$this->walkHydration($mappedFieldName, $object, $value, $data);
}
}
| php | {
"resource": ""
} |
q10153 | Hydrator.getCurrentConfigVariableByName | train | public function getCurrentConfigVariableByName($variableKey)
{
if (! isset($this->currentConfigVariables[$variableKey])) {
throw new ObjectMappingException(
sprintf(
| php | {
"resource": ""
} |
q10154 | PineAnnotationsServiceProvider.registerReader | train | protected function registerReader()
{
// Give a Cached Reader when our
// reader class needs
// a ReaderContract.
$this->app->when(AnnotationsReader::class)
->needs(Reader::class)
| php | {
"resource": ""
} |
q10155 | PineAnnotationsServiceProvider.addAnnotationsToRegistry | train | protected function addAnnotationsToRegistry()
{
// Creates annotation Reader.
$reader = $this->app->make(AnnotationsReader::class);
// Register files autoload.
$reader->addFilesToRegistry(config('pine-annotations.autoload_files'));
| php | {
"resource": ""
} |
q10156 | Compare.isDimensionsEqual | train | public function isDimensionsEqual()
{
if($this->image1->getImageWidth() !== $this->image2->getImageWidth()
| php | {
"resource": ""
} |
q10157 | Compare.isEqual | train | public function isEqual()
{
// CHECK IMAGES DIMENSIONS
if(!$this->isDimensionsEqual())
{
return FALSE;
}
$compare = $this->image1->compareImages($this->image2, Imagick::METRIC_MEANSQUAREERROR);
// IMAGE IS EXACTLY THE SAME
if($compare === TRUE)
{
return TRUE;
}
// IMAGE IS IN TOLERABLE RANGE
| php | {
"resource": ""
} |
q10158 | Paymill.createModel | train | public function createModel($class, $id)
{
$this->model = new $class();
if ($id) {
| php | {
"resource": ""
} |
q10159 | UserController.index | train | public function index(Request $request, UserRepository $users)
{
| php | {
"resource": ""
} |
q10160 | InstallDirectoryCommand.getAllYamls | train | private static function getAllYamls(string $directory): \Generator
{
/** @var \SplFileInfo $file */
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory)) as $file) {
if ($file->isFile() && $file->getExtension() === 'yml') {
| php | {
"resource": ""
} |
q10161 | ExpressionContext.addVariable | train | public function addVariable($key, $value)
{
if (is_null($key) || ! is_string($key)) {
throw new RuntimeException(sprintf('The key where to save your variable in the | php | {
"resource": ""
} |
q10162 | Server.serverResponse | train | public function serverResponse()
{
if(!empty($_GET['imageQuery']))
{
$picture = $this->loadPicture($_GET['imageQuery']);
$savePath = $this->getPath($picture);
$picture->save($savePath);
if($savePath !== $this->getPath($picture))
| php | {
"resource": ""
} |
q10163 | Server.requestWithoutWaiting | train | function requestWithoutWaiting($url, array $params = array())
{
$post = array();
foreach($params as $index => $val)
{
$post[] = $index . '=' . urlencode($val);
}
$post = implode('&', $post);
$request = parse_url($url);
// SUPPORT FOR RELATIVE GENERATOR URL
if(!isset($request['host']))
{
$request['host'] = $_SERVER['HTTP_HOST'];
}
if(!isset($request['port']))
{
$request['port'] = $_SERVER['SERVER_PORT'];
}
// SEND | php | {
"resource": ""
} |
q10164 | DataSet.setValue | train | public function setValue($name, $value)
{
$child = & $this->data;
foreach ($this->currentPath as $part) {
if (isset($child[$part])) {
$child = & $child[$part];
} else { | php | {
"resource": ""
} |
q10165 | DataSet.getValue | train | public function getValue($name)
{
$child = & $this->data;
foreach ($this->currentPath as $part) {
if (isset($child[$part])) {
$child = & $child[$part];
} else { | php | {
"resource": ""
} |
q10166 | DataSet.getValueByPath | train | public function getValueByPath($path)
{
if (is_string($path)) {
$path = $this->parsePath($path);
}
$child = $this->data;
foreach ($path as $part) {
if (isset($child[$part])) {
| php | {
"resource": ""
} |
q10167 | DataSet.setValueByPath | train | public function setValueByPath($path, $value)
{
if (is_string($path)) {
$path = $this->parsePath($path);
}
$endPart = array_pop($path);
$child = & $this->data;
foreach ($path as $part) {
if (isset($child[$part])) {
| php | {
"resource": ""
} |
q10168 | DataSet.parsePath | train | public function parsePath($path)
{
$parts = explode('/', trim($path, '/'));
$pathArray = [];
if ($parts[0] == '.') {
$pathArray = $this->currentPath;
array_shift($parts);
}
foreach ($parts as $part) {
if ($part == '..') {
if (count($pathArray)) {
array_pop($pathArray);
| php | {
"resource": ""
} |
q10169 | DataSet.resolvePath | train | public function resolvePath($value)
{
do {
$value = $this->getValueByPath($value);
| php | {
"resource": ""
} |
q10170 | SourceFactory.create | train | public function create(WP_Post $attachment, Size $size): Source
{
if (!wp_attachment_is_image($attachment)) {
throw new InvalidArgumentException('Attachment must be an image.');
}
$imageSource = (array)wp_get_attachment_image_src(
| php | {
"resource": ""
} |
q10171 | Guzzle5ApiClient._doRequest | train | protected function _doRequest($method, $uri, $options)
{
// For Guzzle5 we cannot have any options that are not pre-defined,
// so instead we put it in the config array
if (isset($options[self::OPT_VIDEO_MANAGER_ID])) {
$options['config'][self::OPT_VIDEO_MANAGER_ID] = $options[self::OPT_VIDEO_MANAGER_ID];
| php | {
"resource": ""
} |
q10172 | AlgoliaComponent.createManager | train | private function createManager()
{
$config = $this->generateConfig();
$algoliaManager = $this->algoliaFactory->make($config);
| php | {
"resource": ""
} |
q10173 | AlgoliaComponent.generateConfig | train | private function generateConfig()
{
return new AlgoliaConfig(
$this->applicationId,
$this->apiKey,
| php | {
"resource": ""
} |
q10174 | URIHelper.hasExtension | train | public static function hasExtension(string $uri, string $extension): bool
{
$extension = '.' . ltrim($extension, '.');
$uriLength = mb_strlen($uri);
$extensionLength = mb_strlen($extension);
if ($extensionLength > $uriLength) {
| php | {
"resource": ""
} |
q10175 | URIHelper.containsExtension | train | public static function containsExtension(string $uri): string
{
$pathParts = explode('/', $uri);
$filename = array_pop($pathParts);
$filenameParts = explode('.', $filename);
| php | {
"resource": ""
} |
q10176 | RoutePermissionRepository.extractPermissionFrom | train | private function extractPermissionFrom(Route $route)
{
$parameters = $route->getAction();
| php | {
"resource": ""
} |
q10177 | RouteAnnotationListener.getUrlFromRoute | train | protected function getUrlFromRoute($name, Route $route)
{
$option = $route->getOption('sitemap');
if ($option === null) {
return null;
}
if (is_string($option)) {
$decoded = json_decode($option, true);
if (!json_last_error() && is_array($decoded)) {
$option = $decoded;
}
}
if (!is_array($option) && !is_bool($option)) {
$bool = filter_var($option, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
| php | {
"resource": ""
} |
q10178 | PHPEngine.getRenderCallback | train | public function getRenderCallback(string $uri, array $context = []): callable
{
if (! is_readable($uri)) {
throw new FailedToLoadView(
sprintf(
_('The View URI "%1$s" is not accessible or readable.'),
$uri
)
);
}
$closure = function () use ($uri, $context) {
// Save current buffering level so we can backtrack in case of an error.
// This is needed because the view itself might also add an unknown number of output buffering levels.
$bufferLevel = ob_get_level();
ob_start();
try {
include $uri;
} catch (Exception $exception) {
// Remove whatever levels were added up until now.
while (ob_get_level() > $bufferLevel) {
| php | {
"resource": ""
} |
q10179 | Text_Password.createMultiple | train | public static function createMultiple(
$number,
$length = 10,
$type = 'pronounceable',
$chars = ''
) {
$passwords = array();
while ($number > 0) {
| php | {
"resource": ""
} |
q10180 | Text_Password.createMultipleFromLogin | train | public static function createMultipleFromLogin($login, $type, $key = 0)
{
$passwords = array();
$number = count($login);
$save = $number;
while ($number > 0) {
while (true) {
$password = self::createFromLogin($login[$save - $number], $type, $key);
| php | {
"resource": ""
} |
q10181 | Text_Password._shuffle | train | protected static function _shuffle($login)
{
$tmp = array();
for ($i = 0; $i < strlen($login); $i++) {
$tmp[] | php | {
"resource": ""
} |
q10182 | Text_Password._rand | train | protected static function _rand($min, $max)
{
if (version_compare(PHP_VERSION, '7.0.0', 'ge')) {
| php | {
"resource": ""
} |
q10183 | Errors.badRequest | train | public function badRequest($message = 'Bad Request', $errors = null): void
{
$this->setStatusCode(400);
| php | {
"resource": ""
} |
q10184 | TWBTreeView.finalize | train | public function finalize()
{
\Ease\TWB\Part::twBootstrapize();
$this->includeJavascript('https://cdnjs.cloudflare.com/ajax/libs/bootstrap-treeview/1.2.0/bootstrap-treeview.min.js');
| php | {
"resource": ""
} |
q10185 | DcxApiClient.stream | train | public function stream($url, array $query, callable $eventListener)
{
try {
$response = $this->guzzleClient->request
(
'GET',
$this->fullUrl($url),
$this->getRequestOptions
(
[
'stream' => true,
'query' => $this->mergeQuery($url, $query),
'headers' =>
[
'Accept' => 'text/event-stream'
]
]
)
);
} catch (RequestException $exception) {
if ($exception->hasResponse()) {
$response = $exception->getResponse();
} else {
| php | {
"resource": ""
} |
q10186 | Service.sendRequest | train | protected function sendRequest($requiredParams, $params, $callback)
{
$response = $this->client->send($requiredParams, array_merge($params, [
'module' => static::getModule(),
'controller' => static::getController(),
'version' => $this->version,
]), function ($response) use ($callback) {
if (isset($response->error)) {
return $response;
}
return call_user_func($callback, $response);
});
if (isset($response->error)) {
$this->lastError = isset($response->error->message) ? $response->error->message : 'Unknown error!';
| php | {
"resource": ""
} |
q10187 | FileLoader.mergeEnvironments | train | public function mergeEnvironments(array $lines, string $file): array
{
if ($this->files->exists($file)) { | php | {
"resource": ""
} |
q10188 | FeatureType.getValue | train | public static function getValue($slug, $featureId, $locale = 'en_US')
{
| php | {
"resource": ""
} |
q10189 | Guzzle6ApiClient._doRequest | train | protected function _doRequest($method, $uri, $options)
{
| php | {
"resource": ""
} |
q10190 | DoctrineIterator.loadPage | train | protected function loadPage($page)
{
$this->pageStart = $page * $this->pageSize;
$this->pageData | php | {
"resource": ""
} |
q10191 | FeatureType.initFeatureFeatureTypes | train | public function initFeatureFeatureTypes($overrideExisting = true)
{
if (null !== $this->collFeatureFeatureTypes && !$overrideExisting) {
| php | {
"resource": ""
} |
q10192 | FeatureType.getFeatureFeatureTypes | train | public function getFeatureFeatureTypes($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collFeatureFeatureTypesPartial && !$this->isNew();
if (null === $this->collFeatureFeatureTypes || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collFeatureFeatureTypes) {
// return empty collection
$this->initFeatureFeatureTypes();
} else {
$collFeatureFeatureTypes = ChildFeatureFeatureTypeQuery::create(null, $criteria)
->filterByFeatureType($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collFeatureFeatureTypesPartial && count($collFeatureFeatureTypes)) {
| php | {
"resource": ""
} |
q10193 | FeatureType.countFeatureFeatureTypes | train | public function countFeatureFeatureTypes(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collFeatureFeatureTypesPartial && !$this->isNew();
if (null === $this->collFeatureFeatureTypes || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collFeatureFeatureTypes) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getFeatureFeatureTypes());
| php | {
"resource": ""
} |
q10194 | FeatureType.addFeatureFeatureType | train | public function addFeatureFeatureType(ChildFeatureFeatureType $l)
{
if ($this->collFeatureFeatureTypes === null) {
$this->initFeatureFeatureTypes();
$this->collFeatureFeatureTypesPartial = true;
}
| php | {
"resource": ""
} |
q10195 | FeatureType.getFeatureFeatureTypesJoinFeature | train | public function getFeatureFeatureTypesJoinFeature($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildFeatureFeatureTypeQuery::create(null, $criteria);
| php | {
"resource": ""
} |
q10196 | FeatureType.initFeatureTypeI18ns | train | public function initFeatureTypeI18ns($overrideExisting = true)
{
if (null !== $this->collFeatureTypeI18ns && !$overrideExisting) {
| php | {
"resource": ""
} |
q10197 | FeatureType.getFeatureTypeI18ns | train | public function getFeatureTypeI18ns($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collFeatureTypeI18nsPartial && !$this->isNew();
if (null === $this->collFeatureTypeI18ns || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collFeatureTypeI18ns) {
// return empty collection
$this->initFeatureTypeI18ns();
} else {
$collFeatureTypeI18ns = ChildFeatureTypeI18nQuery::create(null, $criteria)
->filterByFeatureType($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collFeatureTypeI18nsPartial && count($collFeatureTypeI18ns)) {
| php | {
"resource": ""
} |
q10198 | FeatureType.countFeatureTypeI18ns | train | public function countFeatureTypeI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collFeatureTypeI18nsPartial && !$this->isNew();
if (null === $this->collFeatureTypeI18ns || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collFeatureTypeI18ns) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getFeatureTypeI18ns());
| php | {
"resource": ""
} |
q10199 | FeatureType.addFeatureTypeI18n | train | public function addFeatureTypeI18n(ChildFeatureTypeI18n $l)
{
if ($l && $locale = $l->getLocale()) {
$this->setLocale($locale);
$this->currentTranslations[$locale] = $l;
}
if ($this->collFeatureTypeI18ns === null) {
$this->initFeatureTypeI18ns();
$this->collFeatureTypeI18nsPartial = true;
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.