_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q253000 | Comment.deleteReply | validation | public function deleteReply($msgId, $index, $commentId)
{
$params = [
'msg_data_id' => $msgId,
'index' => $index,
'user_comment_id' => $commentId,
];
return $this->parseJSON('json', [self::API_DELETE_REPLY, $params]);
} | php | {
"resource": ""
} |
q253001 | Collection.getArray | validation | public static function getArray() {
$object = new \ReflectionClass( Collection::class );
$properties = $object->getProperties(\ReflectionProperty::IS_PUBLIC);
$array = array();
foreach ($properties as $property) {
$value = $property->getValue();
if (!empty($value... | php | {
"resource": ""
} |
q253002 | Collection.set | validation | public static function set($property, $value = NULL) {
$object = new \ReflectionClass( Collection::class );
$object->setStaticPropertyValue($property, $value);
return true;
} | php | {
"resource": ""
} |
q253003 | Collection.get | validation | public static function get($property, $default = NULL) {
$object = new \ReflectionClass( Collection::class );
$value = $object->getStaticPropertyValue($property);
//If there is no value return the default
return (empty($value)) ? $default : $value;
} | php | {
"resource": ""
} |
q253004 | IsPipeline.replace | validation | public function replace($needle, $replacement): Pipeline
{
$stages = [];
$found = false;
foreach ($this->stages as $stage) {
if ($this->matches($stage, $needle)) {
$stages[] = $replacement;
$found = true;
continue;
}
$stages[] = $stage;
}
if ($found) {
$pipeline = clone ... | php | {
"resource": ""
} |
q253005 | IsPipeline.handleStage | validation | protected function handleStage(&$stages, $stage)
{
if ($stage instanceof Pipeline) {
$stages = array_merge($stages, $stage->stages());
}
elseif ($stage instanceof MiddlewareInterface) {
$stages[] = $stage;
}
elseif ($stage instanceof RequestHandlerInterface) {
$stages[] = new RequestHandler($stage);... | php | {
"resource": ""
} |
q253006 | Filter.remove | validation | public function remove(ExpressionContract $e)
{
unset($this->expressions[$this->indexOf($e)]);
$this->expressions = array_values($this->expressions);
return $this;
} | php | {
"resource": ""
} |
q253007 | Filter.indexOf | validation | public function indexOf($expressionOrColumn)
{
if ($expressionOrColumn instanceof ExpressionContract) {
return $this->indexOfExpression($expressionOrColumn);
}
return $this->indexOfColumn($expressionOrColumn);
} | php | {
"resource": ""
} |
q253008 | SentinelReplication.wipeServerList | validation | protected function wipeServerList()
{
$this->reset();
$this->master = null;
$this->slaves = array();
$this->pool = array();
} | php | {
"resource": ""
} |
q253009 | SentinelReplication.updateSentinels | validation | public function updateSentinels()
{
SENTINEL_QUERY: {
$sentinel = $this->getSentinelConnection();
try {
$payload = $sentinel->executeCommand(
RawCommand::create('SENTINEL', 'sentinels', $this->service)
);
$this->se... | php | {
"resource": ""
} |
q253010 | SentinelReplication.getConnectionByRole | validation | public function getConnectionByRole($role)
{
if ($role === 'master') {
return $this->getMaster();
} elseif ($role === 'slave') {
return $this->pickSlave();
} elseif ($role === 'sentinel') {
return $this->getSentinelConnection();
}
} | php | {
"resource": ""
} |
q253011 | SentinelReplication.switchTo | validation | public function switchTo(NodeConnectionInterface $connection)
{
if ($connection && $connection === $this->current) {
return;
}
if ($connection !== $this->master && !in_array($connection, $this->slaves, true)) {
throw new \InvalidArgumentException('Invalid connection ... | php | {
"resource": ""
} |
q253012 | SentinelReplication.retryCommandOnFailure | validation | private function retryCommandOnFailure(CommandInterface $command, $method)
{
$retries = 0;
SENTINEL_RETRY: {
try {
$response = $this->getConnectionByCommand($command)->$method($command);
} catch (CommunicationException $exception) {
$this->wip... | php | {
"resource": ""
} |
q253013 | ModuleDependencyResolver.resolve | validation | public function resolve() : array
{
try{
$app_required_modules = array_unique($this->required_modules);
// get component dependency map
$component_dependency_map = $this->getComponentDependencyMap($app_required_modules);
// resolve component dependency
... | php | {
"resource": ""
} |
q253014 | ModuleDependencyResolver.findComponentModuleByType | validation | private function findComponentModuleByType(array $module_list, string $find_component_type)
{
foreach($module_list as $m)
{
$component_type = call_user_func([$m, 'declareComponentType']);
if ($component_type == $find_component_type){
return $m;
}
... | php | {
"resource": ""
} |
q253015 | CalcDef.getMaxPercentForPersonalBonus | validation | private function getMaxPercentForPersonalBonus($levels)
{
$result = 0;
foreach ($levels as $percent) {
if ($percent > $result) {
$result = $percent;
}
}
return $result;
} | php | {
"resource": ""
} |
q253016 | Site.getIsEnabled | validation | protected function getIsEnabled(): \Illuminate\Database\Eloquent\Model
{
$result = Model\Setting::find(1);
$result->value = (bool) $result->value;
return $result;
} | php | {
"resource": ""
} |
q253017 | CliQuestion.getHelper | validation | public function getHelper()
{
if ($this->helper === null) {
$this->helper = $this->command->getHelper('question');
}
return $this->helper;
} | php | {
"resource": ""
} |
q253018 | LinkedCustomFieldsType.appendChoice | validation | public function appendChoice(FormEvent $event)
{
$rootForm = $this->getRootForm($event->getForm());
$group = $rootForm->getData();
if ($group === NULL) {
return;
}
$choices = array();
foreach($group->getCustomFields() as $customFields) {
... | php | {
"resource": ""
} |
q253019 | StartFromThemeController.startAction | validation | public function startAction(Request $request, Application $app)
{
$options = array(
"request" => $request,
"configuration_handler" => $app["red_kite_cms.configuration_handler"],
);
return parent::start($options);
} | php | {
"resource": ""
} |
q253020 | HelperMakeCommand.buildClass | validation | protected function buildClass($name)
{
$stub = $this->files->get($this->getStub());
return str_replace('DummyHelper', $this->getNameInput(), $stub);
} | php | {
"resource": ""
} |
q253021 | EntityDbMapper.fromDbToEntity | validation | public function fromDbToEntity(array $data)
{
$hydratorFactory = $this->documentManager->getHydratorFactory();
$documentClass = $this->documentClass;
$document = new $documentClass();
$hydratorFactory->hydrate($document, $data);
return $document;
} | php | {
"resource": ""
} |
q253022 | EntityDbMapper.fromEntityToDb | validation | public function fromEntityToDb($document)
{
$unitOfWork = $this->documentManager->getUnitOfWork();
$persistenceBuilder = new PersistenceBuilder($this->documentManager, $unitOfWork);
$mapping = array (
'targetDocument' => $this->documentClass,
);
return $persisten... | php | {
"resource": ""
} |
q253023 | ExtendableCollectionBlock.generateSourceFromChildren | validation | protected function generateSourceFromChildren()
{
$i = 1;
$children = array();
foreach ($this->children as $child) {
$childValue = Yaml::parse($child->getSource());
if (is_array($childValue) && array_key_exists("type", $childValue)) {
$childValue["type... | php | {
"resource": ""
} |
q253024 | Page.add | validation | public function add($title, $description, $pageUrl, $iconUrl, $comment = '')
{
$params = [
'title' => $title,
'description' => $description,
'page_url' => $pageUrl,
'icon_url' => $iconUrl,
];
if ($comment !== '') {
$params['comment'... | php | {
"resource": ""
} |
q253025 | Page.update | validation | public function update($pageId, $title, $description, $pageUrl, $iconUrl, $comment = '')
{
$params = [
'page_id' => intval($pageId),
'title' => $title,
'description' => $description,
'page_url' => $pageUrl,
'icon_url' => $iconUrl,
];
... | php | {
"resource": ""
} |
q253026 | Page.pagination | validation | public function pagination($begin, $count)
{
$params = [
'type' => 2,
'begin' => intval($begin),
'count' => intval($count),
];
return $this->parseJSON('json', [self::API_SEARCH, $params]);
} | php | {
"resource": ""
} |
q253027 | Page.delete | validation | public function delete($pageId)
{
$params = [
'page_id' => intval($pageId),
];
return $this->parseJSON('json', [self::API_DELETE, $params]);
} | php | {
"resource": ""
} |
q253028 | Date.getAgeByDate | validation | public static function getAgeByDate(string $sBirthday) : int
{
list($iYear, $iMonth, $iDay) = preg_split('/[-.]/', $sBirthday);
$aToday = array();
$aToday['mois'] = date('n');
$aToday['jour'] = date('j');
$aToday['annee'] = date('Y');
$iYears = $aToday['annee'] - $i... | php | {
"resource": ""
} |
q253029 | Tv.updateTv | validation | private function updateTv($dwnl)
{
$entity = new EBonDwnl();
/** @var EBonDwnl $one */
foreach ($dwnl as $one) {
$tv = $one->getTv();
$calcId = $one->getCalculationRef();
$custId = $one->getCustomerRef();
$entity->setTv($tv);
$id =... | php | {
"resource": ""
} |
q253030 | ElFinderFilesController.filesAction | validation | public function filesAction(Request $request, Application $app)
{
$options = array(
"connector" => $app["red_kite_cms.elfinder_files_connector"],
);
return parent::show($options);
} | php | {
"resource": ""
} |
q253031 | MimeMessage.clear | validation | public function clear($name = null)
{
if (!is_null($name)) {
$name = strtolower($name);
if (array_key_exists($name, self::$clearings)) {
$this->{$name} = self::$clearings[$self::$clearings];
}
} else {
foreach (self::$clearings as $n=>$... | php | {
"resource": ""
} |
q253032 | MimeMessage.setFrom | validation | public function setFrom($mail = '', $name = null, $reply = true)
{
$mail = trim($mail);
if (strlen($mail) && Helper::isEmail($mail)) {
$this->from = !empty($name) ? array($name=>$mail) : array($mail);
$this->getMailer()->setRegistry('Return-Path', '<'.$mail.'>', 'headers');
... | php | {
"resource": ""
} |
q253033 | MimeMessage.setTo | validation | public function setTo($mail = '', $name = null)
{
$this->to = Helper::deduplicate(
array_merge($this->to, call_user_func_array(array('\MimeMailer\Helper', 'checkPeopleArgs'), func_get_args()))
);
return $this;
} | php | {
"resource": ""
} |
q253034 | MimeMessage.setCc | validation | public function setCc($mail = '', $name = null)
{
$this->cc = Helper::deduplicate(
array_merge($this->cc, call_user_func_array(array('\MimeMailer\Helper', 'checkPeopleArgs'), func_get_args()))
);
return $this;
} | php | {
"resource": ""
} |
q253035 | MimeMessage.setBcc | validation | public function setBcc($mail = '', $name = null)
{
$this->bcc = Helper::deduplicate(
array_merge($this->bcc, call_user_func_array(array('\MimeMailer\Helper', 'checkPeopleArgs'), func_get_args()))
);
return $this;
} | php | {
"resource": ""
} |
q253036 | MimeMessage.setAttachment | validation | public function setAttachment($file = '', $clear = false)
{
if (true===$clear) {
$this->clear('text');
}
if (is_array($file)) {
foreach ($file as $_f) {
if (file_exists($_f)) {
$this->attachment[] = $_f;
}
... | php | {
"resource": ""
} |
q253037 | MimeMessage.setSubject | validation | public function setSubject($subject = '', $clear = false)
{
if (true===$clear) {
$this->clear('subject');
}
$this->subject = $subject;
return $this;
} | php | {
"resource": ""
} |
q253038 | MimeMessage.setText | validation | public function setText($text = '', $clear = false)
{
if (true===$clear) {
$this->clear('text');
}
if ('auto'==$text) {
if (!empty($this->html)) {
$html_content = preg_replace("/.*<body[^>]*>|<\/body>.*/si", "", $this->html);
$this->tex... | php | {
"resource": ""
} |
q253039 | MimeMessage.setHtml | validation | public function setHtml($html = '', $clear = false)
{
if (true===$clear) {
$this->clear('text');
}
$this->html .= Helper::formatText($html, 'ascii');
return $this;
} | php | {
"resource": ""
} |
q253040 | MimeMessage.setReplyTo | validation | public function setReplyTo($mail = '', $name = null)
{
if (strlen($mail) && Helper::isEmail($mail)) {
if (!empty($name)) {
$_m = Helper::mailTagger($mail, $name);
} else {
$_m = $mail;
}
$this->getMailer()->setRegistry('Reply-To... | php | {
"resource": ""
} |
q253041 | MimeMessage.substitution | validation | public function substitution($search, $replace)
{
$this->body = str_replace($search, $replace, $this->body);
return $this->body;
} | php | {
"resource": ""
} |
q253042 | Main.hookTemplateRender | validation | public function hookTemplateRender($templates, $data, $rendered, $controller)
{
$template = reset($templates);
if (strpos($template, '/modules/ga_report/templates/panels/') !== false
&& isset($data['content']['data']['report']['data'])
&& isset($data['content']['data']['hand... | php | {
"resource": ""
} |
q253043 | Setup.import | validation | public static function import($name) {
$importPath = FOREVERPHP_ROOT . DS . $name . '.php';
if (file_exists($importPath)) {
include_once $importPath;
} else {
throw new SetupException("The object to import ($name) not exists.");
}
} | php | {
"resource": ""
} |
q253044 | Setup.importFromApp | validation | public static function importFromApp($path) {
$importPath = APPS_ROOT . DS . $path . '.php';
if (file_exists($importPath)) {
include_once $importPath;
} else {
throw new SetupException("The object to import ($path) not exists.");
}
} | php | {
"resource": ""
} |
q253045 | Builder.isRelation | validation | public function isRelation($key)
{
if(!method_exists($this->model, $key)) {
return false;
}
$relation = $this->model->{$key}();
return ($relation instanceof Relation);
} | php | {
"resource": ""
} |
q253046 | Builder.get | validation | public function get($columns = array('*'))
{
$columnsPassed = (func_num_args() > 1);
$columns = $columnsPassed ? $columns : $this->getQueryColumns();
$query = $this->buildQuery($columns);
if (!$columnsPassed) {
// addJoinOnce adds queryColumns again...
ret... | php | {
"resource": ""
} |
q253047 | Builder.chunk | validation | public function chunk($count, callable $callback){
return $this->buildQuery($this->getQueryColumns())->chunk($count, $callback);
} | php | {
"resource": ""
} |
q253048 | Builder.lists | validation | public function lists($column, $key = null){
return $this->buildQuery([$column])->lists($column, $key);
} | php | {
"resource": ""
} |
q253049 | Builder.paginate | validation | public function paginate($perPage = null, $columns = array('*'))
{
$columnsPassed = (func_num_args() > 1) && ($columns !== null);
$columns = $columnsPassed ? $columns : $this->getQueryColumns();
$query = $this->buildQuery($columns);
if ($columnsPassed) {
return $query... | php | {
"resource": ""
} |
q253050 | DataItem.fillRelationConfig | validation | protected function fillRelationConfig(&$config, $otherObject)
{
if (isset($config['parent_object_id'])) {
$config['child_object_id'] = $otherObject;
} elseif (isset($config['child_object_id'])) {
$config['parent_object_id'] = $otherObject;
}
} | php | {
"resource": ""
} |
q253051 | DataItem.loadForeignObject | validation | protected function loadForeignObject()
{
if ($this->_isLoadingForeignObject) {
throw new RecursionException('Ran into recursion while loading foreign object');
}
$this->_isLoadingForeignObject = true;
if (isset($this->deferredModel) && ($attributes = $this->deferredModel-... | php | {
"resource": ""
} |
q253052 | DataItem.loadLocalObject | validation | protected function loadLocalObject()
{
if ($this->_isLoadingLocalObject) {
throw new RecursionException('Ran into recursion while loading local object');
}
$this->_isLoadingLocalObject = true;
if (isset($this->foreignObject) && !isset($this->_localObject)) {
$... | php | {
"resource": ""
} |
q253053 | Benchmark.setPointInLog | validation | public static function setPointInLog(string $sName = 'default')
{
$oLogger = Debug::getInstance();
$oLogger->info('BENCHMARK: Time at this point '.(microtime(true) - self::$_fStart).' - '.$sName);
} | php | {
"resource": ""
} |
q253054 | Material.lists | validation | public function lists($type, $offset = 0, $count = 20)
{
$params = [
'type' => $type,
'offset' => intval($offset),
'count' => min(20, $count),
];
return $this->parseJSON('json', [self::API_LISTS, $params]);
} | php | {
"resource": ""
} |
q253055 | Install.step1 | validation | protected function step1(){
//this is step 1;
$this->view->addToBlock("form", "import://admin/setup/license");
$this->view->setData("step", "1");
$this->view->setData("title", t("Installation | EULA"));
return;
} | php | {
"resource": ""
} |
q253056 | Install.step2 | validation | protected function step2(){
$this->view->addToBlock("form", "import://admin/setup/requirements");
$this->view->setData("step", "2");
$this->view->setData("title", t("Installation | Requirements"));
$systemcheck = new Helpers\Requirements();
$requirements = [];
$directiv... | php | {
"resource": ""
} |
q253057 | Install.step3 | validation | protected function step3(){
$this->view->addToBlock("form", "import://admin/setup/database");
$this->view->setData("step", "3");
$this->view->setData("randomstring", getRandomString('5')."_");
$this->view->setData("title", t("Installation | Database Settings"));
return;
... | php | {
"resource": ""
} |
q253058 | Install.step4 | validation | protected function step4(){
//this is step 1;
$this->view->addToBlock("form", "import://admin/setup/user");
$this->view->setData("step", "4");
$this->view->setData("title", t("Installation | Install SuperUser"));
if ($this->application->input->methodIs("post")) {
... | php | {
"resource": ""
} |
q253059 | IncludeComponentTrait.setServiceLocator | validation | public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
{
$this->serviceLocator = $serviceLocator;
$config = $serviceLocator->getServiceLocator()->get('config');
if (isset($config['rznviewcomponent'])) {
$this->config = $config['rznviewcomponent'];
... | php | {
"resource": ""
} |
q253060 | SampleBootstrap.addAppDependencies | validation | public function addAppDependencies()
{
/**
* @var \Pimple\Container $container
*/
$container = $this->getContainer();
$container['person'] = $container->protect(function ($name) {
return 'Person name: ' . $name;
});
return $this;
} | php | {
"resource": ""
} |
q253061 | ListTable.cell_default | validation | public function cell_default($item, $column) {
$ret = $this->val($item, $column);
return is_null($ret) ? '' : $ret;
} | php | {
"resource": ""
} |
q253062 | ListTable.prepare_items | validation | function prepare_items() {
$this->columns = array(
$this->get_columns(),
$this->get_hidden_columns(),
$this->get_sortable_columns()
);
$this->items = $this->get_items();
usort($this->example_data, array($this, 'usort_reorder'));
//paging
//$per_page = $this->get_items_per_page('books_per_page', ... | php | {
"resource": ""
} |
q253063 | ListTable.render_admin_header | validation | public function render_admin_header() {
//$page = (isset($_GET['page'])) ? esc_attr($_GET['page']) : false;
$page = filter_input(INPUT_GET, 'page');
if ($this->page != $page) {
return;
}
echo '<style type="text/css">';
echo $this->twig->render('list_table.css.twig', array());
echo '</style>';
} | php | {
"resource": ""
} |
q253064 | Stack.replace | validation | public function replace($middleware, $with)
{
$this->pipeline = $this->pipeline->replace($middleware, $with);
return $this;
} | php | {
"resource": ""
} |
q253065 | Bomifier.detect | validation | public function detect()
{
$str = file_get_contents($this->uri);
foreach ($this->getBom('all') as $encoding => $bom) {
if (0 === strncmp($str, $bom, strlen($bom))) {
return $encoding;
}
}
} | php | {
"resource": ""
} |
q253066 | Bomifier.add | validation | public function add($encoding = 'UTF-8')
{
$str = file_get_contents($this->uri);
return file_put_contents($this->uri, $this->getBom($encoding) . $str);
} | php | {
"resource": ""
} |
q253067 | Bomifier.remove | validation | public function remove($encoding)
{
$str = file_get_contents($this->uri);
return file_put_contents($this->uri, substr($str, (strlen($this->getBom($encoding)))));
} | php | {
"resource": ""
} |
q253068 | Bomifier.getBom | validation | public function getBom($encoding = 'UTF-8')
{
$boms = array(
'UTF-8' => pack('CCC', 0xef, 0xbb, 0xbf),
'UTF-16 Big Endian' => pack('CC', 0xfe, 0xff),
'UTF-16 Little Endian' => pack('CC', 0xff, 0xfe),
'UTF-32 Big Endian' => pack('CCCC', 0x0... | php | {
"resource": ""
} |
q253069 | Bomifier.setUri | validation | public function setUri($uri)
{
if (!empty($uri) && !is_file($uri)) {
throw new \Exception(sprintf('File %s not found.', $uri));
}
$this->uri = $uri;
return $this;
} | php | {
"resource": ""
} |
q253070 | TaggedCollection.getByTag | validation | public function getByTag($tag)
{
$taggings = $this->getTaggings();
if (array_key_exists($tag, $taggings)) {
return $taggings[$tag];
}
return array();
} | php | {
"resource": ""
} |
q253071 | TaggedCollection.expand | validation | protected function expand()
{
foreach ($this as $key => $item) {
$item['slug'] = $key;
if (isset($item['date'])) {
$item['formatted_date'] = date(self::DATE_FORMAT, $item['date']);
}
$this->set($key, $item);
}
} | php | {
"resource": ""
} |
q253072 | Container.create | validation | public static function create($command, $app)
{
static $cache = [];
$cacheKey = $command;
if (isset($cache[$cacheKey])) {
$class = $cache[$cacheKey]['class'];
$command = $cache[$cacheKey]['command'];
} else {
if (false === strpos($command, '.')) ... | php | {
"resource": ""
} |
q253073 | CacheConfigListener.getCache | validation | public function getCache()
{
if (! $this->cache) {
$services = $this->getServices();
$cache = $services->get('Cache');
$this->setCache($cache);
}
return $this->cache;
} | php | {
"resource": ""
} |
q253074 | CacheConfigListener.doRestore | validation | public function doRestore(ModulesEvent $event)
{
$cache = $this->getCache();
$data = $cache->get('config');
if ($data) {
$services = $this->getServices();
$services->set('Config', $data);
$event->stopPropagation(true);
}
} | php | {
"resource": ""
} |
q253075 | CacheConfigListener.doStore | validation | public function doStore(ModulesEvent $event)
{
$cache = $this->getCache();
$config = $this->getConfig();
$cache->set('config', $config);
} | php | {
"resource": ""
} |
q253076 | UserRepository.save | validation | public function save(IUser $user): bool
{
if (!$user instanceof Entity) {
return false;
}
return entityManager()->save($user);
} | php | {
"resource": ""
} |
q253077 | Group.addAction | validation | public function addAction(AbstractAction $action)
{
$action->setGroup($this);
$this->actions[$action->getName()] = $action;
return $this;
} | php | {
"resource": ""
} |
q253078 | IdentityAsset.getLogo | validation | public function getLogo($size = null)
{
if (!$this->logoPath || !file_exists($this->logoPath)) {
return;
}
$cacheLogo = $this->sizeImageCache($this->logoPath, $size);
if ($cacheLogo) {
return $this->getCacheAssetUrl($cacheLogo);
}
return false... | php | {
"resource": ""
} |
q253079 | Cache.set | validation | public function set($key, $value) {
if ($this->cacheEnabled) {
$this->cacheEngine->set($key, $value);
}
} | php | {
"resource": ""
} |
q253080 | ImageTool.convert2Jpeg | validation | public static function convert2Jpeg($inputImg, $savePath = null, $quality = null, array $exifData = null)
{
$retval = false;
$img = self::imgCreate($inputImg);
$imgSize = self::size($img);
$jpegImg = imagecreatetruecolor($imgSize[0], $imgSize[1]);
imagecopy($jpegImg, $img, 0, 0, 0, 0, $imgSize[0], $imgSize[1... | php | {
"resource": ""
} |
q253081 | ImageTool.size | validation | public static function size($inputImg)
{
if (is_string($inputImg))
$img = self::imgCreate($inputImg);
else
$img = $inputImg;
$imgW = imagesx($img);
$imgH = imagesy($img);
if (is_string($inputImg))
imagedestroy($img);
return array($imgW, $imgH);
} | php | {
"resource": ""
} |
q253082 | Grid.extractInput | validation | private function extractInput()
{
$params = $this->request->getParams();
$period = $params[self::REQ_PERIOD] ?? '';
if (empty($period)) {
$period = $this->hlpPeriod->getPeriodCurrent(null, 0, HPeriod::TYPE_MONTH);
} else {
$period = $this->hlpPeriod->normalize... | php | {
"resource": ""
} |
q253083 | Grid.getBind | validation | private function getBind()
{
[$dsBegin, $treeType] = $this->extractInput();
$calcId = $this->getCalcId($dsBegin, $treeType);
$bind = [
QGrid::BND_CALC_ID => $calcId
];
return $bind;
} | php | {
"resource": ""
} |
q253084 | Grid.getCalcId | validation | private function getCalcId($dsBegin, $treeType)
{
$codeRegular = $codeForecast = '';
if ($treeType == OptionTreeType::VAL_PLAIN) {
$codeRegular = Cfg::CODE_TYPE_CALC_PV_WRITE_OFF;
$codeForecast = Cfg::CODE_TYPE_CALC_FORECAST_PLAIN;
} elseif ($treeType == OptionTreeTyp... | php | {
"resource": ""
} |
q253085 | LoadPeople.addAPerson | validation | private function addAPerson(array $person, ObjectManager $manager)
{
$p = new Person();
foreach ($person as $key => $value) {
switch ($key) {
case 'CountryOfBirth':
case 'Nationality':
$value = $this->getCountry($value);
... | php | {
"resource": ""
} |
q253086 | LoadPeople.getRandomAddress | validation | private function getRandomAddress()
{
return (new Address())
->setStreetAddress1($this->faker->streetAddress)
->setStreetAddress2(
rand(0,9) > 5 ? $this->faker->streetAddress : ''
)
->se... | php | {
"resource": ""
} |
q253087 | Benri_Db_Table_Row.reset | validation | final public function reset($column)
{
if ($this->isDirty($column)) {
$this->_data[$column] = $this->_cleanData[$column];
unset($this->_modifiedFields[$column]);
}
} | php | {
"resource": ""
} |
q253088 | Benri_Db_Table_Row.save | validation | final public function save()
{
$this->checkReadOnly();
/*
* Allows pre-save logic to be applied to any row.
*
* Zend_Db_Table_Row only uses to do it on _insert OR _update,
* here we can use the very same rules to be applied in both methods.
*/
$t... | php | {
"resource": ""
} |
q253089 | Benri_Db_Table_Row.checkReadOnly | validation | private function checkReadOnly()
{
if (true === $this->_readOnly) {
$this->_pushError(
'',
self::ERR_READ_ONLY,
'This row has been marked read-only'
);
return false;
}
return true;
} | php | {
"resource": ""
} |
q253090 | SettingsProvider.getSettingsFromRealSource | validation | protected function getSettingsFromRealSource($namespace)
{
$arraySettings = $this->getSettingsArray($namespace);
$namespaceOptions = $this->options->getNamespaceOptions($namespace);
$entity = clone($namespaceOptions->getEntityPrototype());
if (!empty($arraySettings)) {
$h... | php | {
"resource": ""
} |
q253091 | XmlRpcBuilder.createFault | validation | public static function createFault($code, $message)
{
$response = new \SimpleXMLElement("<methodResponse></methodResponse>");
$struct = $response->addChild("fault")->addChild("value")->addChild("struct");
$member = $struct->addChild("member");
$member->addChild("name", "faultCode");... | php | {
"resource": ""
} |
q253092 | Home.show | validation | public function show() {
$response = new \Venus\lib\Response();
$response->setContent('<html><body><h1>Hello world!</h1></body></html>');
$response->setStatusCode(\Venus\lib\Response::HTTP_OK);
$response->headers->set('Content-Type', 'text/html');
$response->send();
} | php | {
"resource": ""
} |
q253093 | AbstractWebCtrl.setLayout | validation | protected function setLayout(string $layoutName): void
{
if (is_null($this->view)) {
throw new Exception("It's unable to set Layout without View.");
}
$this->layout = ViewFactory::createLayout($layoutName, $this->view);
} | php | {
"resource": ""
} |
q253094 | AbstractWebCtrl.redirect | validation | protected function redirect(string $uri, bool $isPermanent = false): void
{
$nCode = $isPermanent ? 301 : 302;
Headers::getInstance()
->addByHttpCode($nCode)
->add('Location: '.$uri)
->run();
exit;
} | php | {
"resource": ""
} |
q253095 | Request.getHeader | validation | public function getHeader(string $name): ?string
{
$name = strtolower($name);
foreach ($this->getAllHeaders() as $key => $value) {
if (strtolower($key) === $name) {
return $value;
}
}
return null;
} | php | {
"resource": ""
} |
q253096 | Request.getUrlPath | validation | public function getUrlPath(): ?string
{
$uri = $this->getServerParam('REQUEST_URI', \FILTER_SANITIZE_URL);
if (!is_null($uri)) {
return parse_url($uri, \PHP_URL_PATH);
}
return null;
} | php | {
"resource": ""
} |
q253097 | Request.isAjax | validation | public function isAjax(): bool
{
$param = $this->getServerParam('HTTP_X_REQUESTED_WITH', \FILTER_SANITIZE_STRING);
return !is_null($param) && strtolower($param) === 'xmlhttprequest';
} | php | {
"resource": ""
} |
q253098 | ControllerCookiesTrait.removeCookie | validation | private function removeCookie(
$cookie,
\Psr\Http\Message\ResponseInterface $response
) {
return \Dflydev\FigCookies\FigResponseCookies::remove(
$response,
$cookie
);
} | php | {
"resource": ""
} |
q253099 | DataItem.getHandler | validation | public function getHandler()
{
if ($this->pairedDataItem) {
if (!isset($this->primaryObject)) {
return $this->pairedDataItem;
} elseif (isset($this->companionObject)) {
return static::getHandlingObject($this, $this->pairedDataItem);
}
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.