_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q240700 | Joyst_Model.Save | train | function Save($id, $data = null) {
if (!$id)
return;
$this->LoadSchema();
if (is_array($id)) {
$data = $id;
if (!isset($data[$this->schema['_id']['field']])) // Incomming data has no ID to address by
return;
$id = $data[$this->schema['_id']['field']];
} else {
$data[$this->schema['_id']['fi... | php | {
"resource": ""
} |
q240701 | Joyst_Model.Delete | train | function Delete($id) {
$this->LoadSchema();
$data = array($this->schema['_id']['field'] => $id);
$this->ResetQuery(array(
'method' => 'delete',
'table' => $this->table,
'where' => array(
$this->schema['_id']['field'] => $id,
),
));
$this->Trigger('access', $data);
if (!$this->continue)
... | php | {
"resource": ""
} |
q240702 | Joyst_Model.ResetQuery | train | function ResetQuery($query = null) {
$this->db->ar_select = array();
$this->db->ar_distinct = FALSE;
$this->db->ar_from = array();
$this->db->ar_join = array();
$this->db->ar_where = array();
$this->db->ar_like = array();
$this->db->ar_groupby = array();
$this->db->ar_having = array();
$this->db->ar_k... | php | {
"resource": ""
} |
q240703 | InstallProjectController.configureAction | train | public function configureAction(Request $request)
{
if ($this->get('tenside.status')->isTensideConfigured()) {
throw new NotAcceptableHttpException('Already configured.');
}
$inputData = new JsonArray($request->getContent());
$secret = bin2hex(random_bytes(40));
... | php | {
"resource": ""
} |
q240704 | InstallProjectController.getProjectVersionsAction | train | public function getProjectVersionsAction($vendor, $project)
{
$this->checkUninstalled();
$url = sprintf('https://packagist.org/packages/%s/%s.json', $vendor, $project);
$rfs = new RemoteFilesystem($this->getInputOutput());
$results = $rfs->getContents($url, $url);
$d... | php | {
"resource": ""
} |
q240705 | InstallProjectController.getInstallationStateAction | train | public function getInstallationStateAction()
{
$status = $this->get('tenside.status');
return new JsonResponse(
[
'state' => [
'tenside_configured' => $status->isTensideConfigured(),
'project_created' => $status->isProjectPrese... | php | {
"resource": ""
} |
q240706 | InstallProjectController.createUser | train | private function createUser($username, $password)
{
$user = new UserInformation(
[
'username' => $username,
'acl' => UserInformationInterface::ROLE_ALL
]
);
$user->set('password', $this->get('security.password_encoder')->encodePas... | php | {
"resource": ""
} |
q240707 | InstallProjectController.handleConfiguration | train | private function handleConfiguration($configuration)
{
$tensideConfig = $this->get('tenside.config');
if (isset($configuration['php_cli'])) {
$tensideConfig->setPhpCliBinary($configuration['php_cli']);
}
if (isset($configuration['php_cli_arguments'])) {
$ten... | php | {
"resource": ""
} |
q240708 | FileConfig.loadFile | train | function loadFile($file, $optional=false, $varname=false, $recursive=false)
{
if (!is_file($file))
{
if ($optional)
return $this;
else
throw new Exception("Failed to read config file '$file'");
}
$newConfig = @include($file);
if(!is_array($newConfig) && $varname)
$newConfig = $$varname;
... | php | {
"resource": ""
} |
q240709 | TemplateFinderService.find | train | public function find(PageDocument $page)
{
$request = $this->requestStack->getCurrentRequest();
$template = $page->getDefault(AbstractPhpcrDocument::DEFAULT_TEMPLATE_KEY);
if ($template === null) {
$defaults = [];
/** @var RouteEnhancerInterface $enhancer */
... | php | {
"resource": ""
} |
q240710 | Deklaracja.setPodmiot1 | train | public function setPodmiot1(\KCH\PCC3\Deklaracja\Podmiot1AnonymousType $podmiot1)
{
$this->podmiot1 = $podmiot1;
return $this;
} | php | {
"resource": ""
} |
q240711 | Deklaracja.setZalaczniki | train | public function setZalaczniki(\KCH\PCC3\Deklaracja\ZalacznikiAnonymousType $zalaczniki)
{
$this->zalaczniki = $zalaczniki;
return $this;
} | php | {
"resource": ""
} |
q240712 | ResqueWorkerBase.restore | train | public function restore($workerInstance)
{
list($hostname, $pid, $queues) = explode(':', $workerInstance, 3);
if (!is_array($queues)) {
$queues = explode(',', $queues);
}
$this->queues = $queues;
$this->pid = $pid;
$this->id = $workerInstance; //regenerat... | php | {
"resource": ""
} |
q240713 | LoggerBase.interpolateString | train | private function interpolateString($message, array $context = [])
{
// Build a replacement array with braces around the context keys.
$replace = [];
foreach ($context as $key => $value) {
// Check that the value can be cast to string.
if (!is_array($value) && (!is_obj... | php | {
"resource": ""
} |
q240714 | Prop.file | train | public static function file( $name, & $exists = false )
{
if( !defined("APP_DIR") )
{
return [];
}
$file = APP_DIR . "config" . DIRECTORY_SEPARATOR . $name . '.php';
if( file_exists( $file ) )
{
$data = Helper::includeImport($file);
$exists = true;
}
if( ! isset( $data ) || ! is_array( $data... | php | {
"resource": ""
} |
q240715 | Prop.cache | train | public static function cache( $name )
{
static $cache = [];
$name = (string) $name;
if( ! isset($cache[$name]) )
{
$cache[$name] = new self($name);
}
return $cache[$name];
} | php | {
"resource": ""
} |
q240716 | Prop.group | train | public function group( $name )
{
$name = rtrim($name, '.');
$pref = $name . '.';
$len = strlen($pref);
$data = [];
foreach( array_keys($this->items) as $key )
{
if( $key === $name )
{
$data['.'] = $this->items[$key];
}
else if( strlen($key) > $len && substr($key, 0, $len) === $pref )
{
... | php | {
"resource": ""
} |
q240717 | Prop.pathSet | train | public function pathSet( $path, $value )
{
$path = $this->createPath($path);
if( $path[0] == 1 )
{
$this->offsetSet($path[1], $value);
}
else
{
$array = & $this->items;
for( $i = 1, $len = $path[0]; $i <= $len; $i++ )
{
$key = $path[$i];
if( $i == $len )
{
$array[$key] = $value... | php | {
"resource": ""
} |
q240718 | Prop.pathGetIs | train | public function pathGetIs( $path, $accessible = false )
{
$path = $this->createPath($path);
$array = & $this->items;
$key = $path[1];
if( $path[0] > 1 )
{
for( $i = 1, $len = $path[0]; $i <= $len; $i++ )
{
$key = $path[$i];
if( ! array_key_exists($key, $array) )
{
return false;
}
... | php | {
"resource": ""
} |
q240719 | Prop.pathGetOr | train | public function pathGetOr( $path, $default )
{
$path = $this->createPath($path);
if( $path[0] == 1 )
{
return $this->get($path[1]);
}
$array = & $this->items;
for( $i = 1, $len = $path[0]; $i <= $len; $i++ )
{
$key = $path[$i];
if( ! array_key_exists($key, $array) )
{
break;
}
if(... | php | {
"resource": ""
} |
q240720 | LoopSpec.it_provides_useful_information_about_iterations | train | function it_provides_useful_information_about_iterations()
{
$this->next('one');
$this->getIndex()->shouldBe(0);
$this->getKey()->shouldBe('one');
$this->isFirst()->shouldBe(true);
$this->isLast()->shouldBe(false);
$this->next('two');
$this->getIndex()->shoul... | php | {
"resource": ""
} |
q240721 | Fuel.init | train | public static function init($config)
{
if (static::$initialized)
{
throw new \FuelException("You can't initialize Fuel more than once.");
}
// BC FIX FOR APPLICATIONS <= 1.6.1, makes Redis_Db available as Redis,
// like it was in versions before 1.7
class_exists('Redis', false) or class_alias('Redis_Db... | php | {
"resource": ""
} |
q240722 | Fuel.finish | train | public static function finish()
{
if (\Config::get('caching', false))
{
\Finder::instance()->write_cache('FuelFileFinder');
}
if (static::$profiling and ! static::$is_cli and ! \Input::is_ajax())
{
// Grab the output buffer and flush it, we will rebuffer later
$output = ob_get_clean();
$headers... | php | {
"resource": ""
} |
q240723 | Fuel.generate_base_url | train | protected static function generate_base_url()
{
$base_url = '';
if(\Input::server('http_host'))
{
$base_url .= \Input::protocol().'://'.\Input::server('http_host');
}
if (\Input::server('script_name'))
{
$common = get_common_path(array(\Input::server('request_uri'), \Input::server('script_name')));
... | php | {
"resource": ""
} |
q240724 | Fuel.always_load | train | public static function always_load($array = null)
{
is_null($array) and $array = \Config::get('always_load', array());
isset($array['packages']) and \Package::load($array['packages']);
isset($array['modules']) and \Module::load($array['modules']);
if (isset($array['classes']))
{
foreach ($array['classe... | php | {
"resource": ""
} |
q240725 | Fuel.clean_path | train | public static function clean_path($path)
{
static $search = array(APPPATH, COREPATH, PKGPATH, DOCROOT, '\\');
static $replace = array('APPPATH/', 'COREPATH/', 'PKGPATH/', 'DOCROOT/', '/');
return str_ireplace($search, $replace, $path);
} | php | {
"resource": ""
} |
q240726 | Transport.send | train | public function send(Request $request)
{
$interface = $request->getInterface();
$service = ConfigFactory::getClient()->getService($interface);
$url = $service->getUrl();
$requestRaw = Formatter::serialize($request);
$responseRaw = $this->protocol->sendData($url, $requestRaw)... | php | {
"resource": ""
} |
q240727 | ClientBasic.send | train | protected function send($content)
{
$streamOptions = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-Type: application/json',
'content' => $content,
)
);
$context = stream_context_create($streamOptions);
$result = @file_get_contents($this->getServerUrl(), false, $context);... | php | {
"resource": ""
} |
q240728 | Email.sendActivationMessage | train | public function sendActivationMessage()
{
$macros = new Macros($this->_data);
$message = $this->_params->get('msg_account_activate_msg');
$message = $macros->text($message);
$subject = $this->_params->get('msg_account_activate_subject');
return $this->send($subject, $messag... | php | {
"resource": ""
} |
q240729 | IntercessionClass.addAuthor | train | public function addAuthor(string $name = null, string $email = null)
{
is_null($name) and $name = '';
is_null($email) and $email = '';
if (empty($name) and empty($email)) {
throw new AuthorNoDataException();
}
if (!empty($email)) {
$author ... | php | {
"resource": ""
} |
q240730 | IntercessionClass.addInterface | train | public function addInterface(string $interfaceName, string $alias = null)
{
$this->interfaces[] = $this->addUse($interfaceName, $alias);
} | php | {
"resource": ""
} |
q240731 | IntercessionClass.addTrait | train | public function addTrait(string $traitName, string $alias = null)
{
$this->traits[] = $this->addUse($traitName, $alias);
return $this;
} | php | {
"resource": ""
} |
q240732 | IntercessionClass.extractClassNameFromUse | train | public function extractClassNameFromUse(string $use)
{
$matches = [];
if (preg_match(self::USE_CLASS_EXTRACT_REGEXP, $use, $matches) === 0) {
throw new InvalidNamespaceException($use);
}
$className = $matches['classname'];
$namespace = array_key_exists(... | php | {
"resource": ""
} |
q240733 | ScriptHandler.installJSDependencies | train | public static function installJSDependencies($event) {
echo "Installing JS Library dependencies for the AltamiraBundle\n";
$dir = getcwd();
ScriptHandler::gitSubmodulesUpdate();
ScriptHandler::cleanPublicJSDir();
// discovered that assetic can minify all the code - all not nec... | php | {
"resource": ""
} |
q240734 | FieldFactory.getInstance | train | public static function getInstance(array $config = []) {
// If element has no name
if (!isset($config['name'])){
throw new \Exception("You have to set the name of the field", 1);
}
if(!isset($config['class'])){
$config['class'] = Text::className();
... | php | {
"resource": ""
} |
q240735 | AtomicFileHandler.rewindFile | train | public function rewindFile()
{
$this->openFile();
if(!rewind($this->getFile()))
{
throw FileOperationException::createForFailedToRewindFile($this->getFilePath());
}
return $this;
} | php | {
"resource": ""
} |
q240736 | AtomicFileHandler.isFileEmpty | train | public function isFileEmpty()
{
$this->openFile();
$saved_pointer = $this->getFilePointer();
$this->rewindFile()->seekFileToEnd();
$size_pointer = $this->getFilePointer();
$this->seekFile($saved_pointer);
return $size_pointer === 0;
} | php | {
"resource": ""
} |
q240737 | AtomicFileHandler.checkFile | train | protected function checkFile($writable = true)
{
if(!$this->fileExists()) throw NonExistentFileException::createForFileDoesNotExists($this->getFilePath());
if(!is_readable($this->file_path)) throw NotReadableFileException::createForNotReadable($this->getFilePath());
if($writable)
{
... | php | {
"resource": ""
} |
q240738 | AtomicFileHandler.fileExists | train | protected function fileExists()
{
$this->clearStatCache(true);
return (file_exists($this->file_path) && is_file($this->file_path));
} | php | {
"resource": ""
} |
q240739 | IdentityRoleProviderFactory.createService | train | public function createService(ServiceLocatorInterface $serviceLocator)
{
$identityRoleProvider = new IdentityRoleProvider(
$serviceLocator->get('UserRbac\UserRoleLinkerMapper'),
$serviceLocator->get('UserRbac\ModuleOptions')
);
if ($serviceLocator->get('zfcuser_auth_s... | php | {
"resource": ""
} |
q240740 | Group.setValue | train | public function setValue($value)
{
foreach ((array)$this as $element) {
if ($value == $element->getElement()->getValue()) {
$element->getElement()->check();
} else {
$element->getElement()->check(false);
}
}
} | php | {
"resource": ""
} |
q240741 | Group.getValue | train | public function getValue() : ArrayObject
{
foreach ((array)$this as $element) {
if ($element->getElement() instanceof Radio
&& $element->getElement()->checked()
) {
return new class([$element->getElement()->getValue()]) extends ArrayObject {
... | php | {
"resource": ""
} |
q240742 | Group.isRequired | train | public function isRequired() : Group
{
foreach ((array)$this as $el) {
if (!is_object($el)) {
continue;
}
$el->getElement()->attribute('required', 1);
}
return $this->addTest('required', function ($value) {
foreach ($value as $o... | php | {
"resource": ""
} |
q240743 | Permission.getSections | train | protected function getSections(): array
{
$sections = explode($this->getDivider(), $this->getNotation());
foreach ($sections as $index => $section) {
$sections[$index] = explode($this->getSeparator(), $section);
}
return $sections;
} | php | {
"resource": ""
} |
q240744 | AbstractSearch.normalizeResultSet | train | protected function normalizeResultSet(array $resultSet)
{
$normalized = [];
foreach ($resultSet as $result) {
if (($normalizedResult = $this->normalizeResult($result)) === null) {
continue;
}
$normalized[$normalizedResult] = $normalizedResult;
... | php | {
"resource": ""
} |
q240745 | PageUtil.create | train | public static function create($totalPage, $pageSize = 10, $page = 1, $gets = [])
{
$p = new PageUtil();
if ($pageSize < 1) {
$pageSize = 1;
}
$total = ceil($totalPage / $pageSize);
if ($page < 1) {
$page = 1;
} else if ($page > $total) {
... | php | {
"resource": ""
} |
q240746 | Container.make | train | public function make(string $alias)
{
if (array_key_exists($alias, $this->bindings)) {
$classOrObject = $this->bindings[$alias];
if (is_object($classOrObject)) {
return $classOrObject;
}
return $this->makeInstance($classOrObject);
}
... | php | {
"resource": ""
} |
q240747 | Container.makeInstance | train | public function makeInstance($className)
{
// class reflection
$reflection = new ReflectionClass($className);
// get the class constructor
$constructor = $reflection->getConstructor();
// if there is no constructor, just create and
// return a new instance
if... | php | {
"resource": ""
} |
q240748 | Container.exists | train | public function exists($instance, string $method)
{
$reflection = new ReflectionClass(get_class($instance));
return $reflection->hasMethod($method);
} | php | {
"resource": ""
} |
q240749 | Container.invoke | train | public function invoke($instance, string $method, array $data)
{
// get the parameters
$parameters = $this->resolveMethodParameters($instance, $method, $data, true);
// get the reflection of method
$reflection = new ReflectionMethod(get_class($instance), $method);
// allow ... | php | {
"resource": ""
} |
q240750 | Container.resolveMethodParameters | train | public function resolveMethodParameters($instance, $method, $parameters, $labels = false)
{
// method reflection
$reflectionMethod = new ReflectionMethod($instance, $method);
// resolved array of parameters
return $this->resolveParameters($reflectionMethod->getParameters(), $paramet... | php | {
"resource": ""
} |
q240751 | Container.resolveFunctionParameters | train | public function resolveFunctionParameters($callable, $parameters, $labels = false)
{
// method reflection
$reflectionFunction = new ReflectionFunction($callable);
// resolved array of parameters
return $this->resolveParameters($reflectionFunction->getParameters(), $parameters, $labe... | php | {
"resource": ""
} |
q240752 | Container.resolveParameters | train | private function resolveParameters($parameters, $data, $labels = false)
{
$resolved = [];
/** @var ReflectionParameter $reflectionParameter */
foreach ($parameters as $reflectionParameter) {
/** @noinspection PhpAssignmentInConditionInspection */
$parameter = $this->p... | php | {
"resource": ""
} |
q240753 | Container.parseParameter | train | private function parseParameter(ReflectionParameter $reflectionParameter, &$data, $labels)
{
// get the principal properties
$name = $reflectionParameter->getName();
$value = null;
if ($reflectionParameter->isOptional()) {
$value = $reflectionParameter->getDefaultValue();... | php | {
"resource": ""
} |
q240754 | Container.extractClassName | train | private function extractClassName(ReflectionParameter $reflectionParameter)
{
if (isset($reflectionParameter->getClass()->name)) {
return $reflectionParameter->getClass()->name;
}
return '';
} | php | {
"resource": ""
} |
q240755 | Statement.execute | train | public function execute()
{
$DB = $this->getDBO();
//Run the Query;
$resultId = $DB->exec();
//\Platform\Debugger::log($resultId);
$this->setResultId($resultId)->setConnectionId($DB->getResourceId())->setAffectedRows($this->getAffectedRows());
$DB->resetRun();
... | php | {
"resource": ""
} |
q240756 | Statement.listColumns | train | public function listColumns()
{
$fieldNames = array();
$field = NULL;
while ($field = mysqli_fetch_field($this->getResultId())) {
$fieldNames[] = $field->name;
}
return $fieldNames;
} | php | {
"resource": ""
} |
q240757 | Statement.getColumnMeta | train | public function getColumnMeta($name = '')
{
$retval = array();
$field = NULL;
while ($field = mysqli_fetch_field($this->getResultId())) {
$f = new stdClass();
$f->name = $field->name;
$f->type = $field->type;
$f->default = $field->def;
... | php | {
"resource": ""
} |
q240758 | Statement.freeResults | train | public function freeResults()
{
if (is_a($this->getResultId(), "mysqli_result")) {
mysqli_free_result($this->getResultId());
$this->setResultId(FALSE);
}
} | php | {
"resource": ""
} |
q240759 | ApiController.createOne | train | public function createOne(\Psr\Http\Message\ServerRequestInterface $p_request)
{
$this->logger->debug('FreeFW.ApiController.createOne.start');
$apiParams = $p_request->getAttribute('api_params', false);
//
if ($apiParams->hasData()) {
/**
* @var \FreeFW\Core\... | php | {
"resource": ""
} |
q240760 | ApiController.removeOne | train | public function removeOne(\Psr\Http\Message\ServerRequestInterface $p_request)
{
$this->logger->debug('FreeFW.ApiController.removeOne.start');
$apiParams = $p_request->getAttribute('api_params', false);
//
if ($apiParams->hasData()) {
/**
* @var \FreeFW\Core\... | php | {
"resource": ""
} |
q240761 | FilterComponent.filter | train | public function filter(Query $query)
{
if (!empty($this->filterOptions['conditions'])) {
$query->where($this->filterOptions['conditions']);
}
if (!empty($this->filterOptions['order'])) {
$query->order($this->filterOptions['order']);
}
return $query;
... | php | {
"resource": ""
} |
q240762 | FilterComponent.getBacklink | train | public static function getBacklink($url, ServerRequest $request)
{
if (!isset($url['plugin'])) {
$url['plugin'] = $request->getParam('plugin');
}
if (!isset($url['controller'])) {
$url['controller'] = $request->getParam('controller');
}
$path = join('... | php | {
"resource": ""
} |
q240763 | FilterComponent._initFilterOptions | train | protected function _initFilterOptions()
{
if (!$this->_filterEnabled && !$this->_sortEnabled) {
return;
}
$options = [
'conditions' => [],
'order' => []
];
// check filter params
if (!empty($this->request->getData())) {
... | php | {
"resource": ""
} |
q240764 | FilterComponent._isSortEnabled | train | protected function _isSortEnabled()
{
if (!isset($this->controller->sortFields)) {
return false;
}
foreach ($this->controller->sortFields as $field) {
if (isset($field['actions']) &&
is_array($field['actions']) &&
in_array($this->actio... | php | {
"resource": ""
} |
q240765 | FilterComponent._isFilterEnabled | train | protected function _isFilterEnabled()
{
if (!isset($this->controller->filterFields)) {
return false;
}
foreach ($this->controller->filterFields as $field) {
if (isset($field['actions']) &&
is_array($field['actions']) &&
in_array($this-... | php | {
"resource": ""
} |
q240766 | FilterComponent._isPaginationEnabled | train | protected function _isPaginationEnabled()
{
if (!isset($this->controller->limits) ||
!isset($this->controller->limits[$this->action]) ||
!isset($this->controller->limits[$this->action]['default']) ||
!isset($this->controller->limits[$this->action]['limits'])
) {
... | php | {
"resource": ""
} |
q240767 | FilterComponent._getSortFields | train | protected function _getSortFields()
{
$sortFields = [];
foreach ($this->controller->sortFields as $field => $options) {
if (isset($options['actions']) &&
is_array($options['actions']) &&
in_array($this->action, $options['actions'])
) {
... | php | {
"resource": ""
} |
q240768 | FilterComponent._getFilterFields | train | protected function _getFilterFields()
{
$filterFields = [];
foreach ($this->controller->filterFields as $field => $options) {
if (isset($options['actions']) &&
is_array($options['actions']) &&
in_array($this->action, $options['actions'])
) {
... | php | {
"resource": ""
} |
q240769 | FilterComponent._createSortFieldOption | train | protected function _createSortFieldOption($field, $dir, $options)
{
$sortField = $this->sortFields[$field];
if (isset($sortField['custom'])) {
if (!is_array($sortField['custom'])) {
$sortField['custom'] = [$sortField['custom']];
}
foreach ($sortFie... | php | {
"resource": ""
} |
q240770 | FilterComponent._extractPassParams | train | protected function _extractPassParams()
{
if (!empty($this->controller->filterPassParams[$this->action])) {
foreach ($this->controller->filterPassParams[$this->action] as $key) {
if (!empty($this->request->getParam($key))) {
$this->_passParams[$key] = $this->r... | php | {
"resource": ""
} |
q240771 | FilterComponent._getFilterData | train | protected function _getFilterData()
{
$rawFilterData = $this->request->getData();
$filterData = [];
foreach ($this->filterFields as $filterField => $options) {
if (isset($rawFilterData[$filterField]) && $rawFilterData[$filterField] !== '') {
$filterData[$filterFie... | php | {
"resource": ""
} |
q240772 | FilterComponent._setupSort | train | protected function _setupSort()
{
if (!($this->_sortEnabled = $this->_isSortEnabled())) {
return;
}
$this->sortFields = $this->_getSortFields();
foreach ($this->sortFields as $field => $options) {
if (!isset($options['default'])) {
continue;
... | php | {
"resource": ""
} |
q240773 | FilterComponent._setupFilters | train | protected function _setupFilters()
{
if (!($this->_filterEnabled = $this->_isFilterEnabled())) {
return;
}
$this->filterFields = $this->_getFilterFields();
$sluggedFilter = $this->request->getParam('sluggedFilter', '');
if ($sluggedFilter === '') {
r... | php | {
"resource": ""
} |
q240774 | FilterComponent._setupPagination | train | protected function _setupPagination()
{
if (!($this->_paginationEnabled = $this->_isPaginationEnabled())) {
return;
}
$this->defaultLimit = $this->controller->limits[$this->action]['default'];
$this->limits = $this->controller->limits[$this->action]['limits'];
} | php | {
"resource": ""
} |
q240775 | FilterComponent._isFilterRequest | train | protected function _isFilterRequest()
{
return (
$this->controller !== null &&
$this->request !== null &&
$this->action !== null &&
$this->_filterEnabled
);
} | php | {
"resource": ""
} |
q240776 | FilterComponent._createFilterSlug | train | protected function _createFilterSlug(array $filterData)
{
/** @var Filter $existingFilter */
$existingFilter = $this->Filters->find('slugForFilterData', [
'request' => $this->request,
'filterData' => $filterData
])->first();
if ($existingFilter) {
... | php | {
"resource": ""
} |
q240777 | FilterComponent._applyFilterData | train | protected function _applyFilterData($url)
{
$filterData = $this->_getFilterData();
if (empty($filterData)) {
return $url;
}
return $url + [
'sluggedFilter' => $this->_createFilterSlug($filterData),
'?' => $this->request->getQuery()
];
... | php | {
"resource": ""
} |
q240778 | FilterComponent._applyPassedParams | train | protected function _applyPassedParams($url)
{
if (empty($this->_passParams)) {
return $url;
}
return array_merge($url, $this->_passParams);
} | php | {
"resource": ""
} |
q240779 | FilterComponent._applySort | train | protected function _applySort($url)
{
if (!$this->_sortEnabled) {
return $url;
}
if (!empty($this->request->getQuery('s'))) {
$url['?']['s'] = $this->request->getQuery('s');
}
if (!empty($this->request->getQuery('d'))) {
$url['?']['d'] = ... | php | {
"resource": ""
} |
q240780 | Response.getIsInstructable | train | public function getIsInstructable()
{
$isAjax = (isset(Yii::$app->request->isAjax) && Yii::$app->request->isAjax);
if (isset($_GET['_instruct'])) {
if (!empty($_GET['_instruct'])) {
$this->forceInstructions = true;
$this->disableInstructions = false;
... | php | {
"resource": ""
} |
q240781 | FindsCallableByInheritance.classInheritance | train | public static function classInheritance($object){
$class = new ReflectionClass($object);
$classNames = [$class->getName()];
while($class = $class->getParentClass()){
$classNames[] = $class->getName();
}
return $classNames;
} | php | {
"resource": ""
} |
q240782 | AppManager.initApps | train | public function initApps()
{
if (count($this->apps) > 0) {
throw new AlreadyInitiatedException('The apps are already loaded!');
}
foreach ($this->appList as $className) {
$instance = new $className($this);
$this->apps->append($instance);
}
... | php | {
"resource": ""
} |
q240783 | Base.findSection | train | public function findSection($section)
{
if (!isset($this->sectionMap[$section])) {
throw new UnknownSection($section);
}
return $this->sectionMap[$section];
} | php | {
"resource": ""
} |
q240784 | Base.parseArray | train | public function parseArray(array $ini)
{
$sections = [];
foreach ($ini as $name => $section) {
$section = $this->parseSection($name, $section);
$sections[] = $section;
}
return $sections;
} | php | {
"resource": ""
} |
q240785 | Base.parseSection | train | public function parseSection($name, array $section)
{
$name = explode(':', $name, 2);
$class = $this->findSection($name[0]);
if (isset($name[1])) {
return new $class($name[1], $section);
}
return new $class($section);
} | php | {
"resource": ""
} |
q240786 | Config.save | train | public static function save($file, $config)
{
if ( ! is_array($config))
{
if ( ! isset(static::$items[$config]))
{
return false;
}
$config = static::$items[$config];
}
$info = pathinfo($file);
$type = 'php';
if (isset($info['extension']))
{
$type = $info['extension'];
// Keep exte... | php | {
"resource": ""
} |
q240787 | ErrorHandler.renderError | train | public static function renderError()
{
try
{
$_errorTemplate = \Kisma::get( 'app.error_template', '_error.twig' );
Render::twigView(
$_errorTemplate,
array(
'base_path' => \Kisma::get( 'app.base_path' ),
... | php | {
"resource": ""
} |
q240788 | ErrorHandler._cleanTrace | train | protected static function _cleanTrace( array &$trace, $skipLines = null, $basePath = null )
{
$_trace = array();
$_basePath = $basePath ?: \Kisma::get( 'app.base_path' );
// Skip some lines
if ( !empty( $skipLines ) && count( $trace ) > $skipLines )
{
$trace = ar... | php | {
"resource": ""
} |
q240789 | StatementAbstract.checkPreparation | train | protected function checkPreparation()
{
// must be prepared
if (null === $this->prepared) {
throw new RuntimeException(
Message::get(Message::DB_STMT_NOTPREPARED),
Message::DB_STMT_NOTPREPARED
);
}
// close any previous results... | php | {
"resource": ""
} |
q240790 | AbstractApiLoader.loadItemOrThrowException | train | private function loadItemOrThrowException(
QueryBuildingEventInterface $event,
string $eventName,
EventDispatcherInterface $dispatcher
) {
$queryResult = $this->executeItemQuery($event, $eventName, $dispatcher);
if (empty($queryResult) && $this->noItemException) {
... | php | {
"resource": ""
} |
q240791 | Pagination.createUri | train | public function createUri($page)
{
$queryString = $this->query;
$queryString[] = "page={$page}";
$queryString = implode('&', $queryString);
return Request::pathInfo() . "?{$queryString}";
} | php | {
"resource": ""
} |
q240792 | Pagination.createPageLinks | train | protected function createPageLinks()
{
$pageLinks = array();
if ($this->totalPages > 10) {
$startRange = $this->page - floor($this->range/2);
$endRange = $this->page + floor($this->range/2);
//Start range
if ($startRange <= 0) {
$st... | php | {
"resource": ""
} |
q240793 | Xml.fromObject | train | public static function fromObject( $object, $rootName = null, $nodeName = null, $addHeader = true )
{
if ( !is_object( $object ) )
{
throw new \InvalidArgumentException( 'The value of "$object" is not an object.' );
}
return static::fromArray( get_object_vars( $object ),... | php | {
"resource": ""
} |
q240794 | Xml.fromArray | train | public static function fromArray( $data, $rootName = null, $nodeName = null, $addHeader = true )
{
$_xml = true === $addHeader ? '<?xml version="1.0" encoding="UTF-8" ?>' : null;
if ( null !== $rootName )
{
$_xml .= Markup::openTag( $rootName );
}
$_string = nul... | php | {
"resource": ""
} |
q240795 | Session.& | train | public static function &createWithName($name = null, AuraSession $session = null) : Session
{
$session = ! is_null($session) ? new static : new static($session);
if (is_null($name)) {
return $session;
}
$session->setSegmentName($name);
return $session;
} | php | {
"resource": ""
} |
q240796 | Session.startOrResume | train | public function startOrResume() : bool
{
if (!$this->session->isStarted()) {
return $this->session->start();
}
return $this->session->resume();
} | php | {
"resource": ""
} |
q240797 | Session.validateToken | train | public function validateToken($value) : bool
{
if (!is_string($value)) {
return false;
}
return $this->getCSRFToken()->isValid($value);
} | php | {
"resource": ""
} |
q240798 | Session.exist | train | public function exist($keyName) : bool
{
# double check
return
$this->get($keyName, true) !== true
&& $this->get($keyName, false) !== false;
} | php | {
"resource": ""
} |
q240799 | Parameters.required | train | public function required($keys, array $params = [], array $parents = [])
{
if (!$params) {
$params = $this->all();
}
if (is_array($keys)) {
foreach ($keys as $key => $value) {
if (is_int($key)) {
$key = $value;
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.