_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q265200
Element.getText
test
protected function getText() { if ($this->text == null) return null; $formobj = $this->getFormObj(); return Expression::evaluateExpression($this->text, $formobj); }
php
{ "resource": "" }
q265201
Element.getSCKeyFuncMap
test
public function getSCKeyFuncMap() { if (!$this->canDisplayed()) return null; $map = array(); /** * @todo need to remove, not used (mr_a_ton) */ //$formObj = $this->getFormObj(); // not used if ($this->eventHandlers == null) return null; ...
php
{ "resource": "" }
q265202
Element.getContextMenu
test
public function getContextMenu() { if (!$this->canDisplayed()) return null; $menus = array(); $formObj = $this->getFormObj(); if ($this->eventHandlers == null) return null; $i = 0; foreach ($this->eventHandlers as $eventHandler) { if ($...
php
{ "resource": "" }
q265203
Element.getFunction
test
protected function getFunction() { $events = $this->getEvents(); foreach ($events as $event=>$function){ if(is_array($function)){ foreach($function as $f){ $function_str.=$f.";"; } $func .= " $event=\"$function_str\""; }else{ $func .= " $event=\"$function\""; } } re...
php
{ "resource": "" }
q265204
Element.getRedirectPage
test
public function getRedirectPage($eventHandlerName) { $formObj = $this->getFormObj(); $eventHandler = $this->eventHandlers->get($eventHandlerName); if (!$eventHandler) return null; //echo $evthandler->redirectPage."<br>"; return Expression::evaluateExpression($eventHandler->re...
php
{ "resource": "" }
q265205
Element.getFunctionType
test
public function getFunctionType($eventHandlerName) { $eventHandler = $this->eventHandlers->get($eventHandlerName); if (!$eventHandler) return null; return $eventHandler->functionType; }
php
{ "resource": "" }
q265206
EventHandler.setFormName
test
public function setFormName($formName, $elemName) { $this->_formName = $formName; $this->_elemName = $elemName; if (strpos($this->function, "js:")===0) return; // if no class name, add default class name. i.e. NewRecord => ObjName.NewRecord if ($this->function) ...
php
{ "resource": "" }
q265207
EventHandler.adjustFormName
test
public function adjustFormName($formName) { $this->_formName = $formName; // if no class name, add default class name. i.e. NewRecord => ObjName.NewRecord if ($this->function) { if(strtolower(substr($this->function,0,3))!='js:'){ $pos0 = strpos($this->function, "("); ...
php
{ "resource": "" }
q265208
EventHandler.getFormedFunction
test
public function getFormedFunction() { //return $this->getInvokeAction(); $name = $this->_elemName; $ehName = $this->objectName; $formobj = Openbizx::getObject($this->_formName); if ($this->formedFunction) { return $this->formedFunction; } ...
php
{ "resource": "" }
q265209
EventHandler.parseFunction
test
public function parseFunction($funcString) { $pos = strpos($funcString, "("); $pos1 = strpos($funcString, ")"); if ($pos>0 && $pos1>$pos) { $funcName = substr($funcString,0,$pos); $funcParams = substr($funcString,$pos+1,$pos1-$pos-1); return array(...
php
{ "resource": "" }
q265210
Caller.call
test
public function call($method, array &$arguments = []) { try { // alias for code readability $middle = &$this->middleware; if ($middle instanceof MiddlewareInterface) { assert(is_string($method)); $middle->method($method); i...
php
{ "resource": "" }
q265211
Caller.clear
test
public function clear() { $this->result = null; $this->middleware = new Group; $this->called = false; return $this; }
php
{ "resource": "" }
q265212
Caller.halt
test
public function halt(HaltPropagationException $exception = null) { if ($this->haltEvent !== "") { $pointer = $this->middleware instanceof MiddlewareCollection ? $this->middleware->current() : $this->middleware; $event = $this->haltEvent; if (is_callable(static::$eventCal...
php
{ "resource": "" }
q265213
Caller.reset
test
public function reset() { $this->clear(); $this->called = false; $this->catchHalt = true; $this->haltEvent = MiddlewareHalted::class; return $this; }
php
{ "resource": "" }
q265214
ObjectCreator.create
test
public function create($elementName, Project $project, $creatingClass) { $typedefs = $project->getDataTypeDefinitions(); if(array_key_exists($elementName, $typedefs) && class_exists($typedefs[$elementName])) { $object = new $typedefs[$elementName]; foreach($this->getAfterCreationCallbacksForClass($c...
php
{ "resource": "" }
q265215
HOTP.counterToString
test
protected function counterToString($counter) { $tmp = ""; while ($counter != 0) { $tmp .= chr($counter & 0xff); $counter >>= 8; } return substr(str_pad(strrev($tmp), 8, "\0", STR_PAD_LEFT), 0, 8); }
php
{ "resource": "" }
q265216
Request.Get
test
public function Get($url = null, $params = array()) { if (null !== $url) $this->url = $url; if (!empty($params)) $this->parameters = $params; $query = ''; foreach ($this->parameters as $k => $v) $query .= ((strlen ($query) == 0) ? '?' : '&') . sprintf('%s=%s', $k, $v); $response ...
php
{ "resource": "" }
q265217
Request.Post
test
public function Post($url = null, $params = array()) { if (null !== $url) $this->url = $url; if (!empty($params)) $this->parameters = $params; $this->response = $this->GetResponse('POST'); return $this; }
php
{ "resource": "" }
q265218
Request.GetResponse
test
private function GetResponse($method = 'GET') { //-- since there's no option to use anything other curl, this check is kinda useless //-- I had high hopes with this one using sockets and whatnot, but alas, time is of //-- the essence... in internet time if ($this->useCurl) { $res...
php
{ "resource": "" }
q265219
Request.WillFollowRedirects
test
private function WillFollowRedirects() { $open_basedir = ini_get('open_basedir'); $safe_mode = strtolower(ini_get('safe_mode')); if (empty($open_basedir) && $safe_mode == 'off') { return true; } return false; }
php
{ "resource": "" }
q265220
securityRule_Abstract.checkEffectiveTime
test
public function checkEffectiveTime() { sscanf( $this->effectiveTime, "%2d%2d-%2d%2d", $start_hour, $start_min, $end_hour, $end_min ); $startTime = strtotime(date("Y-m-d ").$start_hour.":".$start_min) ? strtotime(date("Y-m-d ").$start_hour.":".$start_min) : s...
php
{ "resource": "" }
q265221
String.parseStr
test
public static function parseStr( $mixed ) { return is_array($mixed) ? array_map([self, 'parse_str'], $mixed) : self::parse_str($mixed); }
php
{ "resource": "" }
q265222
String.parse_str
test
private static function parse_str( $str ) { $output = []; if (function_exists('mb_parse_str') && !isset($this->env['slim.tests.ignore_multibyte'])) { mb_parse_str($str, $output); } else { parse_str($str, $output); } return $output; }
php
{ "resource": "" }
q265223
FormRenderer.render
test
static public function render($formObj) { $tplEngine = $formObj->templateEngine; $tplAttributes = FormRenderer::buildTemplateAttributes($formObj); if (isset($formObj->jsClass)) { $subForms = ($formObj->subForms) ? implode(";", $formObj->subForms) : ""; if ($formObj->...
php
{ "resource": "" }
q265224
FormRenderer.renderSmarty
test
static protected function renderSmarty($formObj, $tplAttributes = Array()) { $smarty = TemplateHelper::getSmartyTemplate(); $tplFile = TemplateHelper::getTplFileWithPath($formObj->templateFile, $formObj->package); //Translate Array of template variables to \Zend template object fore...
php
{ "resource": "" }
q265225
FormRenderer.renderPHP
test
static protected function renderPHP($formObj, $tplAttributes = Array()) { $form = TemplateHelper::getZendTemplate(); $tplFile = TemplateHelper::getTplFileWithPath($formObj->templateFile, $formObj->package); $form->addScriptPath(dirname($tplFile)); /* $formOutput = $formObj->outputAt...
php
{ "resource": "" }
q265226
CrudController.view
test
public function view(Request $request) { $this->request = $request; $entity = $this->findEntity($request); $this->authorizeView($request, $entity); return $this->createViewEntityResponse($entity); }
php
{ "resource": "" }
q265227
CrudController.store
test
public function store(Request $request) { $this->request = $request; $this->authorizeCreate($request); $writeContext = $this->getContext(Action::CREATE); $inputResource = $this->bodyToResource($writeContext); try { $inputResource->validate($writeContext); ...
php
{ "resource": "" }
q265228
CrudController.callEntityMethod
test
protected function callEntityMethod(Request $request, $method) { // We don't want to include the first argument. $args = func_get_args(); array_shift($args); array_shift($args); return call_user_func_array([ $this->getEntityClassName(), $method ], $args); }
php
{ "resource": "" }
q265229
Controller.middleware
test
public function middleware(string $key, string $group = null) { return $this->middleMan->middle($key, $group); }
php
{ "resource": "" }
q265230
Application.getDefaultCommands
test
protected function getDefaultCommands() { $commands = parent::getDefaultCommands(); $commands[] = new Command\AboutCommand(); $commands[] = new Command\CheckCommand(); return $commands; }
php
{ "resource": "" }
q265231
UserManager.updateUser
test
public function updateUser(UserInterface $user, $andFlush = true) { /** @var EntityManager $em */ $em = $this->objectManager; $meta = $em->getClassMetadata(get_class($user)); $roleClass = $meta->getAssociationTargetClass('roles'); $roles = array(); foreach ($user->get...
php
{ "resource": "" }
q265232
ExtensionService.getSettings
test
protected function getSettings(): array { $configurationManager = $this->objectManager->get(ConfigurationManagerInterface::class); $configuration = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); return $configuration['plugin.']['tx_t3vcont...
php
{ "resource": "" }
q265233
Group.getGroup
test
public function getGroup() { /** @var null|Person $person */ if (is_null($this->regid) === true) { try { $resp = static::getGroupConnection()->execGET( $this->identifier ); } catch (\Exception $e) { throw $e...
php
{ "resource": "" }
q265234
Group.getDirectMembership
test
protected function getDirectMembership() { if (isset($this->regid) === false) { $this->getGroup(); } if (is_null($this->regid) === true) { throw new \Exception('Group Id not specified'); } $resp = static::getGroupConnection()->execGET( "$th...
php
{ "resource": "" }
q265235
Group.getEffectiveMembership
test
protected function getEffectiveMembership() { if (isset($this->regid) === false) { $this->getGroup(); } if (is_null($this->regid) === true) { throw new \Exception('Group Id not specified'); } try { $resp = static::getGroupConnection()->exec...
php
{ "resource": "" }
q265236
Group.parseMembership
test
protected function parseMembership($data) { $html = HtmlDomParser::str_get_html($data); foreach ($html->find('a.member') as $name) { array_push($this->directmembers, $name->innertext); } foreach ($html->find('a.effective_member') as $name) { array_push($this->...
php
{ "resource": "" }
q265237
Group.parseHistory
test
protected function parseHistory($data) { $this->history = []; $html = HtmlDomParser::str_get_html($data); foreach ($html->find('li.history') as $e) { $item = array(); $item['date'] = $e->date; $item['user'] = $e->user; $item['actas'] = $e->a...
php
{ "resource": "" }
q265238
Group.parseAffiliate
test
protected function parseAffiliate($data) { $html = HtmlDomParser::str_get_html($data); $affiliate['group_identifier'] = (empty($html->find('span.identifier', 0)) === false) ? ($html->find('span.identifier', 0)->innertext) ...
php
{ "resource": "" }
q265239
Group.parseSearch
test
protected function parseSearch($data) { $html = HtmlDomParser::str_get_html($data); $groups = array(); foreach ($html->find('li.groupreference') as $e) { $item = array(); $item['regid'] = $e->find('span.regid', 0)->innertext; $item['title'] = $e->find('s...
php
{ "resource": "" }
q265240
BaseForm.getWebpageObject
test
public function getWebpageObject() { $viewName = Openbizx::$app->getCurrentViewName(); if (!$viewName) { return null; } $viewObj = Openbizx::getObject($viewName); return $viewObj; }
php
{ "resource": "" }
q265241
BaseForm.getElement
test
public function getElement($elementName) { if ($this->dataPanel->get($elementName)) { return $this->dataPanel->get($elementName); } if ($this->actionPanel->get($elementName)) { return $this->actionPanel->get($elementName); } if ($this->navPanel->get($e...
php
{ "resource": "" }
q265242
BaseForm.getErrorElements
test
public function getErrorElements($fields) { $errElements = array(); foreach ($fields as $field => $error) { $element = $this->dataPanel->getByField($field); $errElements[$element->objectName] = $error; } return $errElements; }
php
{ "resource": "" }
q265243
BaseForm.rerenderSubForms
test
protected function rerenderSubForms() { if (!$this->subForms) { return; } $this->prepareSubFormsDataObj(); foreach ($this->subForms as $subForm) { $formObj = Openbizx::getObject($subForm); $formObj->rerender(); } return; }
php
{ "resource": "" }
q265244
Bundle.setClass
test
public function setClass($class) { preg_match('/\\\([\w]+Bundle)$/', $class, $match); if (empty($match[1])) { throw new InvalidJsonParameterException(sprintf("The class %s does not seem to be a valid bundle class. Check your autoloader.json file", $class)); } $this->name ...
php
{ "resource": "" }
q265245
Dictionary.getTranslationKey
test
public function getTranslationKey($key): string { return sprintf('%s.%s', $this->prefix, kebab_case($this->get($key))); }
php
{ "resource": "" }
q265246
Dictionary.lists
test
public function lists(): array { $data = []; foreach (array_keys($this->words) as $key) { $data[$key] = $this->trans($key); } return $data; }
php
{ "resource": "" }
q265247
cacheService.loadConfig
test
private function loadConfig(&$configs, &$options) { foreach ($configs as $config) { $value_up = strtoupper($config["ATTRIBUTES"]["VALUE"]); if ($value_up == "Y") { $config["ATTRIBUTES"]["VALUE"] = true; } elseif ($value_up == "N") { $config...
php
{ "resource": "" }
q265248
cacheService.remove
test
public function remove($id) { if ($this->cacheObj && strtoupper($this->cache) == "ENABLED") { return $this->cacheObj->remove($id); } else { return false; } }
php
{ "resource": "" }
q265249
cacheService.getIds
test
public function getIds() { if ($this->cacheObj && strtoupper($this->cache) == "ENABLED") { return $this->cacheObj->getIds(); } else { return false; } }
php
{ "resource": "" }
q265250
cacheService.cleanAll
test
public function cleanAll() { if ($this->cacheObj && strtoupper($this->cache) == "ENABLED") { return $this->cacheObj->clean(\Zend_Cache::CLEANING_MODE_ALL); } else { return false; } }
php
{ "resource": "" }
q265251
cacheService._makeDirectory
test
private function _makeDirectory($pathName, $mode) { is_dir(dirname($pathName)) || $this->_makeDirectory(dirname($pathName), $mode); return is_dir($pathName) || @mkdir($pathName, $mode); }
php
{ "resource": "" }
q265252
ConfigHandler.readLocation
test
protected function readLocation($location) { $reader = null; if (is_dir($location)) { $base_location = Validator::fixPath(Validator::fixRelativePath($location)); foreach ($this->default_filenames as $filename) { $file = $base_location . $filename; ...
php
{ "resource": "" }
q265253
ConfigHandler.getReaderByExtension
test
protected function getReaderByExtension($location) { $ext = pathinfo($location, PATHINFO_EXTENSION); $reader = null; switch ($ext) { case 'json': $reader = new JsonConfigReader(); break; case 'xml': $reader = new XmlCo...
php
{ "resource": "" }
q265254
RouteBranch.addBranch
test
protected function addBranch(string $key): RouteBranch { if( array_key_exists($key, $this->branches) ){ throw new \Exception("{$key} branch already exists for this node."); } $this->branches[$key] = new RouteBranch("{$this->path}/{$key}"); return $this->branches[$key]; ...
php
{ "resource": "" }
q265255
RouteBranch.addRoute
test
public function addRoute(Route $route): void { foreach( $route->getMethods() as $method ){ if( array_key_exists($method, $this->routes) ){ throw new \Exception("{$method}#{$this->path} route has already been defined."); } $this->routes[$method] = $route;...
php
{ "resource": "" }
q265256
RouteBranch.findBranch
test
public function findBranch(string $part): ?RouteBranch { // Try finding an exact match first. if( array_key_exists($part, $this->branches) ){ return $this->branches[$part]; } // Loop through each branch key and match it using a regex. foreach( $this->branches as ...
php
{ "resource": "" }
q265257
RouteBranch.next
test
public function next(string $uriPart): RouteBranch { foreach( $this->branches as $key => $branch ){ if( $uriPart === $key ){ return $branch; } } return $this->addBranch($uriPart); }
php
{ "resource": "" }
q265258
CommentRepository.findByIssue
test
public function findByIssue( IssueInterface $issue, \DateTime $createdAt = null, $writtenBy = null, $limit = null, $offset = null ) { $queryBuilder = $this->getQueryBuilder(); if ($createdAt instanceof \DateTime) { $this->addCriteria($queryBuilder,...
php
{ "resource": "" }
q265259
Wordpress.getWPContents
test
protected function getWPContents($type = 'posts', $multiple = false, $options = [], $post_id = 0, $value = '') { // Access WordPress contents $wpcontents = []; // Exclude current item if (isset($options['exclude']) && 'current' === $options['exclude']) { $options['exclud...
php
{ "resource": "" }
q265260
Wordpress.getWPCategories
test
protected function getWPCategories($options = [], $value = 'cat_ID') { // Build contents $contents = []; $contents[-1] = Translate::t('wordpress.choose.category', [], 'wordpressfield'); // Build options $args = array_merge([ 'hide_empty' => 0, 'orderb...
php
{ "resource": "" }
q265261
Wordpress.getWPMenus
test
protected function getWPMenus($options = [], $value = 'term_id') { // Build contents $contents = []; $contents[-1] = Translate::t('wordpress.choose.menu', [], 'wordpressfield'); // Build options $args = array_merge([ 'hide_empty' => false, 'orderby' =...
php
{ "resource": "" }
q265262
Wordpress.getWPPages
test
protected function getWPPages($options = [], $value = 'ID') { // Build contents $contents = []; $contents[-1] = Translate::t('wordpress.choose.page', [], 'wordpressfield'); // Build options $args = array_merge([ 'sort_column' => 'post_parent,menu_order' ]...
php
{ "resource": "" }
q265263
Wordpress.getWPPosts
test
protected function getWPPosts($options = [], $value = 'ID') { // Build contents $contents = []; $contents[-1] = Translate::t('wordpress.choose.post', [], 'wordpressfield'); // Build options $args = array_merge([ 'post_type' => 'post', 'post_status' =>...
php
{ "resource": "" }
q265264
Wordpress.getWPPosttypes
test
protected function getWPPosttypes($options = [], $value = 'name') { // Build contents $contents = []; $contents[-1] = Translate::t('wordpress.choose.posttype', [], 'wordpressfield'); // Build options $args = array_merge([], $options); // Build request $types...
php
{ "resource": "" }
q265265
Wordpress.getWPTags
test
protected function getWPTags($options = [], $value = 'term_id') { // Build contents $contents = []; $contents[-1] = Translate::t('wordpress.choose.tag', [], 'wordpressfield'); // Build options $args = array_merge([], $options); // Build request $tags_obj = g...
php
{ "resource": "" }
q265266
Wordpress.getWPTaxonomies
test
protected function getWPTaxonomies($options = [], $value = '') { // Build contents $contents = []; $contents[-1] = Translate::t('wordpress.choose.taxonomy', [], 'wordpressfield'); // Build options $args = array_merge([ 'public' => 1 ], $options); ...
php
{ "resource": "" }
q265267
Wordpress.getWPTerms
test
protected function getWPTerms($options = [], $value = 'term_id') { // Build contents $contents = []; $contents[-1] = Translate::t('wordpress.choose.term', [], 'wordpressfield'); // Build options $args = array_merge([ 'hide_empty' => false, ], $options); ...
php
{ "resource": "" }
q265268
SubResolver.addToSearchPath
test
public function addToSearchPath(string $name, string $path, int $precedence) { if (!is_dir($path)) throw new \InvalidArgumentException("Path does not exist: " . $path); $this->search_path[$name] = array('path' => $path, 'precedence' => $precedence); $this->sorted = false; ...
php
{ "resource": "" }
q265269
SubResolver.setPrecedence
test
public function setPrecedence(string $name, int $precedence) { if (!isset($this->search_path[$name])) throw new \InvalidArgumentException("Unknown module: " . $name); if ($this->search_path[$name]['precedence'] !== $precedence) { $this->search_path[$name]['precedence...
php
{ "resource": "" }
q265270
SubResolver.getPrecedence
test
public function getPrecedence(string $name) { if (!isset($this->search_path[$name])) throw new \InvalidArgumentException("Unknown module: " . $name); return $this->search_path[$name]['precedence']; }
php
{ "resource": "" }
q265271
SubResolver.clearCache
test
public function clearCache() { if ($this->cache !== null) $this->cache->set('resolve', $this->name, array('data' => [], 'search_path' => $this->search_path)); return $this; }
php
{ "resource": "" }
q265272
SubResolver.getCachedData
test
protected function getCachedData() { if ($this->cache === null) return null; $sp = $this->cache->get('resolve', $this->name, 'search_path'); if ($sp !== null) $sp = $sp->toArray(); if ($this->search_path !== $sp) $this->clearCache(); ret...
php
{ "resource": "" }
q265273
SubResolver.resolve
test
public function resolve(string $file) { if (!$this->sorted) $this->sortModules(); $file = ltrim($file, '/'); if ($this->ext !== null && substr($file, -strlen($this->ext)) !== $this->ext) $file .= $this->ext; $cache = $this->getCachedData(); $cached =...
php
{ "resource": "" }
q265274
UrlManager.parserRequestUri
test
public function parserRequestUri($request) { $url = $request->getPathUri(); if ($url) { $urlArr = preg_split("/\//si", $url); if (preg_match("/^[a-z_]*$/si", $urlArr[1])) { // http://localhost/?/ModuleName/ViewName/ $module_name = $urlArr[0]; ...
php
{ "resource": "" }
q265275
WebPageWizard.saveStatefullVars
test
public function saveStatefullVars($sessionContext) { if ($this->dropSession){ $sessionContext->cleanObj($this->objectName, true); }else{ $sessionContext->saveObjVar($this->objectName, "FormStates", $this->formStates, true); $sessionContext->saveObjVar($this->objec...
php
{ "resource": "" }
q265276
WebPageWizard.getCurrentStep
test
public function getCurrentStep() { if($_GET['step']) { $this->currentStep=$_GET['step']; return $this->currentStep; } elseif($this->currentStep) { if($this->currentStep > $this->formRefs->count()){ return $this->formRefs->count(); }else{ ...
php
{ "resource": "" }
q265277
WebPageWizard.getFormInputs
test
public function getFormInputs($formName) { $formObj = Openbizx::getObject($formName); $rec = $formObj->getActiveRecord(); return $rec; }
php
{ "resource": "" }
q265278
WebPageWizard.cancel
test
public function cancel() { // call all step forms Cancel method if(is_array($this->formStates)){ foreach ($this->formStates as $formName=>$state) { if ($state['visited']) Openbizx::getObject($formName)->cancel(); } } $this->dro...
php
{ "resource": "" }
q265279
ScalarEnumType.registerSubTypeEnum
test
public static function registerSubTypeEnum(string $subTypeEnumClass, string $subTypeEnumValueRegexp): bool { if (!static::hasSubTypeEnum($subTypeEnumClass, $subTypeEnumValueRegexp)) { // registering same subtype enum class but with different regexp cause exception in following method ...
php
{ "resource": "" }
q265280
AbstractMiddleware.getInput
test
protected function getInput($request, $in, $name) { switch ($in) { case 'header': return $request->header($name); case 'query': return $request->query($name); case 'path': return $request->route($name); ...
php
{ "resource": "" }
q265281
Cleaner.delete
test
protected function delete($file, $expires) { if (!is_array($file['path'])) { $file['path'] = [$file['path']]; } foreach ($file['path'] as $path) { if (File::exists($path)) { if ((time() - File::lastModified($path)) >= $expires) { ...
php
{ "resource": "" }
q265282
Cleaner.convertToSeconds
test
protected function convertToSeconds($expires) { $seconds = 0; if (isset($expires['seconds'])) { $seconds += $expires['seconds']; } if (isset($expires['minutes'])) { $seconds += $expires['minutes'] * 60; } if (isset($e...
php
{ "resource": "" }
q265283
Strings.getKeyWords
test
public static function getKeyWords(string $text, int $maxLen = 60): string { $keyWords = []; // nalezeni vsech linku v textu preg_match_all('/<a[^>]*>[^<]+<\/a>/i', $text, $found); if (isset($found[0])) { foreach ($found[0] as $kw) { $keyWords[] = self::lower(self::trim(strip_tags($kw))); } } //...
php
{ "resource": "" }
q265284
Strings.findEmails
test
public static function findEmails(string $text): array { $result = []; preg_match_all('/[a-z\d._%+-]+@[a-z\d.-]+\.[a-z]{2,4}\b/i', $text, $result); return isset($result[0]) ? $result[0] : []; }
php
{ "resource": "" }
q265285
Strings.containsArray
test
public static function containsArray(string $haystack, array $needle): ?string { foreach ($needle as $query) { if (parent::contains($haystack, $query)) { return $query; } } return null; }
php
{ "resource": "" }
q265286
BaseProxyConnector.redirect
test
public function redirect( Request $request, $endpoint, $path, $responseType = 'json' ) { // Set the Endpoints $this->getEndpoints(); // Get Endpoint config. $this->setBaseUri( $this->getEndpointConfig( $endpoint )['endpoint'] ); // Get Endpoint AUTH // $this->setAuthHeaders(); // Get Required variables...
php
{ "resource": "" }
q265287
MigrationManager.migrateUp
test
public function migrateUp(MigrationConfig $config, $flushDatabase = false): Awaitable { return new Coroutine(function () use ($config, $flushDatabase) { $migrations = $this->instantiateMigrations($config); if (empty($migrations)) { $skip = false; ...
php
{ "resource": "" }
q265288
MigrationManager.migrateDirectoryUp
test
public function migrateDirectoryUp($dir, $flushDatabase = false): Awaitable { $config = new MigrationConfig(); $config->loadMigrationsFromDirectory($dir); return $this->migrateUp($config, $flushDatabase); }
php
{ "resource": "" }
q265289
AbstractTokenEntity.setId
test
public function setId($id = null) { if ($id != null){ $this->isNew = false; $this->id = $id; }else{ $this->id = SecureKey::generate(); } return $this; }
php
{ "resource": "" }
q265290
Worker.daemon
test
public function daemon($sleep = 60, $memoryLimit = 128) { $memoryLimit = $memoryLimit * 1024 * 1024; $startTime = time(); while (true) { $ret = $this->runNextJob(); if (! $ret) { //没有获取到job sleep($sleep); } ($this->memoryExcee...
php
{ "resource": "" }
q265291
Parameters.has
test
public function has($key) { if (isset($this->parameters[$key]) || array_key_exists($key, $this->parameters)) { return true; } return false; }
php
{ "resource": "" }
q265292
Oauth.getOauthRequest
test
public function getOauthRequest(array $params, $httpMethod, $baseUrl, $endPoint) : string { $signatureParams = array_merge($params, $this->getOauthParams()); $signatureParams['oauth_signature'] = $this->getOauthSignature($signatureParams, $httpMethod, $baseUrl . $endPoint); $contentParams = []; foreach ($para...
php
{ "resource": "" }
q265293
Oauth.getOauthSignature
test
private function getOauthSignature(array $params, $httpMethod, $url) : string { $urlParams = []; foreach ($params as $key => $value) { $params[$key] = rawurlencode($value); $urlParams[$key] = $key . '=' . $params[$key]; } ksort($urlParams); $parameterString = implode('&', $urlParams); $signatureBase...
php
{ "resource": "" }
q265294
ProcessBuilder.node
test
public function node($id) { if (isset($this->items[$id])) { throw new \RuntimeException(sprintf('Duplicate item ID: "%s"', $id)); } return $this->items[$id] = new Node($id); }
php
{ "resource": "" }
q265295
ProcessBuilder.transition
test
public function transition($id, $from, $to) { if (isset($this->items[$id])) { throw new \RuntimeException(sprintf('Duplicate item ID: "%s"', $id)); } $transition = $this->items[$id] = new Transition($id, $from); $transition->to($to); return $tran...
php
{ "resource": "" }
q265296
Result.addSetting
test
public function addSetting(ISetting $setting, $cachable = true) { $this->settings[] = $setting; if (true === $cachable) { $this->cachable_settings[] = $setting; } return $this; }
php
{ "resource": "" }
q265297
Result.addSettings
test
public function addSettings(array $settings, $cachable = true) { foreach ($settings as $setting) { if ($setting instanceof ISetting) { $this->addSetting($setting); } } return $this; }
php
{ "resource": "" }
q265298
Result.getSettings
test
public function getSettings($groups = null, $flag = null) { return $this->getFiltered($this->settings, $groups, $flag); }
php
{ "resource": "" }
q265299
Result.getCachableSettings
test
public function getCachableSettings($groups = null, $flag = null) { return $this->getFiltered($this->cachable_settings, $groups, $flag); }
php
{ "resource": "" }