_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q266300 | PEAR_Command_Common.PEAR_Command_Common | test | function PEAR_Command_Common(&$ui, &$config)
{
parent::PEAR();
$this->config = &$config;
$this->ui = &$ui;
} | php | {
"resource": ""
} |
q266301 | PEAR_Command_Common.getCommands | test | function getCommands()
{
$ret = array();
foreach (array_keys($this->commands) as $command) {
$ret[$command] = $this->commands[$command]['summary'];
}
return $ret;
} | php | {
"resource": ""
} |
q266302 | PEAR_Command_Common.getShortcuts | test | function getShortcuts()
{
$ret = array();
foreach (array_keys($this->commands) as $command) {
if (isset($this->commands[$command]['shortcut'])) {
$ret[$this->commands[$command]['shortcut']] = $command;
}
}
return $ret;
} | php | {
"resource": ""
} |
q266303 | PEAR_Command_Common.getHelp | test | function getHelp($command)
{
$config = &PEAR_Config::singleton();
if (!isset($this->commands[$command])) {
return "No such command \"$command\"";
}
$help = null;
if (isset($this->commands[$command]['doc'])) {
$help = $this->commands[$command]['doc'];
... | php | {
"resource": ""
} |
q266304 | PEAR_Command_Common.getHelpArgs | test | function getHelpArgs($command)
{
if (isset($this->commands[$command]['options']) &&
count($this->commands[$command]['options']))
{
$help = "Options:\n";
foreach ($this->commands[$command]['options'] as $k => $v) {
if (isset($v['arg'])) {
... | php | {
"resource": ""
} |
q266305 | Plugin.onPostPackageEvent | test | public function onPostPackageEvent(PackageEvent $event)
{
$package = $this->getOpenBizPackage($event->getOperation());
if ($package) {
// By explicitly setting the package, the onPostCmdEvent() will
// process the update automatically.
$this->OpenBizPackage = $pac... | php | {
"resource": ""
} |
q266306 | BaseDBAdapter.compileDSN | test | static public function compileDSN(&$params) {
$dsn = '';
if (!isset($params['user'])) $params['user'] = 'root';
if (!isset($params['pass'])) $params['pass'] = null;
if (!isset($params['type'])) $params['type'] = 'mysql';
if (!isset($params['host'])) $params['host'] = '127.0.0.1';... | php | {
"resource": ""
} |
q266307 | BaseDBAdapter.escape | test | public function escape($value) {
if (is_array($value)) {
$res = '';
if (count($value) == 0) return 'null';
foreach($value as $val) {
$res .= $this->escapeOne($val).',';
}
$res = substr($res, 0, -1);
return $res;
} el... | php | {
"resource": ""
} |
q266308 | TemplatingViewModule.addTemplateRoot | test | public static function addTemplateRoot(
array &$globalConfig,
string $directory,
string $trim,
string $referenceName = ''
) {
if (!isset($globalConfig['view'])) {
$globalConfig['view'] = [];
}
if (!isset($globalConfig['view'][self::CONFIG_TEMPLATE_ROOTS])) {
$globalConfig['view'][self::CONFIG_TEMPL... | php | {
"resource": ""
} |
q266309 | DoctrinePresenceVerifier.getCount | test | public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = []) {
$idColumn = $idColumn !== null ? $idColumn : 'id';
$qb = $this->createCountQuery($collection)
->where('o.' . $column . ' = :value')
->setParameter('valu... | php | {
"resource": ""
} |
q266310 | DoctrinePresenceVerifier.getMultiCount | test | public function getMultiCount($collection, $column, array $values, array $extra = []) {
$qb = $this->createCountQuery($collection)
->where('o.', $column . ' IN (:values)')
->setParameter('values', array_values($values));
foreach($extra as $key => $extraValue) {
... | php | {
"resource": ""
} |
q266311 | DoctrinePresenceVerifier.createCountQuery | test | protected function createCountQuery($collection, $alias = 'o') {
return $this->getEntityManager()->createQueryBuilder()
->select('COUNT(' . $alias . ')')
->from($collection, $alias);
} | php | {
"resource": ""
} |
q266312 | DoctrinePresenceVerifier.getEntityManager | test | protected function getEntityManager() {
if($this->entities === null) {
$callable = $this->factory;
$this->entities = $callable();
}
return $this->entities;
} | php | {
"resource": ""
} |
q266313 | Url.getCurrentPath | test | protected static function getCurrentPath(RequestApplicationInterface $app, $onlyStaticPart = false) {
$route = $app->getRoute();
return $route ? $route->getRoutePath($onlyStaticPart) : null;
} | php | {
"resource": ""
} |
q266314 | Container.load | test | public function load($name, array $params = array(), $object_loader = null, $force_overload = false)
{
$config = $this->get('config')->get($name, \CarteBlanche\App\Config::NOT_FOUND_GRACEFULLY, array());
$factory = \Library\Factory::create()
->factoryName(__CLASS__)
->mustImp... | php | {
"resource": ""
} |
q266315 | Container.clear | test | public function clear($name)
{
if (true===$this->instances->isEntry($name)) {
$this->instances->setEntry($name, null);
}
} | php | {
"resource": ""
} |
q266316 | Container.getBundle | test | public function getBundle($name)
{
if (true===$this->instances->isEntry($name,'bundles')) {
return $this->instances->getEntry($name,'bundles');
}
return null;
} | php | {
"resource": ""
} |
q266317 | Container.setBundle | test | public function setBundle($name = null, $val = null, $force_overload = false)
{
if (!is_object($val)) {
throw new DomainException(
sprintf('A bundle entry must be an object (got "%s" for bundle "%s")!', gettype($val), $name)
);
}
if (!CodeHelper::isCla... | php | {
"resource": ""
} |
q266318 | Container.clearBundle | test | public function clearBundle($name)
{
if (true===$this->instances->isEntry($name,'bundles')) {
$this->instances->setEntry($name,null,'bundles');
}
} | php | {
"resource": ""
} |
q266319 | CacheInvalidationSubscriber.invalidate | test | public function invalidate(EntityManager $em, $entity) {
$this->log->info('Invalidating entity of class ' . get_class($entity) . ' with ID ' . $entity->getId());
$this->events->fire('oxygen.entity.cache.invalidated', [$entity]);
// if the cache depends on any entities of a given type
fo... | php | {
"resource": ""
} |
q266320 | PEAR_DependencyDB.assertDepsDB | test | function assertDepsDB()
{
if (!is_file($this->_depdb)) {
$this->rebuildDB();
return;
}
$depdb = $this->_getDepDB();
// Datatype format has been changed, rebuild the Deps DB
if ($depdb['_version'] < $this->_version) {
$this->rebuildDB();
... | php | {
"resource": ""
} |
q266321 | PEAR_DependencyDB.getDependentPackageDependencies | test | function getDependentPackageDependencies(&$pkg)
{
$data = $this->_getDepDB();
if (is_object($pkg)) {
$channel = strtolower($pkg->getChannel());
$package = strtolower($pkg->getPackage());
} else {
$channel = strtolower($pkg['channel']);
$package... | php | {
"resource": ""
} |
q266322 | PEAR_DependencyDB.getDependencies | test | function getDependencies(&$pkg)
{
if (is_object($pkg)) {
$channel = strtolower($pkg->getChannel());
$package = strtolower($pkg->getPackage());
} else {
$channel = strtolower($pkg['channel']);
$package = strtolower($pkg['package']);
}
$... | php | {
"resource": ""
} |
q266323 | PEAR_DependencyDB.installPackage | test | function installPackage(&$package)
{
$data = $this->_getDepDB();
unset($this->_cache);
$this->_setPackageDeps($data, $package);
$this->_writeDepDB($data);
} | php | {
"resource": ""
} |
q266324 | PEAR_DependencyDB.uninstallPackage | test | function uninstallPackage(&$pkg)
{
$data = $this->_getDepDB();
unset($this->_cache);
if (is_object($pkg)) {
$channel = strtolower($pkg->getChannel());
$package = strtolower($pkg->getPackage());
} else {
$channel = strtolower($pkg['channel']);
... | php | {
"resource": ""
} |
q266325 | PEAR_DependencyDB.rebuildDB | test | function rebuildDB()
{
$depdb = array('_version' => $this->_version);
if (!$this->hasWriteAccess()) {
// allow startup for read-only with older Registry
return $depdb;
}
$packages = $this->_registry->listAllPackages();
if (PEAR::isError($packages)) {
... | php | {
"resource": ""
} |
q266326 | PEAR_DependencyDB._lock | test | function _lock($mode = LOCK_EX)
{
if (stristr(php_uname(), 'Windows 9')) {
return true;
}
if ($mode != LOCK_UN && is_resource($this->_lockFp)) {
// XXX does not check type of lock (LOCK_SH/LOCK_EX)
return true;
}
$open_mode = 'w';
... | php | {
"resource": ""
} |
q266327 | PEAR_DependencyDB._unlock | test | function _unlock()
{
$ret = $this->_lock(LOCK_UN);
if (is_resource($this->_lockFp)) {
fclose($this->_lockFp);
}
$this->_lockFp = null;
return $ret;
} | php | {
"resource": ""
} |
q266328 | PEAR_DependencyDB._getDepDB | test | function _getDepDB()
{
if (!$this->hasWriteAccess()) {
return array('_version' => $this->_version);
}
if (isset($this->_cache)) {
return $this->_cache;
}
if (!$fp = fopen($this->_depdb, 'r')) {
$err = PEAR::raiseError("Could not open depe... | php | {
"resource": ""
} |
q266329 | PEAR_DependencyDB._writeDepDB | test | function _writeDepDB(&$deps)
{
if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
return $e;
}
if (!$fp = fopen($this->_depdb, 'wb')) {
$this->_unlock();
return PEAR::raiseError("Could not open dependencies file `".$this->_depdb."' for writing");
}
... | php | {
"resource": ""
} |
q266330 | Theme.autoLoadModules | test | protected function autoLoadModules()
{
$extDirectory = __DIR__ . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR;
$extDirectories = glob($extDirectory . "*", GLOB_ONLYDIR);
foreach ($extDirectories as $directory):
if (basename($directory) === "core"):
continue;
... | php | {
"resource": ""
} |
q266331 | Theme.registerModule | test | public function registerModule($key, $instance)
{
do_action("before_theme_module_register");
apply_filters("before_theme_module_init", $key, $instance);
$this->modules[$key] = $instance;
$this->module($key)->init();
apply_filters("after_theme_module_init", $key, $instance);... | php | {
"resource": ""
} |
q266332 | Theme.getContent | test | public function getContent($location)
{
do_action("before_theme_get_content");
apply_filters("before_theme_get_content", $location);
foreach ($this->sections as $section_data):
# Skip if section is not in given location
if ($section_data[1] !== $location):
... | php | {
"resource": ""
} |
q266333 | ErrorController.actionError | test | public function actionError(RequestApplicationInterface $app, \Throwable $exception) {
return $this->render($app, 'view', [
'exception' => $exception,
'exceptionName' => $this->getExceptionName($exception),
], true);
} | php | {
"resource": ""
} |
q266334 | NativeOutputFormatter.setForeground | test | public function setForeground(FormatForeground $foreground = null): void
{
if (null === $foreground) {
$this->foreground = null;
return;
}
$this->foreground = $foreground->getValue();
} | php | {
"resource": ""
} |
q266335 | NativeOutputFormatter.setBackground | test | public function setBackground(FormatBackground $background = null): void
{
if (null === $background) {
$this->background = null;
return;
}
$this->background = $background->getValue();
} | php | {
"resource": ""
} |
q266336 | NativeOutputFormatter.black | test | public function black(bool $background = null): void
{
$this->setColor(
$background ? FormatBackground::BLACK : FormatForeground::BLACK,
$background
);
} | php | {
"resource": ""
} |
q266337 | NativeOutputFormatter.red | test | public function red(bool $background = null): void
{
$this->setColor(
$background ? FormatBackground::RED : FormatForeground::RED,
$background
);
} | php | {
"resource": ""
} |
q266338 | NativeOutputFormatter.green | test | public function green(bool $background = null): void
{
$this->setColor(
$background ? FormatBackground::GREEN : FormatForeground::GREEN,
$background
);
} | php | {
"resource": ""
} |
q266339 | NativeOutputFormatter.yellow | test | public function yellow(bool $background = null): void
{
$this->setColor(
$background ? FormatBackground::YELLOW : FormatForeground::YELLOW,
$background
);
} | php | {
"resource": ""
} |
q266340 | NativeOutputFormatter.blue | test | public function blue(bool $background = null): void
{
$this->setColor(
$background ? FormatBackground::BLUE : FormatForeground::BLUE,
$background
);
} | php | {
"resource": ""
} |
q266341 | NativeOutputFormatter.magenta | test | public function magenta(bool $background = null): void
{
$this->setColor(
$background ? FormatBackground::MAGENTA : FormatForeground::MAGENTA,
$background
);
} | php | {
"resource": ""
} |
q266342 | NativeOutputFormatter.cyan | test | public function cyan(bool $background = null): void
{
$this->setColor(
$background ? FormatBackground::CYAN : FormatForeground::CYAN,
$background
);
} | php | {
"resource": ""
} |
q266343 | NativeOutputFormatter.white | test | public function white(bool $background = null): void
{
$this->setColor(
$background ? FormatBackground::WHITE : FormatForeground::WHITE,
$background
);
} | php | {
"resource": ""
} |
q266344 | NativeOutputFormatter.resetColor | test | public function resetColor(bool $background = null): void
{
$this->setColor(
$background ? FormatBackground::DEFAULT : FormatForeground::DEFAULT,
$background
);
} | php | {
"resource": ""
} |
q266345 | NativeOutputFormatter.setColor | test | protected function setColor(int $color, bool $background = null): void
{
if (null !== $background) {
$this->background = $color;
return;
}
$this->foreground = $color;
} | php | {
"resource": ""
} |
q266346 | NativeOutputFormatter.removeOption | test | public function removeOption(FormatOption $option): void
{
if ($this->hasOption($option)) {
unset($this->options[$option->getValue()]);
}
} | php | {
"resource": ""
} |
q266347 | NativeOutputFormatter.format | test | public function format(string $message): string
{
$set = [];
$unset = [];
// Check if a foreground was specified
if (null !== $this->foreground) {
$set[] = $this->foreground;
$unset[] = FormatForeground::DEFAULT;
}
// Check if a backgroun... | php | {
"resource": ""
} |
q266348 | Logger.logCommand | test | public function logCommand($command, $duration, $connection, $error = false)
{
++$this->commandCount;
if (null !== $this->logger) {
$this->commands[] = [
'cmd' => $command,
'executionMS' => $duration,
'conn' => $connection,
... | php | {
"resource": ""
} |
q266349 | ServerRequest.getUploadedFileLeaves | test | private static function getUploadedFileLeaves(array $uploaded_files)
{
$new_file = [];
if (isset($uploaded_files['tmp_name']) && !is_array($uploaded_files['tmp_name'])) {
$new_file = new UploadedFile(
$uploaded_files['name'] ?? null,
$uploaded_files['type... | php | {
"resource": ""
} |
q266350 | PEAR_PackageFile_v2.setRawState | test | function setRawState($state)
{
if (!isset($this->_packageInfo['stability'])) {
$this->_packageInfo['stability'] = array();
}
$this->_packageInfo['stability']['release'] = $state;
} | php | {
"resource": ""
} |
q266351 | PEAR_PackageFile_v2.listPostinstallScripts | test | function listPostinstallScripts()
{
$filelist = $this->getFilelist();
$contents = $this->getContents();
$contents = $contents['dir']['file'];
if (!is_array($contents) || !isset($contents[0])) {
$contents = array($contents);
}
$taskfiles = array();
... | php | {
"resource": ""
} |
q266352 | PEAR_PackageFile_v2.initPostinstallScripts | test | function initPostinstallScripts()
{
$filelist = $this->getFilelist();
$contents = $this->getContents();
$contents = $contents['dir']['file'];
if (!is_array($contents) || !isset($contents[0])) {
$contents = array($contents);
}
$taskfiles = array();
... | php | {
"resource": ""
} |
q266353 | PEAR_PackageFile_v2.fromArray | test | function fromArray($pinfo)
{
unset($pinfo['old']);
unset($pinfo['xsdversion']);
// If the changelog isn't an array then it was passed in as an empty tag
if (isset($pinfo['changelog']) && !is_array($pinfo['changelog'])) {
unset($pinfo['changelog']);
}
$this->... | php | {
"resource": ""
} |
q266354 | PEAR_PackageFile_v2.getFilelist | test | function getFilelist($preserve = false)
{
if (isset($this->_packageInfo['filelist']) && !$preserve) {
return $this->_packageInfo['filelist'];
}
$this->flattenFilelist();
if ($contents = $this->getContents()) {
$ret = array();
if (!isset($contents['... | php | {
"resource": ""
} |
q266355 | PEAR_PackageFile_v2.getConfigureOptions | test | function getConfigureOptions()
{
if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
return false;
}
$releases = $this->getReleases();
if (isset($releases[0])) {
$releases = $releases[0];
}
if (isset($release... | php | {
"resource": ""
} |
q266356 | PEAR_PackageFile_v2.isCompatible | test | function isCompatible($pf)
{
if (!isset($this->_packageInfo['compatible'])) {
return false;
}
if (!isset($this->_packageInfo['channel'])) {
return false;
}
$me = $pf->getVersion();
$compatible = $this->_packageInfo['compatible'];
if (!i... | php | {
"resource": ""
} |
q266357 | PEAR_PackageFile_v2.isSubpackage | test | function isSubpackage($p)
{
$sub = array();
if (isset($this->_packageInfo['dependencies']['required']['subpackage'])) {
$sub = $this->_packageInfo['dependencies']['required']['subpackage'];
if (!isset($sub[0])) {
$sub = array($sub);
}
}
... | php | {
"resource": ""
} |
q266358 | PEAR_PackageFile_v2.getDependencyGroup | test | function getDependencyGroup($name)
{
$name = strtolower($name);
if (!isset($this->_packageInfo['dependencies']['group'])) {
return false;
}
$groups = $this->_packageInfo['dependencies']['group'];
if (!isset($groups[0])) {
$groups = array($groups);
... | php | {
"resource": ""
} |
q266359 | PEAR_PackageFile_v2._ksplice | test | function _ksplice($array, $key, $value, $newkey)
{
$offset = array_search($key, array_keys($array));
$after = array_slice($array, $offset);
$before = array_slice($array, 0, $offset);
$before[$newkey] = $value;
return array_merge($before, $after);
} | php | {
"resource": ""
} |
q266360 | CSDTCollectionsBundle.build | test | public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new ManagerCompiler());
$container->addCompilerPass(new HelperCompiler());
} | php | {
"resource": ""
} |
q266361 | Helper.modulo | test | public static function modulo($a, $b)
{
if (abs($b)>abs($a)) {
return $a;
}
if ($a>0 && $b>0) {
return ($a%$b);
}
return self::getModuloFromEntirePart($a, $b);
} | php | {
"resource": ""
} |
q266362 | Helper.getModuloFromEntirePart | test | public static function getModuloFromEntirePart($a, $b)
{
$div = round($a/$b, 0, (($a/$b)>=0 ? PHP_ROUND_HALF_DOWN : PHP_ROUND_HALF_UP));
$a = round($a, 0, ($a>=0 ? PHP_ROUND_HALF_DOWN : PHP_ROUND_HALF_UP));
$b = round($b, 0, ($b>=0 ? PHP_ROUND_HALF_DOWN : PHP_ROUND_HALF_UP));
return ... | php | {
"resource": ""
} |
q266363 | HTTP_Request2_Observer_Log.update | test | public function update(SplSubject $subject)
{
$event = $subject->getLastEvent();
if (!in_array($event['name'], $this->events)) {
return;
}
switch ($event['name']) {
case 'connect':
$this->log('* Connected to ' . $event['data']);
... | php | {
"resource": ""
} |
q266364 | HTTP_Request2_Observer_Log.log | test | protected function log($message)
{
if ($this->target instanceof Log) {
$this->target->debug($message);
} elseif (is_resource($this->target)) {
fwrite($this->target, $message . "\r\n");
}
} | php | {
"resource": ""
} |
q266365 | EntityQueryBuilder.selectFromRepositoryEntity | test | public function selectFromRepositoryEntity($alias = null, $indexBy = null)
{
if ($alias) {
$this->entityAlias = $alias;
}
if (!$alias) {
$alias = $this->getEntityAlias();
}
$this->select($alias)->from($this->getEntityClassName(), $alias, $indexBy);
... | php | {
"resource": ""
} |
q266366 | EntityQueryBuilder.getEntityAlias | test | public function getEntityAlias()
{
if (!$this->entityAlias) {
$className = $this->getEntityClassName();
$reflectionCLass = new ReflectionClass($className);
if (is_string($reflectionCLass->getConstant('ALIAS_NAME'))) {
$this->entityAlias = $reflectio... | php | {
"resource": ""
} |
q266367 | EntityQueryBuilder.delete | test | public function delete($delete = null, $alias = null)
{
if ($delete === null) {
$delete = $this->getEntityClassName();
if ($alias === null) {
$alias = $this->getEntityAlias();
}
}
parent::delete($delete, $alias);
return $this;
... | php | {
"resource": ""
} |
q266368 | EntityQueryBuilder.update | test | public function update($update = null, $alias = null)
{
if ($update === null) {
$update = $this->getEntityClassName();
if ($alias === null) {
$alias = $this->getEntityAlias();
}
}
parent::update($update, $alias);
return $this;
... | php | {
"resource": ""
} |
q266369 | EntityQueryBuilder.from | test | public function from($from = null, $alias = null, $indexBy = null)
{
if ($from === null) {
$from = $this->getEntityClassName();
if ($alias === null) {
$alias = $this->getEntityAlias();
}
}
parent::from($from, $alias, $indexBy = null);
... | php | {
"resource": ""
} |
q266370 | EntityQueryBuilder.set | test | public function set($key, $value)
{
parent::set($this->alias($key), $value);
return $this;
} | php | {
"resource": ""
} |
q266371 | EntityQueryBuilder.groupBy | test | public function groupBy($groupBy)
{
/** @var array $groupFields */
$groupFields = func_get_args();
if (count($groupFields) > 0) {
parent::groupBy($this->alias(array_shift($groupFields)));
foreach ($groupFields as $group) {
$this->addGroupBy($group);
... | php | {
"resource": ""
} |
q266372 | EntityQueryBuilder.addGroupBy | test | public function addGroupBy($groupBy)
{
/** @var array $groupFields */
$groupFields = func_get_args();
foreach ($groupFields as $group) {
parent::addGroupBy($this->alias($group));
}
return $this;
} | php | {
"resource": ""
} |
q266373 | EntityQueryBuilder.orderBy | test | public function orderBy($sort, $order = null)
{
if (is_string($sort)) {
$sort = $this->alias($sort);
}
parent::orderBy($sort, $order);
return $this;
} | php | {
"resource": ""
} |
q266374 | EntityQueryBuilder.addOrderBy | test | public function addOrderBy($sort, $order = null)
{
if (is_string($sort)) {
$sort = $this->alias($sort);
}
parent::addOrderBy($sort, $order);
return $this;
} | php | {
"resource": ""
} |
q266375 | EntityQueryBuilder.limit | test | public function limit($maxResults, $offset = null)
{
if (!is_int($maxResults)) {
throw new Exception\InvalidArgumentException('Incorrect argument $maxResults. Only number allowed.');
}
if ($maxResults < 1) {
throw new Exception\InvalidArgumentException(
... | php | {
"resource": ""
} |
q266376 | EntityQueryBuilder.paginate | test | public function paginate($page = 1, $itemsPerPage = 10)
{
if (!is_int($page) || !is_int($itemsPerPage)) {
throw new Exception\InvalidArgumentException(
sprintf(
'Incorrect argument %s. Only number allowed.', is_int($page) ? '$itemsPerPage' : '$page'
... | php | {
"resource": ""
} |
q266377 | EntityQueryBuilder.fetchOne | test | public function fetchOne(array $parameters = [], $hydrationMode = null)
{
$this->appendParameters($parameters);
$this->limit(1, 0);
return $this->getQuery()->getOneOrNullResult($hydrationMode);
} | php | {
"resource": ""
} |
q266378 | EntityQueryBuilder.fetchSingle | test | public function fetchSingle(array $parameters = [], $hydrationMode = null)
{
$this->appendParameters($parameters);
$this->limit(1, 0);
return $this->getQuery()->getSingleResult($hydrationMode);
} | php | {
"resource": ""
} |
q266379 | EntityQueryBuilder.fetchAll | test | public function fetchAll(array $parameters = [], $hydrationMode = DoctrineQuery::HYDRATE_OBJECT)
{
$this->appendParameters($parameters);
return $this->getQuery()->getResult($hydrationMode);
} | php | {
"resource": ""
} |
q266380 | EntityQueryBuilder.param | test | public function param($value, $type = null, $columnName = 'p')
{
$parameterName = $this->findUnusedParameterName($columnName);
if ($type) {
$this->appendParameters(
[
$parameterName => [
$value,
$type
... | php | {
"resource": ""
} |
q266381 | EntityQueryBuilder.findUnusedParameterName | test | protected function findUnusedParameterName($columnName = 'p')
{
$parameters = $this->getParameters()->map(
function($parameter) {
/** @var Parameter $parameter */
return $parameter->getName();
}
);
$index = 0;
do {
... | php | {
"resource": ""
} |
q266382 | EntityQueryBuilder.parseCallMethods | test | protected function parseCallMethods($method, array $lists, array $arguments, $prefix = true)
{
$condition = null;
$fieldName = null;
$methodName = null;
foreach ($lists as $name => $requireArgs) {
if (strpos($method, 'and') === 0) {
$method = lcfirst... | php | {
"resource": ""
} |
q266383 | EntityQueryBuilder.callFunctionalityFields | test | private function callFunctionalityFields($fieldName, $methodName, array $arguments = [], $condition = null)
{
switch ($methodName) {
case 'where':
case 'filterBy':
if ($condition === 'or') {
$this->orWhere(sprintf('%s = %s', $this->alias($fieldName... | php | {
"resource": ""
} |
q266384 | IsAssoc.isAssoc | test | public function isAssoc(): bool
{
if (empty($this->array)) {
return false;
}
return (bool) count(array_filter(array_keys($this->array), 'is_string'));
} | php | {
"resource": ""
} |
q266385 | DescriptionFactory.describe | test | public function describe(Subject $subject): DescriptionInterface
{
$description = $this->createDescription();
foreach ($this->resolvers as $resolver) {
$subject = $resolver->resolve($subject);
}
foreach ($this->enhancers as $enhancer) {
if (false === $enhanc... | php | {
"resource": ""
} |
q266386 | CLog.timestamp | test | public function timestamp($domain, $where, $comment = null)
{
$now = microtime(true);
$this->timestamp[] = array(
'domain' => $domain,
'where' => $where,
'comment' => $comment,
'when' => $now,
'memory' => memory_get_usage(true),
'dur... | php | {
"resource": ""
} |
q266387 | CLog.timestampAsTable | test | public function timestampAsTable()
{
// Set up the table
$first = $this->timestamp[0]['when'];
$last = $this->timestamp[count($this->timestamp) - 1]['when'];
$html = "<table class='logtable'><caption>Timestamps</caption><tr><th>Domain</th><th>Where</th><th>When (sec)</th><th>Duratio... | php | {
"resource": ""
} |
q266388 | CLog.pageLoadTime | test | public function pageLoadTime()
{
$first = $this->timestamp[0]['when'];
$last = $this->timestamp[count($this->timestamp) - 1]['when'];
$loadtime = round($last - $first, 3);
return $loadtime;
} | php | {
"resource": ""
} |
q266389 | CLog.mostTimeConsumingDomain | test | public function mostTimeConsumingDomain()
{
$total = array();
// Gather total duration data of each domain
foreach ($this->timestamp as $val) {
$duration = round($val['duration'], $this->precision);
@$total[$val['domain']] += $duration;
}
// Get the ... | php | {
"resource": ""
} |
q266390 | Card.renderHeader | test | protected function renderHeader() {
if (!isset($this->header)) {
return '';
}
if (isset($this->headerOptions)) {
Html::addCssClass($this->headerOptions, ['widget' => 'card-header']);
$tag = ArrayHelper::remove($this->headerOptions, 'tag', 'div');
$... | php | {
"resource": ""
} |
q266391 | Card.renderHeaderImage | test | protected function renderHeaderImage() {
if (!isset($this->headerImage)) {
return '';
}
Html::addCssClass($this->headerImageOptions, ['widget' => 'card-img-top']);
return $this->htmlHlp->img($this->headerImage, $this->headerImageOptions);
} | php | {
"resource": ""
} |
q266392 | Card.renderBody | test | protected function renderBody($body = null, $includeOb = false) {
$body = isset($body) ? $body : $this->body;
$bodyContent = '';
$bodyTag = 'div';
if (is_array($body)) {
$bodyRows = [];
foreach ($body as $bodyRow) {
$bodyRowContent = $this->renderB... | php | {
"resource": ""
} |
q266393 | Card.renderFooter | test | protected function renderFooter() {
if (!isset($this->footer)) {
return '';
}
if (isset($this->footerOptions)) {
Html::addCssClass($this->footerOptions, ['widget' => 'card-footer']);
$tag = ArrayHelper::remove($this->footerOptions, 'tag', 'div');
$... | php | {
"resource": ""
} |
q266394 | Controller.group | test | public function group()
{
$namespace = \Reaction::$app->router->getRelativeControllerNamespace(static::class);
$namespace = substr($namespace, 0, -10);
$namespaceArray = explode('\\', $namespace);
array_walk($namespaceArray, function(&$value) {
$value = Inflector::camel2i... | php | {
"resource": ""
} |
q266395 | Controller.getOptionValues | test | public function getOptionValues($actionID = null)
{
// $actionId might be used in subclasses to provide properties specific to action id
$properties = [];
foreach ($this->options($actionID) as $property) {
$properties[$property] = $this->$property;
}
return $prop... | php | {
"resource": ""
} |
q266396 | Controller.getActionArgsHelp | test | public function getActionArgsHelp($actionId)
{
$methodName = static::getActionMethod($actionId);
$method = ReflectionHelper::getMethodReflection($this, $methodName);
$tags = ReflectionHelper::getMethodDocTags($method, $this);
$params = isset($tags['param']) ? (array)$tags['param'] : ... | php | {
"resource": ""
} |
q266397 | Controller.getActionOptionsHelp | test | public function getActionOptionsHelp($actionId)
{
$optionNames = $this->options($actionId);
if (empty($optionNames)) {
return [];
}
$class = ReflectionHelper::getClassReflection($this);
$options = [];
foreach ($class->getProperties() as $property) {
... | php | {
"resource": ""
} |
q266398 | RequestHelper.getHeaders | test | public function getHeaders()
{
if ($this->_headers === null) {
$this->_headers = new HeaderCollection();
$headers = $this->reactRequest->getHeaders();
foreach ($headers as $name => $value) {
$this->_headers->add($name, $value);
}
$t... | php | {
"resource": ""
} |
q266399 | RequestHelper.getIsFlash | test | public function getIsFlash()
{
/** @var string $userAgent */
$userAgent = $this->getHeaders()->get('User-Agent', '');
return stripos($userAgent, 'Shockwave') !== false
|| stripos($userAgent, 'Flash') !== false;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.