_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q264700
Application.getDBConnection
test
public function getDBConnection($dbName = null) { $rDBName = (!$dbName) ? "Default" : $dbName; if (isset($this->_dbConnection[$rDBName])) { $db = $this->_dbConnection[$rDBName]; if (!CLI) { return $db; } } $dbInfo = $this->getConfi...
php
{ "resource": "" }
q264701
Application.removeDBConnection
test
public function removeDBConnection($dbName = "Default") { if (isset($this->_dbConnection[$dbName])) { $this->_dbConnection[$dbName]->closeConnection(); unset($this->_dbConnection[$dbName]); } return $this->getDBConnection($dbName); }
php
{ "resource": "" }
q264702
Application.processSecurityFilters
test
public function processSecurityFilters() { $securityService = Openbizx::getService(SECURITY_SERVICE); $securityService->processFilters(); $err_msg = $securityService->getErrorMessage(); if ($err_msg) { if ($this->_securityDeniedView) { $webpage = $this->_s...
php
{ "resource": "" }
q264703
Application.dispatchRequest
test
public function dispatchRequest() { if ($this->request->hasInvocation()) { if ($this->isSessionTimeout()) { $this->getSessionContext()->destroy(); $this->getClientProxy()->redirectView($this->_userTimeoutView); } return $this->dispatchRPC()...
php
{ "resource": "" }
q264704
Application.getParameters
test
private function getParameters() { $getKeys = array_keys($_GET); $params = null; // read parameters "param:name=value" foreach ($getKeys as $key) { if (substr($key, 0, 6) == "param:") { $paramName = substr($key, 6); $paramValue = $_GET[$key...
php
{ "resource": "" }
q264705
Application.renderView
test
public function renderView($webpageName, $form = "", $rule = "", $params = null, $hist = "") { /* @var $webpage \Openbizx\Easy\WebPage */ if ($webpageName == "__DynPopup") { $webpage = Openbizx::getWebpageObject($webpageName); return $webpage->render(); } ...
php
{ "resource": "" }
q264706
Application.validateRequest
test
protected function validateRequest($obj, $methodName) { if (is_a($obj, "Openbizx\Easy\EasyForm") || is_a($obj, "BaseForm")) { if ($obj->validateRequest($methodName)) { return true; } } return false; }
php
{ "resource": "" }
q264707
Application.dispatchView
test
private function dispatchView() { $request = $this->request; if (!ObjectFactoryHelper::getXmlFileWithPath($request->view)) { return $this->renderNotFoundView(); } if (!$this->canUserAccessView($request->view)) { //access denied error return $this->renderView...
php
{ "resource": "" }
q264708
Application.redirectToDefaultModuleView
test
public function redirectToDefaultModuleView($pmodule) { $module = strtolower($pmodule); $modfile = $this->getModulePath() . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'mod.xml'; $xml = simplexml_load_file($modfile); $defaultURL = OPENBIZ_APP_INDEX_URL . $xml->Menu->MenuIte...
php
{ "resource": "" }
q264709
Application.redirectToDefaultUserView
test
public function redirectToDefaultUserView() { $profile = $this->getUserProfile(); if ($profile['roleStartpage'][0]) { $DEFAULT_URL = OPENBIZ_APP_INDEX_URL . $profile['roleStartpage'][0]; } header("Location: $DEFAULT_URL"); exit; }
php
{ "resource": "" }
q264710
Application.initUserProfile
test
public function initUserProfile($username) { /* @var $profileService profileService */ $profileService = Openbizx::getService(PROFILE_SERVICE); if (method_exists($profileService, 'InitProfile')) { $profile = $profileService->initProfile($username); } else { $p...
php
{ "resource": "" }
q264711
Application.getUserPreference
test
public function getUserPreference($attribute = null) { if (!ObjectFactoryHelper::getXmlFileWithPath(OPENBIZ_PREFERENCE_SERVICE)) { return null; } $preferenceService = Openbizx::getService(OPENBIZ_PREFERENCE_SERVICE); if (method_exists($preferenceService, 'getPreference'))...
php
{ "resource": "" }
q264712
Application.getDefaultPerm
test
public function getDefaultPerm($pgroup) { $group = strtolower($pgroup); switch ($group) { default: case 'owner': $setting = $this->getUserPreference('owner_perm'); if ($setting != '') { $perm_code = $setting; ...
php
{ "resource": "" }
q264713
Application.getCurrentViewName
test
public function getCurrentViewName() { if ($this->_currentViewName == "") { $this->_currentViewName = $this->getSessionContext()->getVar("CVN"); // CVN stands for CurrentViewName } return $this->_currentViewName; }
php
{ "resource": "" }
q264714
Application.setCurrentViewName
test
public function setCurrentViewName($viewname) { $this->_currentViewName = $viewname; $this->getSessionContext()->setVar("CVN", $this->_currentViewName); // CVN stands for CurrentViewName }
php
{ "resource": "" }
q264715
Application.getCurrentViewSet
test
public function getCurrentViewSet() { if ($this->_currentViewSet == "") { $this->_currentViewSet = $this->getSessionContext()->getVar("CVS"); } // CVS stands for CurrentViewSet return $this->_currentViewSet; }
php
{ "resource": "" }
q264716
Application.setCurrentViewSet
test
public function setCurrentViewSet($viewSet) { $this->_currentViewSet = $viewSet; $this->getSessionContext()->setVar("CVS", $this->_currentViewSet); // CVS stands for CurrentViewSet }
php
{ "resource": "" }
q264717
Application.setBasePath
test
public function setBasePath($path) { $p = realpath($path); if ($p !== false && is_dir($p)) { $this->_basePath = $p; } else { throw new Exception("The directory does not exist: $path"); } }
php
{ "resource": "" }
q264718
Application.getModulePath
test
public function getModulePath() { if ($this->_modulePath === null) { $this->_modulePath = OPENBIZ_APP_PATH . DIRECTORY_SEPARATOR . "modules"; } return $this->_modulePath; }
php
{ "resource": "" }
q264719
Hasher.hashSQL
test
public function hashSQL($data, $columns, string $hash) { if (is_string($columns)) { $columns = [$columns]; } if (is_array($columns)) { if ($data instanceof DbalCollection) { $data = $data->getQueryBuilder(); } if ($data instanceof Selection) { $col = ''; foreach ($columns as $column) { ...
php
{ "resource": "" }
q264720
Hasher.check
test
public function check($string, string $hash): bool { return hash_equals($this->hash($string), $hash); }
php
{ "resource": "" }
q264721
emailService.readMetadata
test
protected function readMetadata(&$xmlArr) { parent::readMetaData($xmlArr); $this->accounts = new MetaIterator($xmlArr["PLUGINSERVICE"]["ACCOUNTS"]["ACCOUNT"], "EmailAccount"); $this->_logEnabled = $xmlArr["PLUGINSERVICE"]["LOGGING"]["ATTRIBUTES"]["ENABLED"]; if ($this->_logEnabled) {...
php
{ "resource": "" }
q264722
emailService.useAccount
test
public function useAccount($accountName) { //If a mail object exists, overwrite with new object if ($this->_mail) $this->_constructMail(); $this->useAccount = $accountName; $account = $this->accounts->get($accountName); if ($account->isSMTP == "Y") { ...
php
{ "resource": "" }
q264723
emailService.sendEmail
test
public function sendEmail($TOs = null, $CCs = null, $BCCs = null, $subject, $body, $attachments = null, $isHTML = false) { $mail = $this->_mail; // add TO addresses if ($TOs) { foreach ($TOs as $to) { if (is_array($to)) { $mail->addTo($to['emai...
php
{ "resource": "" }
q264724
emailService.logEmail
test
public function logEmail($result, $subject, $body = NULL, $TOs = NULL, $CCs = NULL, $BCCs = NULL) { //Log the email attempt $recipients = ''; // add TO addresses if ($TOs) { foreach ($TOs as $to) { if (is_array($to)) { $recipients .= $t...
php
{ "resource": "" }
q264725
Tags.Info
test
public function Info($tag = mull) { if (empty($tag)) trigger_error("You didn't supply a tag, not sure what whill happen here...", E_USER_WARNING); return $this->Get($this->buildUrl($tag)); }
php
{ "resource": "" }
q264726
ClassLoader.getAutoloadLibFileWithPath
test
public static function getAutoloadLibFileWithPath($className) { if (!$className) { return; } // use class map first if (isset(self::$classMap[$className])) { return self::$classMap[$className]; } // search it in cache first $c...
php
{ "resource": "" }
q264727
ClassLoader.loadMetadataClass
test
public static function loadMetadataClass($className, $packageName = '') { if (class_exists($className, false)) { return true; } if (isset(self::$_classNameCache[$packageName . $className])) { return true; } $filePath = self::getLibFileWithPath($classNa...
php
{ "resource": "" }
q264728
ClassLoader.getCoreLibFilePath
test
public static function getCoreLibFilePath($className) { // if class not yet collect on class map, scan core path. $classFile = $className . '.php'; // TODO: search the file under bin/, bin/data, bin/ui. bin/service, bin/easy, bin/Easy/element. // guess class type and...
php
{ "resource": "" }
q264729
ClassLoader.findClassFileOnCache
test
private static function findClassFileOnCache($className) { // search it in cache first $cacheKey = $className . "_path"; if (extension_loaded('apc') ) { $filePath = apc_fetch($cacheKey); return $filePath; } return null; }
php
{ "resource": "" }
q264730
Alumni.fill
test
protected static function fill(Person $person, array $attrs) { $attrs = array_merge( $attrs, $attrs["PersonAffiliations"]["AlumPersonAffiliation"] ); return parent::fill($person, $attrs); }
php
{ "resource": "" }
q264731
Scheduler.offsetSet
test
public function offsetSet($name, $job) { if (!is_callable($job)) { throw new InvalidArgumentException('Each job must be callable'); } $this->jobs[$name] = $job; }
php
{ "resource": "" }
q264732
Scheduler.process
test
public function process() : void { global $argv; $specific = null; foreach ($argv as $arg) { if (preg_match('@--job=(.*?)$@', $arg, $match)) { $specific = $match[1]; } } $start = time(); $tmp = sys_get_temp_dir(); array_...
php
{ "resource": "" }
q264733
Scheduler.at
test
public function at(string $datestring) : void { global $argv; if (in_array('--all', $argv) || in_array('-a', $argv)) { return; } $date = date($datestring, $this->now); if (!preg_match("@$date$@", date('Y-m-d H:i', $this->now))) { throw new NotDueExcept...
php
{ "resource": "" }
q264734
ColumnListbox.renderLabel
test
public function renderLabel() { if ($this->sortable == "Y") { $rule = $this->objectName; $function = $this->formName . ".SortRecord($rule,$this->sortFlag)"; if($this->sortFlag == "ASC" || $this->sortFlag == "DESC"){ $class=" class=\"current\" "; ...
php
{ "resource": "" }
q264735
DefaultContext.flattenPath
test
protected static function flattenPath(array $path) { $string = ''; foreach ($path as $i => $segment) { if (\is_numeric($segment)) { $string .= '[' . $segment . ']'; continue; } if ($i != 0) { ...
php
{ "resource": "" }
q264736
Module.getConfig
test
public function getConfig() { $provider = new ConfigProvider(); $this->config = $provider->getTemplateConfig(); $this->config['middleware_pipeline'] = $provider->getMiddlewareConfig(); $this->config['service_manager'] = $provider->getDependencyConfig(); $this->conf...
php
{ "resource": "" }
q264737
WebRequest.Create
test
public function Create($url, $method = 'GET', $parameters = array()) { $ch = curl_init(); $key= (string)$ch; $query = ''; $res = null; $options = $this->_options; foreach ($parameters as $k => $v) $query .= ((strlen ($query) == 0) ? "":"&") . sprintf('%s=%s', $k, urlencode($v)); switch (strtolo...
php
{ "resource": "" }
q264738
WebRequest.store
test
private function store() { while ($finished = curl_multi_info_read($this->mh, $messages)) { $key = (string)$finished["handle"]; $this->_responses[$key] = new WebResponse(curl_multi_getcontent($finished["handle"]), curl_getinfo($finished["handle"])); curl_multi_remove_handle($this->mh, $finished["handle"]); ...
php
{ "resource": "" }
q264739
chartService.&
test
public function &getPlotData(&$bizObj, $fields, $labelField) { $oldCacheMode = $bizObj->GetCacheMode(); $bizObj->SetCacheMode(0); // turn off cache mode, not affect the current cache $bizObj->runSearch(-1); // don't use page search while (1) { $recArray = $biz...
php
{ "resource": "" }
q264740
chartService.renderXYPlot
test
public function renderXYPlot(&$data, &$xmlArr) { $id = $xmlArr['ATTRIBUTES']['ID']; $field = $xmlArr['ATTRIBUTES']['FIELD']; $chartType = $xmlArr['ATTRIBUTES']['CHARTTYPE']; $pointType = $xmlArr['ATTRIBUTES']['POINTTYPE']; $weight = $xmlArr['ATTRIBUTES']['WEIGHT']; $c...
php
{ "resource": "" }
q264741
chartService._getMark
test
private function _getMark($mark) { switch (strtoupper($mark)) { case "SQUARE": return MARK_SQUARE; case "UTRIANGLE": return MARK_UTRIANGLE; case "DTRIANGLE": return MARK_DTRIANGLE; case "DIAMOND": return MARK_DIAMOND; case "CIRCLE": return ...
php
{ "resource": "" }
q264742
chartService._getFont
test
private function _getFont($font) { switch (strtoupper($font)) { case "ARIAL": return FF_ARIAL; case "COURIER;": return FF_COURIER; case "TIMES": return FF_TIMES; case "VERDANA": return FF_VERDANA; case "COMIC": return FF_COMIC; ...
php
{ "resource": "" }
q264743
Instaphp.Instance
test
public static function Instance($token = null, $config = array()) { if (self::$instance == null || !empty($token)) { self::$instance = new self($token, $config); } return self::$instance; }
php
{ "resource": "" }
q264744
Attributable.getAttribute
test
public function getAttribute($key) { if (isset($this->attributes[$key])) { return $this->attributes[$key]; } return null; }
php
{ "resource": "" }
q264745
Attributable.setAttributeInGroup
test
public function setAttributeInGroup($group, $key, $value) { $this->attributes[$group][$key] = $value; return $this; }
php
{ "resource": "" }
q264746
Attributable.getAttributeInGroup
test
public function getAttributeInGroup($group, $key) { if (isset($this->attributes[$group][$key])) { return $this->attributes[$group][$key]; } return null; }
php
{ "resource": "" }
q264747
ModelRepository.findOrCreate
test
public function findOrCreate($id, array $columns = ['*']) { $model = $this->query()->find($id, $columns); if (!$model) { return $this->getModel()->newInstance(); } return $model; }
php
{ "resource": "" }
q264748
ModelRepository.getModel
test
public function getModel() { if (!$this->hasDependency('model') && !$this->model instanceof Model) { throw new Exceptions\NoModelSetException; } return $this->model; }
php
{ "resource": "" }
q264749
Hookable.uniqueId
test
private function uniqueId($hookName, $function, $priority) { static $count = 0; if (is_string($function)) { return $function; } if (is_object($function)) { // Closures are currently implemented as objects $function = array($function, ''); }...
php
{ "resource": "" }
q264750
Hookable.callAll
test
private function callAll($args) { if (isset($this->filters['all'])) { reset($this->filters['all']); do { foreach ((array) current($this->filters['all']) as $fn_arr) { if (!is_null($fn_arr['function'])) { call_user_func_array...
php
{ "resource": "" }
q264751
Hookable.append
test
public function append($hookName, $callable, $priority = 10, $accepted_args = 1, $create = true) { if ($create || ! $this->has($hookName, $callable)) { return $this->add($hookName, $callable, $priority, $accepted_args); } return false; }
php
{ "resource": "" }
q264752
Hookable.exists
test
public function exists($hookName, $function_to_check = false) { $hookName = $this->sanitize($hookName); if (!$hookName || !isset($this->filters[$hookName])) { return false; } // Don't reset the internal array pointer $has = !empty($this->filters[$hookName]); ...
php
{ "resource": "" }
q264753
Hookable.call
test
public function call($hookName, $arg = '') { $hookName = $this->sanitize($hookName); if (!$hookName) { return false; } if (! isset($this->actions[$hookName])) { $this->actions[$hookName] = 1; } else { $this->actions[$hookName]++; } ...
php
{ "resource": "" }
q264754
Hookable.replace
test
public function replace( $hookName, $function_to_replace, $callable, $priority = 10, $accepted_args = 1, $create = true ) { $hookName = $this->sanitize($hookName); if (!$hookName) { throw new \Exception("Invalid Hook Name Specified", E_ERRO...
php
{ "resource": "" }
q264755
Hookable.count
test
public function count($hookName) { $hookName = $this->sanitize($hookName); if (!$hookName || !isset($this->filters[$hookName])) { return false; } return count((array) $this->filters[$hookName]); }
php
{ "resource": "" }
q264756
Hookable.isDo
test
public function isDo($hookName = null) { if (null === $hookName) { return ! empty($this->current); } $hookName = $this->sanitize($hookName); return $hookName && in_array($hookName, $this->current); }
php
{ "resource": "" }
q264757
Hookable.isCalled
test
public function isCalled($hookName) { $hookName = $this->sanitize($hookName); if (!$hookName || ! isset($this->actions[$hookName])) { return 0; } return $this->actions[$hookName]; }
php
{ "resource": "" }
q264758
App.addRoute
test
public function addRoute( $path, $middlewares = null, string $method = null, string $name = null ): Route { if (!$path instanceof Route && null === $middlewares) { throw new \InvalidArgumentException('Invalid route config'); } if ($path instanceof...
php
{ "resource": "" }
q264759
App.pipe
test
public function pipe($path, $middlewares = null, string $env = null): self { if (null !== $env && $this->env !== $env) { return $this; } if (null === $middlewares) { $middlewares = $this->buildMiddleware($path); $path = '*'; } if (!$middl...
php
{ "resource": "" }
q264760
App.run
test
public function run(?ServerRequestInterface $request = null, bool $returnResponse = false) { $request = (null !== $request) ? $request : ServerRequest::fromGlobals(); $request = $request->withAttribute('originalResponse', $this->response); $response = $this->dispatcher->handle($request); ...
php
{ "resource": "" }
q264761
SignalExecutionCommand.singalExecution
test
protected function singalExecution(Node $node, Execution $execution, array $vars, array $delegation) { $behavior = $node->getBehavior(); if ($behavior instanceof SignalableBehaviorInterface) { $behavior->signal($execution, $this->signal, $vars, $delegation); } }
php
{ "resource": "" }
q264762
Container.set
test
public function set($id, $value) { if (!empty($this->locks[$id])) { throw new ContainerException("Cannot override locked key {$id}"); } $this->definitions[$id] = $value; $this->calcs[$id] = false; // unset on override unset($this->objects[$id]); }
php
{ "resource": "" }
q264763
Container.raw
test
public function raw($idOrClosure) { if (is_object($idOrClosure) && method_exists($idOrClosure, "__invoke")) { $this->raws->attach($idOrClosure); return $idOrClosure; } if (!isset($this->definitions[$idOrClosure])) { return null; } return...
php
{ "resource": "" }
q264764
Encryption.encrypt
test
public function encrypt(string $value, string $key = null): string { if ($key === null) { $key = $this->getDefaultKey(); } $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($this->cipher)); return $iv . openssl_encrypt($value, $this->cipher, $key, 0, $iv); }
php
{ "resource": "" }
q264765
Encryption.decrypt
test
public function decrypt(string $value, string $key = null): ?string { if ($key === null) { $key = $this->getDefaultKey(); } $ivLength = openssl_cipher_iv_length($this->cipher); $iv = substr($value, 0, $ivLength); $result = @openssl_decrypt(substr($value, $ivLength...
php
{ "resource": "" }
q264766
Encryption.getDefaultKey
test
private function getDefaultKey() { if (isset($this->cache['defaultKey'])) { return $this->cache['defaultKey']; } $app = App::get(); $cacheKey = 'ivopetkov-encryption-default-key'; $value = $app->cache->getValue($cacheKey); if ($value === null) { ...
php
{ "resource": "" }
q264767
DependencyObject.calculateArguments
test
private function calculateArguments(array $config): array { $args = []; foreach ($config as $key => $item) { if (\is_string($item) && $this->base->has($item)) { $args[] = $this->base->get($item); continue; } if (\is_string...
php
{ "resource": "" }
q264768
MySQL.getStrType
test
public static function getStrType( $str ) { if ( null === $str ) { return 's'; } $chrType = substr((string)gettype($str),0,1); return (!in_array($chrType,array("i","d","s"))) ? "b" : $chrType; }
php
{ "resource": "" }
q264769
Route.addApp
test
public function addApp(string $path, $ext, string $module) { $ext_key = empty($ext) ? '_' : $ext; if (!isset($this->apps[$ext_key])) { $this->apps[$ext_key] = array( 'path' => $path, 'module' => $module, 'route' => $this->route, ...
php
{ "resource": "" }
q264770
Route.getSubRoute
test
public function getSubRoute(string $route_part) { $sub_route = $this->route === '/' ? '/' . $route_part : $this->route . '/' . $route_part; if (!isset($this->children[$route_part])) $this->children[$route_part] = new Route($sub_route, $this->depth + 1); return $this->children[$...
php
{ "resource": "" }
q264771
Route.serialize
test
public function serialize() { return serialize([ 'route' => $this->route, 'depth' => $this->depth, 'apps' => $this->apps, 'children' => $this->children ]); }
php
{ "resource": "" }
q264772
Route.unserialize
test
public function unserialize($data) { $data = unserialize($data); $this->route = $data['route']; $this->depth = $data['depth']; $this->apps = $data['apps']; $this->children = $data['children']; }
php
{ "resource": "" }
q264773
Date.getYearToActual
test
public static function getYearToActual(int $beginYear): string { $actualYear = strftime('%Y'); if ($beginYear == $actualYear) { return $actualYear; } else { return $beginYear . ' - ' . $actualYear; } }
php
{ "resource": "" }
q264774
Date.getCurrentTimeStamp
test
public static function getCurrentTimeStamp(): string { $t = microtime(true); $micro = sprintf('%06d', ($t - floor($t)) * 1000000); $d = new DateTime(date('Y-m-d H:i:s.' . $micro, (int) $t)); return $d->format('Y_m_d_H_i_s_u'); }
php
{ "resource": "" }
q264775
Date.getDay
test
public static function getDay($day): string { if ($day instanceof DateTimeInterface) { $day = (int) $day->format('N'); } if (!is_int($day)) { throw new InvalidArgumentException; } return self::$dayNames[self::$locale][$day]; }
php
{ "resource": "" }
q264776
Date.getShortDay
test
public static function getShortDay($day): string { if ($day instanceof DateTimeInterface) { $day = (int) $day->format('N'); } if (!is_int($day)) { throw new InvalidArgumentException; } return self::$dayNamesShort[self::$locale][$day]; }
php
{ "resource": "" }
q264777
Date.getMonth
test
public static function getMonth($month): string { if ($month instanceof DateTimeInterface) { $month = (int) $month->format('n'); } if (!is_int($month)) { throw new InvalidArgumentException; } return self::$monthNames[self::$locale][$month]; }
php
{ "resource": "" }
q264778
Date.getShortMonth
test
public static function getShortMonth($month): string { if ($month instanceof DateTimeInterface) { $month = (int) $month->format('n'); } if (!is_int($month)) { throw new InvalidArgumentException; } return self::$monthNamesShort[self::$locale][$month]; }
php
{ "resource": "" }
q264779
Date.formatDate
test
private static function formatDate($datetime, string $format): ?string { if (empty($datetime)) { return null; } elseif ($datetime instanceof DateTimeInterface) { $date = $datetime; } else { $date = DateTime::createFromFormat('U', (string) $datetime); } return $date->format($format); }
php
{ "resource": "" }
q264780
Date.getDateTime
test
public static function getDateTime($datetime, bool $withSeconds = false): ?string { return self::formatDate($datetime, self::getFormat(true, true, $withSeconds)); }
php
{ "resource": "" }
q264781
Application.registerBaseServices
test
public function registerBaseServices() { //see example https://github.com/slimphp/Slim/blob/3.x/Slim/DefaultServicesProvider.php $container = $this->getContainer(); // wrapper for Request validation if (!isset($container['validator'])) { $container['validator'] = new \Am...
php
{ "resource": "" }
q264782
SectionTreeController.postSectiontreeAction
test
public function postSectiontreeAction() { $serializer = $this->get("tpg_extjs.phpcr_serializer"); $entity = $serializer->deserialize( $this->getRequest()->getContent(), 'Application\Togu\ApplicationModelsBundle\Document\Section', 'json', DeserializationCon...
php
{ "resource": "" }
q264783
SessionEntity.setOwner
test
public function setOwner($type, $id) { $this->ownerType = $type; $this->ownerId = $id; return $this; }
php
{ "resource": "" }
q264784
PleasingMinifyFilter.removeComments
test
private function removeComments( $input, $proxy = false ) { if ( preg_match_all("/\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\//", $input, $comments) ) { foreach ( $comments[ 0 ] as $comment ) { $lines = explode(PHP_EOL, $comment); $newComment = implode(PHP_EOL,preg_grep("/copyright...
php
{ "resource": "" }
q264785
PleasingMinifyFilter.minifyCSS
test
private function minifyCSS($input) { $keepComments = null; $output = $this->stashComments( $input ); // Remove Comments, preserving comments marked as important $output = preg_replace('!/\*[^*\!]*\*+([^/][^*]*\*+)*/!', '', $output); $output = $this->minifySpaceCSS($output); $output = $this-...
php
{ "resource": "" }
q264786
TwigView.setGlobal
test
public function setGlobal($name, $value, $options = []) { if (isset($options['namespace'])) { $this->getEnvironment()->addGlobal($options['namespace'], [$name => $value]); } else { $this->getEnvironment()->addGlobal($name, $value); } }
php
{ "resource": "" }
q264787
StringUtils.quote
test
public static function quote($val = "", $q = "\"") { if (is_string($val)) { return $q . $val . $q; } elseif (is_numeric($val)) { return $val; } elseif (is_array($val)) { return "StringUtils::quote returned 'array'! "; } else { return $q...
php
{ "resource": "" }
q264788
StringUtils.explodeGeneric
test
public static function explodeGeneric($input = '', array $delims = [' ']) { foreach ($delims as $delim) { $input = str_replace($delim, ' ', $input); } $input = preg_replace('/\s\s+/', ' ', $input); $input = trim($input); $out = explode(' ', $input); return...
php
{ "resource": "" }
q264789
User.getRole
test
public function getRole($role) { foreach ($this->getRoles() as $roleItem) { if ($role == $roleItem->getRole()) { return $roleItem; } } return null; }
php
{ "resource": "" }
q264790
User.addRole
test
public function addRole($role) { if (!$role instanceof Role) { //throw new \Exception( "addRole takes a Role object as the parameter" ); $_role = new Role($role); } else { $_role = $role; } if (!$this->hasRole($_role->getRole())) { $_r...
php
{ "resource": "" }
q264791
User.hasRole
test
public function hasRole($role) { $roles = $this->getRoles(); /** @var Role $roleObject */ foreach ($roles as $roleObject) { if ($roleObject->getRole() == strtoupper($role)) { return true; } } return false; }
php
{ "resource": "" }
q264792
ErrorHandler.errorHandler
test
public static function errorHandler($errNo, $errMsg, $fileName, $lineNum, $vars) { // don't respond to the error if it // was suppressed with a '@' if (error_reporting() == 0) { return; } if ($errNo == E_NOTICE || $errNo == E_STRICT) { // || $errno == E_W...
php
{ "resource": "" }
q264793
ErrorHandler.exceptionHandler
test
public static function exceptionHandler($exc) { $errno = $exc->getCode(); $errmsg = $exc->getMessage(); $filename = $exc->getFile(); $linenum = $exc->getLine(); $debug_array = $exc->getTrace(); $back_trace = self::_errorBacktrace($debug_array); $err = self::_g...
php
{ "resource": "" }
q264794
ErrorHandler._getOutputErrorMsg
test
private static function _getOutputErrorMsg($errno, $errmsg, $filename, $linenum, $back_trace) { // timestamp for the error entry date_default_timezone_set('GMT'); // to avoid error PHP 5.1 $dt = date("Y-m-d H:i:s (T)"); // TODO: use CSS class for style $err = "<div style='fon...
php
{ "resource": "" }
q264795
ErrorHandler._errorBacktrace
test
private static function _errorBacktrace($debug_array = NULL) { if ($debug_array == NULL) { $debug_array = debug_backtrace(); } $counter = count($debug_array); $msg = ""; for ($tmp_counter = 0; $tmp_counter != $counter; ++$tmp_counter) { $msg .= "<br><b...
php
{ "resource": "" }
q264796
Check.setName
test
public function setName($name = null) { if (null === $name || !is_string($name)) { $this->name = self::getRandomString(8); } else { $this->name = $name; } return $this; }
php
{ "resource": "" }
q264797
Check.addSetting
test
protected function addSetting($name, $value, $group = null, $flag = ISetting::NORMAL, $cachable = false) { if (empty($name)) { throw new \InvalidArgumentException('A setting must have a valid name.'); } if (null === $group) { $group = $this->getDefaultSettingGroupNam...
php
{ "resource": "" }
q264798
Check.addCachableSetting
test
protected function addCachableSetting($name, $value, $group = null, $flag = ISetting::NORMAL) { $this->addSetting($name, $value, $group, $flag, true); return $this; }
php
{ "resource": "" }
q264799
Container.offsetUnset
test
public function offsetUnset($offset) { if (isset($this->map[$offset])) { unset($this->map[$offset]); } if (isset($this->services[$offset])) { unset($this->services[$offset]); } }
php
{ "resource": "" }