_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 33
8k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q266100
|
Repository.all
|
test
|
public function all(QueryParameters $queryParameters = null) {
return $this->getQuery(
|
php
|
{
"resource": ""
}
|
q266101
|
Repository.columns
|
test
|
public function columns(array $fields, QueryParameters $queryParameters = null) {
$select = '';
foreach($fields as $field) {
$select .= 'o.' . $field;
if($field !== last($fields)) {
$select .= ', ';
}
|
php
|
{
"resource": ""
}
|
q266102
|
Repository.paginate
|
test
|
public function paginate($perPage = 25, QueryParameters $queryParameters = null, $currentPage = null, $searchQuery = null) {
$currentPage = $currentPage === null ? $this->paginator->getCurrentPage() : $currentPage;
$qb = $this->addSearchConditions($this->createSelectQuery(), $searchQuery);
$qb = $qb->setFirstResult($perPage * ($currentPage - 1))
->setMaxResults($perPage);
|
php
|
{
"resource": ""
}
|
q266103
|
Repository.find
|
test
|
public function find($id, QueryParameters $queryParameters = null) {
$q = $this->getQuery(
$this->createSelectQuery()
->andWhere('o.id = :id')
|
php
|
{
"resource": ""
}
|
q266104
|
Repository.persist
|
test
|
public function persist($entity, $flush = true) {
$this->entities->persist($entity);
if($flush)
|
php
|
{
"resource": ""
}
|
q266105
|
Repository.delete
|
test
|
public function delete($entity, $flush = true) {
$this->entities->remove($entity);
if($flush)
|
php
|
{
"resource": ""
}
|
q266106
|
Repository.count
|
test
|
public function count(QueryParameters $queryParameters = null) {
return (int) $this->getQuery(
|
php
|
{
"resource": ""
}
|
q266107
|
Repository.createSelectQuery
|
test
|
protected function createSelectQuery($alias = 'o', $indexBy = null) {
return $this->entities
->createQueryBuilder()
|
php
|
{
"resource": ""
}
|
q266108
|
Repository.applyScopesToQueryBuilder
|
test
|
protected function applyScopesToQueryBuilder(QueryBuilder $qb, array $scopes) {
foreach((array) $scopes as $scope) {
$method = 'scope' . ucfirst($scope);
if(method_exists($this, $method)) {
$qb = $this->{$method}($qb);
|
php
|
{
"resource": ""
}
|
q266109
|
Repository.applyOrderByToQueryBuilder
|
test
|
private function applyOrderByToQueryBuilder(QueryBuilder $queryBuilder, array $orderBy, $alias) {
|
php
|
{
"resource": ""
}
|
q266110
|
Repository.makeNoResultException
|
test
|
protected function makeNoResultException(\Exception $e, Query $q) {
return
|
php
|
{
"resource": ""
}
|
q266111
|
Repository.replaceQueryParameters
|
test
|
private function replaceQueryParameters($query, $parameters) {
foreach($parameters as $parameter) {
$value = $parameter->getValue();
|
php
|
{
"resource": ""
}
|
q266112
|
Client.addMethod
|
test
|
public function addMethod(RPC\Method $method)
{
$tmp
|
php
|
{
"resource": ""
}
|
q266113
|
Client.getMethod
|
test
|
public function getMethod($name)
{
var_dump(array_keys($this->methods));
if (!isset($this->methods[$name])) {
|
php
|
{
"resource": ""
}
|
q266114
|
Client.shutdown
|
test
|
public function shutdown($message = null)
{
if (!$this->loop) {
return false;
}
if ($message) {
|
php
|
{
"resource": ""
}
|
q266115
|
Header.add
|
test
|
public function add(array $headers) {
foreach ($headers as $key
|
php
|
{
"resource": ""
}
|
q266116
|
Header.setLink
|
test
|
public function setLink($url, $as, $type = null, $crossorigin = false, $nopush = false) {
$args = [
sprintf('<%s>', $url),
'rel=preload',
'as='.$as
|
php
|
{
"resource": ""
}
|
q266117
|
ApiGallery.newRequest
|
test
|
public function newRequest(RequestAdapter $request = null)
{
if (empty($request)) {
$request = new GuzzleRequest;
|
php
|
{
"resource": ""
}
|
q266118
|
ApiGallery.newPhoto
|
test
|
public function newPhoto(PhotoAdapter $photo = null)
{
if (empty($photo)) {
$class = $this->getChildClassNamespace() . '\\Photo';
$photo = new $class;
}
|
php
|
{
"resource": ""
}
|
q266119
|
Expr.range
|
test
|
public function range($val, $x, $y)
{
return
|
php
|
{
"resource": ""
}
|
q266120
|
Session.session_start
|
test
|
final public static function session_start()
{
if ( self::$started ) trigger_error('Session already started', E_USER_WARNING);
self::$started = true;
if ( isset($_COOKIE[session_name()]) ) {
self::$id = $_COOKIE[session_name()];
} else {
self::$id = uniqid();
$config = self::session_get_cookie_params();
Cookie::setcookie(
session_name(), self::$id,
$config['lifetime'], $config['path'], $config['domain'],
$config['secure'], $config['httponly']
);
}
if ( !$savePath = session_save_path()
|
php
|
{
"resource": ""
}
|
q266121
|
Session.session_regenerate_id
|
test
|
final public static function session_regenerate_id($delete_old_session = false)
{
if ( !self::$started ) return false;
if ( $delete_old_session ) self::session_destroy();
else {
self::$started = null;
|
php
|
{
"resource": ""
}
|
q266122
|
Session.session_write_close
|
test
|
final public static function session_write_close()
{
if ( !self::$started ) return;
if (self::$handler) {
self::$handler->write(self::$id, self::session_encode());
self::$handler->close();
|
php
|
{
"resource": ""
}
|
q266123
|
Session.session_unset
|
test
|
final public static function session_unset()
{
if ( !isset($_SESSION) )
|
php
|
{
"resource": ""
}
|
q266124
|
Session.session_destroy
|
test
|
final public static function session_destroy()
{
if ( !self::$started ) return false;
self::reset();
|
php
|
{
"resource": ""
}
|
q266125
|
Session.session_decode
|
test
|
final public static function session_decode($data)
{
if ( !$values = unserialize($data) ) return false;
foreach ($values as $key => $value) {
|
php
|
{
"resource": ""
}
|
q266126
|
Session.session_cache_expire
|
test
|
final public static function session_cache_expire($new_cache_expire = null)
{
if( !$new_cache_expire ) return (int) ini_get('session.cache_expire');
|
php
|
{
"resource": ""
}
|
q266127
|
StaticInstanceTrait.instance
|
test
|
public static function instance($refresh = false)
{
$className = get_called_class();
if ($refresh || !isset(self::$_instances[$className]))
|
php
|
{
"resource": ""
}
|
q266128
|
Form.getModuleOptions
|
test
|
protected function getModuleOptions()
{
$entitys = $this->moduleService->getAll(array(
'pagination' => 'off'
));
$options = array();
|
php
|
{
"resource": ""
}
|
q266129
|
Matrix.getSize
|
test
|
public function getSize($which = null)
{
if (!empty($which)) {
return (isset($this->_size[$which]) ? $this->_size[$which] :
|
php
|
{
"resource": ""
}
|
q266130
|
Matrix.setWalkFlag
|
test
|
public function setWalkFlag($flag, $auto_rewind = true)
{
$this->_walk_flag = $flag;
if (true==$auto_rewind) {
|
php
|
{
"resource": ""
}
|
q266131
|
Matrix.setArrayFlag
|
test
|
public function setArrayFlag($flag, $auto_rewind = true)
{
$this->_array_flag = $flag;
if (true==$auto_rewind) {
|
php
|
{
"resource": ""
}
|
q266132
|
Matrix.setData
|
test
|
public function setData(array $data = null)
{
$line_length = $column_length = 0;
foreach ($data as $x=>$items) {
if (!is_array($items)) {
throw new InvalidArgumentException(
"Data parameter of matrix must be a 2 dimensional array (array of arrays)!"
);
}
if (count($items)>$line_length) {
|
php
|
{
"resource": ""
}
|
q266133
|
Matrix.get
|
test
|
public function get($index)
{
try {
if (is_string($index)) {
if ($this->getWalkFlag() & self::WALK_X) {
$ret = $this->getX($index);
} elseif ($this->getWalkFlag() & self::WALK_Y) {
$ret = $this->getY($index);
} else {
$ret = $this->getXY($index);
|
php
|
{
"resource": ""
}
|
q266134
|
Matrix.set
|
test
|
public function set($index, $value)
{
try {
if (is_string($index)) {
if ($this->getWalkFlag() & self::WALK_X) {
$this->setX($index, $value);
} elseif ($this->getWalkFlag() & self::WALK_Y) {
$this->setY($index, $value);
} else {
$this->setXY($index, $value);
|
php
|
{
"resource": ""
}
|
q266135
|
Matrix.rewind
|
test
|
public function rewind()
{
if ($this->getWalkFlag() & self::WALK_X) {
return $this->rewindX();
} elseif ($this->getWalkFlag() & self::WALK_Y) {
|
php
|
{
"resource": ""
}
|
q266136
|
Matrix.previous
|
test
|
public function previous()
{
if ($this->getWalkFlag() & self::WALK_X) {
return $this->previousX();
} elseif ($this->getWalkFlag() & self::WALK_Y) {
|
php
|
{
"resource": ""
}
|
q266137
|
Matrix.previousX
|
test
|
public function previousX()
{
if ($this->previousXExists()) {
$this->seekX($this->keyX()-1);
} else {
|
php
|
{
"resource": ""
}
|
q266138
|
Matrix.previousY
|
test
|
public function previousY()
{
if ($this->previousYExists()) {
$this->seekY($this->keyY()-1);
} else {
|
php
|
{
"resource": ""
}
|
q266139
|
Matrix.previousXY
|
test
|
public function previousXY()
{
if (($this->keyY()-1)>0) {
$this->seekY($this->keyY()-1);
} else {
if (($this->keyX()-1)>0) {
$this->rewindY();
$this->seekX($this->keyX()-1);
|
php
|
{
"resource": ""
}
|
q266140
|
Matrix.next
|
test
|
public function next()
{
if ($this->getWalkFlag() & self::WALK_X) {
return $this->nextX();
} elseif ($this->getWalkFlag() & self::WALK_Y) {
|
php
|
{
"resource": ""
}
|
q266141
|
Matrix.nextX
|
test
|
public function nextX()
{
if ($this->nextXExists()) {
$this->seekX($this->keyX()+1);
} else {
|
php
|
{
"resource": ""
}
|
q266142
|
Matrix.nextY
|
test
|
public function nextY()
{
if ($this->nextYExists()) {
$this->seekY($this->keyY()+1);
} else {
|
php
|
{
"resource": ""
}
|
q266143
|
Matrix.nextXY
|
test
|
public function nextXY()
{
if (($this->keyY()+1)<=$this->countY()) {
$this->seekY($this->keyY()+1);
} else {
if (($this->keyX()+1)<=$this->countX()) {
$this->rewindY();
$this->seekX($this->keyX()+1);
|
php
|
{
"resource": ""
}
|
q266144
|
Matrix.seek
|
test
|
public function seek($index)
{
try {
if ($this->getWalkFlag() & self::WALK_X) {
return $this->seekX($index);
} elseif ($this->getWalkFlag() & self::WALK_Y) {
|
php
|
{
"resource": ""
}
|
q266145
|
Matrix.current
|
test
|
public function current()
{
if ($this->getWalkFlag() & self::WALK_X) {
return $this->currentX();
} elseif ($this->getWalkFlag() & self::WALK_Y) {
|
php
|
{
"resource": ""
}
|
q266146
|
Matrix.key
|
test
|
public function key()
{
if ($this->getWalkFlag() & self::WALK_X) {
return $this->keyX();
} elseif ($this->getWalkFlag() & self::WALK_Y) {
|
php
|
{
"resource": ""
}
|
q266147
|
Matrix.valid
|
test
|
public function valid()
{
if ($this->getWalkFlag() & self::WALK_X) {
return $this->validX();
} elseif ($this->getWalkFlag() & self::WALK_Y) {
|
php
|
{
"resource": ""
}
|
q266148
|
Matrix.validX
|
test
|
public function validX()
{
return (bool) (!is_null($this->keyX()) &&
|
php
|
{
"resource": ""
}
|
q266149
|
Matrix.validY
|
test
|
public function validY()
{
return (bool) ($this->validX()
|
php
|
{
"resource": ""
}
|
q266150
|
Matrix.count
|
test
|
public function count()
{
if ($this->getWalkFlag() & self::WALK_X) {
return $this->countX();
} elseif ($this->getWalkFlag() & self::WALK_Y) {
|
php
|
{
"resource": ""
}
|
q266151
|
Matrix.seekToOffset
|
test
|
public function seekToOffset($offset)
{
try {
if (($this->getArrayFlag() & self::ARRAY_INT) && !is_string($offset)) {
return $this->seekToOffsetInteger($offset);
} else {
|
php
|
{
"resource": ""
}
|
q266152
|
Matrix.seekToOffsetInteger
|
test
|
public function seekToOffsetInteger($offset)
{
$indexes = explode(self::XY_SEPARATOR, $offset);
try {
if (count($indexes)==2) {
if ($indexes[0]=='') {
$this->seekY($indexes[1]);
} else {
$this->seekXY($offset);
}
|
php
|
{
"resource": ""
}
|
q266153
|
Matrix.offsetExists
|
test
|
public function offsetExists($offset)
{
try {
$res = $this
->seekToOffset($offset)
->valid();
|
php
|
{
"resource": ""
}
|
q266154
|
Matrix.offsetGet
|
test
|
public function offsetGet($offset)
{
try {
$res = $this
->seekToOffset($offset)
->current();
} catch (OutOfRangeException $e) {
$res = null;
|
php
|
{
"resource": ""
}
|
q266155
|
Matrix.offsetSet
|
test
|
public function offsetSet($offset, $value)
{
try {
$this
->seekToOffset($offset)
|
php
|
{
"resource": ""
}
|
q266156
|
Boolean.IsValid
|
test
|
public function IsValid() {
if (!is_bool($this->value)) {
$errorMsg = 'The $value property of the instance of ' . __CLASS__ . ' is not a boolean.';
|
php
|
{
"resource": ""
}
|
q266157
|
Router.allowViewMethods
|
test
|
public function allowViewMethods(string $object, ...$allowedMethods)
{
if (isset($this->viewMethods[$object]) === false) {
$this->viewMethods[$object] = [];
}
foreach ($allowedMethods
|
php
|
{
"resource": ""
}
|
q266158
|
Router.allowControllerMethods
|
test
|
public function allowControllerMethods(string $object, ...$allowedMethods)
{
if (isset($this->controllerMethods[$object]) === false) {
$this->controllerMethods[$object] = [];
}
foreach ($allowedMethods
|
php
|
{
"resource": ""
}
|
q266159
|
Query.table
|
test
|
public function table(string $table)
{
$this->changed = true;
|
php
|
{
"resource": ""
}
|
q266160
|
Query.from
|
test
|
public function from(string ...$table)
{
$this->changed = true;
|
php
|
{
"resource": ""
}
|
q266161
|
Query.andWhere
|
test
|
public function andWhere(array $conditions)
{
$this->changed = true;
if ($this->conditions) {
$this->conditions = [
|
php
|
{
"resource": ""
}
|
q266162
|
Query.orWhere
|
test
|
public function orWhere(array $conditions)
{
$this->changed = true;
if ($this->conditions) {
$this->conditions = [
|
php
|
{
"resource": ""
}
|
q266163
|
Zend_Filter_Inflector.setStaticRule
|
test
|
public function setStaticRule($name, $value)
{
$name = $this->_normalizeSpec($name);
|
php
|
{
"resource": ""
}
|
q266164
|
Zend_Filter_Inflector.setStaticRuleReference
|
test
|
public function setStaticRuleReference($name, &$reference)
{
$name = $this->_normalizeSpec($name);
|
php
|
{
"resource": ""
}
|
q266165
|
Zend_Filter_Inflector._getRule
|
test
|
protected function _getRule($rule)
{
if ($rule instanceof Zend_Filter_Interface) {
return $rule;
}
$rule = (string) $rule;
$className = $this->getPluginLoader()->load($rule);
$ruleObject = new $className();
if (!$ruleObject instanceof Zend_Filter_Interface) {
|
php
|
{
"resource": ""
}
|
q266166
|
View.endBody
|
test
|
public function endBody()
{
$this->emit(self::EVENT_END_BODY, [$this]);
echo self::PH_BODY_END;
|
php
|
{
"resource": ""
}
|
q266167
|
View.registerJsFile
|
test
|
public function registerJsFile($url, $options = [], $key = null)
{
$url = \Reaction::$app->getAlias($url);
$key = $key ?: $url;
$helpers = $this->app->helpers;
$depends = ArrayHelper::remove($options, 'depends', []);
if (empty($depends)) {
$position = ArrayHelper::remove($options, 'position', self::POS_END);
$this->jsFiles[$position][$key] = $helpers->html->jsFile($url, $options);
} else {
$this->getAssetManager()->bundles[$key] = Reaction::create([
'class' => AssetBundle::class,
|
php
|
{
"resource": ""
}
|
q266168
|
View.registerJsVar
|
test
|
public function registerJsVar($name, $value, $position = self::POS_HEAD)
{
$js = sprintf('var %s =
|
php
|
{
"resource": ""
}
|
q266169
|
PEAR_Config.getDefaultConfigFiles
|
test
|
function getDefaultConfigFiles()
{
$sl = DIRECTORY_SEPARATOR;
if (OS_WINDOWS) {
return array(
'user' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini',
'system' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini'
|
php
|
{
"resource": ""
}
|
q266170
|
PEAR_Config.&
|
test
|
function &singleton($user_file = '', $system_file = '', $strict = true)
{
if (is_object($GLOBALS['_PEAR_Config_instance'])) {
return $GLOBALS['_PEAR_Config_instance'];
}
$t_conf = &new PEAR_Config($user_file, $system_file, false, $strict);
if ($t_conf->_errorsFound > 0)
|
php
|
{
"resource": ""
}
|
q266171
|
PEAR_Config._setupChannels
|
test
|
function _setupChannels()
{
$set = array_flip(array_values($this->_channels));
foreach ($this->configuration as $layer => $data) {
$i = 1000;
if (isset($data['__channels']) && is_array($data['__channels'])) {
foreach ($data['__channels'] as $channel => $info) {
|
php
|
{
"resource": ""
}
|
q266172
|
PEAR_Config.mergeConfigFile
|
test
|
function mergeConfigFile($file, $override = true, $layer = 'user', $strict = true)
{
if (empty($this->files[$layer])) {
return $this->raiseError("unknown config layer `$layer'");
}
if ($file === null) {
$file = $this->files[$layer];
}
$data = $this->_readConfigDataFrom($file);
if (PEAR::isError($data)) {
if (!$strict) {
return true;
}
$this->_errorsFound++;
$this->lastError = $data;
|
php
|
{
"resource": ""
}
|
q266173
|
PEAR_Config.writeConfigFile
|
test
|
function writeConfigFile($file = null, $layer = 'user', $data = null)
{
$this->_lazyChannelSetup($layer);
if ($layer == 'both' || $layer == 'all') {
foreach ($this->files as $type => $file) {
$err = $this->writeConfigFile($file, $type, $data);
if (PEAR::isError($err)) {
return $err;
}
}
return true;
}
if (empty($this->files[$layer])) {
return $this->raiseError("unknown config file type `$layer'");
}
if ($file === null) {
$file = $this->files[$layer];
}
$data = ($data === null) ? $this->configuration[$layer] : $data;
$this->_encodeOutput($data);
$opt = array('-p', dirname($file));
if (!@System::mkDir($opt)) {
|
php
|
{
"resource": ""
}
|
q266174
|
PEAR_Config._readConfigDataFrom
|
test
|
function _readConfigDataFrom($file)
{
$fp = false;
if (file_exists($file)) {
$fp = @fopen($file, "r");
}
if (!$fp) {
return $this->raiseError("PEAR_Config::readConfigFile fopen('$file','r') failed");
}
$size = filesize($file);
$rt = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
fclose($fp);
$contents = file_get_contents($file);
if (empty($contents)) {
return $this->raiseError('Configuration file "' . $file . '" is empty');
}
set_magic_quotes_runtime($rt);
$version = false;
if (preg_match('/^#PEAR_Config\s+(\S+)\s+/si', $contents, $matches)) {
$version = $matches[1];
$contents = substr($contents, strlen($matches[0]));
} else {
// Museum
|
php
|
{
"resource": ""
}
|
q266175
|
PEAR_Config.getDefaultChannel
|
test
|
function getDefaultChannel($layer = null)
{
$ret = false;
if ($layer === null) {
foreach ($this->layers as $layer) {
if (isset($this->configuration[$layer]['default_channel'])) {
$ret = $this->configuration[$layer]['default_channel'];
break;
}
|
php
|
{
"resource": ""
}
|
q266176
|
PEAR_Config._getChannelValue
|
test
|
function _getChannelValue($key, $layer, $channel)
{
if ($key == '__channels' || $channel == 'pear.php.net') {
return null;
}
$ret = null;
if ($layer === null) {
foreach ($this->layers as $ilayer) {
if (isset($this->configuration[$ilayer]['__channels'][$channel][$key])) {
$ret = $this->configuration[$ilayer]['__channels'][$channel][$key];
break;
}
}
} elseif (isset($this->configuration[$layer]['__channels'][$channel][$key])) {
$ret = $this->configuration[$layer]['__channels'][$channel][$key];
}
if ($key != 'preferred_mirror') {
return $ret;
}
if ($ret !== null) {
$reg = &$this->getRegistry($layer);
if (is_object($reg)) {
$chan = &$reg->getChannel($channel);
if (PEAR::isError($chan)) {
|
php
|
{
"resource": ""
}
|
q266177
|
PEAR_Config.setChannels
|
test
|
function setChannels($channels, $merge = false)
{
if (!is_array($channels)) {
return false;
}
if ($merge) {
$this->_channels = array_merge($this->_channels, $channels);
} else {
$this->_channels = $channels;
}
foreach ($channels as $channel) {
$channel = strtolower($channel);
if ($channel == 'pear.php.net') {
|
php
|
{
"resource": ""
}
|
q266178
|
PEAR_Config.getType
|
test
|
function getType($key)
{
if (isset($this->configuration_info[$key])) {
|
php
|
{
"resource": ""
}
|
q266179
|
PEAR_Config.getDocs
|
test
|
function getDocs($key)
{
if (isset($this->configuration_info[$key])) {
|
php
|
{
"resource": ""
}
|
q266180
|
PEAR_Config.getPrompt
|
test
|
function getPrompt($key)
{
if (isset($this->configuration_info[$key])) {
|
php
|
{
"resource": ""
}
|
q266181
|
PEAR_Config.getGroup
|
test
|
function getGroup($key)
{
if (isset($this->configuration_info[$key])) {
|
php
|
{
"resource": ""
}
|
q266182
|
PEAR_Config.getGroups
|
test
|
function getGroups()
{
$tmp = array();
foreach ($this->configuration_info as
|
php
|
{
"resource": ""
}
|
q266183
|
PEAR_Config.getGroupKeys
|
test
|
function getGroupKeys($group)
{
$keys = array();
foreach ($this->configuration_info as $key
|
php
|
{
"resource": ""
}
|
q266184
|
PEAR_Config.getSetValues
|
test
|
function getSetValues($key)
{
if (isset($this->configuration_info[$key]) &&
isset($this->configuration_info[$key]['type']) &&
$this->configuration_info[$key]['type'] == 'set')
{
$valid_set = $this->configuration_info[$key]['valid_set'];
|
php
|
{
"resource": ""
}
|
q266185
|
PEAR_Config.getKeys
|
test
|
function getKeys()
{
$keys = array();
foreach ($this->layers as $layer) {
$test = $this->configuration[$layer];
if (isset($test['__channels'])) {
|
php
|
{
"resource": ""
}
|
q266186
|
PEAR_Config.remove
|
test
|
function remove($key, $layer = 'user', $channel = null)
{
if ($channel === null) {
$channel = $this->getDefaultChannel();
}
if ($channel !== 'pear.php.net') {
if (isset($this->configuration[$layer]['__channels'][$channel][$key])) {
unset($this->configuration[$layer]['__channels'][$channel][$key]);
return true;
|
php
|
{
"resource": ""
}
|
q266187
|
PEAR_Config.removeLayer
|
test
|
function removeLayer($layer)
{
if (isset($this->configuration[$layer])) {
$this->configuration[$layer] = array();
|
php
|
{
"resource": ""
}
|
q266188
|
PEAR_Config.definedBy
|
test
|
function definedBy($key, $returnchannel = false)
{
foreach ($this->layers as $layer) {
$channel = $this->getDefaultChannel();
if ($channel !== 'pear.php.net') {
if (isset($this->configuration[$layer]['__channels'][$channel][$key])) {
if ($returnchannel) {
return array('layer' => $layer, 'channel' => $channel);
}
|
php
|
{
"resource": ""
}
|
q266189
|
PEAR_Config.isDefined
|
test
|
function isDefined($key)
{
foreach ($this->layers as $layer) {
if (isset($this->configuration[$layer][$key])) {
|
php
|
{
"resource": ""
}
|
q266190
|
PEAR_Config.setRegistry
|
test
|
function setRegistry(&$reg, $layer = 'user')
{
if ($this->_noRegistry) {
return false;
}
if (!in_array($layer, array('user', 'system'))) {
return false;
}
$this->_registry[$layer] =
|
php
|
{
"resource": ""
}
|
q266191
|
Zend_Config_Json._processExtends
|
test
|
protected function _processExtends(array $data, $section, array $config = array())
{
if (!isset($data[$section])) {
throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section));
}
$thisSection = $data[$section];
if (is_array($thisSection) && isset($thisSection[self::EXTENDS_NAME])) {
if (is_array($thisSection[self::EXTENDS_NAME])) {
|
php
|
{
"resource": ""
}
|
q266192
|
Zend_Config_Json._replaceConstants
|
test
|
protected function _replaceConstants($value)
{
foreach ($this->_getConstants() as $constant) {
if (strstr($value, $constant)) {
// handle backslashes that may represent windows path names for instance
|
php
|
{
"resource": ""
}
|
q266193
|
PdoWriter.getCallback
|
test
|
protected function getCallback(): callable
{
if ($this->callback === null) {
$this->callback = function (LogInterface $log): array {
$metaData = $log->getMetaData() ?: null;
if (is_array($metaData) === true) {
$metaData = json_encode($metaData, JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_UNESCAPED_SLASHES);
}
$priority = $log->getPriority();
return [
|
php
|
{
"resource": ""
}
|
q266194
|
Enum.isValid
|
test
|
public static function isValid($value): bool
{
if (\is_array($value) || \is_object($value)) {
return false;
}
// Get the valid values to compare with
$validValues = static::validValues();
// If the value isset in the valid values array and the value matches
// the value to check
// ?? Why is this here ??
// As is known by all isset is faster than in_array. We want to
// capitalize on that with some enums by making the const VALUES
// array a key value pair of the value itself so that we've
// essentially got value => value for each item in the const VALUES
// array. This way we can take advantage of the quickness of isset over
// in_array. However, because not all enums may do this
|
php
|
{
"resource": ""
}
|
q266195
|
Enum.validValues
|
test
|
public static function validValues(): array
{
// If the const VALUES array has been populated
if (null !== static::VALUES) {
// Use it as the developer took the time to define it
return static::VALUES;
}
// Get the class name that was called
$className =
|
php
|
{
"resource": ""
}
|
q266196
|
Enum.reflectionValidValues
|
test
|
protected static function reflectionValidValues(): array
{
try {
// Get a reflection class of the enum
$reflectionClass = new ReflectionClass(static::class);
$values = $reflectionClass->getConstants();
} // Catch any exceptions
catch (\Exception $exception) {
$values = [];
}
$validValues = [];
// Iterate through the values
foreach ($values as $key => $value) {
// If this value is defined in this abstract Enum (self)
|
php
|
{
"resource": ""
}
|
q266197
|
Enum.setValue
|
test
|
public function setValue($value): void
{
// If the value is not valid
if (! static::isValid($value)) {
// Throw an exception
throw new InvalidArgumentException(
sprintf(
|
php
|
{
"resource": ""
}
|
q266198
|
PEAR_Task_Postinstallscript.init
|
test
|
function init($xml, $fileattribs, $lastversion)
{
$this->_class = str_replace('/', '_', $fileattribs['name']);
$this->_filename =
|
php
|
{
"resource": ""
}
|
q266199
|
PEAR_Task_Postinstallscript.startSession
|
test
|
function startSession($pkg, $contents)
{
if ($this->installphase != PEAR_TASK_INSTALL) {
return false;
}
// remove the tasks: namespace if present
$this->_pkg = $pkg;
$this->_stripNamespace();
$this->logger->log(0, 'Including external post-installation script "' .
$contents . '" - any errors are in this script');
include_once $contents;
if (class_exists($this->_class)) {
$this->logger->log(0, 'Inclusion succeeded');
} else {
return $this->throwError('init of post-install script class "' . $this->_class
. '" failed');
}
$this->_obj = new $this->_class;
|
php
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.