_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 83
13k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q252200 | Mover.processSplFileInfo | validation | private function processSplFileInfo(\SplFileInfo $file)
{
//clear TO directory if needed
if ($this->getCurrentCommand()->isUsePathReplace()) {
$this->getCurrentCommand()->setToDirectory(NULL);
}
//calc from directory
$filePathFrom = $this->prepareFilePathFrom($file);
//calc to directory
$filePathTo = $this->prepareFilePathTo($file);
//for debug
$this->currentFilePathFrom = $filePathFrom;
$this->currentFilePathTo = $filePathTo;
// \Zend\Debug\Debug::dump($filePathFrom, 'filePathFrom');
// \Zend\Debug\Debug::dump($filePathTo, 'filePathTo');
// exit();
$this->validateFileFrom($filePathFrom);
$this->validateFileTo($filePathTo);
if (!$this->isMoveIt()) {
return null;
}
$result = $this->doSystemCommand($filePathFrom, $filePathTo);
return $result;
} | php | {
"resource": ""
} |
q252201 | Mover.prepareFilePathTo | validation | private function prepareFilePathTo(\SplFileInfo $file)
{
if ($this->currentCommand->isUsePathReplace()) {
$fileWhereToMovePath = $file->getPath() . DIRECTORY_SEPARATOR;
if ($this->direction === self::DIRECTION_FORWARD) {
$filePathTo = $this->currentCommand->replacePath($fileWhereToMovePath);
} elseif ($this->direction === self::DIRECTION_BACK) {
$filePathTo = $this->currentCommand->replacePathBack($fileWhereToMovePath);
} else {
throw new \Exception(__METHOD__ . " wrong direction");
}
//fuck
$this->currentCommand->setToDirectory($filePathTo);
} else {
$filePathTo = $this->currentCommand->getToDirectory();
}
if (!file_exists($filePathTo) && !is_dir($filePathTo)) {
mkdir($filePathTo, $this->defaultDirMod, TRUE);
} else {
chmod($filePathTo, $this->defaultDirMod);
}
if ($this->currentCommand->getDestinationFileName()) {
$fileName = $this->currentCommand->getDestinationFileName();
} else {
$fileName = $file->getFilename();
}
$filePathTo .= $fileName;
return $filePathTo;
} | php | {
"resource": ""
} |
q252202 | PageCache.restoreResponse | validation | protected function restoreResponse($response, $data)
{
if (isset($data['format'])) {
$response->format = $data['format'];
}
if (isset($data['version'])) {
$response->version = $data['version'];
}
if (isset($data['statusCode'])) {
$response->statusCode = $data['statusCode'];
}
if (isset($data['statusText'])) {
$response->statusText = $data['statusText'];
}
if (isset($data['headers']) && is_array($data['headers'])) {
$headers = $response->getHeaders()->toArray();
$response->getHeaders()->fromArray(array_merge($data['headers'], $headers));
}
if (isset($data['cookies']) && is_array($data['cookies'])) {
$cookies = $response->getCookies()->toArray();
$response->getCookies()->fromArray(array_merge($data['cookies'], $cookies));
}
} | php | {
"resource": ""
} |
q252203 | LogChecker.isInvalidLogDate | validation | private function isInvalidLogDate($file)
{
$pattern = '/laravel-(\d){4}-(\d){2}-(\d){2}.log/';
if ((bool) preg_match($pattern, $file, $matches) === false) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q252204 | Input.getUri | validation | public static function getUri()
{
// Set basic protocol.
$parts = [$uri = self::getScheme(), '://'];
// Set auth username and auth password.
$authUsername = self::getAuthUsername();
$authPassword = self::getAuthPassword();
if ($authUsername !== null && $authPassword !== null) {
$parts[] = $authUsername . ':' . $authPassword . '@';
}
// Set host.
$parts[] = self::getHost();
// Set port.
$port = self::getPort();
if ($port != self::getStandardPort(self::getScheme())) {
$parts[] = ':' . $port;
}
// Set path.
$path = self::getPath();
if ($path !== null && $path != '') {
$parts[] = '/' . $path;
}
// Set query.
$query = Input::getQuery();
if (is_array($query) && count($query) > 0) {
$queryString = [];
foreach ($query as $key => $value) {
$queryKeyValue = $key . '=';
if ($value !== null) {
if (is_string($value)) {
$value = urlencode($value);
}
$queryKeyValue .= $value;
}
$queryString[] = $queryKeyValue;
}
if (count($queryString) > 0) {
$parts[] = '?' . implode('&', $queryString);
}
}
return implode('', $parts);
} | php | {
"resource": ""
} |
q252205 | Input.getHost | validation | public static function getHost()
{
$host = null;
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$host = $_SERVER['HTTP_X_FORWARDED_HOST'];
} elseif (isset($_SERVER['HTTP_HOST'])) {
$host = $_SERVER['HTTP_HOST'];
} elseif (isset($_SERVER['SERVER_NAME'])) {
$host = $_SERVER['SERVER_NAME'];
} else {
$host = gethostname();
}
return $host;
} | php | {
"resource": ""
} |
q252206 | Input.getStandardPort | validation | public static function getStandardPort($scheme = null)
{
if ($scheme === null) {
$scheme = self::getScheme();
}
if (isset(self::$schemes[$scheme])) {
return self::$schemes[$scheme];
}
return 0;
} | php | {
"resource": ""
} |
q252207 | Input.getScheme | validation | public static function getScheme()
{
$protocol = isset($_SERVER['REQUEST_SCHEME']) ? strtolower($_SERVER['REQUEST_SCHEME']) : 'http';
if ($protocol == 'http' && self::isSsl()) {
$protocol .= 's';
}
return $protocol;
} | php | {
"resource": ""
} |
q252208 | Input.isSsl | validation | public static function isSsl()
{
$isSecure = false;
if (isset($_SERVER['HTTPS']) && in_array($_SERVER['HTTPS'], ['on', '1'])) {
$isSecure = true;
} elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$isSecure = true;
} elseif (isset($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {
$isSecure = true;
}
return $isSecure;
} | php | {
"resource": ""
} |
q252209 | Input.getPath | validation | public static function getPath()
{
$uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
if (strpos($uri, '?') > 0) {
$uri = substr($uri, 0, strpos($uri, '?'));
}
$uri = preg_replace("/^\\/(.*)$/", "$1", $uri);
$uri = preg_replace("/^(.*)\\/$/", "$1", $uri);
return $uri;
} | php | {
"resource": ""
} |
q252210 | Input.getQuery | validation | public static function getQuery($name = '', $defaultValue = null)
{
$queryStringParts = [];
if (isset($_SERVER['QUERY_STRING'])) {
parse_str($_SERVER['QUERY_STRING'], $queryStringParts);
}
if ($name != '') {
if (isset($queryStringParts[$name])) {
return $queryStringParts[$name];
} else {
return $defaultValue;
}
}
return $queryStringParts;
} | php | {
"resource": ""
} |
q252211 | Input.getRequest | validation | public static function getRequest($name, $defaultValue = null)
{
if (isset($_REQUEST[$name])) {
return $_REQUEST[$name];
}
return $defaultValue;
} | php | {
"resource": ""
} |
q252212 | Input.getHeader | validation | public static function getHeader($header, $defaultValue = '')
{
$header = strtolower(str_replace(['_', ' '], '-', $header));
$headers = self::getHeaders();
if (is_array($headers)) {
foreach ($headers as $name => $value) {
if (strtolower($name) == $header) {
return $value;
}
}
}
return $defaultValue;
} | php | {
"resource": ""
} |
q252213 | Input.getAuthUsername | validation | public static function getAuthUsername()
{
$result = null;
if (isset($_SERVER['PHP_AUTH_USER'])) {
$result = $_SERVER['PHP_AUTH_USER'];
}
if (trim($result) == '') {
$result = null;
}
return $result;
} | php | {
"resource": ""
} |
q252214 | Input.getAuthPassword | validation | public static function getAuthPassword()
{
$result = null;
if (isset($_SERVER['PHP_AUTH_PW'])) {
$result = $_SERVER['PHP_AUTH_PW'];
}
if (trim($result) == '') {
$result = null;
}
return $result;
} | php | {
"resource": ""
} |
q252215 | LocationTrait.saveLocation | validation | public function saveLocation($runValidation = true, $attributeNames = null)
{
$location = $this->location;
if ($location === null) {
$location = new Location();
}
$location->country_id = $this->country_id;
$location->region_id = $this->region_id;
$location->city_id = $this->city_id;
$location->state_id = $this->state_id;
$location->address = $this->address;
$location->postal_code = $this->postal_code;
$location->latitude = $this->latitude;
$location->longitude = $this->longitude;
if (is_array($attributeNames)) {
$attributesNames = array_intersect(
['country_id', 'region_id', 'city_id', 'state_id', 'address', 'postal_code', 'latitude', 'longitude'], $attributesNames
);
}
if (empty($attributeNames)) {
$attributeNames = null;
}
if ($location->save($runValidation, $attributeNames) === false) {
$this->addErrors($location->getErrors());
return false;
}
$this->location_id = $location->id;
return true;
} | php | {
"resource": ""
} |
q252216 | LocationTrait.populateLocationOwner | validation | public function populateLocationOwner()
{
$location = $this->location;
if ($location !== null) {
$this->country_id = $location->country_id;
$this->region_id = $location->region_id;
$this->city_id = $location->city_id;
$this->state_id = $location->state_id;
$this->address = $location->address;
$this->postal_code = $location->postal_code;
$this->latitude = $location->latitude;
$this->longitude = $location->longitude;
}
} | php | {
"resource": ""
} |
q252217 | VerifierUserTrait.sendVerification | validation | public function sendVerification()
{
$this->setVerificationCode ($this->createVerificationCode());
$user =& $this;
return Mail::queue(Config::get('verifier.template'), ['user' => $this ], function($message) use($user) {
$message->to($user->email, $user->getVerificationEmailName())->subject($user->getVerificationEmailSubject());
});
} | php | {
"resource": ""
} |
q252218 | VerifierUserTrait.verify | validation | public static function verify($code)
{
if (!$code) {
return null;
}
if ($user = self::lookupVerificationCode($code)) {
$user->setVerificationCode();
}
return $user;
} | php | {
"resource": ""
} |
q252219 | VerifierUserTrait.setVerificationCode | validation | protected function setVerificationCode($code = null)
{
$this->{Config::get('verifier.store_column')} = $code;
if ($code) {
$this->{Config::get('verifier.flag_column')} = false;
} else {
$this->{Config::get('verifier.flag_column')} = true;
}
$this->save();
} | php | {
"resource": ""
} |
q252220 | DoctrineListener.postPersist | validation | public function postPersist(LifecycleEventArgs $args): void {
if(!$this->enableIndexing) {
return;
}
$this->updateEntity($args->getObject(), $args->getObjectManager());
} | php | {
"resource": ""
} |
q252221 | DoctrineListener.preRemove | validation | public function preRemove(LifecycleEventArgs $args): void {
if(!$this->enableIndexing) {
return;
}
$this->removeEntity($args->getObject(), $args->getObjectManager());
} | php | {
"resource": ""
} |
q252222 | LogCollection.tree | validation | public function tree($trans = false)
{
$tree = [];
foreach ($this->items as $date => $log) {
/* @var \Orchid\Log\Entities\Log $log */
$tree[$date] = $log->tree($trans);
}
return $tree;
} | php | {
"resource": ""
} |
q252223 | SysInfo.getMemInfo | validation | public static function getMemInfo()
{
$result = [];
if ($n = preg_match_all('/^([\S]+):\s+(\d+)\skB$/im', file_get_contents('/proc/meminfo'), $matches)) {
for ($i = 0; $i < $n; $i++) {
$result[$matches[1][$i]] = $matches[2][$i];
}
}
return $result;
} | php | {
"resource": ""
} |
q252224 | SysInfo.getDiskUsage | validation | public static function getDiskUsage()
{
$result = [];
$lines = explode("\n", trim(shell_exec('df')));
array_shift($lines);
foreach ($lines as &$line) {
if (0 === strpos($line, '/')) {
$result[] = explode("\t", $line);
}
}
return $result;
} | php | {
"resource": ""
} |
q252225 | SysInfo.getHostId | validation | public static function getHostId()
{
if (self::isWindows()) {
$uuid = explode("\r\n", trim(shell_exec('wmic csproduct get UUID')));
return (\count($uuid) === 2 ? $uuid[1] : false);
}
$uuid = trim(shell_exec('hostid'));
return $uuid === null ? false : $uuid;
} | php | {
"resource": ""
} |
q252226 | SysInfo.checkPhpVersion | validation | public static function checkPhpVersion()
{
$version = null;
if (\defined('PHP_VERSION')) {
$version = PHP_VERSION;
} else {
$version = phpversion('');
}
//Case management system of ubuntu, php version return 5.2.4-2ubuntu5.2
if (strpos($version, '-') !== false) {
$version = substr($version, 0, strpos($version, '-'));
}
return $version;
} | php | {
"resource": ""
} |
q252227 | SysInfo.getMaxUploadSize | validation | public static function getMaxUploadSize($max_size = 0)
{
$post_max_size = Tools::unformatBytes(ini_get('post_max_size'));
$upload_max_filesize = Tools::unformatBytes(ini_get('upload_max_filesize'));
if ($max_size > 0) {
$result = min($post_max_size, $upload_max_filesize, $max_size);
} else {
$result = min($post_max_size, $upload_max_filesize);
}
return $result;
} | php | {
"resource": ""
} |
q252228 | Dumpling.D | validation | public static function D($value, $options=array())
{
if (is_numeric($options)) {
$options = array('depth' => $options);
} elseif (empty($options)) {
$options = array();
}
$plop = new Dumpling($options);
return $plop->dump($value);
} | php | {
"resource": ""
} |
q252229 | Configuration.getConfigTreeBuilder | validation | public function getConfigTreeBuilder()
{
$tree_builder = new TreeBuilder();
$tree_builder
->root('anime_db_cache_time_keeper')
->children()
->booleanNode('enable')
->defaultTrue()
->end()
->scalarNode('use_driver')
->cannotBeEmpty()
->defaultValue('file')
->end()
->arrayNode('private_headers')
->treatNullLike([])
->prototype('scalar')->end()
->defaultValue(['Authorization', 'Cookie'])
->end()
->append($this->getEtagHasher())
->append($this->getTrack())
->arrayNode('drivers')
->append($this->getDriverFile())
->append($this->getDriverMemcache())
->append($this->getDriverMulti())
->append($this->getDriverShmop())
->end()
->end();
return $tree_builder;
} | php | {
"resource": ""
} |
q252230 | SetDataCapableTrait._setData | validation | protected function _setData($key, $value)
{
$store = $this->_getDataStore();
try {
$this->_containerSet($store, $key, $value);
} catch (InvalidArgumentException $e) {
throw $this->_createOutOfRangeException($this->__('Invalid store'), null, $e, $store);
} catch (OutOfRangeException $e) {
throw $this->_createInvalidArgumentException($this->__('Invalid key'), null, $e, $store);
}
} | php | {
"resource": ""
} |
q252231 | FileEntity.hasExtension | validation | public function hasExtension(string $extension): bool
{
$test = $this->getExtension();
return (strcasecmp($extension, $test) === 0);
} | php | {
"resource": ""
} |
q252232 | FileEntity.getName | validation | public function getName(bool $includeExtension = false): string
{
$filename = basename($this->path);
if ($includeExtension) {
return $filename;
}
return $this->splitName()[0];
} | php | {
"resource": ""
} |
q252233 | FileEntity.splitName | validation | public function splitName(string $defaultExtension = ""): array
{
$filename = basename($this->path);
$extpos = strrpos($filename, ".");
if ($extpos === false || $extpos === 0) {
$name = $filename;
$ext = $defaultExtension;
}
else {
$name = substr($filename, 0, $extpos);
$ext = substr($filename, $extpos + 1);
}
return [$name, $ext];
} | php | {
"resource": ""
} |
q252234 | FileEntity.getByteSize | validation | public function getByteSize(): int
{
if ($this->test(\sndsgd\Fs::READABLE) !== true) {
$this->error = "failed to stat filesize; {$this->error}";
return -1;
}
$bytes = @filesize($this->path);
if ($bytes === false) {
$this->setError("failed to stat filesize for '{$this->path}'");
return -1;
}
return $bytes;
} | php | {
"resource": ""
} |
q252235 | FileEntity.getSize | validation | public function getSize(
int $precision = 0,
string $point = ".",
string $sep = ","
): string
{
$bytes = $this->getByteSize();
if ($bytes === -1) {
return "";
}
return \sndsgd\Fs::formatSize($bytes, $precision, $point, $sep);
} | php | {
"resource": ""
} |
q252236 | FileEntity.write | validation | public function write(string $contents, int $opts = 0): bool
{
if ($this->prepareWrite() !== true) {
$this->error = "failed to write '{$this->path}; {$this->error}";
return false;
}
return $this->writeFile($contents, $opts);
} | php | {
"resource": ""
} |
q252237 | FileEntity.prepend | validation | public function prepend(string $contents, int $maxMemory = 8096): bool
{
$test = \sndsgd\Fs::EXISTS | \sndsgd\Fs::READABLE | \sndsgd\Fs::WRITABLE;
if ($this->test($test) === false) {
$this->error = "failed to prepend file; {$this->error}";
return false;
}
$len = strlen($contents);
$size = filesize($this->path);
$endsize = $len + $size;
# if the overall filesize is greater than `maxMemory`, write efficiently
if ($endsize > $maxMemory) {
return $this->prependFileInPlace($contents, $len, $endsize);
}
# use file_get/put_contents to handle the operation
if (($tmp = $this->readFile(0)) === false) {
return false;
}
if ($this->writeFile($contents.$tmp, 0) === false) {
return false;
}
return true;
} | php | {
"resource": ""
} |
q252238 | FileEntity.read | validation | public function read(int $offset = 0)
{
if ($this->test(\sndsgd\Fs::EXISTS | \sndsgd\Fs::READABLE) === false) {
$this->error = "failed to read file; {$this->error}";
return false;
}
return $this->readFile($offset);
} | php | {
"resource": ""
} |
q252239 | FileEntity.getLineCount | validation | public function getLineCount(): int
{
$ret = 0;
$fh = fopen($this->path, "r");
while (!feof($fh)) {
$buffer = fread($fh, 8192);
$ret += substr_count($buffer, PHP_EOL);
}
fclose($fh);
return $ret;
} | php | {
"resource": ""
} |
q252240 | VirtualHost.matchLocale | validation | public function matchLocale($locale)
{
$locale = Locale::create($locale);
if (!empty($this->redirect))
return false;
if ($locale === null)
return true;
foreach ($this->locales as $l)
if ($l->getLocale() == $locale->getLocale())
return true;
return false;
} | php | {
"resource": ""
} |
q252241 | VirtualHost.selectLocaleFromAcceptHeader | validation | public function selectLocaleFromAcceptHeader(Accept $header)
{
// Collect a list of all supported locales
$my_locales = [];
foreach ($this->locales as $supported_locale)
{
$list = $supported_locale->getFallbackList();
foreach ($list as $locale)
$my_locales[$locale->getLocale()] = $supported_locale->getLocale();
}
$best = $header->getBestResponseType(array_keys($my_locales));
return empty($best) ? null : ($my_locales[$best] ?? null);
} | php | {
"resource": ""
} |
q252242 | VirtualHost.setLocale | validation | public function setLocale($locale)
{
$locale = WF::cast_array($locale);
foreach ($locale as $l)
$this->locales[] = new Locale($l);
// Remove duplicate locales
$this->locales = array_unique($this->locales);
return $this;
} | php | {
"resource": ""
} |
q252243 | VirtualHost.setRedirect | validation | public function setRedirect($hostname)
{
if (!empty($hostname))
{
$this->redirect = new URL($hostname);
$this->redirect->set('path', rtrim($this->redirect->path, '/'));
}
else
$this->redirect = false;
return $this;
} | php | {
"resource": ""
} |
q252244 | VirtualHost.URL | validation | public function URL($path = '', $current_url = null)
{
$url = new URL($this->url);
$path = ltrim($path, '/');
$url->set('path', $url->path . $path);
if ($current_url instanceof URL)
{
if ($url->host === $current_url->host && $url->scheme === $current_url->scheme && $url->port === $current_url->port)
{
$url->host = null;
$url->scheme = null;
}
}
return $url;
} | php | {
"resource": ""
} |
q252245 | VirtualHost.getPath | validation | public function getPath($url)
{
$url = new URL($url);
$to_replace = $this->url->path;
$path = $url->path;
if (strpos($path, $to_replace) === 0)
$path = substr($path, strlen($to_replace));
$path = '/' . urldecode($path);
return $path;
} | php | {
"resource": ""
} |
q252246 | ContentSecurityPolicyMiddleware.setSandbox | validation | public function setSandbox(string $sandbox):void
{
if (!in_array($sandbox, self::SANDBOX_VALUES)) {
throw new MiddlewareException(
$this,
sprintf(
"%s is not a correct value for the CSP sandbox, correct values are: %s (see %s)",
$sandbox, implode(', ', self::SANDBOX_VALUES),
'https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox'
)
);
}
$this->tags['sandbox'] = $sandbox;
} | php | {
"resource": ""
} |
q252247 | ContentSecurityPolicyMiddleware.setRefererPolicy | validation | public function setRefererPolicy(string $refererPolicy):void
{
if (!in_array($refererPolicy, self::REFERER_POLICY_VALUES)) {
throw new MiddlewareException(
$this,
sprintf(
"%s is not a valid CSP referer policy, correct values are: %s (see %s)",
$refererPolicy, implode(', ', self::REFERER_POLICY_VALUES),
'https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/referrer'
)
);
}
$this->tags['referer'] = $refererPolicy;
} | php | {
"resource": ""
} |
q252248 | ContentSecurityPolicyMiddleware.requireSriFor | validation | public function requireSriFor(bool $script, bool $style):void
{
if ($script && $style) {
$this->tags['require-sri-for'] = ['script', 'style'];
}
else if ($script) {
$this->tags['require-sri-for'] = ['script'];
}
else if ($style) {
$this->tags['require-sri-for'] = ['style'];
}
} | php | {
"resource": ""
} |
q252249 | ContentSecurityPolicyMiddleware.addReportUri | validation | public function addReportUri(string $reportUri):bool
{
if (!filter_var($reportUri, FILTER_VALIDATE_URL)) {
throw new MiddlewareException(
$this,
sprintf(
"'%s' is not a valid URI and can not be set as the CSP report URI",
$reportUri
)
);
}
if (!in_array($reportUri, $this->tags['report-uri'])) {
$this->tags['report-uri'][] = $reportUri;
return true;
}
return false;
} | php | {
"resource": ""
} |
q252250 | ContentSecurityPolicyMiddleware.addPluginType | validation | public function addPluginType(string $mediaType):bool
{
if (!preg_match('#^[-\w]+/[-\w]+$#ui', $mediaType)) {
throw new MiddlewareException(
$this,
sprintf(
"'%s' is not a valid media type and can not be used as a CSP plugin type",
$mediaType
)
);
}
if (!in_array($mediaType, $this->tags['plugin-types'])) {
$this->tags['plugin-types'][] = $mediaType;
return true;
}
return false;
} | php | {
"resource": ""
} |
q252251 | ContentSecurityPolicyMiddleware.addDefaultSrc | validation | public function addDefaultSrc(string $source):bool
{
if (!in_array($source, $this->tags['default-src'])) {
$this->tags['default-src'][] = $source;
return true;
}
return false;
} | php | {
"resource": ""
} |
q252252 | ContentSecurityPolicyMiddleware.getHeaderValue | validation | public function getHeaderValue():?string
{
$headerValue = [];
foreach ($this->tags as $name => $tagValue) {
if (is_array($tagValue) && !empty($tagValue)) {
$headerValue[] = $name.' '.implode(' ', $tagValue).';';
}
elseif (is_string($tagValue) && !empty($tagValue)) {
$headerValue[] = $name.' '.$tagValue.';';
}
elseif (is_bool($tagValue) && $tagValue) {
$headerValue[] = $name.';';
}
}
return $headerValue ? implode(' ', $headerValue) : null;
} | php | {
"resource": ""
} |
q252253 | BaseInstaller.importSchemaFile | validation | protected function importSchemaFile(string $schemaFile, string $controlTableName = null): void
{
if ($controlTableName !== null) {
if ($this->db->getSchemaManager()->tablesExist([$controlTableName])) {
$this->output->writeln('<comment>Schema already exists in the database, skipping schema import for file <info>' . $schemaFile . '</info></comment>');
return;
}
}
$this->runQueriesFromFile($schemaFile);
} | php | {
"resource": ""
} |
q252254 | BaseInstaller.importDataFile | validation | protected function importDataFile(string $dataFile, string $controlTableName = null): void
{
if ($controlTableName !== null) {
$query = $this->db->createQueryBuilder();
$query->select('count(*) AS count')
->from($controlTableName);
$data = $query->execute()->fetchAll();
$contentCount = (int) $data[0]['count'];
if ($contentCount > 0) {
$this->output->writeln('<comment>Data already exists in the database, skipping data import for file <info>' . $dataFile . '</info></comment>');
return;
}
}
$this->runQueriesFromFile($dataFile);
} | php | {
"resource": ""
} |
q252255 | Type.set | validation | public function set($value)
{
if ($value !== null) {
$value = $this->check($value);
}
if ($value !== $this->value) {
$this->value = $value;
$this->notify();
}
return $this;
} | php | {
"resource": ""
} |
q252256 | Time.sec2time | validation | public static function sec2time($seconds)
{
$sec = intval($seconds);
$dtF = new \DateTime("@0");
$dtT = new \DateTime("@$sec");
return $dtF->diff($dtT)->format('%a days, %h hours, %i minutes and %s seconds');
} | php | {
"resource": ""
} |
q252257 | Controller.addDefaultListeners | validation | public function addDefaultListeners()
{
$this->dispatcher->addListener( Events::EVENT_BEFORE_CONTROLLER_RUN, $this );
$this->dispatcher->addListener( Events::EVENT_AFTER_CONTROLLER_RUN, $this );
} | php | {
"resource": ""
} |
q252258 | Controller.run | validation | public function run()
{
$event = new BeforeControllerRunEvent();
$this->dispatcher->fire( Events::EVENT_BEFORE_CONTROLLER_RUN, $event );
$action = $this->action->getName();
if ( $this->action->hasParams() )
{
call_user_func_array( [
$this,
$action
],
$this->action->getParams()
);
}
else
{
$this->$action();
}
$event = new AfterControllerRunEvent();
$this->dispatcher->fire( Events::EVENT_AFTER_CONTROLLER_RUN, $event );
} | php | {
"resource": ""
} |
q252259 | Controller.loadView | validation | public function loadView( $data = [ ], $return = FALSE )
{
$retVal = NULL;
//$extraData = $this->filter( self::ON_LOAD_EXTRA_DATA_FILTER, [ ] );
$extra = [
'route' => $this->_getRoute(),
];
extract( $extra, EXTR_OVERWRITE );
//extract( $extraData, EXTR_OVERWRITE );
extract( $data, EXTR_OVERWRITE );
$level = error_reporting();
error_reporting( 0 );
ob_start();
if ( isset( $view ) )
{
$viewsDirEvent = new GetViewsDirEvent();
$this->dispatcher->fire( Events::EVENT_GET_VIEWS_DIR, $viewsDirEvent );
$viewDir = $viewsDirEvent->getViewsDir();
if ( NULL === $viewDir )
{
throw new RawException( 'The views directory has not been set.' );
}
if ( FALSE !== strstr( $view, '.php' ) )
{
include $viewDir . $view;
}
else
{
include $viewDir . $view . '.php';
}
$newView = ob_get_clean();
if ( $return )
{
$retVal = $newView;
}
else
{
$this->pageView .= $newView;
}
}
else
{
$retVal = '';
}
error_reporting( $level );
return $retVal;
} | php | {
"resource": ""
} |
q252260 | Controller._getRoute | validation | private function _getRoute()
{
$action = str_replace( 'Action', '', $this->action->getName() );
$action = explode( '\\', $action );
$action = strtolower( $action[ 0 ] );
$cls = str_replace( 'Controller', '', get_class( $this ) );
$cls = strtolower( $cls );
$path = explode( '\\', $cls );
$path = $path[ count( $path ) - 1 ] . '/' . $action;
if ( $this->action->hasParams() )
{
foreach ( $this->action->getParams() as $param )
{
$path .= '/' . $param;
}
}
return $path;
} | php | {
"resource": ""
} |
q252261 | Controller.handle | validation | public function handle( IEvent $event, $name, IDispatcher $dispatcher )
{
if ( $event instanceof BeforeControllerRunEvent )
{
return $this->onBeforeAction();
}
elseif ( $event instanceof AfterControllerRunEvent )
{
return $this->onAfterAction();
}
} | php | {
"resource": ""
} |
q252262 | TaskRunner.findTasks | validation | private function findTasks()
{
if ($this->init)
return;
$resolver = $this->app->moduleManager;
$modules = $resolver->getModules();
foreach ($modules as $mod)
$mod->registerTasks($this);
// Provide a way to register tasks using a hook
Hook::execute("Wedeto.Application.Task.TaskRunner.findTasks", ['taskrunner' => $this]);
$this->init = true;
} | php | {
"resource": ""
} |
q252263 | TaskRunner.listTasks | validation | public function listTasks($ostr = STDOUT)
{
$this->findTasks();
if (count($this->task_list) === 0)
{
// @codeCoverageIgnoreStart
fprintf($ostr, "No tasks available\n");
// @codeCoverageIgnoreEnd
}
else
{
fprintf($ostr, "Listing available tasks: \n");
foreach ($this->task_list as $task => $desc)
{
$task = str_replace('\\', ':', $task);
fprintf($ostr, "- %-30s", $task);
CLI::formatText(32, CLI::MAX_LINE_LENGTH, ' ' . $desc, $ostr);
}
printf("\n");
}
} | php | {
"resource": ""
} |
q252264 | TaskRunner.run | validation | public function run(string $task, $ostr = STDERR)
{
// CLI uses : because \ is used as escape character, so that
// awkward syntax is required.
$task = str_replace(":", "\\", $task);
$log = Logger::getLogger('');
$log->addLogWriter(new StreamWriter(STDOUT));
if (!class_exists($task))
{
fprintf($ostr, "Error: task does not exist: {$task}\n");
return false;
}
try
{
if (!is_subclass_of($task, TaskInterface::class))
{
fprintf($ostr, "Error: invalid task: {$task}\n");
return false;
}
$taskrunner = new $task;
$taskrunner->execute();
}
catch (\Throwable $e)
{
fprintf($ostr, "Error: error while running task: %s\n", $task);
fprintf($ostr, "Exception: %s\n", get_class($e));
fprintf($ostr, "Message: %s\n", $e->getMessage());
if (method_exists($e, "getLine"))
fprintf($ostr, "On: %s (line %d)\n", $e->getFile(), $e->getLine());
fprintf($ostr, $e->getTraceAsString() . "\n");
return false;
}
return true;
} | php | {
"resource": ""
} |
q252265 | GroupByTrait.buildGroupBy | validation | protected function buildGroupBy()/*# : array */
{
$result = [];
foreach ($this->clause_groupby as $grp) {
$result[] = $grp[0] ? $grp[1] : $this->quote($grp[1]);
}
return $result;
} | php | {
"resource": ""
} |
q252266 | Query.__isset | validation | public function __isset($name): bool {
if(strrpos($name, 'facet_', -strlen($name)) !== false) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q252267 | LocationFormWidget.country | validation | protected function country()
{
$this->parts['{country}'] = $this->form->field($this->model, $this->model->getCountryPropertyName(), ['options' => ['class' => 'form-group']])->dropDownList(
ArrayHelper::map(Country::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), [
'id' => $this->fieldIds['country']
, 'prompt' => Yii::t('jlorente/location', 'Select country')
, 'name' => $this->getSubmitModelName($this->model->getCountryPropertyName())
]);
} | php | {
"resource": ""
} |
q252268 | LocationFormWidget.city | validation | protected function city()
{
$pluginOptions = [
'url' => Url::to(["/{$this->module->id}/city/list"])
, 'depends' => [$this->fieldIds['country']]
];
if (isset($this->fieldIds['state'])) {
$pluginOptions['depends'][] = $this->fieldIds['state'];
$pluginOptions['initDepends'] = [$this->fieldIds['country']];
} else {
$pluginOptions['depends'][] = null;
}
if (isset($this->fieldIds['region'])) {
$pluginOptions['depends'][] = $this->fieldIds['region'];
if (isset($this->fieldIds['state'])) {
$pluginOptions['initDepends'][] = $this->fieldIds['state'];
}
} else {
$pluginOptions['depends'][] = null;
}
$this->parts['{city}'] = $this->form->field($this->model, $this->model->getCityPropertyName())->widget(DepDrop::className(), [
'options' => [
'id' => $this->fieldIds['city']
, 'cityholder' => Yii::t('jlorente/location', 'Select city')
, 'name' => $this->getSubmitModelName($this->model->getCityPropertyName())
]
, 'data' => ArrayHelper::map(City::find()->where(['region_id' => $this->model->region_id])->orderBy(['name' => SORT_ASC])->all(), 'id', 'name')
, 'pluginOptions' => $pluginOptions
]);
} | php | {
"resource": ""
} |
q252269 | LocationFormWidget.address | validation | protected function address()
{
$this->parts['{address}'] = $this->form->field($this->model, 'address')->textInput([
'name' => $this->getSubmitModelName('address')
, 'id' => $this->fieldIds['address']
]);
} | php | {
"resource": ""
} |
q252270 | LocationFormWidget.geolocation | validation | protected function geolocation()
{
$this->parts['{geolocation}'] = $this->form->field($this->model, 'latitude')->textInput([
'name' => $this->getSubmitModelName('latitude')
, 'id' => $this->fieldIds['latitude']
])
. "\n"
. $this->form->field($this->model, 'longitude')->textInput([
'name' => $this->getSubmitModelName('longitude')
, 'id' => $this->fieldIds['longitude']
]);
} | php | {
"resource": ""
} |
q252271 | LocationFormWidget.getSubmitModelName | validation | public function getSubmitModelName($attribute)
{
return empty($this->submitModelName) ? Html::getInputName($this->model, $attribute) : $this->submitModelName . "[$attribute]";
} | php | {
"resource": ""
} |
q252272 | LocationFormWidget.ensureFieldIds | validation | protected function ensureFieldIds()
{
if ($this->submitModelName) {
$formName = Inflector::slug($this->submitModelName, '_');
} else {
$model = new \ReflectionClass($this->model);
$formName = $model->getShortName();
}
$parts = [];
preg_match_all('/{([^}]+)}/', $this->template, $parts);
$keys = array_flip($parts[1]);
$fieldIds = [];
if (isset($keys['country'])) {
$fieldIds['country'] = $formName . '_country_id';
}
if (isset($keys['state'])) {
$fieldIds['state'] = $formName . '_state_id';
}
if (isset($keys['region'])) {
$fieldIds['region'] = $formName . '_region_id';
}
if (isset($keys['city'])) {
$fieldIds['city'] = $formName . '_city_id';
}
if (isset($keys['address'])) {
$fieldIds['address'] = $formName . '_address';
}
if (isset($keys['postalCode'])) {
$fieldIds['postal_code'] = $formName . '_postal_code';
}
if (isset($keys['geolocation'])) {
$fieldIds['latitude'] = $formName . '_latitude';
$fieldIds['longitude'] = $formName . '_longitude';
}
$this->fieldIds = $fieldIds;
} | php | {
"resource": ""
} |
q252273 | PermisoVoter.supports | validation | protected function supports($attribute, $subject)
{
// if the attribute isn't one we support, return false
if (!in_array($attribute, array(self::MENU, self::PERMISO))) {
return false;
}
if ($attribute == self::MENU && !is_null($subject) && !$subject instanceof Menu) {
return false;
}
return true;
} | php | {
"resource": ""
} |
q252274 | UserManager.init | validation | public function init()
{
$this->_file = \Yii::getAlias($this->path.'/config/'.self::FILENAME);
$this->loadFromFile();
} | php | {
"resource": ""
} |
q252275 | UserManager.loadFromFile | validation | private function loadFromFile()
{
if (is_file($this->_file)) {
$this->_params = require($this->_file);
} else {
$this->_params = ['users' => []];
}
} | php | {
"resource": ""
} |
q252276 | _ets.check_level | validation | function check_level($error_level, $errno, $message)
{
if (error_reporting() & $error_level) {
switch ($error_level) {
case E_NOTICE: $type = 'notice'; break;
case E_WARNING: $type = 'warning'; break;
case E_ERROR: $type = 'error'; break;
}
echo "<b>ETS $type:</b> $message";
}
if ($error_level == E_ERROR) {
exit;
}
} | php | {
"resource": ""
} |
q252277 | _ets.elt_label | validation | function elt_label($eltid)
{
switch($eltid) {
case _ETS_ROOT: return 'root element';
case _ETS_TEXT: return 'text element';
case _ETS_TAG: return 'simple tag element';
case _ETS_ALT_TAG: return 'alternate tag element';
case _ETS_TEMPLATE: return 'template element';
case _ETS_SET: return 'set element';
case _ETS_SETVAL: return 'set-value element';
case _ETS_MIS: return 'missing element';
case _ETS_MISVAL: return 'missing-value element';
case _ETS_PHP: return 'PHP element';
case _ETS_CONST: return 'constant element';
case _ETS_IF: return 'if element';
case _ETS_CODE: return 'PHP code or test';
case _ETS_CHOOSE: return 'choose element';
case _ETS_WHENTEST: return 'when-test element';
case _ETS_ELSE: return 'else element';
case _ETS_CHOOSEVAR: return 'choose-variable element';
case _ETS_WHENVAL: return 'when-value element';
case _ETS_CALL: return 'call element';
case _ETS_ARG: return 'argument element';
case _ETS_MIS_TEMPLATE: return 'missing template element';
case _ETS_REDUCE: return 'reduce element';
case _ETS_REPEAT: return 'repeat element';
case _ETS_RSS: return 'rss element';
case _ETS_INCLUDE: return 'include element';
case _ETS_INSERT: return 'insert element';
case _ETS_EVAL: return 'eval element';
case _ETS_SAFE: return 'safe eval element';
case _ETS_ROOT_EVAL: return 'eval or safe element';
case _ETS_PLACE: return 'place element';
}
} | php | {
"resource": ""
} |
q252278 | _ets.store_reduce | validation | function store_reduce(&$elts, $value)
{
switch(strtoupper($value)) {
case 'OFF':
case 'NOTHING':
$elts['0reduce'] = _ETS_REDUCE_OFF;
return TRUE;
case 'SPACE':
case 'SPACES':
$elts['0reduce'] = _ETS_REDUCE_SPACES;
return TRUE;
case 'CRLF':
case 'ON':
case 'ALL':
$elts['0reduce'] = _ETS_REDUCE_ALL;
return TRUE;
default:
return FALSE;
}
} | php | {
"resource": ""
} |
q252279 | _ets.node_path_walk | validation | function node_path_walk($elements, $rank, $ptype, &$i, &$line, $cvalue, $ncontent, $content, $code)
{
if (count($elements) == 1) {
$elt[$ptype . ':' . $i . ':' . $elements[0] . ':' . $cvalue] = $this->parse($code ? _ETS_CODE : $ptype, $i, $line, $ncontent, $content);
} else {
$element1 = array_shift($elements);
$masktype = ($ptype == _ETS_MIS || $ptype == _ETS_MISVAL) ? _ETS_MIS_TEMPLATE : _ETS_TEMPLATE;
$elt[$masktype . ':' . $i . '.' . $rank . ':' . $element1] = $this->node_path_walk($elements, $rank + 1, $ptype, $i, $line, $cvalue, $ncontent, $content, $code);
}
return $elt;
} | php | {
"resource": ""
} |
q252280 | _ets.store_node | validation | function store_node(&$elts, $ptype, &$i, &$line, $cname, $cvalue, $ncontent, $content, $code = FALSE)
{
$isabsolute = FALSE;
if ($cname{0} == '/' && $cname{1} == '/') {
$isabsolute = TRUE;
$cname = substr($cname, 2);
}
$elements = explode('/', $cname);
if (count($elements) == 1 && !$isabsolute) {
$elts[$ptype . ':' . $i . ':' . $cname . ':' . $cvalue] = $this->parse($code ? _ETS_CODE : $ptype, $i, $line, $ncontent, $content);
} else {
if ($isabsolute) {
$elts[_ETS_TEMPLATE . ':' . $i . '.1://'] = $this->node_path_walk($elements, 2, $ptype, $i, $line, $cvalue, $ncontent, $content, $code);
} else {
$element1 = array_shift($elements);
$masktype = ($ptype == _ETS_MIS || $ptype == _ETS_MISVAL) ? _ETS_MIS_TEMPLATE : _ETS_TEMPLATE;
$elts[$masktype . ':' . $i . '.1:' . $element1] = $this->node_path_walk($elements, 2, $ptype, $i, $line, $cvalue, $ncontent, $content, $code);
}
}
} | php | {
"resource": ""
} |
q252281 | _ets.leaf_path_walk | validation | function leaf_path_walk($elements, $rank, $ptype, &$i, $cvalue)
{
if (count($elements) == 1) {
$elt[$ptype . ':' . $i . ':' . $elements[0] . ':' . $cvalue] = '';
} else {
$element1 = array_shift($elements);
$elt[_ETS_TEMPLATE . ':' . $i . '.' . $rank . ':' . $element1] = $this->leaf_path_walk($elements, $rank + 1, $ptype, $i, $cvalue);
}
return $elt;
} | php | {
"resource": ""
} |
q252282 | _ets.store_leaf | validation | function store_leaf(&$elts, $ptype, &$i, $cname, $cvalue = NULL)
{
$isabsolute = FALSE;
if ($cname{0} == '/' && $cname{1} == '/') {
$isabsolute = TRUE;
$cname = substr($cname, 2);
}
$elements = explode('/', $cname);
if (count($elements) == 1 && !$isabsolute) {
$elts[$ptype . ':' . $i . ':' . $cname . ':' . $cvalue] = '';
} else {
if ($isabsolute) {
$elts[_ETS_TEMPLATE . ':' . $i . '.1://'] = $this->leaf_path_walk($elements, 2, $ptype, $i, $cvalue);
} else {
$element1 = array_shift($elements);
$elts[_ETS_TEMPLATE . ':' . $i . '.1:' . $element1] = $this->leaf_path_walk($elements, 2, $ptype, $i, $cvalue);
}
}
} | php | {
"resource": ""
} |
q252283 | _ets.store_text | validation | function store_text(&$elts, &$i, $ptype, $ntext, $ctext)
{
if ($ntext == 1 && $ptype != _ETS_ROOT) {
$elts[_ETS_TEXT . ':' . $i] = $ctext;
}
} | php | {
"resource": ""
} |
q252284 | _ets.is_space | validation | function is_space($char)
{
$asc = ord($char);
if ($asc == 32) {
return TRUE;
} elseif ($asc > 8 && $asc < 14) {
return TRUE;
}
return FALSE;
} | php | {
"resource": ""
} |
q252285 | _ets.masktree_merge | validation | function masktree_merge($masktree1, $masktree2, $maskname)
{
$merged = array_merge($masktree1, $masktree2);
if (count($merged) < count($masktree1) + count($masktree2)) {
$keys1 = array_keys($masktree1);
$keys2 = array_keys($masktree2);
$keysm = array_merge($keys1, $keys2);
$keysc = array_count_values($keysm);
foreach ($keysc as $keyn => $keyc) {
if ($keyc > 1) {
if ($keyn == '0reduce') {
$this->error(6, 49, 'reduce element already used');
} elseif ($keyn != '0include') {
$this->error(16, 60, "template $keyn already defined in <b>$maskname</b>");
}
}
}
}
return $merged;
} | php | {
"resource": ""
} |
q252286 | _ets.read_content | validation | function read_content()
{
if ($this->external_source_read) {
$fct = $this->source_read_name;
return $fct($this->container);
} else {
$content = FALSE;
if ($handle = @fopen($this->container, 'rb')) {
$size = @filesize($this->container);
$content = @fread($handle, $size);
fclose($handle);
}
return $content;
}
} | php | {
"resource": ""
} |
q252287 | _ets.parse_containers | validation | function parse_containers($containers)
{
// Construct an array of container names
if (!is_array($containers)) {
$containers = explode(',', $containers);
}
// Parse each container
foreach ($containers as $container) {
$masktree = $this->read_container($container, _ETS_ROOT);
if ($masktree === FALSE) {
$this->error(11, 52, $this->container);
} else {
$this->masktree = $this->masktree_merge($this->masktree, $masktree, $container);
}
}
} | php | {
"resource": ""
} |
q252288 | _ets.get_value | validation | function get_value($parent, $varname)
{
if (isset($parent->$varname)) {
return $parent->$varname;
} else {
$elements = explode('[', $varname);
if (count($elements) == 1) {
return NULL;
} else {
$vartest = $parent;
foreach ($elements as $elementid => $element) {
if ($elementid == 0) {
$vartest = $parent->$element;
if (!isset($vartest)) {
return NULL;
}
} else {
$index = substr($element, 0, -1);
if ($index == '_first') {
$keys = array_keys($vartest);
$index = $keys[0];
} elseif ($index == '_last') {
$keys = array_keys($vartest);
$index = $keys[count($keys) - 2];
}
if (!isset($vartest[$index])) {
return NULL;
} else {
$vartest = $vartest[$index];
}
}
}
}
return $vartest;
}
} | php | {
"resource": ""
} |
q252289 | _ets.add_system_var | validation | function add_system_var(&$datatree, $index, $last, $key)
{
$datatree->_key = $key;
$datatree->_index = $index;
$datatree->_rank = $index + 1;
$datatree->_odd = $datatree->_not_even = (1 == $datatree->_rank % 2);
$datatree->_even = $datatree->_not_odd = (0 == $datatree->_rank % 2);
$datatree->_first = (0 == $index);
$datatree->_middle = !$datatree->_first && !$last;
$datatree->_last = $last;
$datatree->_not_first = !$datatree->_first;
$datatree->_not_last = !$last;
$datatree->_not_middle = !$datatree->_middle;
} | php | {
"resource": ""
} |
q252290 | _ets.parse_info | validation | function parse_info($info)
{
$elements = explode(':', $info);
$count = count($elements);
if ($count > 4) {
for ($i = 4; $i < $count; ++$i) {
$elements[3] .= ':' . $elements[$i];
}
} else {
$elements = array_pad($elements, 4, '');
}
return array($elements[0], $elements[2], $elements[3]);
} | php | {
"resource": ""
} |
q252291 | _ets.protect_spaces | validation | function protect_spaces($data)
{
$data = str_replace("\n", "\1n\1", $data);
$data = str_replace("\r", "\1r\1", $data);
$data = str_replace("\t", "\1t\1", $data);
return str_replace(" " , "\1s\1", $data);
} | php | {
"resource": ""
} |
q252292 | _ets.build_all | validation | function build_all($datatree, $entry)
{
// No entry: stop
if (!isset($this->masktree[$entry])) {
$this->error(8, 57, $entry);
}
// Data tree
$this->datatree = $datatree;
if (is_array($this->datatree)) {
$this->datatree['_parent'] = NULL;
} elseif (is_object($this->datatree)) {
$this->datatree->_parent = NULL;
} elseif (isset($this->datatree)) {
$this->error(9, 58);
$this->datatree = NULL;
}
// Build
$built = $this->build_mask($this->datatree, $this->masktree[$entry]);
// Reduce and return
if (!isset($this->masktree['0reduce'])) {
$this->masktree['0reduce'] = _ETS_REDUCE_OFF;
}
switch ($this->masktree['0reduce']) {
case _ETS_REDUCE_OFF:
break;
case _ETS_REDUCE_SPACES:
$built = preg_replace('/(\r\n|\r|\n)+/sm', "\n", preg_replace('/[ \t]*?(\r\n|\r|\n)+[\t ]*/sm', "\n", $built));
break;
case _ETS_REDUCE_ALL:
$built = preg_replace('/[ \t]*?(\r\n|\r|\n)+[\t ]*/sm', '', $built);
break;
}
$built = str_replace("\1n\1", "\n", $built);
$built = str_replace("\1r\1", "\r", $built);
$built = str_replace("\1t\1", "\t", $built);
$built = str_replace("\1s\1", " ", $built);
return $built;
} | php | {
"resource": ""
} |
q252293 | _ets.sprintt | validation | public static function sprintt($datatree, $containers, $entry = 'main', $hsr = _ETS_SOURCE_READ, $hcr = _ETS_CACHE_READ, $hcw = _ETS_CACHE_WRITE)
{
$ets = new _ets($containers, $hsr, $hcr, $hcw);
return $ets->build_all($datatree, $entry);
} | php | {
"resource": ""
} |
q252294 | _ets.sprintts | validation | public static function sprintts($datatree, $containers, $entry = 'main')
{
return $this->sprintt($datatree, $containers, $entry, _ETS_STRING_READ, '', '');
} | php | {
"resource": ""
} |
q252295 | _ets.printts | validation | public static function printts($datatree, $containers, $entry = 'main')
{
$this->printt($datatree, $containers, $entry, _ETS_STRING_READ, '', '');
} | php | {
"resource": ""
} |
q252296 | AssetManager.getBundle | validation | public function getBundle($name, $publish = true)
{
if ($this->bundles === false) {
return $this->loadDummyBundle($name);
} elseif (!isset($this->bundles[$name])) {
return $this->bundles[$name] = $this->loadBundle($name, [], $publish);
} elseif ($this->bundles[$name] instanceof AssetBundle) {
return $this->bundles[$name];
} elseif (is_array($this->bundles[$name])) {
return $this->bundles[$name] = $this->loadBundle($name, $this->bundles[$name], $publish);
} elseif ($this->bundles[$name] === false) {
return $this->loadDummyBundle($name);
} else {
throw new InvalidConfigException("Invalid asset bundle configuration: $name");
}
} | php | {
"resource": ""
} |
q252297 | UrlExtension.urlFunction | validation | public function urlFunction($route, array $params = []) {
return $this->container['url_generator']->generate($route, $params, UrlGeneratorInterface::ABSOLUTE_URL);
} | php | {
"resource": ""
} |
q252298 | UrlExtension.pathFunction | validation | public function pathFunction($route, array $params = []) {
return $this->container['url_generator']->generate($route, $params, UrlGeneratorInterface::ABSOLUTE_PATH);
} | php | {
"resource": ""
} |
q252299 | GetDataStoreCapableTrait._getDataStore | validation | protected function _getDataStore()
{
return $this->dataStore === null
? $this->dataStore = $this->_createDataStore()
: $this->dataStore;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.