_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q238600
Armourer.getBaseOfWoundsUsingWeaponlike
train
public function getBaseOfWoundsUsingWeaponlike(WeaponlikeCode $weaponlikeCode, Strength $currentStrength): int { // weapon base of wounds has to be summed with strength via bonus summing, see PPH page 92 right column $baseOfWounds = $this->tables->getBaseOfWoundsTable()->getBaseOfWounds( ...
php
{ "resource": "" }
q238601
Dispatcher.callQueueMethodOnHandler
train
protected function callQueueMethodOnHandler($class, $method, $arguments) { $handler = (new ReflectionClass($class))->newInstanceWithoutConstructor(); $handler->queue($this->resolveQueue(), 'Illuminate\Events\CallQueuedHandler@call', [ 'class' => $class, 'method' => $method, 'data' => serialize($arguments), ]...
php
{ "resource": "" }
q238602
AdminUserInstaller.createFirstUser
train
protected function createFirstUser() { $info = [ 'first_name' => $this->askForFirstName(), 'last_name' => $this->askForLastName(), 'email' => $this->askForEmail(), 'password' => $this->askForPassword(), 'created_at' => Carbon::now(), ...
php
{ "resource": "" }
q238603
RunInstallCommand.getInstallScript
train
public function getInstallScript() { if (! $this->installScript) { $installClass = $this->installNamespace.'Install'; if (! class_exists($installClass)) { $message = sprintf('No install class found at %s. Nothing to do.', $installClass); throw new Ru...
php
{ "resource": "" }
q238604
RunInstallCommand.hasTablesOrViews
train
protected function hasTablesOrViews() { $tables = $this->db->query('SHOW TABLES', DbAdapter::QUERY_MODE_EXECUTE); return (bool) count($tables); }
php
{ "resource": "" }
q238605
RunInstallCommand.dropTables
train
protected function dropTables() { $tables = $this->db->query( 'SHOW FULL TABLES WHERE TABLE_TYPE LIKE "BASE_TABLE"', DbAdapter::QUERY_MODE_EXECUTE ); // Disable foreign key checks -- we are wiping the database on purpose $this->db->query( 'SET FOR...
php
{ "resource": "" }
q238606
RunInstallCommand.dropViews
train
protected function dropViews() { $views = $this->db->query( 'SHOW FULL TABLES WHERE TABLE_TYPE LIKE "VIEW"', DbAdapter::QUERY_MODE_EXECUTE ); foreach ($views as $view) { $this->db->query( 'DROP VIEW '.reset($view), DbAdapte...
php
{ "resource": "" }
q238607
RunInstallCommand.install
train
protected function install(AbstractInstall $installScript, OutputInterface $output) { $dataPath = DATADIR; $output->writeln(' Installing App...'); // Install the database structure $this->runSql( $dataPath.DIRECTORY_SEPARATOR.GenerateInstallCommand::STRUCTURE_FILE, ...
php
{ "resource": "" }
q238608
RunInstallCommand.runSql
train
protected function runSql($file, $message, $notFoundMessage, $output) { if (! is_file($file)) { $output->writeln($notFoundMessage); return; } $output->writeln($message); $dataSql = file_get_contents($file); // Split the sql file on new lines and in...
php
{ "resource": "" }
q238609
Memory.percentUsage
train
public function percentUsage() { $total = $this->systemTotal(); $free = $this->systemFree(); $usage = []; foreach( $total as $slotId => $amount ) { $usage[ $slotId ] = intval( ceil( ( ( $amount - $free[ $slotId ] ) * 100 ) / $amount ) ); } return $usag...
php
{ "resource": "" }
q238610
Select.add
train
public function add($text, $value){ $this->select[] = array($text, $value); $this->validator->addPossibility($value); }
php
{ "resource": "" }
q238611
InstallHandler.setPermissions
train
public static function setPermissions(Event $event) { $options = array_merge( array( self::PARAM_WRITABLE => array(), self::PARAM_EXECUTABLE => array(), ), $event->getComposer()->getPackage()->getExtra() ); foreach ((array)...
php
{ "resource": "" }
q238612
Xml.partialFormat
train
public function partialFormat($data, $nodeName = null) { if (!$nodeName) { $nodeName = $this->getNodeName($data); } $data = $this->parseData($data); if (is_scalar($data)) { return "<$nodeName>" . $this->parseScalarData($data) . "</$nodeName>"; } ...
php
{ "resource": "" }
q238613
Xml.getNodeName
train
protected function getNodeName($data) { if (is_object($data)) { $nodeName = preg_replace('/.*\\\/', '', get_class($data)); return preg_replace('/\W/', '', $nodeName); } elseif (is_array($data)) { return 'array'; } return $this->defaultNodeName; ...
php
{ "resource": "" }
q238614
Xml.parseNonScalarData
train
protected function parseNonScalarData($data, $fallbackName = null) { $xml = ''; if (!$fallbackName) { $fallbackName = $this->defaultNodeName; } foreach ($data as $property => $value) { // Clear non-alphanumeric characters $property = preg_replace('...
php
{ "resource": "" }
q238615
Application.registerCommands
train
protected function registerCommands() { $this->add(new \Daedalus\Command\DumpContainerCommand($this->kernel->getContainer())); $this->add(new \Daedalus\Command\HelpCommand($this->kernel->getContainer())); }
php
{ "resource": "" }
q238616
Application.addOutputFormatterStyles
train
protected function addOutputFormatterStyles(OutputInterface $output) { foreach ($this->getOutputFormatterStyles() as $name => $style) { $output->getFormatter()->setStyle($name, $style); } }
php
{ "resource": "" }
q238617
Builder.fake
train
public function fake($field, $type, array $options = []) { $field = $this->get($field); $field->setFake($type, $options); return $this; }
php
{ "resource": "" }
q238618
Builder.copy
train
public function copy($type = null) { $builder = new Builder($this->type, $this->dogmatist, $this->parent, $this->strict); $this->copyData($builder); if ($type !== null) { $builder->setType($type); } return $builder; }
php
{ "resource": "" }
q238619
CacheKey.validate
train
public static function validate(string $key) : bool { $le = strlen($key); if ($le < static::VALID_LENGTH_MIN || $le > static::VALID_LENGTH_MAX) { return false; } if ($key{0} === '-') { return false; } // Faster than a regular expression. ...
php
{ "resource": "" }
q238620
AbstractInvoice.setDueDate
train
private function setDueDate(Carbon $dueDate = null) { if (is_null($dueDate)) { $dueDate = Carbon::now(); } $this->dueDate = $dueDate; }
php
{ "resource": "" }
q238621
AbstractInvoice.setCreatedAt
train
private function setCreatedAt(Carbon $createdAt = null) { if (is_null($createdAt)) { $createdAt = Carbon::now(); } $this->createdAt = $createdAt; }
php
{ "resource": "" }
q238622
GroupsTable.moveUsersToAlternativeGroups
train
public function moveUsersToAlternativeGroups($userIdGroupIdMapping) { $affectedUsers = 0; $affectedGroups = []; foreach ($userIdGroupIdMapping as $userId => $groupId) { $affectedUsers += $this->UsersGroups->updateAll([ 'group_id' => $groupId ], [ ...
php
{ "resource": "" }
q238623
BroadcasterManager.addBroadcaster
train
public static function addBroadcaster(BroadcasterInterface $broadcaster) { self::instantiateDefaultBroadcasters(); self::$broadcasters[$broadcaster->getName()] = $broadcaster; }
php
{ "resource": "" }
q238624
BroadcasterManager.get
train
public static function get($name) { $name = strtolower($name); if (!isset(self::$instantiated[$name])) { throw new InvalidArgumentException(sprintf('Broadcaster "%s" is not instantiated.', $name)); } return self::$instantiated[$name]; }
php
{ "resource": "" }
q238625
BroadcasterManager.build
train
public static function build($name, array $configs = array()) { if (isset(self::$instantiated[$name])) { return self::$instantiated[$name]; } self::instantiateDefaultBroadcasters(); if (!isset(self::$broadcasters[$name])) { throw new InvalidArgumentException(...
php
{ "resource": "" }
q238626
BroadcasterManager.instantiate
train
private static function instantiate($class, array $configs) { $reflection = new ReflectionClass($class); $constructor = $reflection->getConstructor(); $arguments = array(); foreach ($constructor->getParameters() as $param) { $name = $param->getName(); if (iss...
php
{ "resource": "" }
q238627
Data.addData
train
public function addData($key, $value) { if (isset($this->data[$key])) { $this->data[$key] = array_merge_recursive( $this->data[$key], $value ); } else { $this->setData($key, $value); } }
php
{ "resource": "" }
q238628
HtmlHelper.link
train
public function link($content, $url = [], array $options = []) { /* @var $url_helper UrlHelper */ $url_helper = $this->url; $cfg = [ 'href' => is_array($url) ? ( key_exists('push', $url) ? $url_helper->push($url['push']) : ( key_exists(...
php
{ "resource": "" }
q238629
HtmlHelper.js
train
public function js($name = NULL, $external = FALSE, array $options = []) { if ($name) { $this->_js[$name] = $options + [ 'src' => $external ? $name : PO_PATH_JS . '/' . $name ]; } else { return implode(PHP_EOL, array_map(function($value) { ...
php
{ "resource": "" }
q238630
HtmlHelper.meta
train
public function meta($name = NULL, $content = NULL) { if ( $name ) { $this->_meta[$name] = ['name' => $name, 'content' => $content]; } else { return implode(PHP_EOL, array_map(function($meta) { return '<meta name="' . $meta['name'] . '" content="' . $meta['co...
php
{ "resource": "" }
q238631
HtmlHelper.img
train
public function img($name, array $options = [], $external = FALSE) { $cfg = $options + [ 'class' => '' ]; return '<img src = "' . ($external ? $name : PO_PATH_IMG . '/' . $name) . '" ' . Str::htmlserialize($cfg) . ' />'; }
php
{ "resource": "" }
q238632
HtmlHelper.nestedList
train
public function nestedList(array $list, array $options = [], array $item_options = [], $type_list = 'list') { $type = $type_list == 'list' ? 'ul' : 'ol'; $r = '<' . $type . ' ' . Str::htmlserialize($options) . '>'; foreach ($list as $key => $l) { $r .= is_array($l) ? $this->neste...
php
{ "resource": "" }
q238633
JobFactoryRegistry.get
train
public function get($name) { if (isset($this->factories[$name])) { return $this->factories[$name]; } throw JobFactoryException::create(sprintf('Not found %s job factory', $name)); }
php
{ "resource": "" }
q238634
ErrorListenerFactory.make
train
public static function make() { $services = Provider::getServices(); $config = $services->get('Config'); $strategies = []; if (isset($config['error']['strategies'])) { $strategies = (array) $config['error']['strategies']; } $listener = new ErrorListener; ...
php
{ "resource": "" }
q238635
CoderController.actionEncode
train
public function actionEncode() { $text = Enter::display('Enter text'); $encrypted = \App::$domain->encrypt->coder->encode($text); Output::block($encrypted, 'Encrypted'); }
php
{ "resource": "" }
q238636
CoderController.actionDecode
train
public function actionDecode() { $encrypted = Enter::display('Enter encrypted'); $text = \App::$domain->encrypt->coder->decode($encrypted); Output::block($text, 'Text'); }
php
{ "resource": "" }
q238637
DateLocalizationCapabilities.translator
train
protected static function translator() { if (static::$translator === null) { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); static::$translator = $translator; static::setLocale('en'); } return static::$...
php
{ "resource": "" }
q238638
Accordion.render
train
protected function render() { if (!isset($this->items[0])) { return ''; } foreach ($this->items as $itemId => $item) { $item->setCollapsable( self::$id, self::$id . $itemId, in_array($itemId, $this->openedItems)); ...
php
{ "resource": "" }
q238639
iauRy.Ry
train
public static function Ry($theta, array &$r) { $s; $c; $a00; $a01; $a02; $a20; $a21; $a22; $s = sin($theta); $c = cos($theta); $a00 = $c * $r[0][0] - $s * $r[2][0]; $a01 = $c * $r[0][1] - $s * $r[2][1]; $a02 = $c * $r[0][2] - $s * $r[2][2]; $a20 = $s * $r[0][0] ...
php
{ "resource": "" }
q238640
AbstractNavbarElement.isActive
train
final public function isActive($active = null) { if (isset($active)) { $this->active = (bool) $active; return $this; } else { return $this->active; } }
php
{ "resource": "" }
q238641
Zend_Gdata_Calendar.getCalendarEventFeed
train
public function getCalendarEventFeed($location = null) { if ($location == null) { $uri = self::CALENDAR_EVENT_FEED_URI; } else if ($location instanceof Zend_Gdata_Query) { $uri = $location->getQueryUrl(); } else { $uri = $location; } return...
php
{ "resource": "" }
q238642
ObjectManager.get
train
public function get($class) { $class = ltrim($class, '\\'); if (!isset($this->sharedInstances[$class])) { $this->sharedInstances[$class] = $this->create($class); } return $this->sharedInstances[$class]; }
php
{ "resource": "" }
q238643
ObjectManager.invoke
train
public function invoke($object, $method, array $arguments = []) { $reflection = new \ReflectionClass($object); $method = $reflection->getMethod($method); $args = $this->resolveArguments($method, $arguments); return $method->invokeArgs($object, $args); }
php
{ "resource": "" }
q238644
ObjectManager.resolveArguments
train
protected function resolveArguments( ReflectionMethod $method, array $arguments ) { $params = $method->getParameters(); $result = []; foreach ($params as $param) { /** @var ReflectionParameter $param */ if (isset($arguments[$param->name])) { ...
php
{ "resource": "" }
q238645
VersionConstraintController.checkVersionConstraintAction
train
public function checkVersionConstraintAction(Request $request) { try { $inputData = new JsonArray($request->getContent()); } catch (\Exception $exception) { return new JsonResponse( [ 'status' => 'ERROR', 'error' => 'in...
php
{ "resource": "" }
q238646
Theme.set_config
train
public function set_config($key, $value = null) { if (is_array($key)) { $this->config = \Arr::merge($this->config, $key); } else { \Arr::set($this->config, $key, $value); } return $this; }
php
{ "resource": "" }
q238647
Theme.get_parent_themes
train
public function get_parent_themes($theme_name) { $return = array($this->create_theme_array($theme_name)); $theme_info = $this->load_info($theme_name); if ( ! empty($theme_info['parent'])) { $return = array_merge($return, $this->get_parent_themes($theme_info['parent'])); } elseif($theme_name !== $this->...
php
{ "resource": "" }
q238648
Theme.asset_url
train
public function asset_url($path) { $url = $this->asset_path($path); if (filter_var($url, FILTER_VALIDATE_URL) === false) { $url = \Uri::create($url); } return $url; }
php
{ "resource": "" }
q238649
Container.loadRoutes
train
public function loadRoutes() { if ($this->bound('router')) { /** * Use Cached Routes if Available */ if ($this['config']->get('routes.cache') && $this['files']->exists($this['config']->get('routes.compiled'))) { $contents = $this['files']->get($this['config']->get('routes.compiled')); if (!emp...
php
{ "resource": "" }
q238650
Container.routeRequest
train
public function routeRequest() { if($this->bound('router')){ try { $pluginRequest = $this['request']; $this['router']->matched(function ($event) { global $wp_query; $wp_query->is_404 = false; $this->route_dispatched = true; }); $response = $this['router']->dispatch($pluginRequest); ...
php
{ "resource": "" }
q238651
Parser.parse
train
public function parse(\DOMDocument $dom) { $feed = $this->getStandard()->newFeed(); $rootNode = $this->getStandard()->getRootNode($dom); $this->parseNodeChildren($rootNode, $feed); return $feed; }
php
{ "resource": "" }
q238652
Parser.parseNodeChildren
train
public function parseNodeChildren(\DOMNode $node, NodeInterface $target) { $rules = $this->getStandard()->getRules(); foreach ($node->childNodes as $childNode) { /** @var RuleInterface $rule */ foreach ($rules as $rule) { if ($rule->canHandle($childNode, $targ...
php
{ "resource": "" }
q238653
ApiRoute.getQuery
train
public function getQuery($index = false) { return ($index) ? array_value($this->query, $index) : $this->query; }
php
{ "resource": "" }
q238654
ReferersListComposer.calculateLanguagesPercentage
train
private function calculateLanguagesPercentage($referers) { $total = $referers->sum('count'); return $referers->transform(function ($item) use ($total) { return $item + [ 'percentage' => round(($item['count'] / $total) * 100, 2) ]; }); }
php
{ "resource": "" }
q238655
Database.select
train
public function select($sql, $class = "", $all = FALSE, $array = array()) { // Prepara a Query $sth = $this->prepare($sql); // Define os dados do Where, se existirem. foreach ($array as $key => $value) { // Se o tipo do dado for inteiro, usa PDO::PARAM_INT, caso contr�ri...
php
{ "resource": "" }
q238656
Database.ExecuteInsert
train
public function ExecuteInsert($table, $data) { if (is_object($data)) ModelState::ModelTreatment($data); $data = (array)$data; // Ordena ksort($data); // Campos e valores $camposNomes = implode('`, `', array_keys($data)); ...
php
{ "resource": "" }
q238657
Database.ExecuteUpdate
train
public function ExecuteUpdate($table, $data, $where) { if (is_object($data)) ModelState::ModelTreatment($data); $data = (array)$data; // Ordena ksort($data); // Define os dados que ser�o atualizados $novosDados = NULL; foreach ($data as $key => ...
php
{ "resource": "" }
q238658
_ServiceResponse._success
train
public static function _success($objects, $echoResponse = TRUE, $format = 'json') { return self::_doResponse('success', $objects, $echoResponse, $format); }
php
{ "resource": "" }
q238659
_ServiceResponse._failure
train
public static function _failure($objects, $echoResponse = TRUE, $format = 'json') { return self::_doResponse('failure', $objects, $echoResponse, $format); }
php
{ "resource": "" }
q238660
_ServiceResponse._doResponse
train
private static function _doResponse($type, $objects, $echoResponse, $format) { $ret = array(); $ret['status'] = $type; if (is_array($objects)) { foreach ($objects as $k => $v) { $ret[$k] = $v; } } else { $ret[] = $objects; } ...
php
{ "resource": "" }
q238661
Config.loadFile
train
private function loadFile ($file) { if (!isset ($this->files[$file])) { $filename = $this->folder . $file . '.php'; // First load these if (file_exists ($filename)) { $this->files[$file] = include ($filename); } // Now overload with environment values if (isset ($this->environment)) {...
php
{ "resource": "" }
q238662
Config.getValue
train
private function getValue ($name, $default) { $parts = explode ('.', $name); $file = array_shift ($parts); $this->loadFile ($file); if (! isset ($this->files[$file])) { return $default; } else { $out = $this->files[$file]; foreach ($parts as $part) { if (!isset ($out[$part])) { r...
php
{ "resource": "" }
q238663
FileManager.expandDirectories
train
public function expandDirectories($baseDir) { $directories = array(); foreach (scandir($baseDir) as $file) { if ($file == '.' || $file == '..') continue; $dir = $baseDir . DS . $file; if (is_dir($dir)) { $directories [] = $dir; ...
php
{ "resource": "" }
q238664
LogServiceProvider.register
train
public function register(Application $app) { $this->config = $app['config']->load('log'); $handlers = $this->getHandlers($app); $app['log'] = $app->share(function ($app) use ($handlers) { return new Logger('main', $handlers); }); $app->initializer('Synapse\\Log\...
php
{ "resource": "" }
q238665
LogServiceProvider.boot
train
public function boot(Application $app) { // Register Monolog error handler for fatal errors here because Symfony's handler overrides it $monologErrorHandler = new MonologErrorHandler($app['log']); $monologErrorHandler->registerErrorHandler(); $monologErrorHandler->registerFatalHandl...
php
{ "resource": "" }
q238666
LogServiceProvider.getHandlers
train
protected function getHandlers(Application $app) { $handlers = []; // File Handler $file = Arr::path($this->config, 'file.path'); if ($file) { $handlers[] = $this->getFileHandler($file); $handlers[] = $this->getFileExceptionHandler($file); } ...
php
{ "resource": "" }
q238667
LogServiceProvider.getFileHandler
train
protected function getFileHandler($file) { $format = '[%datetime%] %channel%.%level_name%: %message% %context% %extra%'.PHP_EOL; $handler = new StreamHandler($file, Logger::INFO); $handler->setFormatter(new LineFormatter($format)); return new DummyExceptionHandler($handler); }
php
{ "resource": "" }
q238668
LogServiceProvider.getFileExceptionHandler
train
protected function getFileExceptionHandler($file) { $format = '%context.stacktrace%'.PHP_EOL; $handler = new StreamHandler($file, Logger::ERROR); $handler->setFormatter(new ExceptionLineFormatter($format)); return $handler; }
php
{ "resource": "" }
q238669
LogServiceProvider.getLogglyHandler
train
protected function getLogglyHandler() { $token = Arr::path($this->config, 'loggly.token'); if (! $token) { throw new ConfigException('Loggly is enabled but the token is not set.'); } return new LogglyHandler($token, Logger::INFO); }
php
{ "resource": "" }
q238670
LogServiceProvider.getRollbarHandler
train
protected function getRollbarHandler($environment) { $rollbarConfig = Arr::get($this->config, 'rollbar', []); return new RollbarHandler($rollbarConfig, $environment); }
php
{ "resource": "" }
q238671
Mapper.findRootOf
train
public function findRootOf( $id ) { return $this->findOne( array( 'id' => $this->sql() ->select() ->columns( array( 'rootId' ) ) ->where( array( 'id' => $id, ) ), ...
php
{ "resource": "" }
q238672
Mapper.getTagIdByName
train
private function getTagIdByName( $tag ) { $tagSql = $this->sql( $this->getTableInSchema( static::$tagTableName ) ); $select = $tagSql->select() ->columns( array( 'id' ) ) ->where( array( new TypedParameters( ...
php
{ "resource": "" }
q238673
Mapper.setTagFor
train
protected function setTagFor( $paragraphId, $tag ) { $rows = 0; $tagSql = $this->sql( $this->getTableInSchema( static::$tagTableName ) ); $tagJoinSql = $this->sql( $this->getTableInSchema( static::$tagJoinTableName ) ); $tagId = $this->getTagIdByName( $tag ); ...
php
{ "resource": "" }
q238674
Mapper.saveRawProperties
train
public function saveRawProperties( $id, $properties ) { $result = 0; if ( ! empty( $properties ) ) { foreach ( $properties as $property ) { $result += $this->saveProperty( $id, empty( $property['locale'] ) ? nul...
php
{ "resource": "" }
q238675
Mapper.saveRawData
train
public function saveRawData( array $data ) { if ( ! parent::save( $data ) ) { return null; } return isset( $data['id'] ) ? $data['id'] : null; }
php
{ "resource": "" }
q238676
ErrorAction.chooseView
train
protected function chooseView(){ if($this->guestView){ if(Yii::$app->user->isGuest){ $this->controller->layout=$this->guestLayout; $this->view=$this->guestView; } } if($this->userView){ if(!Yii::$app->user->isGuest){ ...
php
{ "resource": "" }
q238677
Installer.installViaSubtree
train
public function installViaSubtree() { return new Process(sprintf( 'cd %s && git remote add %s %s && git subtree add --prefix=%s --squash %s %s', base_path(), $this->getComponentName(), $this->getRepoUrl(), $this->getDestinationPath(), $...
php
{ "resource": "" }
q238678
Redis.retrieve
train
public function retrieve($key) { // Get value by key $value = $this->redis->get($key); if($value === false) return null; return $value; }
php
{ "resource": "" }
q238679
Insert.values
train
public function values(array $valuesArray) { $this->_checkColumnsArrayIsset()->_checkArraysForSameLength($valuesArray)->_checkValuesArrayType($valuesArray); $this->values[] = $valuesArray; return $this; }
php
{ "resource": "" }
q238680
ehough_shortstop_api_HttpRequest.setUrl
train
public final function setUrl($url) { if (is_string($url)) { $this->_url = new ehough_curly_Url($url); return; } if (! $url instanceof ehough_curly_Url) { throw new ehough_shortstop_api_exception_InvalidArgumentException( 'setUrl() only ...
php
{ "resource": "" }
q238681
Engine.getErrFunc
train
protected function getErrFunc() { if (null === $this->errFunc) { $this->errFunc = function ($errno, $errstr, $errfile, $errline) { $this->stopErrorHandling(); throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); }; } retu...
php
{ "resource": "" }
q238682
Spot2Trait.mapper
train
public function mapper($entityName) { if (!class_exists($entityName)) { throw new \Exception('Unable to get mapper for unknown entity class '.$entityName); } $locator = $this['spot2.locator']; return $locator->mapper($entityName); }
php
{ "resource": "" }
q238683
ModuleController.indexAction
train
public function indexAction($page, $sort, $direction) { $acl = $this->get('bacon_acl.service.authorization'); if (!$acl->authorize('module', 'INDEX')) { throw $this->createAccessDeniedException(); } $breadcumbs = $this->container->get('bacon_breadcrumbs'); $bre...
php
{ "resource": "" }
q238684
ModuleController.newAction
train
public function newAction(Request $request) { $acl = $this->get('bacon_acl.service.authorization'); if (!$acl->authorize('module', 'NEW')) { throw $this->createAccessDeniedException(); } $breadcumbs = $this->container->get('bacon_breadcrumbs'); $breadcumbs->add...
php
{ "resource": "" }
q238685
ModuleController.showAction
train
public function showAction(Request $request, Module $entity) { $acl = $this->get('bacon_acl.service.authorization'); if (!$acl->authorize('module', 'SHOW')) { throw $this->createAccessDeniedException(); } $breadcumbs = $this->container->get('bacon_breadcrumbs'); ...
php
{ "resource": "" }
q238686
ModuleController.deleteAction
train
public function deleteAction(Module $entity) { $acl = $this->get('bacon_acl.service.authorization'); if (!$acl->authorize('module', 'DELETE')) { throw $this->createAccessDeniedException(); } $handler = new ModuleFormHandler( $this->createDeleteForm('module_d...
php
{ "resource": "" }
q238687
RedisFactory.createRedisByConfig
train
public static function createRedisByConfig(array $config) { $Redis = new Connection(); $Redis->setHost(@$config['host']) ->setPort(@$config['port']); (isset($config['persistent'])) && $Redis->setPersistent($config['persistent']); (isset($config['connect_timeout'])) && $R...
php
{ "resource": "" }
q238688
ExecuteInstallation.execute
train
public function execute(Framework $framework, CliRequest $request, Response $response) { // Configure turbo $this->configure(); // Save the settings $this->configurationManager->saveConfigurationFile(); // Execute the DataSource setups $dataSourceMan...
php
{ "resource": "" }
q238689
ExecuteInstallation.configure
train
protected function configure() { $configureSettingGroup = $this->cliHelper->confirmAction('Would you like to change the settings?'); if (!$configureSettingGroup) { return; } $this->configureSettings($this->configurationManager->getSettings()); }
php
{ "resource": "" }
q238690
ExecuteInstallation.configureSettings
train
protected function configureSettings($settings, $path = '') { foreach ($settings as $key => $node) { if (is_array($node)) { $this->configureSettings($node, $path . $key . '.'); } else { $this->configureSetting($path . $key, $node); } ...
php
{ "resource": "" }
q238691
ExecuteInstallation.configureSetting
train
protected function configureSetting($path, $value) { $newValue = $this->cliHelper->inputText('Please enter the value for "' . $path . '":', $value); if ($newValue === $value) { return; } $this->configurationManager->setSetting($path, $newValue); }
php
{ "resource": "" }
q238692
MapsEngine_RasterCollectionsRasters_Resource.batchDelete
train
public function batchDelete($id, MapsEngine_RasterCollectionsRasterBatchDeleteRequest $postBody, $optParams = array()) { $params = array('id' => $id, 'postBody' => $postBody); $params = array_merge($params, $optParams); return $this->call('batchDelete', array($params), "MapsEngine_RasterCollectionsRasters...
php
{ "resource": "" }
q238693
Model.onModules
train
public function onModules( ModulesEvent $event ) { $saved = 0; $model = $event->getTarget(); $mapper = $model->getMapper(); $modules = $event->getParams(); foreach ( $modules as $name => $enabled ) { if ( empty( $name ) ) { ...
php
{ "resource": "" }
q238694
Env.load
train
public function load($path, $file = '.env') { try { $env = new \Dotenv\Dotenv($path, $file); $env->load(); return true; } catch (\Dotenv\Exception\InvalidPathException $e) { return false; } }
php
{ "resource": "" }
q238695
LoggerFactory.create
train
public static function create( $kernel, $filename, $maxFiles = 0, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false ) { return new RotatingFileHandler( $kernel->getLogDir() . DIRECTORY_SEPARATOR . $filename...
php
{ "resource": "" }
q238696
Client.send
train
public function send($message, array $options = []) { $sms = new Message($options); $this->request('sms', $sms->getParams()); $response = $this->getResponse(); if ($response['error_code'] !== '000') { $this->errors[] = $response['error_code']; return false; ...
php
{ "resource": "" }
q238697
Client.request
train
public function request($url, array $params = []) { $curl = new Curl(); $query = $this->buildQuery($params); $curl->setOptions($this->url . $url, $query, $this->port); $response = $curl->exec(); $this->setResponse($response); $this->setErrors($response); retur...
php
{ "resource": "" }
q238698
Client.buildQuery
train
public function buildQuery(array $params = []) { $params = array_merge($params, [ 'user_login' => $this->login, 'api_key' => $this->apiKey ]); return http_build_query($params); }
php
{ "resource": "" }
q238699
Client.setErrors
train
protected function setErrors($response) { libxml_use_internal_errors(true); $doc = new \DOMDocument('1.0', 'utf-8'); $doc->loadXML($response); $errors = libxml_get_errors(); if (!empty($errors)) { $this->errors[] = 'Xml response is invalid'; } r...
php
{ "resource": "" }