_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 33
8k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q266600
|
DatabaseOptions.setDataColumn
|
test
|
public function setDataColumn($dataColumn)
{
$dataColumn = (string) $dataColumn;
/** @noinspection IsEmptyFunctionUsageInspection */
if (empty($dataColumn)) {
|
php
|
{
"resource": ""
}
|
q266601
|
DatabaseOptions.setLifetimeColumn
|
test
|
public function setLifetimeColumn($lifetimeColumn)
{
$lifetimeColumn = (string) $lifetimeColumn;
/** @noinspection IsEmptyFunctionUsageInspection */
if (empty($lifetimeColumn)) {
|
php
|
{
"resource": ""
}
|
q266602
|
DatabaseOptions.setModifiedColumn
|
test
|
public function setModifiedColumn($modifiedColumn)
{
$modifiedColumn = (string) $modifiedColumn;
/** @noinspection IsEmptyFunctionUsageInspection */
if (empty($modifiedColumn)) {
|
php
|
{
"resource": ""
}
|
q266603
|
DatabaseOptions.setCreatedColumn
|
test
|
public function setCreatedColumn($createdColumn)
{
$createdColumn = (string) $createdColumn;
/** @noinspection IsEmptyFunctionUsageInspection */
if (empty($createdColumn)) {
|
php
|
{
"resource": ""
}
|
q266604
|
Social.providers
|
test
|
public static function providers()
{
return collect(Settings::first()->fillable)->filter(function ($value) {
return strpos($value, '_client_id') !== false;
|
php
|
{
"resource": ""
}
|
q266605
|
Social.availableProviders
|
test
|
public static function availableProviders()
{
$settings = Settings::first();
return collect(static::providers())->filter(function ($value) use
|
php
|
{
"resource": ""
}
|
q266606
|
ContentNegotiationServiceProvider.boot
|
test
|
public function boot(Application $app)
{
$app->before(array($this, "setRequestFormat"), Application::EARLY_EVENT);
|
php
|
{
"resource": ""
}
|
q266607
|
ContentNegotiationServiceProvider.register
|
test
|
public function register(Container $app)
{
$app["conneg.responseFormats"] = array("html");
$app["conneg.requestFormats"] = array("form");
$app["conneg.defaultFormat"] = "html";
$app["conneg"] = function (Container $app) {
if ($app->offsetExists("serializer")) {
if ($app["serializer"] instanceof JMS\Serializer) {
if (!$app->offsetExists("conneg.serializationContext")) {
$app["conneg.serializationContext"] = null;
}
if (!$app->offsetExists("conneg.deserializationContext")) {
|
php
|
{
"resource": ""
}
|
q266608
|
ContentNegotiationServiceProvider.setRequestFormat
|
test
|
public function setRequestFormat(Request $request, Application $app)
{
// If there is no Accept header, do nothing
if (!$request->headers->get("Accept")) {
return;
}
// Check the Accept header for acceptable formats
foreach ($request->getAcceptableContentTypes() as $contentType) {
// If any format is acceptable, do nothing
if ($contentType === "*/*") {
return;
}
$format = $request->getFormat($contentType);
|
php
|
{
"resource": ""
}
|
q266609
|
ContentNegotiationServiceProvider.validateRequestContentType
|
test
|
public function validateRequestContentType(Request $request, Application $app)
{
// Define the "form" format so we can use it for validation
$request->setFormat("form", array("application/x-www-form-urlencoded", "multipart/form-data"));
$format = $request->getContentType();
|
php
|
{
"resource": ""
}
|
q266610
|
ReturnPromise.execute
|
test
|
public function execute(array $args, FunctionProphecy $function)
{
$value = array_shift($this->returnValues);
if (!count($this->returnValues)) {
|
php
|
{
"resource": ""
}
|
q266611
|
PEAR_Downloader.discover
|
test
|
function discover($channel)
{
$this->log(1, 'Attempting to discover channel "' . $channel . '"...');
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$callback = $this->ui ? array(&$this, '_downloadCallback') : null;
if (!class_exists('System')) {
require_once 'System.php';
}
$tmpdir = $this->config->get('temp_dir');
$tmp = System::mktemp('-d -t "' . $tmpdir . '"');
$a = $this->downloadHttp('http://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
PEAR::popErrorHandling();
if (PEAR::isError($a)) {
// Attempt to fallback to https automatically.
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$this->log(1, 'Attempting fallback to https instead of http on channel "' . $channel . '"...');
$a = $this->downloadHttp('https://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
PEAR::popErrorHandling();
if (PEAR::isError($a)) {
return false;
}
}
list($a, $lastmodified) = $a;
if (!class_exists('PEAR_ChannelFile')) {
require_once 'PEAR/ChannelFile.php';
|
php
|
{
"resource": ""
}
|
q266612
|
PEAR_Downloader.&
|
test
|
function &getDependency2Object(&$c, $i, $p, $s)
{
if (!class_exists('PEAR_Dependency2')) {
require_once 'PEAR/Dependency2.php';
|
php
|
{
"resource": ""
}
|
q266613
|
PEAR_Downloader.getDownloadDir
|
test
|
function getDownloadDir()
{
if (isset($this->_downloadDir)) {
return $this->_downloadDir;
}
$downloaddir = $this->config->get('download_dir');
if (empty($downloaddir) || (is_dir($downloaddir) && !is_writable($downloaddir))) {
if (is_dir($downloaddir) && !is_writable($downloaddir)) {
$this->log(0, 'WARNING: configuration download directory "' . $downloaddir .
'" is not writeable. Change download_dir config variable to ' .
'a writeable dir to avoid this warning');
}
if (!class_exists('System')) {
require_once 'System.php';
}
if (PEAR::isError($downloaddir = System::mktemp('-d'))) {
return $downloaddir;
}
$this->log(3, '+ tmp dir created at ' . $downloaddir);
|
php
|
{
"resource": ""
}
|
q266614
|
PEAR_Downloader._detectDepCycle
|
test
|
function _detectDepCycle(&$deplinks)
{
do {
$keepgoing = false;
foreach ($deplinks as $dep => $parents) {
foreach ($parents as $parent => $unused) {
// reset the parent cycle detector
$this->_testCycle(null, null, null);
if ($this->_testCycle($dep, $deplinks, $parent)) {
$keepgoing = true;
|
php
|
{
"resource": ""
}
|
q266615
|
PEAR_Downloader._setupGraph
|
test
|
function _setupGraph($t, $reg, &$deplinks, &$nodes, $package)
{
foreach ($t as $dep) {
$depchannel = !isset($dep['channel']) ? '__uri': $dep['channel'];
$dname = $reg->parsedPackageNameToString(
array(
'channel' => $depchannel,
'package' => strtolower($dep['name']),
));
|
php
|
{
"resource": ""
}
|
q266616
|
Request.getUrlArg
|
test
|
public function getUrlArg($param = null, $default = false)
{
$routes = CarteBlanche::getContainer()->get('router')->getRouteParsed();
if (!empty($routes)) {
if ($param=='args') {
if (isset($routes['args']))
return $routes['args'];
} else {
if (isset($routes[$param]))
|
php
|
{
"resource": ""
}
|
q266617
|
Console.outputLine
|
test
|
public function outputLine($string = '', $translate = true)
{
if ($translate) {
|
php
|
{
"resource": ""
}
|
q266618
|
Console.getArgs
|
test
|
public function getArgs($strict = false, $force = false)
{
if (is_null($this->args) || $force) {
$this->args = new \cli\Arguments($strict);
$this->args->addFlag(array(
|
php
|
{
"resource": ""
}
|
q266619
|
NoCaptchaServiceProvider.registerNoCaptcha
|
test
|
private function registerNoCaptcha()
{
$this->singleton(Contracts\NoCaptcha::class, function($app) {
/** @var \Illuminate\Config\Repository $config */
$config = $app['config'];
return new NoCaptcha(
$config->get('no-captcha.secret'),
$config->get('no-captcha.sitekey'),
|
php
|
{
"resource": ""
}
|
q266620
|
NoCaptchaServiceProvider.registerValidatorRules
|
test
|
private function registerValidatorRules($app)
{
$app['validator']->extend('captcha', function($attribute, $value) use ($app) {
unset($attribute);
|
php
|
{
"resource": ""
}
|
q266621
|
NoCaptchaServiceProvider.registerFormMacros
|
test
|
private function registerFormMacros($app)
{
if ($app->bound('form')) {
$app['form']->macro('captcha', function($name = null, array $attributes = []) use ($app) {
|
php
|
{
"resource": ""
}
|
q266622
|
PEAR_ChannelFile.fromXmlFile
|
test
|
function fromXmlFile($descfile)
{
if (!file_exists($descfile) || !is_file($descfile) || !is_readable($descfile) ||
(!$fp = fopen($descfile, 'r'))) {
require_once 'PEAR.php';
return PEAR::raiseError("Unable to open $descfile");
}
//
|
php
|
{
"resource": ""
}
|
q266623
|
PEAR_ChannelFile.fromAny
|
test
|
function fromAny($info)
{
if (is_string($info) && file_exists($info) && strlen($info) < 255) {
$tmp = substr($info, -4);
if ($tmp == '.xml') {
$info = $this->fromXmlFile($info);
} else {
$fp = fopen($info, "r");
$test = fread($fp, 5);
fclose($fp);
if ($test == "<?xml") {
$info = $this->fromXmlFile($info);
|
php
|
{
"resource": ""
}
|
q266624
|
PEAR_ChannelFile.toXml
|
test
|
function toXml()
{
if (!$this->_isValid && !$this->validate()) {
$this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID);
return false;
}
if (!isset($this->_channelInfo['attribs']['version'])) {
$this->_channelInfo['attribs']['version'] = '1.0';
}
$channelInfo = $this->_channelInfo;
$ret = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
$ret .= "<channel version=\"" .
$channelInfo['attribs']['version'] . "\" xmlns=\"http://pear.php.net/channel-1.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:schemaLocation=\"http://pear.php.net/dtd/channel-"
. $channelInfo['attribs']['version'] . " http://pear.php.net/dtd/channel-" .
$channelInfo['attribs']['version'] . ".xsd\">
<name>$channelInfo[name]</name>
<summary>" . htmlspecialchars($channelInfo['summary'])."</summary>
";
if (isset($channelInfo['suggestedalias'])) {
$ret .= ' <suggestedalias>' . $channelInfo['suggestedalias'] . "</suggestedalias>\n";
}
if (isset($channelInfo['validatepackage'])) {
$ret .= ' <validatepackage version="' .
$channelInfo['validatepackage']['attribs']['version']. '">' .
htmlspecialchars($channelInfo['validatepackage']['_content']) .
"</validatepackage>\n";
}
$ret .= " <servers>\n";
|
php
|
{
"resource": ""
}
|
q266625
|
PEAR_ChannelFile._validateError
|
test
|
function _validateError($code, $params = array())
{
|
php
|
{
"resource": ""
}
|
q266626
|
PEAR_ChannelFile.getBaseURL
|
test
|
function getBaseURL($resourceType, $mirror = false)
{
if ($mirror == $this->_channelInfo['name']) {
$mirror = false;
}
if ($mirror) {
$mir = $this->getMirror($mirror);
if (!$mir) {
return false;
}
$rest = $mir['rest'];
} else {
$rest = $this->_channelInfo['servers']['primary']['rest'];
}
if (!isset($rest['baseurl'][0])) {
$rest['baseurl'] = array($rest['baseurl']);
}
|
php
|
{
"resource": ""
}
|
q266627
|
PEAR_ChannelFile.resetFunctions
|
test
|
function resetFunctions($type, $mirror = false)
{
if ($mirror) {
if (isset($this->_channelInfo['servers']['mirror'])) {
$mirrors = $this->_channelInfo['servers']['mirror'];
if (!isset($mirrors[0])) {
$mirrors = array($mirrors);
}
foreach ($mirrors as $i => $mir) {
if ($mir['attribs']['host'] == $mirror) {
if (isset($this->_channelInfo['servers']['mirror'][$i][$type])) {
unset($this->_channelInfo['servers']['mirror'][$i][$type]);
|
php
|
{
"resource": ""
}
|
q266628
|
PEAR_ChannelFile.setDefaultPEARProtocols
|
test
|
function setDefaultPEARProtocols($version = '1.0', $mirror = false)
{
switch ($version) {
case '1.0' :
$this->resetREST($mirror);
if (!isset($this->_channelInfo['servers'])) {
$this->_channelInfo['servers'] = array('primary' =>
|
php
|
{
"resource": ""
}
|
q266629
|
PEAR_ChannelFile.getMirror
|
test
|
function getMirror($server)
{
foreach ($this->getMirrors() as $mirror) {
if ($mirror['attribs']['host'] == $server) {
|
php
|
{
"resource": ""
}
|
q266630
|
PEAR_ChannelFile.setValidationPackage
|
test
|
function setValidationPackage($validateclass, $version)
{
if (empty($validateclass)) {
unset($this->_channelInfo['validatepackage']);
}
$this->_channelInfo['validatepackage']
|
php
|
{
"resource": ""
}
|
q266631
|
PEAR_ChannelFile.addFunction
|
test
|
function addFunction($type, $version, $name = '', $mirror = false)
{
if ($mirror) {
return $this->addMirrorFunction($mirror, $type, $version, $name);
}
$set = array('attribs' => array('version' => $version), '_content' => $name);
if (!isset($this->_channelInfo['servers']['primary'][$type]['function'])) {
if (!isset($this->_channelInfo['servers'])) {
$this->_channelInfo['servers'] = array('primary' =>
array($type => array()));
} elseif (!isset($this->_channelInfo['servers']['primary'])) {
$this->_channelInfo['servers']['primary'] = array($type => array());
}
|
php
|
{
"resource": ""
}
|
q266632
|
PEAR_ChannelFile.addMirrorFunction
|
test
|
function addMirrorFunction($mirror, $type, $version, $name = '')
{
if (!isset($this->_channelInfo['servers']['mirror'])) {
$this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
array('mirror' => $mirror));
return false;
}
$setmirror = false;
if (isset($this->_channelInfo['servers']['mirror'][0])) {
foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
if ($mirror == $mir['attribs']['host']) {
$setmirror = &$this->_channelInfo['servers']['mirror'][$i];
break;
}
}
} else {
if ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) {
$setmirror = &$this->_channelInfo['servers']['mirror'];
}
}
if (!$setmirror) {
$this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
array('mirror' => $mirror));
|
php
|
{
"resource": ""
}
|
q266633
|
PEAR_ChannelFile.getValidationPackage
|
test
|
function getValidationPackage()
{
if (!$this->_isValid && !$this->validate()) {
return false;
}
if (!isset($this->_channelInfo['validatepackage'])) {
return array('attribs' => array('version' =>
|
php
|
{
"resource": ""
}
|
q266634
|
PEAR_ChannelFile.&
|
test
|
function &getValidationObject($package = false)
{
if (!class_exists('PEAR_Validate')) {
require_once 'PEAR/Validate.php';
}
if (!$this->_isValid) {
if (!$this->validate()) {
$a = false;
return $a;
}
}
if (isset($this->_channelInfo['validatepackage'])) {
if ($package == $this->_channelInfo['validatepackage']) {
// channel validation packages are always validated by PEAR_Validate
$val = &new PEAR_Validate;
return $val;
}
if (!class_exists(str_replace('.', '_',
$this->_channelInfo['validatepackage']['_content']))) {
if ($this->isIncludeable(str_replace('_', '/',
$this->_channelInfo['validatepackage']['_content']) . '.php')) {
include_once str_replace('_', '/',
$this->_channelInfo['validatepackage']['_content']) . '.php';
$vclass = str_replace('.', '_',
|
php
|
{
"resource": ""
}
|
q266635
|
BaseObject.canGetProperty
|
test
|
public function canGetProperty($name, $checkVars = true)
{
$getter = static::_GETTER_PREFIX . $name;
|
php
|
{
"resource": ""
}
|
q266636
|
BaseObject.canSetProperty
|
test
|
public function canSetProperty($name, $checkVars = true)
{
$setter = static::_GETTER_PREFIX . $name;
|
php
|
{
"resource": ""
}
|
q266637
|
Container.getCacheFile
|
test
|
public function getCacheFile(callable $encoder = null): string
{
if (\is_null($encoder)) {
$encoder = function ($value): string {
return var_export($value, true);
};
}
$this->loadCacheParameters();
|
php
|
{
"resource": ""
}
|
q266638
|
Container.loadCacheParameters
|
test
|
private function loadCacheParameters(): void
{
foreach ($this->entryCache as $id => $entry) {
$parameters = $entry->getCacheParameters();
if (!$this->isConstantValue($parameters)) {
|
php
|
{
"resource": ""
}
|
q266639
|
Container.addEntry
|
test
|
public function addEntry(string $id, EntryInterface $type): void
{
if (isset($this[$id])) {
throw new ContainerException("Entry for identifier
|
php
|
{
"resource": ""
}
|
q266640
|
Container.get
|
test
|
public function get($id)
{
if (array_key_exists($id, $this->valueCache)) {
return $this->valueCache[$id];
}
$entry = $this->getEntry($id);
|
php
|
{
"resource": ""
}
|
q266641
|
Container.getEntry
|
test
|
private function getEntry(string $id): EntryInterface
{
if (isset($this->entryCache[$id])) {
return $this->entryCache[$id];
}
if (!isset($this->entries[$id])) {
throw new NotFoundException("No entry was found for the identifier '$id'");
}
|
php
|
{
"resource": ""
}
|
q266642
|
Container.has
|
test
|
public function has($id): bool
{
return isset($this->entries[$id]) ||
|
php
|
{
"resource": ""
}
|
q266643
|
Container.offsetUnset
|
test
|
public function offsetUnset($offset): void
{
unset(
$this->entries[$offset],
|
php
|
{
"resource": ""
}
|
q266644
|
SiteAttribute.applySiteConditions
|
test
|
protected function applySiteConditions()
{
if ($this->siteId !== null) {
$this->andWhere(Db::parseParam('siteId', $this->siteId));
} else {
|
php
|
{
"resource": ""
}
|
q266645
|
AssignByKey.assign
|
test
|
function assign(array $keys, $value)
{
foreach ($keys as $key) {
$arr = &$this->array[$key];
|
php
|
{
"resource": ""
}
|
q266646
|
PEAR_PackageFile._extractErrors
|
test
|
function _extractErrors($err = null)
{
static $errors = array();
if ($err === null) {
$e = $errors;
$errors = array();
|
php
|
{
"resource": ""
}
|
q266647
|
ZeroConfDriver.getModelsConfigFile
|
test
|
public function getModelsConfigFile()
{
$o = $this->params;
$file = $o['path'] . DIRECTORY_SEPARATOR . 'normalist_zeroconf_cache_'
|
php
|
{
"resource": ""
}
|
q266648
|
ZeroConfDriver.getModelsDefinition
|
test
|
public function getModelsDefinition()
{
$file = $this->getModelsConfigFile();
if (!file_exists($file) || !is_readable($file)) {
throw new Exception\ModelFileNotFoundException(__METHOD__ . " Model configuration file '$file' does not exists or not readable");
}
if (defined('HHVM_VERSION')) {
// As an 'evil' workaround, waiting for hhvm to comply
// see https://github.com/facebook/hhvm/issues/1447
$definition = false;
$file_content = file_get_contents($file);
$file_content = trim(str_replace('<?php', '', $file_content));
$file_content = trim(str_replace('return array(', '$definition = array(', $file_content));
eval($file_content);
|
php
|
{
"resource": ""
}
|
q266649
|
ZeroConfDriver.saveModelsDefinition
|
test
|
protected function saveModelsDefinition(array $models_definition)
{
$file = $this->getModelsConfigFile();
if (file_exists($file) && !is_writable($file)) {
throw new Exception\ModelFileNotWritableException(__METHOD__ . "Model configuration file '$file' cannot be overwritten, not writable.");
}
//$config = new Config($models_defintion, true);
$writer = new Writer\PhpArray();
$models_definition['normalist'] = ['model_version' => Metadata\NormalistModels::VERSION];
|
php
|
{
"resource": ""
}
|
q266650
|
ZeroConfDriver.getMetadata
|
test
|
public function getMetadata()
{
$cache_key = md5(serialize($this->params));
if (!array_key_exists($cache_key, self::$metadataCache)) {
if ($this->metadata === null) {
self::$metadataCache[$cache_key] = $this->getDefaultMetadata();
} else
|
php
|
{
"resource": ""
}
|
q266651
|
BankAbstract.setName
|
test
|
public function setName($name)
{
$name = (string) $name;
if ($this->exists() && $this->name !== $name) {
$this->updated['name']
|
php
|
{
"resource": ""
}
|
q266652
|
BankAbstract.setColor
|
test
|
public function setColor($color)
{
$color = (string) $color;
if ($this->exists() && $this->color !== $color) {
$this->updated['color']
|
php
|
{
"resource": ""
}
|
q266653
|
BankAbstract.setParser
|
test
|
public function setParser($parser)
{
$parser = (string) $parser;
if ($this->exists() && $this->parser !== $parser) {
$this->updated['parser']
|
php
|
{
"resource": ""
}
|
q266654
|
Aggregator.aggregate
|
test
|
public function aggregate($collection)
{
// Ensure the collection is materialized.
$collection = $this->mirror->materializeCollection($collection);
// Create aggregate collection to accumulate style sheets.
$aggregate = new StyleAggregate();
foreach ($collection as $resource) {
if ($resource instanceof MaterializedResource) {
$internalResource = $resource->getResource();
$mediaType = 'all';
if ($internalResource instanceof CssResource) {
$mediaType = $internalResource->getMediaType();
|
php
|
{
"resource": ""
}
|
q266655
|
NoAPI.curl
|
test
|
public static function curl($url)
{
$req = curl_init();
$opt = [
CURLOPT_AUTOREFERER => true,
CURLOPT_COOKIEJAR => tempnam(sys_get_temp_dir(), 'curl'),
CURLOPT_FAILONERROR => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HEADER => true,
CURLOPT_HTTPHEADER => ['DNT: 1', 'Accept-Language: en-us,en;q=0.5'],
CURLOPT_MAXREDIRS => 5,
|
php
|
{
"resource": ""
}
|
q266656
|
NoAPI.imageProxy
|
test
|
public static function imageProxy($url, $filename, $directory, $overwrite = null)
{
$allowedmimetype = [ 'image/gif', 'image/jpeg', 'image/png', 'image/x-icon' ];
$localpath = $directory . '/noapi_' . $filename;
if (! $overwrite && file_exists($localpath)) return $localpath;
$image = file_get_contents($url);
$finfo = new \finfo(FILEINFO_MIME_TYPE);
|
php
|
{
"resource": ""
}
|
q266657
|
Validator.createValidator
|
test
|
public static function createValidator($type, $model, $attributes, $params = [])
{
$params['attributes'] = $attributes;
if ($type instanceof \Closure || ($model->hasMethod($type) && !isset(static::$builtInValidators[$type]))) {
// method-based validator
$params['class'] = __NAMESPACE__ . '\InlineValidator';
$params['method'] = $type;
} else {
if (isset(static::$builtInValidators[$type])) {
$type = static::$builtInValidators[$type];
|
php
|
{
"resource": ""
}
|
q266658
|
Validator.validateAttribute
|
test
|
public function validateAttribute($model, $attribute)
{
$result = $this->validateValue($model->$attribute);
if ($result instanceof ExtendedPromiseInterface) {
return $result->then(function($_result) use ($model, $attribute) {
if (!empty($_result)) {
|
php
|
{
"resource": ""
}
|
q266659
|
Validator.validate
|
test
|
public function validate($value, &$error = null)
{
$result = $this->validateValue($value);
if (empty($result)) {
return true;
}
list($message, $params) = $result;
$params['attribute'] = Reaction::t('rct', 'the input value');
if (is_array($value)) {
$params['value'] = 'array()';
|
php
|
{
"resource": ""
}
|
q266660
|
App.run
|
test
|
public function run($namespace)
{
$this->namespace = $namespace;
$this->_initRegister();
date_default_timezone_set($this->config['timezone']);
if (false === IS_CLI) {
|
php
|
{
"resource": ""
}
|
q266661
|
App.shutdown
|
test
|
public static function shutdown()
{
$error = error_get_last();
if ($error !== null) {
if (App::app()->config['debug'] == false) {
|
php
|
{
"resource": ""
}
|
q266662
|
App.url
|
test
|
public function url($controller, $action, $param)
{
$path = url();
if (empty($param)) {
// return PATH_APP_REL.'/'.$controller.'/'.$action;
return $path . '/' . $controller.'/'.$action;
} else {
|
php
|
{
"resource": ""
}
|
q266663
|
UrlHelper.canonical
|
test
|
public function canonical()
{
$routePath = $this->getCurrentPath(true);
if ($routePath === null) {
|
php
|
{
"resource": ""
}
|
q266664
|
UrlHelper.normalizeRoutePath
|
test
|
protected function normalizeRoutePath($routePath)
{
$routePath = Reaction::$app->getAlias((string) $routePath);
if (strncmp($routePath, '/', 1) === 0) {
// absolute route
return $routePath;
}
$route = $this->app->getRoute();
// relative route
if ($route === null || $route->controller === null) {
|
php
|
{
"resource": ""
}
|
q266665
|
Application.isWorking
|
test
|
public function isWorking()
{
if (null != $this->exception) {
return false;
}
foreach ($this->getTests() as $test) {
if ($test->hasFailed()) {
$this->exception =
|
php
|
{
"resource": ""
}
|
q266666
|
ViewFinderTrait.getViewNames
|
test
|
public function getViewNames($schema = '', $refresh = false)
{
if (!isset($this->_viewNames[$schema]) || $refresh) {
return $this->findViewNames($schema)->then(
function($names) use($schema) {
|
php
|
{
"resource": ""
}
|
q266667
|
Psr16Manager.get
|
test
|
public function get(string $key, $default = null)
{
$value = static::$handler->get($this->normalized($key));
// If we could not find the cache value, we will get
// the default value for this cache value. This default could be a callback
// so we will execute the value function which will resolve it if needed.
if (is_null($value))
|
php
|
{
"resource": ""
}
|
q266668
|
Psr16Manager.set
|
test
|
public function set(string $key, $value, int $ttl = null)
{
$keyNormalized = $this->normalized($key);
$result = static::$handler->set($keyNormalized, $value, $ttl ?? $this->ttl);
if ($result) {
if ($this->assistant) {
|
php
|
{
"resource": ""
}
|
q266669
|
Psr16Manager.setMultiple
|
test
|
public function setMultiple(array $values, int $ttl = null)
{
$valuesNormalized = [];
foreach ($values as $key => $value) {
$valuesNormalized[$this->normalized($key)] = $value;
}
$result = static::$handler->setMultiple(
$valuesNormalized,
$ttl ?? $this->ttl
);
if ($result) {
if ($this->assistant) {
|
php
|
{
"resource": ""
}
|
q266670
|
Psr16Manager.pull
|
test
|
public function pull(string $key, $default = null)
{
$result = $this->get($key, $default);
|
php
|
{
"resource": ""
}
|
q266671
|
Psr16Manager.add
|
test
|
public function add(string $key, $value, int $ttl = null)
{
// If the store has an "add" method we will call the method on the store so it
// has a chance to override this logic. Some drivers better support the way
// this operation should work with a total "atomic" implementation of it.
if (method_exists(static::$handler, 'add')) {
return static::$handler->add(
$this->normalized($key),
$value,
$ttl ?? $this->ttl
|
php
|
{
"resource": ""
}
|
q266672
|
Psr16Manager.remember
|
test
|
public function remember(string $key, \Closure $callback, $ttl = null)
{
$value = $this->get($key);
// If the item exists in the cache we will just return this immediately and if
// not we will execute the given Closure and cache the result of that for a
// given number of seconds so it's available for all subsequent requests.
|
php
|
{
"resource": ""
}
|
q266673
|
Psr16Manager.delete
|
test
|
public function delete(string $key)
{
$keyNormalized = $this->normalized($key);
$result = static::$handler->delete($keyNormalized);
if ($result) {
if ($this->assistant) {
|
php
|
{
"resource": ""
}
|
q266674
|
Phone.filter
|
test
|
public function filter($str)
{
$str = preg_replace("|[\D+]|", "", $str);
if (strlen($str) == 11 && in_array(substr($str, 0, 1), array("7", "8"))) {
|
php
|
{
"resource": ""
}
|
q266675
|
ConfigTrait.configDefaultOptions
|
test
|
protected function configDefaultOptions(Command $command)
{
$defaultConfPath = getcwd() . '/' . $this->confDir;
$command->addArgument('working-directory', InputOption::VALUE_REQUIRED, 'Working directory', getcwd());
$command
->addOption('app-type', null, InputOption::VALUE_REQUIRED, 'Application type', StaticApplicationInterface::APP_TYPE_WEB)
->addOption('app-host', null, InputOption::VALUE_REQUIRED, 'Host to run', '127.0.0.1')
->addOption('app-port', null,
|
php
|
{
"resource": ""
}
|
q266676
|
ConfigTrait.optionOrConfigValue
|
test
|
protected function optionOrConfigValue(InputInterface $input, $config, $optionName, $configName = null)
{
$optionNameRaw = $this->normalizeConfigArrayPath($optionName);
if ($input->hasParameterOption('--' . $optionNameRaw)) {
return $this->getOptionWithTypeCast($input, $optionName);
}
if (!isset($configName)) {
|
php
|
{
"resource": ""
}
|
q266677
|
ConfigTrait.getOptionWithTypeCast
|
test
|
protected function getOptionWithTypeCast(InputInterface $input, $optionName)
{
$optionNameExp = explode(':', $optionName);
if (count($optionNameExp) > 1) {
$optionName = $optionNameExp[0];
$optionType = $optionNameExp[1];
}
$optionValue = $input->getOption($optionName);
|
php
|
{
"resource": ""
}
|
q266678
|
ConfigTrait.loadConfigFromFile
|
test
|
protected function loadConfigFromFile($path, $appType = StaticApplicationInterface::APP_TYPE_WEB)
{
if (!isset($this->_reader)) {
$reader = new ConfigReader([
'path' => $path,
|
php
|
{
"resource": ""
}
|
q266679
|
ConfigTrait.loadConfig
|
test
|
protected function loadConfig(InputInterface $input, OutputInterface $output, $saveConfig = true)
{
$configsPath = $this->getConfigPath($input);
$appType = $input->getOption('app-type');
$config = $this->loadConfigFromFile($configsPath, $appType);
/**
* Array format
* [ 'OPTION_NAME:TYPE' => 'CONFIG_ARRAY_PATH', ]
*/
$configOptions = [
'app-host' => 'appStatic.hostname',
'app-port:int' => 'appStatic.port',
'app-debug:bool' => 'appStatic.debug',
];
foreach ($configOptions
|
php
|
{
"resource": ""
}
|
q266680
|
ConfigTrait.renderConfig
|
test
|
protected function renderConfig(OutputInterface $output, array $config)
{
$table = new Table($output);
|
php
|
{
"resource": ""
}
|
q266681
|
ConfigTrait.renderValue
|
test
|
private function renderValue($value)
{
$type = gettype($value);
$valueStr = null;
switch ($type) {
case 'object':
$valueStr = 'object(' . get_class($value) . ')';
break;
case 'array':
$valueStr = 'array(' . count($value) . ')';
break;
case 'boolean':
$valueStr =
|
php
|
{
"resource": ""
}
|
q266682
|
ConfigTrait.normalizeConfigArrayPath
|
test
|
private function normalizeConfigArrayPath($configPath)
{
if (!strpos($configPath, ':')) {
|
php
|
{
"resource": ""
}
|
q266683
|
PEAR_PackageFile_v2_rw._setPackageVersion2_1
|
test
|
function _setPackageVersion2_1()
{
$info = array(
'version' => '2.1',
'xmlns' => 'http://pear.php.net/dtd/package-2.1',
'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0
|
php
|
{
"resource": ""
}
|
q266684
|
PEAR_PackageFile_v2_rw.clearContents
|
test
|
function clearContents($baseinstall = false)
{
$this->_filesValid = false;
$this->_isValid = 0;
if (!isset($this->_packageInfo['contents'])) {
$this->_packageInfo = $this->_insertBefore($this->_packageInfo,
array('compatible',
'dependencies', 'providesextension', 'usesrole', 'usestask',
'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',
'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
'bundle', 'changelog'), array(), 'contents');
}
if ($this->getPackageType() != 'bundle') {
|
php
|
{
"resource": ""
}
|
q266685
|
PEAR_PackageFile_v2_rw.clearDeps
|
test
|
function clearDeps()
{
if (!isset($this->_packageInfo['dependencies'])) {
$this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(),
array(
'dependencies' => array('providesextension',
|
php
|
{
"resource": ""
}
|
q266686
|
PEAR_PackageFile_v2_rw.setPackageType
|
test
|
function setPackageType($type)
{
$this->_isValid = 0;
if (!in_array($type, array('php', 'extbin', 'extsrc', 'zendextsrc',
'zendextbin', 'bundle'))) {
return false;
}
if (in_array($type, array('zendextsrc', 'zendextbin'))) {
$this->_setPackageVersion2_1();
}
if ($type != 'bundle') {
$type .= 'release';
}
foreach (array('phprelease', 'extbinrelease', 'extsrcrelease',
'zendextsrcrelease', 'zendextbinrelease', 'bundle') as $test) {
|
php
|
{
"resource": ""
}
|
q266687
|
PEAR_PackageFile_v2_rw.&
|
test
|
function &_getCurrentRelease($strict = true)
{
if ($p = $this->getPackageType()) {
if ($strict) {
if ($p == 'extsrc' || $p == 'zendextsrc') {
$a = null;
return $a;
}
}
if ($p != 'bundle') {
$p .= 'release';
}
|
php
|
{
"resource": ""
}
|
q266688
|
PEAR_PackageFile_v2_rw.addInstallAs
|
test
|
function addInstallAs($path, $as)
{
$r = &$this->_getCurrentRelease();
if ($r === null) {
return false;
}
$this->_isValid = 0;
$r = $this->_mergeTag($r, array('attribs' => array('name' => $path,
|
php
|
{
"resource": ""
}
|
q266689
|
PEAR_PackageFile_v2_rw.addIgnore
|
test
|
function addIgnore($path)
{
$r = &$this->_getCurrentRelease();
if ($r === null) {
return false;
}
$this->_isValid = 0;
$r = $this->_mergeTag($r, array('attribs' => array('name'
|
php
|
{
"resource": ""
}
|
q266690
|
PEAR_PackageFile_v2_rw.addBinarypackage
|
test
|
function addBinarypackage($package)
{
if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
return false;
}
$r = &$this->_getCurrentRelease(false);
if ($r === null) {
return false;
|
php
|
{
"resource": ""
}
|
q266691
|
PEAR_PackageFile_v2_rw.addConfigureOption
|
test
|
function addConfigureOption($name, $prompt, $default = null)
{
if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
return false;
}
$r = &$this->_getCurrentRelease(false);
if ($r === null) {
|
php
|
{
"resource": ""
}
|
q266692
|
PEAR_PackageFile_v2_rw.setPhpInstallCondition
|
test
|
function setPhpInstallCondition($min, $max, $exclude = false)
{
$r = &$this->_getCurrentRelease();
if ($r === null) {
return false;
}
$this->_isValid = 0;
if (isset($r['installconditions']['php'])) {
unset($r['installconditions']['php']);
}
$dep = array('min' => $min, 'max' => $max);
if ($exclude) {
if (is_array($exclude) && count($exclude) == 1) {
$exclude = $exclude[0];
|
php
|
{
"resource": ""
}
|
q266693
|
PEAR_PackageFile_v2_rw.setOsInstallCondition
|
test
|
function setOsInstallCondition($name, $conflicts = false)
{
$r = &$this->_getCurrentRelease();
if ($r === null) {
return false;
}
$this->_isValid = 0;
if (isset($r['installconditions']['os'])) {
unset($r['installconditions']['os']);
}
$dep = array('name' => $name);
if ($conflicts) {
$dep['conflicts'] = '';
}
if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
$r = $this->_mergeTag($r, $dep,
array(
|
php
|
{
"resource": ""
}
|
q266694
|
PEAR_PackageFile_v2_rw.setArchInstallCondition
|
test
|
function setArchInstallCondition($pattern, $conflicts = false)
{
$r = &$this->_getCurrentRelease();
if ($r === null) {
return false;
}
$this->_isValid = 0;
if (isset($r['installconditions']['arch'])) {
unset($r['installconditions']['arch']);
}
$dep = array('pattern' => $pattern);
if ($conflicts) {
$dep['conflicts'] = '';
}
if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
$r = $this->_mergeTag($r, $dep,
array(
|
php
|
{
"resource": ""
}
|
q266695
|
PEAR_PackageFile_v2_rw.generateChangeLogEntry
|
test
|
function generateChangeLogEntry($notes = false)
{
return array(
'version' =>
array(
'release' => $this->getVersion('release'),
'api' => $this->getVersion('api'),
),
'stability' =>
$this->getStability(),
|
php
|
{
"resource": ""
}
|
q266696
|
VideoModel.isVideo
|
test
|
public function isVideo()
{
return $this->pathExists() && $this->exists() &&
|
php
|
{
"resource": ""
}
|
q266697
|
VideoModel.getVideoInfos
|
test
|
public function getVideoInfos()
{
if (!$this->exists()) return false;
|
php
|
{
"resource": ""
}
|
q266698
|
TransactionAbstract.setDate
|
test
|
public function setDate($date)
{
$date = (string) $date;
if ($this->exists() && $this->date !== $date) {
$this->updated['date']
|
php
|
{
"resource": ""
}
|
q266699
|
TransactionAbstract.setAmount
|
test
|
public function setAmount($amount)
{
$amount = (float) $amount;
if ($this->exists() && $this->amount !== $amount) {
$this->updated['amount']
|
php
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.