_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q262300
RollingCurl.request
test
public function request($url, $method = "GET", $postData = null, $headers = null, $options = null) { $newRequest = new Request($url, $method); if ($postData) { $newRequest->setPostData($postData); } if ($headers) { $newRequest->setHeaders($headers); } ...
php
{ "resource": "" }
q262301
RollingCurl.post
test
public function post($url, $postData = null, $headers = null, $options = null) { return $this->request($url, "POST", $postData, $headers, $options); }
php
{ "resource": "" }
q262302
RollingCurl.put
test
public function put($url, $putData = null, $headers = null, $options = null) { return $this->request($url, "PUT", $putData, $headers, $options); }
php
{ "resource": "" }
q262303
RollingCurl.delete
test
public function delete($url, $headers = null, $options = null) { return $this->request($url, "DELETE", null, $headers, $options); }
php
{ "resource": "" }
q262304
RollingCurl.execute
test
public function execute() { $master = curl_multi_init(); // start the first batch of requests $firstBatch = $this->getNextPendingRequests($this->getSimultaneousLimit()); // what a silly "error" if (count($firstBatch) == 0) { return; } foreach (...
php
{ "resource": "" }
q262305
RollingCurl.addOptions
test
public function addOptions($options) { if (!is_array($options)) { throw new \InvalidArgumentException("options must be an array"); } $this->options = $options + $this->options; return $this; }
php
{ "resource": "" }
q262306
Cluster.onRequestExecute
test
public function onRequestExecute(RequestEvent $event) { $request = $event->getRequest(); //Make sure we have some nodes to choose from if (count($this->nodes) === 0) { throw new RuntimeException("No nodes in cluster, request failed"); } //Choose a random node ...
php
{ "resource": "" }
q262307
Cluster.autodetect_parseNodes
test
private function autodetect_parseNodes() { foreach ($this->nodes as $node) { try { $client = new Client('http://' . $node['host'] . ':' . $node['port']); $request = $client->get('/_nodes/http'); $response = $request->send()->json(); ...
php
{ "resource": "" }
q262308
IndexDocumentRequest.document
test
public function document($value, $id = null, $update = false) { if (!$this->batch instanceof BatchCommand) { throw new exceptions\RuntimeException("Cannot add a new document to an external BatchCommandInterface"); } $this->finalizeCurrentCommand(); if (is_a...
php
{ "resource": "" }
q262309
IndexDocumentRequest.execute
test
public function execute() { /* foreach (array('index', 'type') as $key) { if (!isset($this->params[$key])) { throw new exceptions\RuntimeException($key." cannot be empty."); } } foreach (array('index', 'type') as $key) { ...
php
{ "resource": "" }
q262310
IndexDocumentRequest.finalizeCurrentCommand
test
private function finalizeCurrentCommand() { if ($this->batch instanceof BatchCommand && $this->currentCommand !== null) { if (isset($this->params['update']) && $this->params['update'] === true) { $this->currentCommand->action('post')->suffix('_update'); if ($t...
php
{ "resource": "" }
q262311
IndexDocumentRequest.currentCommandCheck
test
private function currentCommandCheck() { $this->params['update'] = true; if ($this->currentCommand === null) { $this->currentCommand = new Command(); } }
php
{ "resource": "" }
q262312
GalleryBehavior.getGallery
test
public function getGallery(Model $Model, $object_id = null) { $Album = new Album(); if (!$object_id) { $object_id = $Model->id; } return $Album->getAttachedAlbum($Model->alias, $object_id); }
php
{ "resource": "" }
q262313
Album.init
test
public function init($model = null, $model_id = null) { # If there is a Model and ModelID on parameters, get or create a folder for it if ($model && $model_id) { # Searching for folder that belongs to this particular $model and $model_id if (!$album = $this->getAttachedAlbum(...
php
{ "resource": "" }
q262314
Album.createInitAlbum
test
private function createInitAlbum($model = null, $model_id = null) { $this->save( array( 'Album' => array( 'model' => $model, 'model_id' => $model_id, 'status' => 'draft', 'tags' => '', ...
php
{ "resource": "" }
q262315
Album.generateAlbumName
test
private function generateAlbumName($model = null, $model_id = null) { $name = 'Album - ' . rand(111, 999); if ($model && $model_id) { $name = Inflector::humanize('Album ' . $model . ' - ' . $model_id); } return $name; }
php
{ "resource": "" }
q262316
AlbumsController.upload
test
public function upload($model = null, $model_id = null) { ini_set("memory_limit", "10000M"); if (isset($this->params['gallery_id']) && !empty($this->params['gallery_id'])) { $album = $this->Album->findById($this->params['gallery_id']); } else { # If the gallery doesn...
php
{ "resource": "" }
q262317
Picture.afterDelete
test
public function afterDelete() { if( $this->pictureToDelete ) { $this->deleteVersions($this->pictureToDelete); $this->pictureToDelete = null; } }
php
{ "resource": "" }
q262318
Picture.getResizeToSize
test
public function getResizeToSize() { $width = $height = 0; if (Configure::check('GalleryOptions.Pictures.resize_to.0')) { $width = Configure::read('GalleryOptions.Pictures.resize_to.0'); } if (Configure::check('GalleryOptions.Pictures.resize_to.1')) { $height...
php
{ "resource": "" }
q262319
Picture.addImageStyles
test
public function addImageStyles($path) { # Styles configured in bootstrap.php $sizes = Configure::read('GalleryOptions.Pictures.styles'); $links = array(); if (count($sizes)) { $root_url = WWW_ROOT; $relative_url = Router::url('/'); # Current fil...
php
{ "resource": "" }
q262320
Picture.deleteVersions
test
public function deleteVersions($id) { # Remove all versions of the picture $pictures = $this->find( 'all', array( 'conditions' => array( 'Picture.main_id' => $id ) ) ); if (count($pictures)) { ...
php
{ "resource": "" }
q262321
Picture.savePicture
test
public function savePicture($album_id, $filename, $path, $main_id = null, $style = 'full') { $this->create(); # Save the record in database $picture = array( 'Picture' => array( 'album_id' => $album_id, 'name' => $filename, 'path' ...
php
{ "resource": "" }
q262322
Picture.createExtraImages
test
public function createExtraImages($styles, $filename, $tmp_name, $album_id, $main_id, $image_name) { $ext = pathinfo($filename, PATHINFO_EXTENSION); if (count($styles)) { foreach ($styles as $style_name => $style) { $width = $style[0]; $height = $style[1]...
php
{ "resource": "" }
q262323
Zebra_Image.Zebra_Image
test
function Zebra_Image() { // set default values for properties $this->chmod_value = 0755; $this->error = 0; $this->jpeg_quality = 85; $this->png_compression = 9; $this->preserve_aspect_ratio = $this->preserve_time = $this->enlarge_smaller_images = true; $...
php
{ "resource": "" }
q262324
Zebra_Image._prepare_image
test
function _prepare_image($width, $height, $background_color = '#FFFFFF') { // create a blank image $identifier = imagecreatetruecolor((int)$width <= 0 ? 1 : (int)$width, (int)$height <= 0 ? 1 : (int)$height); // if we are creating a PNG image if ($this->target_type == 'png' && $back...
php
{ "resource": "" }
q262325
InstallController.configure
test
public function configure() { $files_path = WWW_ROOT . 'files' . DS; if (!file_exists($files_path)) { mkdir($files_path, 0755); } $galleries_path = $files_path . 'gallery' . DS; if (!file_exists($galleries_path)) { mkdir($galleries_path, 0755); ...
php
{ "resource": "" }
q262326
InstallController._configureDatabase
test
private function _configureDatabase() { try { $db = ConnectionManager::getDataSource('default'); if (!$db->isConnected()) { throw new Exception("You need to connect to a MySQL Database to use this Plugin."); } /** Verify if the tables already...
php
{ "resource": "" }
q262327
InstallController._createConfigFile
test
private function _createConfigFile() { $destinationPath = App::pluginPath('Gallery') . 'config' . DS . 'config.php'; if (!file_exists($destinationPath)) { $configFile = new File(App::pluginPath('Gallery') . 'config' . DS . 'config.php.install'); $configFile->copy($destinati...
php
{ "resource": "" }
q262328
Generate_Docs.checkSummaries
test
public function checkSummaries() { $need_summaries = array(); foreach ( $this->service['operations'] as $method => $info ) { if ( ! isset( $info['summary'] ) ) { $need_summaries[] = $method; } } if ( ! empty( $need_summaries ) ) { echo PHP_EOL; echo 'Please set summaries for all operations to...
php
{ "resource": "" }
q262329
Generate_Docs.generate
test
public function generate() { ob_start(); foreach ( $this->service['operations'] as $method => $info ) { // Add method to info array for more convenient templates $info['method'] = $method; // Heading echo $this->template( $this->tmpl_heading, $info ); // Code Block start echo $this->template(...
php
{ "resource": "" }
q262330
GalleryHelper.link
test
public function link($model = null, $model_id = null, $html_options = array()) { return $this->_View->Html->link( __('Upload pictures'), array( 'controller' => 'albums', 'action' => 'upload', 'plugin' => 'gallery', $mode...
php
{ "resource": "" }
q262331
GalleryHelper.showroom
test
public function showroom( $model = null, $model_id = null, $album_id = null, $style = 'medium', $html_options = array('jquery' => true, 'swipebox' => true)) { $album = $this->getAlbum($model, $model_id, $album_id); if (!empty($album)) { # Load sc...
php
{ "resource": "" }
q262332
GalleryHelper.showroomTmpl
test
public function showroomTmpl($album, $style = 'medium') { if (empty($album['Picture'])) { $this->_noPhotosMessageTmpl(); } else { foreach ($album['Picture'] as $picture) { $this->_thumbnailTmpl($picture, $style); } } }
php
{ "resource": "" }
q262333
GalleryHelper._loadScripts
test
private function _loadScripts($scripts = array('jquery' => true, 'swipebox' => true)) { if (!isset($scripts['jquery']) || (isset($scripts['jquery']) && $scripts['jquery'] == true)) { echo $this->_View->Html->script( 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.j...
php
{ "resource": "" }
q262334
PicturesController.delete
test
public function delete($id) { # Delete the picture and all its versions $this->Picture->delete($id); $this->render(false, false); }
php
{ "resource": "" }
q262335
PicturesController.sort
test
public function sort() { if ($this->request->is('post')) { $order = explode(",", $_POST['order']); $i = 1; foreach ($order as $photo) { $this->Picture->read(null, $photo); $this->Picture->set('order', $i); $this->Picture->sa...
php
{ "resource": "" }
q262336
YouTube.listChannelSections
test
public function listChannelSections($parameters) { $this->apiUri = $this->baseUri . '/channelSections'; $this->filters = [ 'channelId', 'id', ]; if (empty($parameters) || !isset($parameters['part'])) { throw new \InvalidArgumentException( ...
php
{ "resource": "" }
q262337
Worker.start
test
public function start() { if (!$this->simulation) { $sockets = []; socket_create_pair(AF_UNIX, SOCK_STREAM, 0, $sockets); $pid = getmypid(); $this->pid = $this->forkThread([$this, 'onWorkerStart'], [$sockets[1], $pid]); $this->toChild = $sockets[0]; socket_set_nonblock($this->toChild); } ...
php
{ "resource": "" }
q262338
Worker.stop
test
public function stop($wait = false) { if ($this->simulation) { $this->state = self::TERMINATED; return true; } if (!is_dir('/proc/'.$this->pid)) return null; $this->state = self::TERMINATING; if (!posix_kill($this->pid, SIGTERM)) return false; ...
php
{ "resource": "" }
q262339
Worker.kill
test
public function kill($wait = false) { if ($this->simulation) { $this->state = self::TERMINATED; return true; } if (!is_dir('/proc/'.$this->pid)) return null; $this->state = self::TERMINATING; if (!posix_kill($this->pid, SIGKILL)) return false; if...
php
{ "resource": "" }
q262340
Worker.sendPayload
test
public function sendPayload($data) { // if not forked yet if (!$this->simulation && $this->pid === null) { $this->start(); } $this->remainingPayloadsCounter++; $this->state = self::RUNNING; if ($this->simulation) { $result = $this->sentPayloadsCounter++; $this->simulation...
php
{ "resource": "" }
q262341
Worker.onWorkerStart
test
protected function onWorkerStart($socket, $parentPid) { declare(ticks = 1); // set signal handler pcntl_signal(SIGTERM, [$this, 'onSigTerm']); $this->toParent = $socket; $this->parentPid = $parentPid; socket_set_nonblock($this->toParent); $i = 0; whil...
php
{ "resource": "" }
q262342
ForkingThread.forkThread
test
public function forkThread($callback, array $params = []) { $res = pcntl_fork(); if ($res < 0) throw new Exception('Can\'t fork'); if ($res === 0) { call_user_func_array($callback, $params); exit; } else { return $res; } }
php
{ "resource": "" }
q262343
SamlUtils.getAuthnRequest
test
public function getAuthnRequest( $consumer_service_url, $idp_destination, $issuer, $saml_crt, $saml_key ) { $authn_request = new AuthnRequest(); $authn_request ->setAssertionConsumerServiceURL($consumer_service_url) ->setProtocolBinding...
php
{ "resource": "" }
q262344
SamlUtils.parseSamlResponse
test
public function parseSamlResponse(array $payload) { $deserialization_context = new DeserializationContext(); $deserialization_context->getDocument()->loadXML(base64_decode($payload['SAMLResponse'])); $saml_response = new Response(); $saml_response->deserialize($deserialization_conte...
php
{ "resource": "" }
q262345
Manager.getBinaries
test
public function getBinaries(callable $predicate = null) { $binaries = $this->binaries; if ($predicate !== null) { return array_filter($binaries, $predicate); } return $binaries; }
php
{ "resource": "" }
q262346
Manager.getPendingBinaries
test
public function getPendingBinaries() { return $this->getBinaries(function (BinaryInterface $binary) { $exists = $binary->exists($this->getInstallPath()); $supported = $binary->isSupported(); return $supported && !$exists; }); }
php
{ "resource": "" }
q262347
Manager.update
test
public function update($binaryName = '') { if ($binaryName) { $this->updateSingle($binaryName); return; } foreach ($this->binaries as $binary) { $binary->fetchAndSave($this->getInstallPath()); } }
php
{ "resource": "" }
q262348
Manager.updateSingle
test
public function updateSingle($binaryName) { if (! array_key_exists($binaryName, $this->binaries)) { throw new RuntimeException("Binary named $binaryName does not exist"); } $binary = $this->binaries[$binaryName]; $binary->fetchAndSave($this->getInstallPath()); }
php
{ "resource": "" }
q262349
Manager.start
test
public function start($background = false, $port = 4444, array $args = []) { $selenium = $this->binaries['selenium']; $this->assertStartConditions($selenium); $process = $this->getSeleniumProcess(); $this->registerBinaries($process, $selenium); if ($port != 4444) { ...
php
{ "resource": "" }
q262350
Manager.clean
test
public function clean() { $files = glob($this->getInstallPath() . '/*'); foreach ($files as $file) { unlink($file); } }
php
{ "resource": "" }
q262351
Manager.assertStartConditions
test
protected function assertStartConditions(SeleniumStandalone $selenium) { if (!$selenium->exists($this->getInstallPath())) { throw new RuntimeException("Selenium Standalone binary not installed"); } if (!$this->getSeleniumProcess()->isAvailable()) { throw new RuntimeE...
php
{ "resource": "" }
q262352
Manager.registerBinaries
test
protected function registerBinaries(SeleniumProcessInterface $process, SeleniumStandalone $selenium) { $drivers = $this->getDrivers(); foreach ($drivers as $driver) { $process->addBinary($driver, $this->getInstallPath()); } $process->addBinary($selenium, $this->getInstall...
php
{ "resource": "" }
q262353
BinaryHelper.createBinary
test
public function createBinary($name, $supported, $exists) { $binary = $this->prophet->prophesize('Peridot\WebDriverManager\Binary\BinaryInterface'); $binary->isSupported()->willReturn($supported); $binary->getName()->willReturn($name); $binary->exists(Argument::any())->willReturn($exi...
php
{ "resource": "" }
q262354
LoginPolicy.getValidExternalUrlValue
test
private function getValidExternalUrlValue($url) { if ($url === null || (is_string($url) && filter_var($url, FILTER_VALIDATE_URL))) { return $url; } throw new InvalidArgumentException('URL is not valid'); }
php
{ "resource": "" }
q262355
ChromeDriver.getLinuxFileName
test
public function getLinuxFileName() { $file = "linux32"; $system = $this->resolver->getSystem(); if ($system->is64Bit()) { $file = 'linux64'; } return $file; }
php
{ "resource": "" }
q262356
CompressedBinary.save
test
public function save($directory) { if (empty($this->contents)) { return false; } if ($this->exists($directory)) { return true; } $compressedPath = $directory . DIRECTORY_SEPARATOR . $this->getOutputFileName(); $this->removeOldVersions($direct...
php
{ "resource": "" }
q262357
StandardBinaryRequest.onNotification
test
public function onNotification($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) { switch($notification_code) { case STREAM_NOTIFY_PROGRESS: $this->emit('progress', [$bytes_transferred]); break; case STREAM_NOTIFY_...
php
{ "resource": "" }
q262358
UpdateCommand.watchProgress
test
protected function watchProgress(OutputInterface $output) { $progress = new ProgressBar($output); $progress->setFormat('%bar% (%percent%%)'); $this->manager->on('request.start', function ($url, $bytes) use ($progress, $output) { $output->writeln('<comment>Downloading ' . basename...
php
{ "resource": "" }
q262359
UpdateCommand.getPreMessage
test
protected function getPreMessage($name) { $binaries = $this->manager->getBinaries(); $message = 'Ensuring binaries are up to date'; $isSingleUpdate = $name && array_key_exists($name, $binaries); if (! $isSingleUpdate) { return $message; } $binary = $bina...
php
{ "resource": "" }
q262360
UpdateCommand.getPostMessage
test
protected function getPostMessage(array $pending, $name) { if ($name) { $pending = array_filter($pending, function (BinaryInterface $binary) use ($name) { return $binary->getName() === $name; }); } $count = array_reduce($pending, function ($r, BinaryI...
php
{ "resource": "" }
q262361
Workflow.addPipe
test
protected function addPipe(AbstractPipe $pipe) { if ($pipe->getPosition() === self::PREPEND) { array_unshift($this->pipeline, $pipe); } else { $this->pipeline[] = $pipe; } return $this; }
php
{ "resource": "" }
q262362
Workflow.convertItem
test
protected function convertItem($item, ConverterPipe $pipe) { $filterValue = $pipe->getFilterField() ? Vale::get($item, $pipe->getFilterField()) : $item; if ($pipe->getFilter() === null || $pipe->getFilter()->filter($filterValue) === true) { return $pipe->getConverter()->convert($item); ...
php
{ "resource": "" }
q262363
Workflow.convertItemValue
test
protected function convertItemValue($item, ConverterPipe $pipe) { $value = Vale::get($item, $pipe->getField()); $filterValue = $pipe->getFilterField() ? Vale::get($item, $pipe->getFilterField()) : $item; if ($pipe->getFilter() === null || $pipe->getFilter()->filter($filterValue) === t...
php
{ "resource": "" }
q262364
Workflow.writeItem
test
protected function writeItem($item, WriterPipe $pipe) { if ($pipe->getFilter() === null || $pipe->getFilter()->filter($item) === true) { $pipe->getWriter()->writeItem($item); return true; } return false; }
php
{ "resource": "" }
q262365
ApplyAuthenticationMiddleware.getTransportFrom
test
protected function getTransportFrom(ServerRequestInterface $request) { if ($this->value_container instanceof RequestValueContainerInterface) { $this->value_container->setRequest($request); } if ($this->value_container->hasValue()) { return $this->value_container->get...
php
{ "resource": "" }
q262366
PasswordStrengthValidator.validate
test
public function validate($password, PasswordPolicyInterface $policy) { if (!is_string($password)) { throw new InvalidPasswordException('Password is not a string'); } $password = trim($password); if (empty($password)) { throw new InvalidPasswordException('Pas...
php
{ "resource": "" }
q262367
TaxonomyAttribute.getTaxonomy
test
public function getTaxonomy(EntityContract $entity) { return $this->getRelationManager($entity)->findOrCreateOrFail(['name' => $this->getTaxonomyName()])->getResource(); }
php
{ "resource": "" }
q262368
TaxonomyAttribute.valid
test
public function valid(EntityContract $entity, $value) { if (!parent::valid($entity, $value)) { return false; } return ($this->getTaxonomyName() !== null && $value->parent_id === $this->getTaxonomy($entity)->id) || $this->getTaxonomyName() === null; }
php
{ "resource": "" }
q262369
TaxonomyAttribute.getDescriptor
test
public function getDescriptor() { return [ 'constraint' => [ 'parent_id' => $this->getTaxonomyName() ? $this->getTaxonomy($this->getManager()->newEntity())->id : null, ], ]; }
php
{ "resource": "" }
q262370
Util.getEnv
test
public static function getEnv(string $key, $valueDefault = null) { // uppers for nginx $value = $_ENV[$key] ?? $_ENV[strtoupper($key)] ?? $_SERVER[$key] ?? $_SERVER[strtoupper($key)] ?? $valueDefault; if ($value === null) { if (false === ($value = getenv($key)))...
php
{ "resource": "" }
q262371
Util.getClientIp
test
public static function getClientIp(): ?string { $ip = null; if (null != ($ip = self::getEnv('HTTP_X_FORWARDED_FOR'))) { if (false !== strpos($ip, ',')) { $ip = trim((string) end(explode(',', $ip))); } } // all ok elseif (null != ($ip = ...
php
{ "resource": "" }
q262372
Util.getCurrentUrl
test
public static function getCurrentUrl(bool $withQuery = true): string { static $filter, $scheme, $host, $port; if ($filter == null) { $filter = function($input) { // decode first @important $input = rawurldecode($input); // encode quotes an...
php
{ "resource": "" }
q262373
Util.unparseQueryString
test
public static function unparseQueryString(array $input, bool $decode = false, string $ignoredKeys = null, bool $stripTags = true, bool $normalizeArrays = true): string { if ($ignoredKeys != '') { $ignoredKeys = explode(',', $ignoredKeys); foreach ($input as $key => $_) { ...
php
{ "resource": "" }
q262374
PropertyIssetTrait.__isset
test
public final function __isset(string $name) { if (!property_exists($this, $name)) { throw new PropertyTraitException(sprintf('Property %s::$%s does not exist', static::class, $name)); } return ($this->{$name} !== null); }
php
{ "resource": "" }
q262375
GeoCode.lookup
test
public function lookup($sAddress = '') { $sAddress = trim($sAddress); if (empty($sAddress)){ return null; } // Check caches; local cache first followed by DB cache $oCache = $this->getCache($sAddress); if (!empty($oCache)) { return $oCache;...
php
{ "resource": "" }
q262376
ExtendedJsonConfig.doInclusions
test
protected function doInclusions(&$value, $key, string $baseDirectory) { if (!is_string($value)) { return; } $matches = []; if (preg_match(sprintf('/^\s*%1$s(?<action>include|extends)\:(?<var>[\w\-\.\,\s]+)%1$s\s*$/i', preg_quote(self::TAG)), $value, $matches) != 1) { ...
php
{ "resource": "" }
q262377
ExtendedJsonConfig.doActions
test
public function doActions(&$value) { if (!is_string($value)) { return; } $matches = []; if (preg_match(sprintf('/^\s*%1$s(?<action>[\w\-\.]+)\:(?<var>[\w\-\.\,\s]+)%1$s\s*$/i', preg_quote(self::TAG)), $value, $matches) != 1) { return; } try {...
php
{ "resource": "" }
q262378
FormShiftItemHandler.down
test
private static function down(array $array, int $item): array { if (\count($array) - 1 > $item) { $b = \array_slice($array, 0, $item, true); $b[] = $array[$item + 1]; $b[] = $array[$item]; $b += \array_slice($array, $item + 2, \count($array), true); ...
php
{ "resource": "" }
q262379
FormShiftItemHandler.up
test
private static function up(array $array, int $item): array { if ($item > 0 && $item < \count($array)) { $b = \array_slice($array, 0, $item - 1, true); $b[] = $array[$item]; $b[] = $array[$item - 1]; $b += \array_slice($array, $item + 1, \count($array), true); ...
php
{ "resource": "" }
q262380
FormService.updateFormRead
test
public function updateFormRead(string $formUuid): void { /** * @var Form $aggregate */ $aggregate = $this->aggregateFactory->build($formUuid, Form::class); // Build FormRead entity from Aggregate. $formRead = $this->entityManager->getRepository(FormRead::class)->fi...
php
{ "resource": "" }
q262381
FormService.getField
test
private function getField(array $payload, array $data, string $propertyName) { $isField = false; $payload = json_decode(json_encode($payload), true); if ($payload['items'] && \is_array($payload['items']) && \count($payload['items']) > 0) { foreach ($payload['items'] as $item) { ...
php
{ "resource": "" }
q262382
FormBaseHandler.getMatching
test
private static function getMatching(array &$item, string $itemUuid, callable $callable = null, array &$collection) { // Return true if this item is the one we are looking for. if (isset($item['uuid']) && $item['uuid'] === $itemUuid) { if ($callable) { $callable($item, $co...
php
{ "resource": "" }
q262383
FormBaseHandler.onItem
test
public static function onItem(Form $aggregate, string $itemUuid, callable $callable): void { foreach ($aggregate->items as &$item) { if ($c = self::getMatching($item, $itemUuid, $callable, $aggregate->items)) { return; } } }
php
{ "resource": "" }
q262384
FormBaseHandler.getItem
test
public static function getItem(Form $aggregate, string $itemUuid) { foreach ($aggregate->items as &$item) { if ($c = self::getMatching($item, $itemUuid, null, $aggregate->items)) { return $c; } } return null; }
php
{ "resource": "" }
q262385
AbstractConfig.replaceVariables
test
protected function replaceVariables(&$value) { if (!is_string($value)) { return; } // Variables $matches = []; if (preg_match_all(sprintf('/%1$s(?<var>[\w\-\.\,\s]+)%1$s/i', preg_quote(self::TAG)), $value, $matches, PREG_SET_ORDER) == 0) { return; ...
php
{ "resource": "" }
q262386
JsonConfig.loadJson
test
protected function loadJson(string $json): array { $json = preg_replace('#^\s*//.*$\v?#mx', '', $json); $configuration = json_decode($json, true); if (!is_array($configuration)) { throw new ConfigException('Not a valid JSON data'); } return $configuration; }
php
{ "resource": "" }
q262387
JsonConfig.loadUrl
test
protected function loadUrl(string $jsonFile): array { //Get real path of file if (($fileName = realpath($jsonFile)) === false) { throw new NotFoundException(sprintf('File "%s" not found', $jsonFile)); } // Read file if (($json = @file_get_contents($fileName)) ===...
php
{ "resource": "" }
q262388
LatLng.setLatLng
test
public function setLatLng($sLat, $sLng) { $this->setLat($sLat); $this->setLng($sLng); return $this; }
php
{ "resource": "" }
q262389
LatLng.getLatLng
test
public function getLatLng() { $oLatLng = new \stdClass(); $oLatLng->lat = $this->sLat; $oLatLng->lng = $this->sLng; return $oLatLng; }
php
{ "resource": "" }
q262390
FormController.errorResponse
test
public function errorResponse(string $formUuid = null) { $messages = $this->messageBus->getMessagesJson(); if ($formUuid) { foreach ($messages as $message) { $this->addFlash( 'warning', $message['message'] ); ...
php
{ "resource": "" }
q262391
FormController.redirectToForm
test
private function redirectToForm(string $formUuid): Response { /** @var FormRead|null $formRead */ $formRead = $this->entityManager->getRepository(FormRead::class)->findOneBy([ 'uuid' => $formUuid, ]); if ($formRead) { return $this->redirectToRoute('forms_edit...
php
{ "resource": "" }
q262392
FormController.createFormAggregate
test
public function createFormAggregate(Request $request) { /** @var \Symfony\Component\Security\Core\User\UserInterface $user */ $user = $this->getUser(); $form = $this->createForm(FormType::class); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) ...
php
{ "resource": "" }
q262393
FormController.formRemoveItem
test
public function formRemoveItem(string $formUuid, int $onVersion, string $itemUuid) { /** @var \Symfony\Component\Security\Core\User\UserInterface $user */ $user = $this->getUser(); $success = false; $this->commandBus->dispatch(new FormRemoveItemCommand($user->getId(), Uuid::uuid1()-...
php
{ "resource": "" }
q262394
PluginInstaller.checkAutoloadDump
test
public static function checkAutoloadDump(\Composer\Composer $composer) { if (static::$useAutoloadDump === null) { static::$useAutoloadDump = false; $rootPackage = static::getRootPackage($composer); if (!$rootPackage || ($rootPackage->getType() !== 'project')) { ...
php
{ "resource": "" }
q262395
PluginInstaller.getPluginClassNames
test
public static function getPluginClassNames( \Composer\Package\PackageInterface $package, \Composer\Package\PackageInterface $rootPackage = null ) { $packageType = $package->getType(); $packagePrettyName = $package->getPrettyName(); $packageName = $package->getName(); ...
php
{ "resource": "" }
q262396
PluginInstaller.getInstallName
test
public static function getInstallName( \Composer\Package\PackageInterface $package, \Composer\Package\PackageInterface $rootPackage = null ) { $packagePrettyName = $package->getPrettyName(); $packageName = $package->getName(); $installName = null; $rootPackageExtra =...
php
{ "resource": "" }
q262397
PluginInstaller.guessInstallName
test
protected static function guessInstallName($packageName) { $name = $packageName; if (strpos($packageName, '/') !== false) { list(, $name) = explode('/', $packageName); } $name = preg_replace('/[\.\-_]+(?>plugin|theme)$/u', '', $name); $name = preg_replace_callbac...
php
{ "resource": "" }
q262398
PluginInstaller.mapRootExtra
test
protected static function mapRootExtra(array $packageExtra, $packagePrettyName) { if (isset($packageExtra[$packagePrettyName])) { return $packageExtra[$packagePrettyName]; } if (strpos($packagePrettyName, '/') !== false) { list($vendor, $name) = explode('/', $package...
php
{ "resource": "" }
q262399
PluginInstaller.writePluginConfig
test
public static function writePluginConfig($pluginConfig, array $plugins, array $pluginClassNames) { $data = array(); foreach ($plugins as $pluginName => $installerName) { // see https://github.com/composer/composer/blob/1.0.0/src/Composer/Command/InitCommand.php#L206-L210 if (...
php
{ "resource": "" }