_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q8200 | Helpers.& | train | protected function & setCoreClass ($newCoreClassName, $coreClassVar, $coreClassInterface) {
if (call_user_func(
[$this->toolClass, 'CheckClassInterface'],
$newCoreClassName, $coreClassInterface, TRUE, TRUE // check static methods and throw an exception if false
)) $this->$coreClassVar = $newCoreClassName;
... | php | {
"resource": ""
} |
q8201 | Helpers.& | train | protected function & setHandler (array & $handlers, callable $handler, $priorityIndex = NULL) {
// there is possible to call any `callable` as closure function in variable
// except forms like `'ClassName::methodName'` and `['childClassName', 'parent::methodName']`
// and `[$childInstance, 'parent::methodName']`.... | php | {
"resource": ""
} |
q8202 | CreatePropertyConditionListener.onCreatePropertyCondition | train | public function onCreatePropertyCondition(CreatePropertyConditionEvent $event)
{
if (!$this->scopeMatcher->currentScopeIsFrontend()) {
return;
}
$meta = $event->getData();
if ('conditionpropertyvalueis' !== $meta['type']) {
return;
}
$metaMo... | php | {
"resource": ""
} |
q8203 | MigratorUtil.getClassNameFromFile | train | public static function getClassNameFromFile($file)
{
$fp = fopen($file, 'r');
$class = $namespace = $buffer = '';
$i = 0;
while (!$class) {
if (feof($fp)) {
break;
}
// Read entire lines to prevent keyword truncation
... | php | {
"resource": ""
} |
q8204 | ConfirmExtension.configureTwigBundle | train | private function configureTwigBundle(ContainerBuilder $container)
{
// Get the twig configurations.
$name = 'twig';
$configs = $container->getExtensionConfig($name);
// Find any existing configurations and add to it them so when the
// configs are merged they do not overw... | php | {
"resource": ""
} |
q8205 | NamespaceMethods.& | train | public static function & GetNamespace (
$name = \MvcCore\ISession::DEFAULT_NAMESPACE_NAME
) {
if (!static::GetStarted()) static::Start();
if (!isset(static::$instances[$name])) {
static::$instances[$name] = new static($name);
}
/** @var $result \MvcCore\Session */
$result = & static::$instances[$name];
... | php | {
"resource": ""
} |
q8206 | Builder.buildAsProduction | train | public function buildAsProduction(Collection $collection, $group)
{
// Get the assets of the given group from the collection. The collection is also responsible
// for handling any ordering of the assets so that we just need to build them.
$assets = $collection->getAssetsWithoutRaw($group);
... | php | {
"resource": ""
} |
q8207 | Builder.buildAsDevelopment | train | public function buildAsDevelopment(Collection $collection, $group)
{
// Get the assets of the given group from the collection. The collection is also responsible
// for handling any ordering of the assets so that we just need to build them.
$assets = $collection->getAssetsWithoutRaw($group);... | php | {
"resource": ""
} |
q8208 | Builder.collectionDefinitionHasChanged | train | protected function collectionDefinitionHasChanged($assets, $entry, $group)
{
// If the manifest entry doesn't even have the group registered then it's obvious that the
// collection has changed and needs to be rebuilt.
if ( ! $entry->hasDevelopmentAssets($group))
{
return... | php | {
"resource": ""
} |
q8209 | Builder.makeBuildPath | train | protected function makeBuildPath()
{
if ( ! $this->files->exists($this->buildPath))
{
$this->files->makeDirectory($this->buildPath);
}
} | php | {
"resource": ""
} |
q8210 | Component.initDefaultProperties | train | public function initDefaultProperties()
{
if (!empty($this->schema->properties)) {
foreach ($this->schema->properties as $property_name => $property) {
if ($this->setPropertyDefaultValue($property)) {
$this->property_values->$property_name = $this->getFactory(... | php | {
"resource": ""
} |
q8211 | Component.get | train | public function get($property_name = null)
{
if (!isset($property_name)) {
return $this->property_values;
}
// @todo: This probably needs a refactor.
// If this is a component itself just return the component.
if (isset($this->property_values->$property_name)
... | php | {
"resource": ""
} |
q8212 | Component.validate | train | public function validate($notify = false)
{
$validator = $this->getValidator();
if ($validator) {
// Expand the schema.
// TODO: recurse & $value->validate() instead?
$schema = clone $this->schema;
$this->resolver->resolve($schema, $this->schema_path);... | php | {
"resource": ""
} |
q8213 | Component.render | train | public function render()
{
$template_variables = $this->prepareRender();
if ($this->configuration->developerMode()) {
$this->validate(true);
}
// Decode/encode turns the full array/object into an array.
// Just typecasting to an array does not recursively apply ... | php | {
"resource": ""
} |
q8214 | Component.prepareTemplateVariables | train | public function prepareTemplateVariables($variables)
{
if (!isset($variables)) {
$variables = new \stdClass();
}
// Set name property if the schema does not define it.
if (!isset($variables->name) && !empty($this->schema_name)) {
$variables->name = $this->sch... | php | {
"resource": ""
} |
q8215 | TranslationToDatabase.getValue | train | private function getValue(array $values, $languages, $group, $parent = NULL)
{
foreach($values as $key => $value){
foreach($languages as $language){
$entry = Translation::firstOrCreate([
'key' => $key,
'language' => $language,
'translation_group' => $group->id,
'parent' => $parent
... | php | {
"resource": ""
} |
q8216 | TranslationToDatabase.updateTranslationGroups | train | private function updateTranslationGroups($groupname)
{
$group = TranslationGroup::firstOrCreate(['name' => $groupname]);
array_push($this->translation_groups, $group);
} | php | {
"resource": ""
} |
q8217 | Posterize.setLevel | train | public function setLevel($level)
{
if ($level < 0 || $level > 100) {
throw new \InvalidArgumentException(sprintf(
'Invalid Postrize Level "%s"', (string) $level
));
}
$this->level = (int) $level;
return $this;
} | php | {
"resource": ""
} |
q8218 | Instancing.& | train | public static function & GetInstance (array $routes = [], $autoInitialize = TRUE) {
if (!self::$instance) {
/** @var $app \MvcCore\Application */
$app = & \MvcCore\Application::GetInstance();
self::$routeClass = $app->GetRouteClass();
self::$routerClass = $app->GetRouterClass();
self::$toolClass = $app... | php | {
"resource": ""
} |
q8219 | Models.all | train | public static function all()
{
$command = 'grep --include="*.php" --files-with-matches -r "class" '.app_path();
exec($command, $files);
return collect($files)->map(function($file) {
return self::convertFileToClass($file);
})->filter(function($class) {
return... | php | {
"resource": ""
} |
q8220 | Models.convertFileToClass | train | private static function convertFileToClass(string $file)
{
$fh = fopen($file, 'r');
$namespace = '';
while(($line = fgets($fh, 5000)) !== false) {
if (str_contains($line, 'namespace')) {
$namespace = trim(str_replace(['namespace', ';'], '', $line));
... | php | {
"resource": ""
} |
q8221 | Models.utf8EncodeModel | train | public static function utf8EncodeModel(Model $model)
{
foreach($model->toArray() as $key => $value) {
if (is_numeric($value) || !is_string($value)) {
continue;
}
$model->$key = utf8_encode($value);
}
return $model;
} | php | {
"resource": ""
} |
q8222 | Models.getNextId | train | public static function getNextId(Model $model)
{
$statement = DB::select('show table status like \''.$model->getTable().'\'');
if (!isset($statement[0]) || !isset($statement[0]->Auto_increment)) {
throw new \Exception('Unable to retrieve next auto-increment id for this model.');
... | php | {
"resource": ""
} |
q8223 | Models.areRelated | train | public static function areRelated(...$relations)
{
try {
$max_key = count($relations) - 1;
foreach ($relations as $key => $current) {
if (!is_array($current)) {
$previous = null;
if ($key > 0) {
$previous = $relations[ $key - 1 ];
$previous = is_array($previous)
? $previous[ ... | php | {
"resource": ""
} |
q8224 | Content.IsXmlOutput | train | public function IsXmlOutput () {
if (isset($this->headers['Content-Type'])) {
$value = $this->headers['Content-Type'];
return strpos($value, 'xml') !== FALSE;
}
return FALSE;
} | php | {
"resource": ""
} |
q8225 | Content.Send | train | public function Send () {
if ($this->IsSent()) return;
$httpVersion = $this->GetHttpVersion();
$code = $this->GetCode();
$status = $this->codeMessage !== NULL
? ' '.$this->codeMessage
: (isset(static::$codeMessages[$code])
? ' '.static::$codeMessages[$code]
: '');
if (!isset($this->headers['Co... | php | {
"resource": ""
} |
q8226 | MelisSiteTable.getSites | train | public function getSites($env = '', $includeSite404Table = false)
{
$select = $this->tableGateway->getSql()->select();
$select->columns(array('*'));
if($includeSite404Table) {
$select->join('melis_cms_site_domain', 'melis_cms_site_domain.sdom_site_id = melis_cms_site.site_id',
array('*'), $s... | php | {
"resource": ""
} |
q8227 | MelisSiteTable.getSiteById | train | public function getSiteById($idSite, $env, $includeSite404Table = false)
{
// Retrieve cache version if front mode to avoid multiple calls
$cacheKey = get_class($this) . '_getSiteById_' . $idSite . '_' . $env . '_' . $includeSite404Table;
$cacheConfig = 'engine_page_services';
$melisEngine... | php | {
"resource": ""
} |
q8228 | Png.setFilter | train | public function setFilter($filter)
{
$validFilters = self::NO_FILTER |
self::FILTER_NONE | self::FILTER_SUB |
self::FILTER_UP | self::FILTER_AVG |
self::FILTER_PAETH | self::ALL_FILTERS;
$filter = $filter & $validFilters;
$this->filter = (int... | php | {
"resource": ""
} |
q8229 | Png.isPngFile | train | public static function isPngFile($filename)
{
try {
$image = new ImageFile($filename);
if (strtolower($image->getMime()) !== @image_type_to_mime_type(IMAGETYPE_PNG)) {
return false;
}
return true;
} catch (\RuntimeException $ex) {
... | php | {
"resource": ""
} |
q8230 | Png.saveAlpha | train | protected function saveAlpha(Png $png, $flag)
{
if ($flag) {
$png->alphaBlending(false);
if (false == @imagesavealpha($png->getHandler(), $flag)) {
throw new CanvasException(sprintf(
'Faild Saving The Alpha Channel Information To The Png Canvas... | php | {
"resource": ""
} |
q8231 | Image.getResizedFilename | train | protected function getResizedFilename( $filepath, $width, $height, $crop ) {
$filename = basename( $filepath );
// match filename extension with dot
// only the last extension will match when there are multiple ones
$extension_pattern = '/(\.[^\.]+)$/';
// add width, height and crop to filename
$replaceme... | php | {
"resource": ""
} |
q8232 | Image.store | train | protected function store( $source, $destination, $width, $height, $crop ) {
if ( file_exists( $destination ) ) {
return $destination;
}
$editor = wp_get_image_editor( $source );
if ( is_wp_error( $editor ) ) {
return '';
}
$editor->resize( $width, $height, $crop );
$editor->save( $destination );
... | php | {
"resource": ""
} |
q8233 | DirectoryMethods.GetCurrentViewFullPath | train | public function GetCurrentViewFullPath () {
$result = NULL;
$renderedFullPaths = & $this->__protected['renderedFullPaths'];
$count = count($renderedFullPaths);
if ($count > 0)
$result = $renderedFullPaths[$count - 1];
return $result;
} | php | {
"resource": ""
} |
q8234 | DirectoryMethods.GetCurrentViewDirectory | train | public function GetCurrentViewDirectory () {
$result = $this->GetCurrentViewFullPath();
$lastSlashPos = mb_strrpos($result, '/');
if ($lastSlashPos !== FALSE) {
$result = mb_substr($result, 0, $lastSlashPos);
}
return $result;
} | php | {
"resource": ""
} |
q8235 | AttributeBag.withAttribute | train | public function withAttribute(string $offset, $value) : self
{
if ($this->restricted) {
if (!in_array($offset, array_keys($this->attributes))) {
$message = sprintf('%s it not an allowed attribute on this object. The only allowed attributes are %s', $offset, implode(',', array_key... | php | {
"resource": ""
} |
q8236 | TranslatorBuilder.build | train | public function build()
{
$fixer = new VendorDirectoryFixer();
// Set up the Translation component
$translator = new Translator($this->locale);
$pos = strpos($this->locale, '_');
$file = 'validators.' . ($pos ? substr($this->locale, 0, $pos) : $this->locale) . '.... | php | {
"resource": ""
} |
q8237 | MelisSite404Table.getDataBySiteIdAndPageId | train | public function getDataBySiteIdAndPageId($siteId, $pageId)
{
$select = $this->tableGateway->getSql()->select();
$select->columns(array('*'));
$select->where(array("s404_site_id" => $siteId, 's404_page_id' => $pageId));
$resultSet = $this->tableGateway->selectWith($select);
... | php | {
"resource": ""
} |
q8238 | APIRequest.has | train | public function has($key)
{
if ($this->needParser()) {
$this->treatPutRequest();
return array_key_exists($key, $_REQUEST);
}
return parent::has($key);
} | php | {
"resource": ""
} |
q8239 | AbstractCanvas.isValidFile | train | protected function isValidFile($file)
{
if (!is_file($file) || !is_readable($file)) {
throw new \InvalidArgumentException(sprintf(
'File "%s" Is Not Readable', (string) $file
));
}
} | php | {
"resource": ""
} |
q8240 | AbstractCanvas.preserveAlpha | train | protected function preserveAlpha($dest, $src)
{
$transparent = @imagecolortransparent($src);
if (-1 != $transparent) {
$color = @imagecolorsforindex($src, $transparent);
$allocated = @imagecolorallocatealpha(
$dest
, $co... | php | {
"resource": ""
} |
q8241 | Profiler.extend | train | public function extend(Contracts\Listener $listener): self
{
$listener->handle($this->getLogger());
return $this;
} | php | {
"resource": ""
} |
q8242 | ZmqSocket.handleEvent | train | public function handleEvent()
{
while ($this->socket !== null)
{
$events = $this->socket->getSockOpt(ZMQ::SOCKOPT_EVENTS);
$hasEvents = ($events & ZMQ::POLL_IN) || ($events & ZMQ::POLL_OUT && $this->buffer->listening);
if (!$hasEvents)
{
... | php | {
"resource": ""
} |
q8243 | ZmqSocket.handleReadEvent | train | public function handleReadEvent()
{
$messages = $this->socket->recvmulti(ZMQ::MODE_DONTWAIT);
if (false !== $messages)
{
$this->emit('messages', [ $messages ]);
}
} | php | {
"resource": ""
} |
q8244 | ZmqSocket.close | train | public function close()
{
if ($this->closed)
{
return;
}
$this->emit('end', [ $this ]);
$this->loop->removeStream($this->fd);
$this->buffer->flushListeners();
$this->flushListeners();
unset($this->socket);
$this->closed = true;
... | php | {
"resource": ""
} |
q8245 | EdgeDetection.setType | train | public function setType($type, $divisor = 1.0, $offset = 0.0)
{
if (!array_key_exists($type, self::$SUPPORTED_TYPES)) {
throw new \InvalidArgumentException('Invalid Edge Type');
}
$this->type = $type;
$this->divisor = $divisor;
$this->offset = $offset;
re... | php | {
"resource": ""
} |
q8246 | CssoFilter.filterLoad | train | public function filterLoad(AssetInterface $asset)
{
$inputFile = tempnam(sys_get_temp_dir(), 'csso');
file_put_contents($inputFile, $asset->getContent());
// Before we create our process builder we'll create the arguments to be given to the builder.
// If we have a node bin supplie... | php | {
"resource": ""
} |
q8247 | FileCacheClassLoader.saveCacheFile | train | public function saveCacheFile()
{
if ($this->store !== null) {
file_put_contents($this->cacheFile, $this->createCache($this->store), LOCK_EX);
$this->store = null;
}
} | php | {
"resource": ""
} |
q8248 | FileCacheClassLoader.storeCache | train | public function storeCache(array $cache)
{
if ($this->store === null) {
register_shutdown_function([$this, 'saveCacheFile']);
}
$this->store = $cache;
} | php | {
"resource": ""
} |
q8249 | FileCacheClassLoader.createCache | train | private function createCache(array $cache)
{
ksort($cache);
$format = "\t%s => %s," . PHP_EOL;
$rows = [];
foreach ($cache as $key => $value) {
$rows[] = sprintf($format, var_export($key, true), var_export($value, true));
}
return sprintf('<?php return ... | php | {
"resource": ""
} |
q8250 | Filterable.apply | train | public function apply($filter, Closure $callback = null)
{
// If the supplied filter is an array then we'll treat it as an array of filters that are
// to be applied to the resource.
if (is_array($filter))
{
return $this->applyFromArray($filter);
}
$filte... | php | {
"resource": ""
} |
q8251 | Filterable.applyFromArray | train | public function applyFromArray($filters)
{
foreach ($filters as $key => $value)
{
$filter = $this->factory->get('filter')->make(is_callable($value) ? $key : $value)->setResource($this);
is_callable($value) and call_user_func($value, $filter);
$this->filters[$fil... | php | {
"resource": ""
} |
q8252 | MelisSearchService.createIndex | train | public function createIndex($moduleName, $pageId, $exclude = array(),
$_defaultPath = self::FOLDER_PATH)
{
$this->tmpLogs = '';
$pageContent = '';
$folderPath = $_defaultPath . $moduleName;
$lucenePath = $folderPath. '/' .self::FOLDER_NAME;
/... | php | {
"resource": ""
} |
q8253 | MelisSearchService.clearIndex | train | public function clearIndex($dir)
{
$success = 0;
if (!file_exists($dir))
{
$success = 1;
}
if (!is_dir($dir))
{
return @unlink($dir);
}
foreach (scandir($dir) as $item)
{
if ($item == '.' || $item == '..')... | php | {
"resource": ""
} |
q8254 | MelisSearchService.optimizeIndex | train | public function optimizeIndex($moduleName)
{
$translator = $this->getServiceLocator()->get('translator');
$status = $translator->translate('tr_melis_engine_search_optimize');
$lucenePath = self::FOLDER_PATH.$moduleName.'/'.self::FOLDER_NAME . '/indexes';
if(file_exists($lucenePath) ... | php | {
"resource": ""
} |
q8255 | MelisSearchService.setSearchResultsAsXml | train | protected function setSearchResultsAsXml($searchValue, $searchResults)
{
$pagePublishTable = $this->getServiceLocator()->get('MelisEngineTablePagePublished');
$pageLangTbl = $this->getServiceLocator()->get('MelisEngineTablePageLang');
$cmsLangTbl = $this->getServiceLocator()->get('MelisEngi... | php | {
"resource": ""
} |
q8256 | MelisSearchService.createDocument | train | protected function createDocument($data = array())
{
$enginePage = $this->getServiceLocator()->get('MelisEngineTree');
$translator = $this->getServiceLocator()->get('translator');
$pageSvc = $this->getServiceLocator()->get('MelisEnginePage');
$doc = new Document();
if(is_a... | php | {
"resource": ""
} |
q8257 | MelisSearchService.getHtmlDescription | train | protected function getHtmlDescription($html)
{
$content = '';
$doc = new \DOMDocument;
@$doc->loadHTML($html);
$xpath = new \DOMXPath($doc);
$query = '//p[preceding-sibling::p]';
foreach ($xpath->query($query) as $node) {
$content .= trim($node->textCont... | php | {
"resource": ""
} |
q8258 | MelisSearchService.getUrlContent | train | protected function getUrlContent($url)
{
$contents = '';
$time = (int) self::MAX_TIMEOUT_MINS * 60;
$timeout = stream_context_create(array(
'http' => array(
'timeout' => $time,
),
));
set_time_limit($time);
ini_set('max_executi... | php | {
"resource": ""
} |
q8259 | MelisSearchService.getUrlStatus | train | protected function getUrlStatus($url)
{
if($this->isValidUrl($url)) {
ini_set('allow_url_fopen', 1);
$url = @get_headers($url, 1);
if($url) {
$status = explode(' ',$url[0]);
return (int) $status[1];
}
}
else {
... | php | {
"resource": ""
} |
q8260 | MelisSearchService.createDir | train | protected function createDir($path)
{
$status = false;
if(!file_exists($path)) {
$oldmask = umask(0);
mkdir($path, 0755);
umask($oldmask);
// check if the directory is readable and writable
$status = $this->changePermission($path);
... | php | {
"resource": ""
} |
q8261 | MelisSearchService.changePermission | train | protected function changePermission($path, $octal = 0755)
{
$status = false;
if(!is_writable($path))
chmod($path, $octal);
if(!is_readable($path))
chmod($path, $octal);
if(is_readable($path) && is_writable($path))
$status = true;
return... | php | {
"resource": ""
} |
q8262 | MelisSearchService.limitedText | train | protected function limitedText($text, $limit = 200)
{
$postString = '...';
$strCount = strlen(trim($text));
$sLimitedText = $text;
if($strCount > $limit)
{
$sLimitedText = substr($text, 0, $limit) . $postString;
}
return $sLimitedText;
} | php | {
"resource": ""
} |
q8263 | MelisSearchService.isValidUrl | train | protected function isValidUrl($url)
{
$valid = false;
$parseUrl = parse_url($url);
if(isset($parseUrl['host']) || !empty($parseUrl['host'])) {
$uri = new \Zend\Validator\Uri();
if ($uri->isValid($url)) {
$valid = true;
}
else... | php | {
"resource": ""
} |
q8264 | Common.expandNumber | train | public function expandNumber($number)
{
switch (strtoupper(substr($number, -1))) {
case 'B':
$multiplier = 1000000000;
break;
case 'M':
$multiplier = 1000000;
break;
case 'K':
$multiplier = 10... | php | {
"resource": ""
} |
q8265 | Common.shortenNumber | train | public function shortenNumber($number)
{
$abbr = [9 => 'B', 6 => 'M', 3 => 'K'];
foreach ($abbr as $exponent => $suffix) {
if ($number >= pow(10, $exponent)) {
return intval($number / pow(10, $exponent)) . $suffix;
}
}
return $number;
} | php | {
"resource": ""
} |
q8266 | Common.xpTolevel | train | public function xpTolevel($xp)
{
$modifier = 0;
for ($i = 1; $i <= 126; $i++) {
$modifier += floor($i + 300 * pow(2, ($i / 7)));
$level = floor($modifier / 4);
if ($xp < $level) {
return $i;
}
}
// Return the maximum ... | php | {
"resource": ""
} |
q8267 | Common.levelToXp | train | public function levelToXp($level)
{
$xp = 0;
for ($i = 1; $i < $level; $i++) {
$xp += floor($i + 300 * pow(2, ($i / 7)));
}
$xp = floor($xp / 4);
// Check if our value is above 200m, if so return 200m, otherwise our value
return ($xp > 200000000 ? 20000... | php | {
"resource": ""
} |
q8268 | Handlers.Dump | train | public static function Dump ($value, $return = FALSE, $exit = FALSE) {
if (static::$originalDebugClass) {
$options = ['bar' => FALSE, 'backtraceIndex' => 1];
if ($exit) $options['lastDump'] = TRUE;
$dumpedValue = static::dumpHandler($value, NULL, $options);
} else {
$dumpedValue = @call_user_func(static... | php | {
"resource": ""
} |
q8269 | Handlers.BarDump | train | public static function BarDump ($value, $title = NULL, $options = []) {
if (static::$originalDebugClass) {
if (!isset($options['backtraceIndex'])) $options['backtraceIndex'] = 1;
$options['bar'] = static::$debugging;
$dumpedValue = static::dumpHandler($value, $title, $options);
} else {
$dumpedValue = @... | php | {
"resource": ""
} |
q8270 | Handlers.Exception | train | public static function Exception ($exception, $exit = TRUE) {
if (static::$originalDebugClass) {
$dumpedValue = static::dumpHandler(
$exception, NULL, ['bar' => !$exit, 'backtraceIndex' => 1]
);
if (static::$debugging) {
echo $dumpedValue;
} else {
static::storeLogRecord($dumpedValue, \MvcCore... | php | {
"resource": ""
} |
q8271 | Handlers.storeLogRecord | train | protected static function storeLogRecord ($value, $priority) {
$content = date('[Y-m-d H-i-s]') . "\n" . $value;
$content = preg_replace("#\n(\s)#", "\n\t$1", $content) . "\n";
if (!static::$logDirectoryInitialized) static::initLogDirectory();
$fullPath = static::$LogDirectory . '/' . $priority . '.log';
file... | php | {
"resource": ""
} |
q8272 | Handlers.formatDebugDumps | train | protected static function formatDebugDumps () {
$dumps = '';
$lastDump = FALSE;
$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
$appRoot = $app->GetRequest()->GetAppRoot();
foreach (self::$dumps as $values) {
list($dumpResult, $lastDumpLocal) = self::formatDebugDump($values, ... | php | {
"resource": ""
} |
q8273 | Handlers.formatDebugDump | train | protected static function formatDebugDump ($dumpRecord, $appRoot = NULL) {
$result = '';
$lastDump = FALSE;
if ($appRoot === NULL) {
$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
$appRoot = $app->GetRequest()->GetAppRoot();
}
$options = $dumpRecord[2];
$result .= '<div... | php | {
"resource": ""
} |
q8274 | Handlers.sendDumpInAjaxHeader | train | protected static function sendDumpInAjaxHeader ($value, $title, $options) {
static $ajaxHeadersIndex = 0;
$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
$response = & $app->GetResponse();
list ($dumpStr,) = self::formatDebugDump(
[$value, $title, $options],
$app->GetRequest... | php | {
"resource": ""
} |
q8275 | Handlers.isHtmlResponse | train | protected static function isHtmlResponse () {
$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
$request = & $app->GetRequest();
if ($request->IsInternalRequest()) return FALSE;
$response = & $app->GetResponse();
return $response->HasHeader('Content-Type') && $response->IsHtmlOutp... | php | {
"resource": ""
} |
q8276 | HtmlPage.withAttributeHelper | train | private function withAttributeHelper(string $collection, string $key, string $value)
{
$newAttributes = $this->$collection->withAttribute($key, $value);
$that = clone($this);
$that->$collection = $newAttributes;
return $that;
} | php | {
"resource": ""
} |
q8277 | HttpClient.appendQuery | train | protected static function appendQuery(string $uri, array $query = []): string {
if (!empty($query)) {
$qs = http_build_query($query);
$uri .= (strpos($uri, '?') === false ? '?' : '&').$qs;
}
return $uri;
} | php | {
"resource": ""
} |
q8278 | HttpClient.delete | train | public function delete(string $uri, array $query = [], array $headers = [], array $options = []) {
$uri = static::appendQuery($uri, $query);
return $this->request(HttpRequest::METHOD_DELETE, $uri, '', $headers, $options);
} | php | {
"resource": ""
} |
q8279 | HttpClient.get | train | public function get(string $uri, array $query = [], array $headers = [], $options = []) {
$uri = static::appendQuery($uri, $query);
return $this->request(HttpRequest::METHOD_GET, $uri, '', $headers, $options);
} | php | {
"resource": ""
} |
q8280 | HttpClient.handleErrorResponse | train | public function handleErrorResponse(HttpResponse $response, $options = []) {
if ($options['throw'] ?? $this->throwExceptions) {
$body = $response->getBody();
if (is_array($body)) {
$message = $body['message'] ?? $response->getReasonPhrase();
} else {
... | php | {
"resource": ""
} |
q8281 | HttpClient.head | train | public function head(string $uri, array $query = [], array $headers = [], $options = []) {
$uri = static::appendQuery($uri, $query);
return $this->request(HttpRequest::METHOD_HEAD, $uri, '', $headers, $options);
} | php | {
"resource": ""
} |
q8282 | HttpClient.options | train | public function options(string $uri, array $query = [], array $headers = [], $options = []) {
$uri = static::appendQuery($uri, $query);
return $this->request(HttpRequest::METHOD_OPTIONS, $uri, '', $headers, $options);
} | php | {
"resource": ""
} |
q8283 | HttpClient.patch | train | public function patch(string $uri, $body = [], array $headers = [], $options = []) {
return $this->request(HttpRequest::METHOD_PATCH, $uri, $body, $headers, $options);
} | php | {
"resource": ""
} |
q8284 | HttpClient.post | train | public function post(string $uri, $body = [], array $headers = [], $options = []) {
return $this->request(HttpRequest::METHOD_POST, $uri, $body, $headers, $options);
} | php | {
"resource": ""
} |
q8285 | HttpClient.put | train | public function put(string $uri, $body = [], array $headers = [], $options = []) {
return $this->request(HttpRequest::METHOD_PUT, $uri, $body, $headers, $options);
} | php | {
"resource": ""
} |
q8286 | HttpClient.request | train | public function request(string $method, string $uri, $body, array $headers = [], array $options = []) {
$request = $this->createRequest($method, $uri, $body, $headers, $options);
// Call the chain of middleware on the request.
$response = call_user_func($this->middleware, $request);
if ... | php | {
"resource": ""
} |
q8287 | HttpClient.setDefaultHeader | train | public function setDefaultHeader(string $name, string $value) {
$this->defaultHeaders[$name] = $value;
return $this;
} | php | {
"resource": ""
} |
q8288 | HttpClient.addMiddleware | train | public function addMiddleware(callable $middleware) {
$next = $this->middleware;
$this->middleware = function (HttpRequest $request) use ($middleware, $next): HttpResponse {
return $middleware($request, $next);
};
return $this;
} | php | {
"resource": ""
} |
q8289 | MelisEngineCacheSystemService.isCacheConfActive | train | public function isCacheConfActive($confCache)
{
$active = true;
$config = $this->getServiceLocator()->get('config');
if (!empty($config['caches']) && !empty($config['caches'][$confCache]))
{
$conf = $config['caches'][$confCache];
if (isset($conf['active']))
... | php | {
"resource": ""
} |
q8290 | MelisEngineCacheSystemService.getTtlByKey | train | public function getTtlByKey($confCache, $cacheKey)
{
$ttl = 0;
$config = $this->getServiceLocator()->get('config');
if (!empty($config['caches']) && !empty($config['caches'][$confCache]))
{
$conf = $config['caches'][$confCache];
// Get default ttl from adapater config
... | php | {
"resource": ""
} |
q8291 | VerifierPresenterTrait.tryCall | train | protected function tryCall($method, array $parameters): bool
{
$called = parent::tryCall($method, $parameters);
if (!$called && substr($method, 0, 6) === 'action') {
$class = get_class($this);
throw new BadRequestException("Action '$class::$method' does not exist.");
... | php | {
"resource": ""
} |
q8292 | VerifierPresenterTrait.createRequest | train | public function createRequest($component, $destination, array $parameters, $mode)
{
return parent::createRequest($component, $destination, $parameters, $mode);
} | php | {
"resource": ""
} |
q8293 | ButtonDropdownSorter.renderSortButtonDropdown | train | protected function renderSortButtonDropdown()
{
$attributes = empty($this->attributes) ? array_keys($this->sort->attributes) : $this->attributes;
$links = [];
foreach ($attributes as $name) {
$links[] = Html::tag('li', $this->sort->link($name, [
'tabindex' => '-1'... | php | {
"resource": ""
} |
q8294 | Line.setLocation | train | public function setLocation(Coordinate $start, Coordinate $end)
{
return $this->setStart($start)->setEnd($end);
} | php | {
"resource": ""
} |
q8295 | Manifest.get | train | public function get($collection)
{
$collection = $this->getCollectionNameFromInstance($collection);
return isset($this->entries[$collection]) ? $this->entries[$collection] : null;
} | php | {
"resource": ""
} |
q8296 | Manifest.make | train | public function make($collection)
{
$collection = $this->getCollectionNameFromInstance($collection);
$this->dirty = true;
return $this->get($collection) ?: $this->entries[$collection] = new Entry;
} | php | {
"resource": ""
} |
q8297 | Manifest.forget | train | public function forget($collection)
{
$collection = $this->getCollectionNameFromInstance($collection);
if ($this->has($collection))
{
$this->dirty = true;
unset($this->entries[$collection]);
}
} | php | {
"resource": ""
} |
q8298 | Manifest.load | train | public function load()
{
$path = $this->manifestPath.'/collections.json';
if ($this->files->exists($path) and is_array($manifest = json_decode($this->files->get($path), true)))
{
foreach ($manifest as $key => $entry)
{
$entry = new Entry($entry['finge... | php | {
"resource": ""
} |
q8299 | Manifest.save | train | public function save()
{
if ($this->dirty)
{
$path = $this->manifestPath.'/collections.json';
$this->dirty = false;
return (bool) $this->files->put($path, $this->entries->toJson());
}
return false;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.