_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q240200
SkillPartQuery.filterByCompositeId
train
public function filterByCompositeId($compositeId = null, $comparison = null) { if (is_array($compositeId)) { $useMinMax = false; if (isset($compositeId['min'])) { $this->addUsingAlias(SkillPartTableMap::COL_COMPOSITE_ID, $compositeId['min'], Criteria::GREATER_EQUAL); ...
php
{ "resource": "" }
q240201
SkillPartQuery.useSkillRelatedByPartIdQuery
train
public function useSkillRelatedByPartIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinSkillRelatedByPartId($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'SkillRelatedByPartId', '\gossi\trixionary\model\SkillQuery'); }
php
{ "resource": "" }
q240202
SkillPartQuery.useSkillRelatedByCompositeIdQuery
train
public function useSkillRelatedByCompositeIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinSkillRelatedByCompositeId($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'SkillRelatedByCompositeId', '\gossi\trixionary\model\Skil...
php
{ "resource": "" }
q240203
Zend_Gdata_HttpClient.setAuthSubPrivateKeyFile
train
public function setAuthSubPrivateKeyFile($file, $passphrase = null, $useIncludePath = false) { $fp = @fopen($file, "r", $useIncludePath); if (!$fp) { require_once 'Zend/Gdata/App/InvalidArgumentException.php'; throw new Zend_Gdata_App_...
php
{ "resource": "" }
q240204
Zend_Gdata_HttpClient.setAuthSubPrivateKey
train
public function setAuthSubPrivateKey($key, $passphrase = null) { if ($key != null && !function_exists('openssl_pkey_get_private')) { require_once 'Zend/Gdata/App/InvalidArgumentException.php'; throw new Zend_Gdata_App_InvalidArgumentException( 'You cannot enable secur...
php
{ "resource": "" }
q240205
Zend_Gdata_HttpClient.filterHttpRequest
train
public function filterHttpRequest($method, $url, $headers = array(), $body = null, $contentType = null) { if ($this->getAuthSubToken() != null) { // AuthSub authentication if ($this->getAuthSubPrivateKeyId() != null) { // secure AuthSub $time = time(); ...
php
{ "resource": "" }
q240206
EventStaticController.singleEventAction
train
public function singleEventAction() { $this->checkStaticTemplateIsIncluded(); $this->checkSettings(); $this->slotExtendedAssignMultiple([ self::VIEW_VARIABLE_ASSOCIATION_ID => $this->settings[self::SETTINGS_ASSOCIATION_ID], self::VIEW_VARIABLE_EVENT_ID => $this->sett...
php
{ "resource": "" }
q240207
ValidationResultSet.getErrorMessages
train
public function getErrorMessages() { $messages = array(); foreach($this->entries as $entry) { if($entry->isError()) { $messages[] = $entry->getMessage(); } } return $messages; }
php
{ "resource": "" }
q240208
ArrayableData.toArray
train
public function toArray(): array { $data = ReflectionUtil::objToSnakeArray($this, static::blacklist()); foreach ($this->renamed as $name => $newName) { if (!array_key_exists($name, $data)) { continue; } $data[$newName] = $data[$name]; u...
php
{ "resource": "" }
q240209
DomainRepository.get
train
public function get($id): Domain { if (!$model = Domain::findOne($id)) { throw new NotFoundException($this->i18n->t('setrun/sys/domain', 'Domain is not found')); } return $model; }
php
{ "resource": "" }
q240210
DomainRepository.save
train
public function save(Domain $model): void { if (!$model->save()) { throw new \RuntimeException($this->i18n->t('setrun/sys', 'Saving error')); } }
php
{ "resource": "" }
q240211
ExceptionTrait.encodeArray
train
protected function encodeArray(array $args): array { foreach ($args as $key => $value) { if (is_object($value)) { $args[$key] = get_class($value); } } return $args; }
php
{ "resource": "" }
q240212
Application.ahoy
train
public static function ahoy(array $config = []) { static $inst = null; if ($inst === null) { $inst = new Application(); $inst->registry = Registry::ahoy(); $inst->treasureChest = new Container(); $inst->setConfig($config); ...
php
{ "resource": "" }
q240213
Application.setSail
train
public function setSail() { $env = new Environment($_SERVER); if (!count($this->registry->getAll())) { $config = $env->fetchConfig($this->configFolder, $this->environment); $this->setConfig($config); } $request = ServerRequestFactory::fromGlobals($_SERV...
php
{ "resource": "" }
q240214
HubV3Client.listResources
train
private function listResources($filters = array(), $listType = null) { $uri = '/resources'; $query = array(); if ($listType) { $query[] = $listType; } foreach ($filters as $name => $value) { $query[] = "{$name}={$value}"; } if (sizeof(...
php
{ "resource": "" }
q240215
Base32.decode
train
public function decode($data) { // Make sure we have a valid data string. $mod = strlen($data) % 8; if ($mod === 1 || $mod === 3 || $mod === 6) { throw new \DomainException('Invalid input.'); } // Convert the data to a binary string. $bits = ''; ...
php
{ "resource": "" }
q240216
Base32.encode
train
public function encode($data) { // Convert the data to a binary string. $bits = ''; foreach (str_split($data) as $char) { $bits .= sprintf('%08b', ord($char)); } // Make sure the string length is a multiple of 5, padding if needed. $len = strlen($bits); ...
php
{ "resource": "" }
q240217
File_Area.get_handler
train
public function get_handler($path, array $config = array(), $content = array()) { $path = $this->get_path($path); if (is_file($path)) { $info = pathinfo($path); // deal with path names without an extension isset($info['extension']) or $info['extension'] = ''; // check file extension if ( ! empt...
php
{ "resource": "" }
q240218
File_Area.get_path
train
public function get_path($path) { $pathinfo = is_dir($path) ? array('dirname' => $path, 'extension' => null, 'basename' => '') : pathinfo($path); // make sure we have a dirname to work with isset($pathinfo['dirname']) or $pathinfo['dirname'] = ''; // do we have a basedir, and is the path already prefixed by ...
php
{ "resource": "" }
q240219
File_Area.get_url
train
public function get_url($path) { if(empty($this->url)) { throw new \LogicException('File operation now allowed: cannot create a file url without an area url.'); } $path = $this->get_path($path); $basedir = $this->basedir; empty($basedir) and $basedir = DOCROOT; if(stripos($path, $basedir) !== 0) ...
php
{ "resource": "" }
q240220
Request.getPayload
train
public function getPayload(string $key, $default = null) { if ($this->payload === null) { $contentType = $this->getHeader('Content-Type', ''); if (!$contentType) { $contentType = $this->getHeader('Content-type'); } if ($contentType) { ...
php
{ "resource": "" }
q240221
Bench.end
train
public function end($name = self::DEFAULT_NAME) { $this->end_time[$name] = microtime(true); $this->memory_usage[$name] = memory_get_usage(true); }
php
{ "resource": "" }
q240222
Bench.getTime
train
public function getTime($raw = false, $format = null, $name = self::DEFAULT_NAME) { $elapsed = $this->end_time[$name] - $this->start_time[$name]; return $raw ? $elapsed : self::readableElapsedTime($elapsed, $format, $name); }
php
{ "resource": "" }
q240223
Bench.getMemoryUsage
train
public function getMemoryUsage($raw = false, $format = null, $name = self::DEFAULT_NAME) { return $raw ? $this->memory_usage[$name] : self::readableSize($this->memory_usage[$name], $format); }
php
{ "resource": "" }
q240224
Bench.getMemoryPeak
train
public function getMemoryPeak($raw = false, $format = null) { $memory = memory_get_peak_usage(true); return $raw ? $memory : self::readableSize($memory, $format); }
php
{ "resource": "" }
q240225
WidgetController.mostRecentOrdersAction
train
public function mostRecentOrdersAction($max = 20) { $em = $this->getDoctrine()->getManager(); /** @var ProductOrderRepository $productOrderRepo */ $productOrderRepo = $em->getRepository('AmulenShopBundle:ProductOrder'); $orders = $productOrderRepo->recentOrders($max); retur...
php
{ "resource": "" }
q240226
BankTransferProvider.process
train
public function process(Request $request, Transaction $transaction, Delivery $delivery) { //UPDATE TRANSACTION $em = $this->container->get('doctrine')->getManager(); $pm = $em->getRepository('EcommerceBundle:PaymentMethod')->findOneBySlug('bank-transfer-test'); $transaction->setStatu...
php
{ "resource": "" }
q240227
FormHaveOptions.buildOptions
train
protected function buildOptions() { $created = ''; foreach($this->getOptions() as $key => $value){ if ($key === 'class') { $value = $this->buildClassString($value); } $created .= "$key='$value' "; } return rtrim($created, ' '); ...
php
{ "resource": "" }
q240228
ResultSet.add
train
public function add(DocumentInterface $document) { $this->documents[(string) $document->getIdentity()] = $document; return $this; }
php
{ "resource": "" }
q240229
AssetsServiceProvider.register
train
public function register(Application $app) { $assets = $this; $app['assets'] = $app->share(function() use($app, $assets){ return $assets; }); }
php
{ "resource": "" }
q240230
AssetsServiceProvider.boot
train
public function boot(Application $app) { $assets = $this; $app->before(function(Request $request) use($app, $assets){ $baseUrl = rtrim($request->getScheme().'://'.$request->getHttpHost().$request->getBasePath()).'/'; $assets->setCoreUrl($baseUrl); $assets->setOption('baseUrl', $baseUrl); $assets->setOp...
php
{ "resource": "" }
q240231
AssetsServiceProvider.renderAssets
train
public function renderAssets(&$content) { $this->prepareAssets(); $js = $this->renderJs(); $css = $this->renderCss(); $bodyJs = $this->renderJs(self::ON_BODY); if(!empty($css)) { if(strpos($content, "</head>")>0) $content = str_replace("</head>","####replace-css-here####</head>",$content); else ...
php
{ "resource": "" }
q240232
AssetsServiceProvider.renderJs
train
public function renderJs($position=self::ON_HEAD) { $result = ""; $js = $this->getJs($position); if(!empty($js)) array_walk($js, function($value) use (&$result){ $result .= '<script src="'.$value.'" type="text/javascript"></script>'; }); $custom = $this->getCustomJs($position); if(!empty($custom)) {...
php
{ "resource": "" }
q240233
AssetsServiceProvider.renderCss
train
public function renderCss() { $result = ""; $css = $this->getCss(); if(!empty($css)) array_walk($css, function($value) use (&$result){ $result .= '<link href="'.$value.'" type="text/css" rel="stylesheet">'; }); $custom = $this->getCustomCss(); if(!empty($custom)) { $customCss = '<style type="text...
php
{ "resource": "" }
q240234
AssetsServiceProvider.getJs
train
public function getJs($position=self::ON_HEAD) { if($this->js===array()) return array(); $js = isset($this->js[$position])&&!empty($this->js[$position])?$this->js[$position]:array(); if($js===array()) return $js; $options = $this->options; if($this->isCombineEnabled()) $this->combine('js', $js); ...
php
{ "resource": "" }
q240235
AssetsServiceProvider.getCss
train
public function getCss() { $css = $this->css; $options = $this->options; if($this->isCombineEnabled()) $this->combine('css', $css); // avoiding duplicate assets $css = array_flip(array_flip($css)); array_walk($css, function(&$value) use($options){ if(!empty($options['baseUrl'])&&strpos($value,'http...
php
{ "resource": "" }
q240236
AssetsServiceProvider.customJs
train
public function customJs($id, $script="", $position=self::ON_HEAD) { if(!isset($this->customJs[$position])) $this->customJs[$position] = array(); $this->customJs[$position][$id] = $script; return $this; }
php
{ "resource": "" }
q240237
AssetsServiceProvider.getCustomJs
train
public function getCustomJs($position=self::ON_HEAD) { return isset($this->customJs[$position])?$this->customJs[$position]:array(); }
php
{ "resource": "" }
q240238
AssetsServiceProvider.customCss
train
public function customCss($id, $css="") { if(func_num_args()==1) { $css = $id; $id = uniqid(); } $this->customCss[$id] = $css; return $this; }
php
{ "resource": "" }
q240239
AssetsServiceProvider.combine
train
public function combine($type, &$files) { $basePath = realpath($this->getOption('basePath')); if(empty($basePath))return $files; $cacheName = $this->createCachePath($this->getOption('cacheFileName')?$this->getOption('cacheFileName'):$this->createFileName($type,$files)).'.'.$type; $this->setOption('coreUrl',$th...
php
{ "resource": "" }
q240240
AssetsServiceProvider.prepareAssets
train
private function prepareAssets() { $lib = $this; $attached_groups = $this->getAttachedGroups(); array_walk($lib->attached_groups, function($group_name) use($lib){ $groups = $lib->getGroups(); $group_contents = $groups[$group_name]; array_walk($group_contents, function($value, $key) use($lib, $group_name...
php
{ "resource": "" }
q240241
ContentTypeGroup.add
train
public function add($name) { $this->repository->setCurrentUser($this->repository->getUserService()->loadUser($this->adminID)); $contentTypeService = $this->repository->getContentTypeService(); $contentTypeGroupStruct = $contentTypeService->newContentTypeGroupCreateStruct($name); tr...
php
{ "resource": "" }
q240242
Replacement.replace
train
public function replace() { foreach($this->matches as $match) { $value = $this->extractValue($match); $this->insertValue($value, $match['raw']); } }
php
{ "resource": "" }
q240243
Replacement.insertValue
train
public function insertValue($value, $match) { $this->str = str_replace($match, $value, $this->str); }
php
{ "resource": "" }
q240244
Replacement.extractValue
train
public function extractValue(Array $match) { switch(gettype($match['value'])) { case 'string': return $match['value']; break; case 'object': // Extract Closures if(get_class($match['value']) == 'Closure') { return $this->closureExtract($match); } // Extract Classes return $th...
php
{ "resource": "" }
q240245
Replacement.classExtract
train
public function classExtract(Array $match) { $extract = new ClassExtraction(get_class($match['value']), $match); return $extract->extract(); }
php
{ "resource": "" }
q240246
Response.dispatch
train
public function dispatch(ResponseInterface $response, int $status, $result) { // Build output array $contents = [ 'status' => $status, 'result' => $result, ]; // Convert output to JSON $contents = json_encode($contents, JSON_PRETTY_PRINT); //...
php
{ "resource": "" }
q240247
Collection.sort
train
public function sort( bool $desc = false ) { $items = $this->items; asort($items); if($desc) { $items = array_reverse($items, true); } return new static($items); }
php
{ "resource": "" }
q240248
Collection.sortKeys
train
public function sortKeys( int $options = SORT_REGULAR, bool $desc = false ) { $items = $this->items; $desc ? krsort($items, $options) : ksort($items, $options); return new static($items); }
php
{ "resource": "" }
q240249
Collection.sortBy
train
public function sortBy( \Closure $callback, bool $save_keys = true ) { $items = $this->items; $save_keys ? uasort($items, $callback) : usort($items, $callback); return new static($items); }
php
{ "resource": "" }
q240250
Collection.sortByKeys
train
public function sortByKeys( \Closure $callback ) { $items = $this->items; uksort($items, $callback); return new static($items); }
php
{ "resource": "" }
q240251
ScriptRunner.remove_remarks
train
private function remove_remarks($sql) { $lines = explode("\n", $sql); // try to keep mem. use down $sql = ""; $linecount = count($lines); $output = ""; for ($i = 0; $i < $linecount; $i++) { if (($i != ($linecount - 1)) || (strlen($lines[$i]) > 0)) { ...
php
{ "resource": "" }
q240252
Modules.removeModuleQueueItem
train
public function removeModuleQueueItem($key_or_regex){ $removed_queue_items = []; // user passed the numeric key of queue item if(is_numeric($key_or_regex)){ $removed_queue_items[] = $this->_module_queue[$key_or_regex]; unset($this->_module_queue[$key_or_regex]); // user passed a regex that will be matche...
php
{ "resource": "" }
q240253
Modules._insertModuleConfig
train
private function _insertModuleConfig($namespace, $overwrite){ // get module name from namespace $namespace_array = explode('\\', trim($namespace,'\\')); $path_array = array_slice($namespace_array, 1, 2); $module_config_path = ROOT_PATH . implode('/', $path_array) . '/configs/'; $module_config_path = str_repla...
php
{ "resource": "" }
q240254
Modules._runModuleController
train
private function _runModuleController($page_module){ // execute module controller $view = (new $page_module['class'])->run($this->_dom); // set the handle variable according to this module's controller return value if(is_resource($view) && get_resource_type($view) == 'stream'){ return [ 'handle' => $vie...
php
{ "resource": "" }
q240255
QueryBuilder.doExecute
train
private function doExecute($fetch = false, $fetchMode = null, $fetchClass = null) { if ($fetch) { $fetchMode = Database::normalizeFetchType($fetchMode); } // Parse SQL and Bind $sql = $this->query->getSQL(); $bind = $this->query->getBind(); // Connection...
php
{ "resource": "" }
q240256
Essentials.excel
train
public function excel($filename, $data) { \Excel::create($filename, function ($excel) use ($filename, $data) { $excel->sheet($filename, function ($sheet) use ($data) { $sheet->fromArray($data); }); }) ->export('xlsx'); }
php
{ "resource": "" }
q240257
Essentials.geoCoder
train
public function geoCoder($lat, $lng, $ak, $mcode, $url) { $client = new \GuzzleHttp\Client(); $parameters = [ 'form_params' => [ 'ak' => $ak, 'location' => $lat . ',' . $lng, 'output' => 'json', 'pois' => 0, ...
php
{ "resource": "" }
q240258
Router._remoteIP
train
private static function _remoteIP() { // Catch all possible hints of the client's IP address, not just REMOTE_ADDR foreach ( array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', ...
php
{ "resource": "" }
q240259
Router._initCommon
train
private static function _initCommon() { global $PPHP; self::$_req['warnings'] = array(); self::$_req['status'] = 200; self::$_req['redirect'] = false; self::$_req['protocol'] = (self::$_req['ssl'] ? 'https' : 'http'); }
php
{ "resource": "" }
q240260
Router.initCLI
train
public static function initCLI() { global $PPHP; self::$_PATH = array(); self::$_req['lang'] = $PPHP['config']['global']['default_lang']; self::$_req['default_lang'] = $PPHP['config']['global']['default_lang']; self::$_req['base'] = ''; self::$_req['binary'] ...
php
{ "resource": "" }
q240261
Router.startup
train
public static function startup() { global $PPHP; trigger('language', self::$_req['lang']); if (isset(self::$_PATH[1]) && listeners('route/' . self::$_PATH[0] . '+' . self::$_PATH[1])) { self::$_base = array_shift(self::$_PATH) . '+' . array_shift(self::$_PATH); } elseif...
php
{ "resource": "" }
q240262
Router.run
train
public static function run() { if (!pass('validate_request', 'route/' . self::$_base)) { return; }; if (self::$_base !== null && !pass('route/' . self::$_base, self::$_PATH)) { trigger('http_status', 500); }; }
php
{ "resource": "" }
q240263
Router.addWarning
train
public static function addWarning($code, $level = 1, $args = null) { if ($args === null) { // Callers may use null as well. $args = array(); }; if (!is_array($args)) { $args = array($args); }; switch ($level) { case 0: case ...
php
{ "resource": "" }
q240264
AdapterFactory.factory
train
public function factory( $adapter, $options = null ) { $adapter = parent::factory( $adapter, $options ); $adapter->setModel( $this->getModel() ); if ( $adapter instanceof ServiceLocatorAwareInterface ) { $adapter->setServiceLocator( $this->getServiceLocator() ); ...
php
{ "resource": "" }
q240265
BaseAction.generateModuleUrl
train
public function generateModuleUrl($actionName, array $parameters = array(), $absolute = false) { return $this->module->generateModuleUrl($actionName, $parameters, $absolute); }
php
{ "resource": "" }
q240266
BaseAction.render
train
public function render($template, array $parameters = array(), $response = null) { if (is_array($template)) { // guessing template $parameters = $template; $bundle = ''; $module = null; foreach (explode('\\', get_class($this->getModule())) as $par...
php
{ "resource": "" }
q240267
BaseAction.createFormBuilder
train
public function createFormBuilder($data = null, array $options = array()) { return $this->getContainer()->get('form.factory')->createBuilder('form', $data, $options); }
php
{ "resource": "" }
q240268
Client.execute
train
public function execute(Request $request, Response $response) { // Open curl handler $handle = curl_init(); // Set header callback curl_setopt($handle, CURLOPT_HEADERFUNCTION, array(&$response, 'header')); // Do not reuse connection curl_setopt($handle, CURLOPT_FORBID_REUSE, 1)...
php
{ "resource": "" }
q240269
ModuleManifest.processIncludes
train
protected function processIncludes() { foreach ($this->getXml()->xpath('/includes/include[@type != "" and @file != ""]') as $include) { $processor = $this->getIncludeProcessor((string)$include['type']); if (!$processor) { trigger_error(sprintf('No include processor fo...
php
{ "resource": "" }
q240270
ModuleManifest.validate
train
public function validate($xsd = null) { if (!$xsd) { $xsdPath = __DIR__ . '/../../../resources/xsd/'; $xsd = $xsdPath . 'rampage/core/ModuleManifest.xsd'; } try { $dom = new DOMDocument(); $dom->loadXML($this->getXml()->asXML()); ...
php
{ "resource": "" }
q240271
ModuleManifest.getModulePath
train
public function getModulePath($file, $asFileInfo = false) { $path = $this->moduleDirectory . ltrim($file, '/'); if ($asFileInfo) { $path = new \SplFileInfo($path); } return $path; }
php
{ "resource": "" }
q240272
ModuleManifest.loadServiceConfig
train
protected function loadServiceConfig() { $xml = $this->getNode('./servicemanager'); $config = $this->createServiceManagerConfig($xml, true); if ($config) { $this->manifest['application_config']['service_manager'] = $config; } return $this; }
php
{ "resource": "" }
q240273
ModuleManifest.loadPluginManagerConfigs
train
protected function loadPluginManagerConfigs() { foreach ($this->getXml()->xpath('plugins/pluginmanager[@type != ""]') as $pmConfig) { $key = (string)$pmConfig['type']; $config = $this->createServiceManagerConfig($pmConfig); if ($config) { $this->manifest[...
php
{ "resource": "" }
q240274
ModuleManifest.loadLocaleConfig
train
protected function loadLocaleConfig() { $xml = $this->getXml(); $config = &$this->manifest['application_config']; if (!isset($xml->locale->pattern)) { return $this; } foreach ($xml->xpath('locale/pattern[@pattern != ""]') as $node) { $dir = isset($no...
php
{ "resource": "" }
q240275
ModuleManifest.childToArray
train
protected function childToArray(SimpleXmlElement $xml, $name) { if (!isset($xml->{$name})) { return array(); } return $xml->{$name}->toPhpValue('array'); }
php
{ "resource": "" }
q240276
ModuleManifest.getRouteConfig
train
protected function getRouteConfig($node) { if ((!$node instanceof SimpleXmlElement) || !$node->route) { return false; } $config = array(); foreach ($node->route as $route) { $type = (string)$route['type']; $name = (string)$route['name']; ...
php
{ "resource": "" }
q240277
ModuleManifest.loadRouteConfig
train
protected function loadRouteConfig() { $xml = $this->getNode('router'); if (!$xml instanceof SimpleXmlElement) { return $this; } $config = $this->getRouteConfig($xml); if (!$config) { return $this; } $this->manifest['application_confi...
php
{ "resource": "" }
q240278
ModuleManifest.loadThemeConfig
train
protected function loadThemeConfig() { $xml = $this->getXml(); foreach ($xml->xpath('./resources/themes/theme[@name != "" and @path != ""]') as $node) { $path = (string)$node['path']; $name = (string)$node['name']; $this->manifest['application_config']['rampage'...
php
{ "resource": "" }
q240279
JobRepository.getStatistics
train
public function getStatistics($status) { $qb = $this->createQueryBuilder('q'); $qb->select('SUBSTRING(q.job, 1, 200) AS class'); $qb->where($qb->expr()->eq('q.status', $qb->expr()->literal($status))); $result = $qb->getQuery()->getScalarResult(); $stats = []; foreac...
php
{ "resource": "" }
q240280
AppFactory.getConfigArr
train
protected function getConfigArr(string $configAppFile) : array { $configCoreFile = __DIR__.'/../Config/config.php'; $configCore = $this->requireFile($configCoreFile); $configApp = $this->requireFile($configAppFile); $services = []; $skipCoreServices = $configApp['ski...
php
{ "resource": "" }
q240281
SubscriberService.preAdd
train
public function preAdd(Event $e) { $form = $e->getParam('form'); /* @var $inputFilter \UthandoUser\InputFilter\UserInputFilter */ $inputFilter = $form->getInputFilter(); $inputFilter->addEmailNoRecordExists(); }
php
{ "resource": "" }
q240282
MW_Mail_Message_Zend.getObject
train
public function getObject() { if( !empty( $this->_embedded ) ) { $parts = array(); if( $this->_html != null ) { $part = new Zend_Mime_Part( $this->_html ); $part->charset = $this->_object->getCharset(); $part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $part->disposition = Zend_Mime...
php
{ "resource": "" }
q240283
AbstractFactory.prefixModule
train
protected function prefixModule($name) { if (strpos($name, ':') === false) { $name = $this->getModuleName() .':'. $name; } return $name; }
php
{ "resource": "" }
q240284
Container.checkCache
train
protected function checkCache($name) { if (!isset($this->files[$name])) { $this->files[$name] = $this->getObject($name); } }
php
{ "resource": "" }
q240285
Container.renderFile
train
public function renderFile($name, array $attrs = array(), $urlType = UrlType::CDN) { $this->checkCache($name); return $this->files[$name]->render($attrs, $urlType); }
php
{ "resource": "" }
q240286
Container.renderFileUrl
train
public function renderFileUrl($name, $urlType = UrlType::CDN) { $this->checkCache($name); return $this->files[$name]->renderUrl($urlType); }
php
{ "resource": "" }
q240287
Container.renderAllFiles
train
public function renderAllFiles($limit = 100, $urlType = UrlType::CDN, $htmlPrefix = false, $htmlSuffix = false) { $config = (is_int($limit)) ? array(PaginatedIterator::LIMIT => $limit) : array(); $files = $this->container->objectList($config); $outputString = ''; $outputArray = arra...
php
{ "resource": "" }
q240288
AbstractTransport.beforeSendPerformed
train
protected function beforeSendPerformed(Swift_Mime_Message $message) { $event = new Swift_Events_SendEvent($this, $message); foreach ($this->plugins as $plugin) { if (method_exists($plugin, 'beforeSendPerformed')) { $plugin->beforeSendPerformed($event); } ...
php
{ "resource": "" }
q240289
Generator.getSymbol
train
public static function getSymbol($type = self::SYMBOL_LOWER) { switch ($type) { case self::SYMBOL_LOWER: return chr(mt_rand(97, 122)); break; case self::SYMBOL_UPPER: return chr(mt_rand(65, 90)); break; case self::SYMBOL_DIGIT: return mt_rand(0, 9); break; default: return null...
php
{ "resource": "" }
q240290
Generator.getPassword
train
public static function getPassword($length = 8) { $password = ""; for ($i = 0; $i < $length; $i++) { $password .= self::getSymbol(mt_rand(0, 2)); } return $password; }
php
{ "resource": "" }
q240291
FormErrorConverter.convertToArray
train
public static function convertToArray(\Symfony\Component\Form\Form $form) { //The array of errors messages $errors = array(); $errors['errors'] = array(); $errors['children'] = array(); //Get the errors for this level foreach($form->getErrors() as $error) { $...
php
{ "resource": "" }
q240292
User.verifyPassword
train
public function verifyPassword($username, $password) { $this->find("username", $username); return password_verify($password, $this->password); }
php
{ "resource": "" }
q240293
ContentExtension.getContentsBySlugsFunction
train
public function getContentsBySlugsFunction($slugs, $keepOrder = false) { $search = $this->repository->createSearch(); $search->addQuery(new TermsQuery('slug', $slugs), 'should'); $result = $this->repository->execute($search); if ($keepOrder) { $orderedResult = []; ...
php
{ "resource": "" }
q240294
ContentExtension.snippetFunction
train
public function snippetFunction( $slug, $template = null ) { $result = null; if ($this->handler && $this->router) { $route = $this->router->generate( '_ongr_plain_cms_snippet', [ 'slug' => $slug, 'tem...
php
{ "resource": "" }
q240295
Json.serialise
train
public static function serialise( $o, $options = 0, $depth = self::DEFAULT_OUTPUT_DEPTH){ $s = \json_encode($o, $options, $depth); static::$_LastError = \json_last_error(); return $s; }
php
{ "resource": "" }
q240296
ThemeSupports.registerSupports
train
protected function registerSupports() { do_action("before_theme_add_supports"); foreach ($this->getConfig("supports") as $feature => $enabled): if (!$enabled): continue; endif; add_theme_support($feature); endforeach; do_action("a...
php
{ "resource": "" }
q240297
Maestrano_Saml_Request.getRedirectUrl
train
public function getRedirectUrl() { // Build the request $id = $this->_generateUniqueID(); $issueInstant = $this->_getTimestamp(); $request = <<<AUTHNREQUEST <samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:asserti...
php
{ "resource": "" }
q240298
Maestrano_Saml_Request.setConsumerHost
train
public function setConsumerHost($host) { $host = rtrim($host, '/'); $this->_settings->spReturnUrl = $host . Maestrano::with($this->_preset)->param('sso.consume_path'); }
php
{ "resource": "" }
q240299
Config.load
train
public function load($directory, $subkey = null) { $config = []; // load main config $file = $directory.'_default.php'; if (!is_file($file)) return array(); $config = array_merge($config, include($file)); $file = $directory.'_default_app.php'; if (is_file($file)) $config = array_merge($config, include($...
php
{ "resource": "" }