_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q30600 | File.getFileTypeByExtension | train | protected static function getFileTypeByExtension(string $extension): int
{
switch ($extension) {
case 'png':
case 'jpg':
return FileInterface::TYPE_STATIC_IMAGE;
case 'gif':
return FileInterface::TYPE_ANIMATED_IMAGE;
case 'web... | php | {
"resource": ""
} |
q30601 | MelisWebPackService.getAssets | train | public function getAssets()
{
$assets = [];
$resources = $this->config()->getItem('meliscore/ressources');
$useBuildAssets = (bool) $resources['build']['use_build_assets'];
$cssBuild = $resources['build']['css'];
$jsBuild = $resources['build']['js'];
$webpack... | php | {
"resource": ""
} |
q30602 | MelisWebPackService.getWebPackMixFile | train | protected function getWebPackMixFile()
{
$webPackPath = $_SERVER['DOCUMENT_ROOT'];
$file = self::WEBPACK_FILE;
$webpack = $webPackPath . DIRECTORY_SEPARATOR . $file;
return $webpack;
} | php | {
"resource": ""
} |
q30603 | MelisWebPackService.getWebPackMixStaticFile | train | public function getWebPackMixStaticFile()
{
$webPackPath = $_SERVER['DOCUMENT_ROOT'];
$file = self::WEBPACK_STATIC_FILE;
$webpack = $webPackPath . DIRECTORY_SEPARATOR . $file;
return $webpack;
} | php | {
"resource": ""
} |
q30604 | MelisWebPackService.getMergedAssets | train | public function getMergedAssets($useBundle = false)
{
$plugin = new MelisHeadPluginHelper($this->getServiceLocator());
$assets = $plugin->__invoke('/', $useBundle);
return $assets;
} | php | {
"resource": ""
} |
q30605 | MelisWebPackService.getCached | train | private function getCached()
{
$syntax = "// Cached assets do not modify\r\nlet cache = [" . PHP_EOL;
foreach ($this->getCachedFiles() as $file) {
$syntax .= "'$file'," . PHP_EOL;
}
$syntax .= "];";
return $syntax;
} | php | {
"resource": ""
} |
q30606 | FormHelper.loadRelation | train | public static function loadRelation(ActiveRecord $model, $relationName, $data, $requiredData = [])
{
$relationClass = $model->getRelation($relationName)->modelClass;
return static::loadMultiple(
@$data[(new $relationClass())->formName()],
$relationClass,
$model->$... | php | {
"resource": ""
} |
q30607 | FormHelper.loadMultiple | train | public static function loadMultiple($data, $modelClass, $models = [], $requiredData = [])
{
$result = ['models' => $models, 'errors' => []];
if (!$data) {
return $result;
}
if (!is_array($models)) {
$data = [@$models->id => $data];
$models = [@$mo... | php | {
"resource": ""
} |
q30608 | FormHelper.setUploadedFile | train | public static function setUploadedFile(Model $model, $attribute, $options = [])
{
foreach ($options as $name => $value) {
$_FILES[$model->formName()][$name][$attribute] = $value;
}
} | php | {
"resource": ""
} |
q30609 | FileLock.obtainLock | train | public function obtainLock()
{
$tries = 0;
$waitClosure = $this->getWaitClosure();
do {
if ($this->doLock()->isLocked()) {
return $this;
}
++$tries;
$waitClosure();
} while ($tries < $this->lockTry);
retu... | php | {
"resource": ""
} |
q30610 | GameController.notFoundAction | train | public function notFoundAction()
{
$templatePathResolver = $this->getServiceLocator()->get('Zend\View\Resolver\TemplatePathStack');
// I create a template path in which I can find a custom template
$controller = explode('\\', get_class($this));
$controllerPath = str_replace('Con... | php | {
"resource": ""
} |
q30611 | GameController.bounceAction | train | public function bounceAction()
{
$availableGames = $this->getGameService()->getAvailableGames($this->user);
$rssUrl = '';
$config = $this->getGameService()->getServiceManager()->get('config');
if (isset($config['rss']['url'])) {
$rssUrl = $config['rss']['url'];
}... | php | {
"resource": ""
} |
q30612 | GameController.prizesAction | train | public function prizesAction()
{
if (count($this->game->getPrizes()) == 0) {
return $this->notFoundAction();
}
$viewModel = $this->buildView($this->game);
return $viewModel;
} | php | {
"resource": ""
} |
q30613 | GameController.prizeAction | train | public function prizeAction()
{
$prizeIdentifier = $this->getEvent()->getRouteMatch()->getParam('prize');
$prize = $this->getPrizeService()->getPrizeMapper()->findByIdentifier($prizeIdentifier);
if (!$prize) {
return $this->notFoundAction();
}
$viewMod... | php | {
"resource": ""
} |
q30614 | GameController.buildView | train | public function buildView($game)
{
if ($this->getRequest()->isXmlHttpRequest()) {
$viewModel = new JsonModel();
if ($game) {
$view = $this->addAdditionalView($game);
if ($view && $view instanceof \Zend\View\Model\ViewModel) {
$viewM... | php | {
"resource": ""
} |
q30615 | ResourceInformation.canHandle | train | public function canHandle($payload)
{
if (is_object($payload) && is_a($payload, $this->payloadClassName)) {
return true;
} elseif (is_string($payload) && is_subclass_of($payload, $this->payloadClassName)) {
return true;
} else {
return false;
}
... | php | {
"resource": ""
} |
q30616 | ResourceInformation.getUriBuilder | train | public function getUriBuilder()
{
$uriBuilder = $this->resourceMapper->getControllerContext()->getUriBuilder();
$uriBuilder->reset()->setFormat($this->format)->setCreateAbsoluteUri(true);
return $uriBuilder;
} | php | {
"resource": ""
} |
q30617 | AbstractCommand.runOtherCommand | train | protected function runOtherCommand($name, array $arguments = array())
{
$arguments['command'] = $name;
$cleanup_command = $this->getApplication()->find($name);
$input = new ArrayInput($arguments);
return $cleanup_command->run($input, $this->io->getOutput());
} | php | {
"resource": ""
} |
q30618 | AbstractCommand.getContainer | train | protected function getContainer()
{
static $container;
if ( !isset($container) ) {
/** @var ContainerHelper $container_helper */
$container_helper = $this->getHelper('container');
$container = $container_helper->getContainer();
}
return $container;
} | php | {
"resource": ""
} |
q30619 | CssParserFilterAttr._isEqualSelector | train | private function _isEqualSelector($node)
{
return $node->hasAttribute($this->_attrName)
&& $node->getAttribute($this->_attrName) == $this->_value;
} | php | {
"resource": ""
} |
q30620 | CssParserFilterAttr._isNotEqualSelector | train | private function _isNotEqualSelector($node)
{
return !$node->hasAttribute($this->_attrName)
|| $node->getAttribute($this->_attrName) != $this->_value;
} | php | {
"resource": ""
} |
q30621 | CssParserFilterAttr._isContainSelector | train | private function _isContainSelector($node)
{
if ($node->hasAttribute($this->_attrName)) {
$attr = $node->getAttribute($this->_attrName);
$len = strlen($this->_value);
if ($len > 0) {
$pos = strpos($attr, $this->_value);
return $pos !== fals... | php | {
"resource": ""
} |
q30622 | CssParserFilterAttr._isContainWordSelector | train | private function _isContainWordSelector($node)
{
if ($node->hasAttribute($this->_attrName)) {
$items = explode(" ", trim($node->getAttribute($this->_attrName)));
foreach ($items as $item) {
if (preg_match("/^\w+$/", $item) && $this->_value == $item) {
... | php | {
"resource": ""
} |
q30623 | CssParserFilterAttr._isContainPrefixSelector | train | private function _isContainPrefixSelector($node)
{
if ($node->hasAttribute($this->_attrName)) {
$attr = $node->getAttribute($this->_attrName);
$len = strlen($this->_value);
if ($len > 0) {
$pos = stripos($attr, $this->_value);
return $pos =... | php | {
"resource": ""
} |
q30624 | CssParserFilterAttr._isStartWithSelector | train | private function _isStartWithSelector($node)
{
if ($node->hasAttribute($this->_attrName) && strlen($this->_value) > 0) {
$attrValue = $node->getAttribute($this->_attrName);
return strpos($attrValue, $this->_value) === 0;
}
return false;
} | php | {
"resource": ""
} |
q30625 | CssParserFilterAttr._isEndWithSelector | train | private function _isEndWithSelector($node)
{
if ($node->hasAttribute($this->_attrName)) {
$len = strlen($this->_value);
if ($len > 0) {
$attr = $node->getAttribute($this->_attrName);
$attrLen = strlen($attr);
return $len <= $attrLen
... | php | {
"resource": ""
} |
q30626 | CssParserFilterAttr._isAttrSelector | train | private function _isAttrSelector($node)
{
$ret = false;
if ($this->_op == CssParserFilterAttr::EQUAL_SELECTOR) {
$ret = $this->_isEqualSelector($node);
} elseif ($this->_op == CssParserFilterAttr::NOT_EQUAL_SELECTOR) {
$ret = $this->_isNotEqualSelector($node);
... | php | {
"resource": ""
} |
q30627 | Summary.schedule | train | public function schedule($postId)
{
if ($postId !== 'options' || !isset($_GET['page']) || $_GET['page'] !== 'acf-options-feedback-options') {
return;
}
wp_unschedule_hook('customer-feedback/email_summary');
wp_clear_scheduled_hook('customer-feedback/email_summary');
... | php | {
"resource": ""
} |
q30628 | Summary.getCachedResult | train | public function getCachedResult($interval)
{
if (!empty(self::$resultCache[$interval])) {
return self::$resultCache[$interval];
}
return false;
} | php | {
"resource": ""
} |
q30629 | Summary.renderReport | train | public function renderReport($from = null, $to = null, $return = false)
{
// Get dates from querystring
if (isset($_GET['date_from']) && !empty($_GET['date_from'])) {
$from = $_GET['date_from'];
}
if (isset($_GET['date_to']) && !empty($_GET['date_to'])) {
$to... | php | {
"resource": ""
} |
q30630 | Summary.getDataBetween | train | public function getDataBetween($from = null, $to = null)
{
$answerPosts = $this->getAnswerPosts($from, $to);
$yesno = array('yes' => 0, 'no' => 0);
$pending = array();
foreach ($answerPosts as $post) {
$topics = wp_get_post_terms($post->ID, 'feedback_topic');
... | php | {
"resource": ""
} |
q30631 | Summary.getAnswerPosts | train | public function getAnswerPosts($from = null, $to = null)
{
$answerPosts = array(
'posts_per_page' => -1,
'post_type' => 'customer-feedback',
'post_status' => array('publish', 'pending', 'draft'),
);
$answerPosts['date_query'] = array(
'inclusi... | php | {
"resource": ""
} |
q30632 | AccessBehavior.beforeSave | train | public function beforeSave()
{
if ($this->owner->hasAttribute($this->attribute) && !$this->owner->{$this->attribute}) {
$this->owner->setAttribute($this->attribute, Yii::$app->user->identity->{$this->attribute});
}
} | php | {
"resource": ""
} |
q30633 | AccessBehavior.search | train | public function search($params)
{
/** @var ActiveRecord $owner */
$owner = $this->owner;
$query = $owner::find();
$t = is_array($query->from) ? key($query->from) : $query->from;
return $query
->filterWhere($params)
->andWhere(["$t.owner_id" => Yii::$ap... | php | {
"resource": ""
} |
q30634 | AccessBehavior.relationList | train | public function relationList($relationName, $index = 'id', $name = null)
{
$model = $this->owner;
/** @var ActiveRecord $class */
$class = $model->getRelation($relationName)->modelClass;
$item = new $class();
/** @var \yii\db\ActiveQuery $relation */
$relation = metho... | php | {
"resource": ""
} |
q30635 | Url.filter | train | public static function filter($value = null, bool $allowNull = false)
{
if (self::valueIsNullAndValid($allowNull, $value)) {
return null;
}
self::validateString($value);
return self::filterUrl($value);
} | php | {
"resource": ""
} |
q30636 | Cookie.name | train | public function name($name = null)
{
if ($name !== null) {
if (preg_match("/[=,; \t\r\n\013\014]/", $name)) {
throw new \InvalidArgumentException(sprintf('Cookie name "%s" contains invalid characters', $name));
}
if (empty($name)) {
throw ... | php | {
"resource": ""
} |
q30637 | Cookie.value | train | public function value($value = null)
{
if ($value !== null) {
$this->value = $value;
}
return (string) $this->value;
} | php | {
"resource": ""
} |
q30638 | Cookie.ttl | train | public function ttl($ttl = null)
{
if ($ttl === null) {
return (int) $this->ttl;
}
if ($ttl instanceof \DateTime) {
return $this->ttl = $ttl->format('U');
}
return $this->ttl = time() + (int) $ttl;
} | php | {
"resource": ""
} |
q30639 | Cookie.path | train | public function path($path = null)
{
if ($path !== null) {
$this->path = $path;
}
return (string) $this->path;
} | php | {
"resource": ""
} |
q30640 | Cookie.secure | train | public function secure($secure = null)
{
if ($secure !== null) {
$this->secure = (bool) $secure;
}
return (bool) $this->secure;
} | php | {
"resource": ""
} |
q30641 | Cookie.httpOnly | train | public function httpOnly($httpOnly = null)
{
if ($httpOnly !== null) {
$this->httpOnly = (bool) $httpOnly;
}
return (bool) $this->httpOnly;
} | php | {
"resource": ""
} |
q30642 | Sequence.push | train | public function push(...$elements): self
{
foreach ($elements as $element) {
$this->validate($element);
$this->elements[] = $element;
}
return $this;
} | php | {
"resource": ""
} |
q30643 | Sequence.unshift | train | public function unshift(...$elements)
{
foreach ($elements as $element) {
$this->validate($element);
}
return \array_unshift($this->elements, ...$elements);
} | php | {
"resource": ""
} |
q30644 | ConfigurationManager.fetchConfiguration | train | protected function fetchConfiguration($parameter)
{
$configuration = $this->configurationRepository->fetchParameter($parameter);
if (null === $configuration) {
$exception = array(
'message' => 'exception_parameter_does_not_exist',
'parameters' => array(
... | php | {
"resource": ""
} |
q30645 | Armada.register | train | public function register(array $aOptions = array())
{
$sentry = jaxon()->sentry();
$sentry->addClassOptions($this->appConfig);
$sentry->mergeClassOptions($aOptions);
$sentry->register();
} | php | {
"resource": ""
} |
q30646 | ClearLogsListener.clearLogs | train | private function clearLogs()
{
foreach ($this->logger->getHandlers() as $handler) {
if ($handler instanceof FingersCrossedHandler) {
$handler->clear();
}
}
} | php | {
"resource": ""
} |
q30647 | GeotUpdates.parseRequest | train | private function parseRequest( $request ) {
// if request fail or plugin don't exit
if( ! isset($request->id) )
return;
$res = (object) array(
'name' => isset( $request->name ) ? $request->name : '',
'version' => $request->version,
'slug' => $request->slug,
'download_link'... | php | {
"resource": ""
} |
q30648 | ModulePresenter.getImageUrlOrDefault | train | protected function getImageUrlOrDefault()
{
$imagePath = $this->entity->path;
if (!Storage::exists($imagePath)) {
$imagePath = $this->imgNotFound();
}
return Storage::url($imagePath);
} | php | {
"resource": ""
} |
q30649 | GearmanConsumer.setup | train | protected function setup(): void
{
if (null === $this->worker) {
$worker = new \GearmanWorker();
$worker->setTimeout($this->timeout);
if (empty($this->servers)) {
try {
// by default we add the local machine
if (!$w... | php | {
"resource": ""
} |
q30650 | GearmanConsumer.work | train | protected function work(): void
{
if (@$this->worker->work()
|| $this->worker->returnCode() == GEARMAN_IO_WAIT
|| $this->worker->returnCode() == GEARMAN_NO_JOBS
) {
if ($this->worker->returnCode() == GEARMAN_SUCCESS) {
return;
}
... | php | {
"resource": ""
} |
q30651 | GearmanConsumer.teardown | train | protected function teardown(): void
{
if ($this->worker) {
@$this->worker->unregisterAll();
$this->worker = null;
}
} | php | {
"resource": ""
} |
q30652 | Job.getData | train | public function getData()
{
$data = array();
foreach (get_object_vars($this) as $key => $value) {
if (strpos($key, '__') !== 0) {
$data[$key] = $value;
}
}
return $data;
} | php | {
"resource": ""
} |
q30653 | App.fire | train | public function fire($event, $subject = null, $message = null)
{
return $this->dispatcher()->fire($event, $subject, $message);
} | php | {
"resource": ""
} |
q30654 | App.eventMsg | train | private function eventMsg(\Exception $exception)
{
return sprintf('%s (%s line:%s)', $exception->getMessage(), $exception->getFile(), $exception->getLine());
} | php | {
"resource": ""
} |
q30655 | App.callController | train | protected function callController($controller)
{
if (is_string($controller) && strpos($controller, self::SEPARATOR) !== false) {
list($controller, $action) = explode(self::SEPARATOR, $controller);
$response = $this->callClassController($controller, $action);
} elseif (is_call... | php | {
"resource": ""
} |
q30656 | App.callClassController | train | private function callClassController($controller, $action)
{
if (!class_exists($controller)) {
throw new AppException(sprintf('Invalid class name or class "%s" does not exists', $controller));
}
$instance = new $controller($this);
if ($res = $this->callMethod($instance,... | php | {
"resource": ""
} |
q30657 | App.callMethod | train | private function callMethod($instance, $method)
{
if (!method_exists($instance, $method) || !is_callable([$instance, $method])) {
return false;
}
return call_user_func([$instance, $method]);
} | php | {
"resource": ""
} |
q30658 | Request.updateHostHeaderFromUri | train | protected function updateHostHeaderFromUri()
{
if ($host = $this->uri->getHost()) {
if (($port = $this->uri->getPort()) !== null) {
$host .= ':' . $port;
}
$this->headers->set('Host', $host);
}
} | php | {
"resource": ""
} |
q30659 | CookieBag.has | train | public function has($offset = null)
{
if ($offset === null) {
return $this->count() > 0;
}
return array_key_exists($offset, $this->storage);
} | php | {
"resource": ""
} |
q30660 | CookieBag.asArray | train | public function asArray()
{
$cookies = [];
foreach (array_filter($this->storage) as $cookie) {
$cookies[] = 'Set-Cookie: ' . (string) $cookie;
}
return $cookies;
} | php | {
"resource": ""
} |
q30661 | RequestCode.setCodeLength | train | public function setCodeLength($value)
{
$this->codeLength = filter_var(
$value,
FILTER_VALIDATE_INT,
array(
'options' => array(
'min_range' => self::CODE_LENGTH_DEFAULT,
'max_range' => self::CODE_LENGTH_MAX
... | php | {
"resource": ""
} |
q30662 | RequestCode.setCallbackUrl | train | public function setCallbackUrl($value)
{
$this->callbackUrl = filter_var($value, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED);
if (!$this->callbackUrl) {
throw new \Exception('Invalid URL.');
}
return $this;
} | php | {
"resource": ""
} |
q30663 | RequestCode.setSenderId | train | public function setSenderId($value)
{
if (is_numeric($value)) {
if (strlen($value) <= self::SENDER_ID_NUMERIC_MAX) {
$this->senderId = $value;
} else {
throw new \Exception('The sender ID is too long (' . self::SENDER_ID_NUMERIC_MAX . ' Max.).');
... | php | {
"resource": ""
} |
q30664 | RequestCode.set | train | public function set($variableName, $value)
{
$authorizedSetters = array(
'clientRef',
'phoneNumber',
'codeLength',
'codeType',
'caseSensitive',
'callbackUrl',
'senderId',
'messageTemplate'
);
if ... | php | {
"resource": ""
} |
q30665 | UuidInterfaceHandler.serialize | train | public function serialize(VisitorInterface $visitor, ?UuidInterface $uuid, Type $type, Context $context): ?string
{
if (null === $uuid) {
return $visitor->visitNull(null, Type::null(), $context);
}
return $visitor->visitString($uuid->toString(), $type, $context);
} | php | {
"resource": ""
} |
q30666 | UuidInterfaceHandler.deserialize | train | public function deserialize(VisitorInterface $visitor, $data, Type $type, Context $context): ?UuidInterface
{
if (empty($data)) {
return $visitor->visitNull(null, Type::null(), $context);
}
return Uuid::fromString($data);
} | php | {
"resource": ""
} |
q30667 | StreamWrapper.dir_opendir | train | public function dir_opendir($path, $options) {
$url = $this->parseUrl($path);
if (empty($url['host'])) {
trigger_error('Container name is required.' , E_USER_WARNING);
return FALSE;
}
try {
$this->initializeObjectStorage();
$container = $this->store->container($url['host']);
... | php | {
"resource": ""
} |
q30668 | StreamWrapper.dir_readdir | train | public function dir_readdir() {
// If we are at the end of the listing, return FALSE.
if (count($this->dirListing) <= $this->dirIndex) {
return FALSE;
}
$curr = $this->dirListing[$this->dirIndex];
$this->dirIndex++;
if ($curr instanceof \HPCloud\Storage\ObjectStorage\Subdir) {
$ful... | php | {
"resource": ""
} |
q30669 | StreamWrapper.rename | train | public function rename($path_from, $path_to) {
$this->initializeObjectStorage();
$src = $this->parseUrl($path_from);
$dest = $this->parseUrl($path_to);
if ($src['scheme'] != $dest['scheme']) {
trigger_error("I'm too stupid to copy across protocols.", E_USER_WARNING);
}
if ( empty($src['h... | php | {
"resource": ""
} |
q30670 | StreamWrapper.stream_close | train | public function stream_close() {
try {
$this->writeRemote();
}
catch (\HPCloud\Exception $e) {
trigger_error('Error while closing: ' . $e->getMessage(), E_USER_NOTICE);
return FALSE;
}
// Force-clear the memory hogs.
unset($this->obj);
fclose($this->objStream);
} | php | {
"resource": ""
} |
q30671 | StreamWrapper.stream_flush | train | public function stream_flush() {
try {
$this->writeRemote();
}
catch (\HPCloud\Exception $e) {
syslog(LOG_WARNING, $e);
trigger_error('Error while flushing: ' . $e->getMessage(), E_USER_NOTICE);
return FALSE;
}
} | php | {
"resource": ""
} |
q30672 | StreamWrapper.writeRemote | train | protected function writeRemote() {
$contentType = $this->cxt('content_type');
if (!empty($contentType)) {
$this->obj->setContentType($contentType);
}
// Skip debug streams.
if ($this->isNeverDirty) {
return;
}
// Stream is dirty and needs a write.
if ($this->isDirty) {
... | php | {
"resource": ""
} |
q30673 | StreamWrapper.stream_seek | train | public function stream_seek($offset, $whence) {
$ret = fseek($this->objStream, $offset, $whence);
// fseek returns 0 for success, -1 for failure.
// We need to return TRUE for success, FALSE for failure.
return $ret === 0;
} | php | {
"resource": ""
} |
q30674 | StreamWrapper.stream_set_option | train | public function stream_set_option($option, $arg1, $arg2) {
switch ($option) {
case STREAM_OPTION_BLOCKING:
return stream_set_blocking($this->objStream, $arg1);
case STREAM_OPTION_READ_TIMEOUT:
// XXX: Should this have any effect on the lower-level
// socket, too? Or just the buff... | php | {
"resource": ""
} |
q30675 | StreamWrapper.unlink | train | public function unlink($path) {
$url = $this->parseUrl($path);
// Host is required.
if (empty($url['host'])) {
trigger_error('Container name is required.', E_USER_WARNING);
return FALSE;
}
// I suppose we could allow deleting containers,
// but that isn't really the purpose of the
... | php | {
"resource": ""
} |
q30676 | StreamWrapper.generateStat | train | protected function generateStat($object, $container, $size) {
// This is not entirely accurate. Basically, if the
// file is marked public, it gets 100775, and if
// it is private, it gets 100770.
//
// Mode is always set to file (100XXX) because there
// is no alternative that is more sensible.... | php | {
"resource": ""
} |
q30677 | StreamWrapper.setMode | train | protected function setMode($mode) {
$mode = strtolower($mode);
// These are largely ignored, as the remote
// object storage does not distinguish between
// text and binary files. Per the PHP recommendation
// files are treated as binary.
$this->isBinary = strpos($mode, 'b') !== FALSE;
$thi... | php | {
"resource": ""
} |
q30678 | StreamWrapper.cxt | train | protected function cxt($name, $default = NULL) {
// Lazilly populate the context array.
if (is_resource($this->context) && empty($this->contextArray)) {
$cxt = stream_context_get_options($this->context);
// If a custom scheme name has been set, use that.
if (!empty($cxt[$this->schemeName])) ... | php | {
"resource": ""
} |
q30679 | StreamWrapper.parseUrl | train | protected function parseUrl($url) {
$res = parse_url($url);
// These have to be decode because they will later
// be encoded.
foreach ($res as $key => $val) {
if ($key == 'host') {
$res[$key] = urldecode($val);
}
elseif ($key == 'path') {
if (strpos($val, '/') === 0) ... | php | {
"resource": ""
} |
q30680 | StreamWrapper.initializeObjectStorage | train | protected function initializeObjectStorage() {
$token = $this->cxt('token');
$account = $this->cxt('account');
// Legacy support for old 'key' param.
$key = $this->cxt('key', $this->cxt('secret'));
$tenantId = $this->cxt('tenantid');
$tenantName = $this->cxt('tenantname');
$authUrl = $thi... | php | {
"resource": ""
} |
q30681 | StreamWrapper.initializeCDN | train | protected function initializeCDN($token, $catalog) {
$cdn = $this->cxt('use_cdn', FALSE);
// No CDN should be enabled.
if (empty($cdn)) {
return FALSE;
}
// Use the CDN object, if provided.
elseif ($cdn instanceof \HPCloud\Storage\CDN) {
$this->cdn = $cdn;
}
// Or try to cre... | php | {
"resource": ""
} |
q30682 | WorkingDirectory.getUserHomeDirectory | train | protected function getUserHomeDirectory()
{
if ( defined('PHP_WINDOWS_VERSION_MAJOR') ) {
if ( !getenv('APPDATA') ) {
throw new ApplicationException('The APPDATA environment variable must be set to run correctly.');
}
return strtr(getenv('APPDATA'), '\\', '/');
}
if ( !getenv('HOME') ) {
throw ... | php | {
"resource": ""
} |
q30683 | eZPageBlockItem.toXML | train | public function toXML( DOMDocument $dom )
{
if ( !$this->XMLStorable )
{
return false;
}
$itemNode = $dom->createElement( 'item' );
foreach ( $this->attributes as $attrName => $attrValue )
{
switch ( $attrName )
{
... | php | {
"resource": ""
} |
q30684 | eZPageBlockItem.createFromXML | train | public static function createFromXML( DOMElement $node )
{
$newObj = new eZPageBlockItem();
if ( $node->hasAttributes() )
{
foreach ( $node->attributes as $attr )
{
$newObj->setAttribute( $attr->name, $attr->value );
}
}
f... | php | {
"resource": ""
} |
q30685 | AddLanguageBlocksListener.configurePermalinkForNewLanguage | train | protected function configurePermalinkForNewLanguage($content)
{
if (null === $this->languageManager || null === $this->container) {
return $content;
}
$urlManager = $this->container->get('red_kite_cms.url_manager');
$languageName = $this->languageManager->get()->getLang... | php | {
"resource": ""
} |
q30686 | Mission.getPlayableGames | train | public function getPlayableGames($entry = null)
{
$sortedPlayableGames = array();
foreach ($this->missionGames as $missionGame) {
$g = $missionGame->getGame();
if ($g->isStarted() && $g->getActive()) {
if (!$missionGame->getConditions() || $missio... | php | {
"resource": ""
} |
q30687 | Mission.getPreviousGame | train | public function getPreviousGame($entry = null)
{
$currentGame = $this->getNextPlayableGame($entry);
$previousMissionGame = null;
foreach ($this->missionGames as $missionGame) {
if ($missionGame->getGame()->getId() === $currentGame->getId()) {
return $previousMiss... | php | {
"resource": ""
} |
q30688 | Mission.getNextPlayableGame | train | public function getNextPlayableGame($entry = null)
{
$sortedPlayableGames = $this->getPlayableGames($entry);
return (count($sortedPlayableGames) >= 1)?current($sortedPlayableGames)->getGame():null;
} | php | {
"resource": ""
} |
q30689 | Mission.isPlayable | train | public function isPlayable($subGame, $entry = null)
{
if (!$subGame) {
return false;
}
$sortedPlayableGames = $this->getPlayableGames($entry);
foreach ($sortedPlayableGames as $pgame) {
if ($subGame->getIdentifier() === $pgame->getGame()->getIdentifie... | php | {
"resource": ""
} |
q30690 | Math.fromBase | train | public static function fromBase($number, $base)
{
// trim base 64 padding char, only positive
$number = trim($number, ' =-');
if ($number === '' || strpos($number, '.') !== false) {
throw new \InvalidArgumentException('Argument number is not an integer');
}
$base... | php | {
"resource": ""
} |
q30691 | Math.toBase | train | public function toBase($base)
{
if ($this->normalize()->hasDecimals()) {
throw new \InvalidArgumentException('Argument number is not an integer');
}
// do not mutate, only support positive integers
$number = ltrim((string) $this, '-');
if (static::$gmpSupport && ... | php | {
"resource": ""
} |
q30692 | Service.addArgument | train | public function addArgument(string $name, $value): Service
{
$this->arguments[$name] = $value;
return $this;
} | php | {
"resource": ""
} |
q30693 | Service.addArguments | train | public function addArguments(array $arguments): Service
{
$this->arguments = array_replace($this->arguments ?? [], $arguments);
return $this;
} | php | {
"resource": ""
} |
q30694 | Service.addCall | train | public function addCall(string $method, array $arguments = []): Service
{
$this->calls[$method] = $arguments;
return $this;
} | php | {
"resource": ""
} |
q30695 | SimpleRequestBus.receiveRequest | train | public function receiveRequest(Request $request): Response
{
$curie = $request::schema()->getCurie();
$curieStr = $curie->toString();
if (isset($this->handlers[$curieStr])) {
$handler = $this->handlers[$curieStr];
} else {
try {
$handler = $th... | php | {
"resource": ""
} |
q30696 | AssetDirectory.add | train | public function add($file, $force = false)
{
if (!file_exists($file)) {
throw new \InvalidArgumentException(sprintf('File "%s" does not exist.', $file));
}
if (false === $force && null !== $path = $this->getCache($file)) {
return null === $this->target ? $path : $thi... | php | {
"resource": ""
} |
q30697 | AssetDirectory.getCache | train | private function getCache($file)
{
if (null === $this->cache) {
return null;
}
$key = md5($file);
// File already present
if ($this->cache->has($key)) {
list($mtime, $path) = unserialize($this->cache->get($key));
if ($mtime === filemtime... | php | {
"resource": ""
} |
q30698 | ResponseRecordStorage.createResponse | train | protected function createResponse($pid, $alias, $timeout = 0.0, $timeoutIncrease = 1.0)
{
return new ResponseRecord($pid, $alias, $timeout, $timeoutIncrease);
} | php | {
"resource": ""
} |
q30699 | ResponseRecordStorage.existsResponse | train | protected function existsResponse($pid)
{
return isset($this->reps[$pid]) || isset($this->handledReps[$pid]);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.